ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/mon/README
(Generate patch)

Comparing mon/README (file contents):
Revision 1.2 by cebix, 1999-10-04T19:40:36Z vs.
Revision 1.9 by cebix, 2000-10-18T00:50:00Z

# Line 1 | Line 1
1  
2 <        mon, Version 2.2
3 <        A command-driven file monitor
2 >  cxmon, Version 3.0
3 >  A command-line file manipulation tool and disassembler
4  
5 <        Copyright (C) 1997-1999 Christian Bauer, Marc Hellwig
6 <        Freely distributable
5 >  Copyright (C) 1997-2000 Christian Bauer, Marc Hellwig
6 >  GNU binutils disassemblers Copyright (C) 1988, 89, 91, 93, 94, 95, 96, 97, 1998
7 >    Free Software Foundation, Inc.
8  
9  
10   License
11   -------
12  
13 < mon is available under the terms of the GNU General Public License. See the
13 > cxmon is available under the terms of the GNU General Public License. See the
14   file "COPYING" that is included in the distribution for details.
15  
16  
17   Overview
18   --------
19  
20 < "mon" is an interactive command-driven file manipulation tool that is inspired
21 < by the "Amiga Monitor" by Timo Rossi <trossi@jyu.fi>. It has commands and
22 < features similar to a machine code monitor/debugger, but it is not intended
23 < to be used for debugging. It doesn't operate on physical or virtual RAM
24 < locations of a process but rather on a fixed-size (but adjustable) buffer with
25 < adresses starting at 0. Also, there are no commands to trace code, set
25 < breakpoints etc. There are, however, built-in PowerPC, 680x0, 6502 and 8080
26 < disassemblers.
20 > cxmon is an interactive command-driven file manipulation tool that is
21 > inspired by the "Amiga Monitor" by Timo Rossi <trossi@jyu.fi>. It has
22 > commands and features similar to a machine code monitor/debugger, but it
23 > lacks any functions for running/tracing code. There are, however, built-in
24 > PowerPC, 680x0, 80x86, 6502 and Z80 disassemblers. By default, cxmon operates
25 > on a fixed-size (but adjustable) memory buffer with adresses starting at 0.
26  
27  
28   Installation
# Line 35 | Line 34 | Please consult the file "INSTALL" for in
34   Usage
35   -----
36  
37 < mon can be started from the Shell or from the Tracker (BeOS), but command line
38 < history doesn't work when started from the Tracker). If you give no command
39 < line arguments, mon enters interactive mode. Otherwise, all arguments are
40 < interpreted and executed as mon commands. The default buffer size is 1MB.
41 < The mon command prompt looks like this:
37 > cxmon can be started from the Shell or from the Tracker (BeOS), but command
38 > line history doesn't work when started from the Tracker.
39 >
40 > Options:
41 >  -m  enables symbolic MacOS A-Trap and low memory globals display in the
42 >      680x0 disassembler
43 >  -r  makes cxmon operate in real (virtual) memory space instead of an
44 >      allocated buffer
45 >
46 > If no additional command line arguments are given, cxmon enters interactive
47 > mode. Otherwise, all remaining arguments are interpreted and executed as cxmon
48 > commands.
49 >
50 > The default buffer size is 1MB.
51 >
52 > The cxmon command prompt looks like this:
53  
54    [00000000]->
55  
# Line 49 | Line 59 | section on expressions). You can get a s
59  
60   Commands that create a longer output can be interrupted with Ctrl-C.
61  
62 < To quit mon, enter the command "x".
62 > To quit cxmon, enter the command "x".
63  
64  
65   Constants, variables and expressions
# Line 65 | Line 75 | values. A variable is referred to by its
75   combinations of digits and letters (they may also start with a digit) that
76   are not also valid hexadecimal numbers. Names are case-sensitive.
77  
78 < mon accepts expressions in all places where you have to specify a number. The
79 < following operators are available and have the same meaning and precedence as
80 < in the C programming language:
78 > cxmon accepts expressions in all places where you have to specify a number.
79 > The following operators are available and have the same meaning and
80 > precedence as in the C programming language:
81  
82    ~   complement
83    +   unary plus
# Line 107 | Line 117 | values and ASCII strings separated by co
117   The buffer
118   ----------
119  
120 < Those mon commands that operate on "memory" operate on a buffer allocated by
121 < mon whose size is adjustable with the "@" command. The default buffer size is
122 < 1MB. The buffer is an array of bytes where each byte has a 32-bit integer
123 < address. Addresses start at 0 and are taken modulo the buffer size (i.e. for
124 < the default 1MB buffer, addresses 0 and 100000 refer to the same byte).
120 > Those cxmon commands that operate on "memory" operate on a buffer allocated
121 > by cxmon whose size is adjustable with the "@" command. The default buffer
122 > size is 1MB. The buffer is an array of bytes where each byte has a 32-bit
123 > integer address. Addresses start at 0 and are taken modulo the buffer size
124 > (i.e. for the default 1MB buffer, addresses 0 and 100000 refer to the same
125 > byte).
126  
127 < The buffer is the working area of mon where you load files into, manipulate
127 > The buffer is the working area of cxmon where you load files into, manipulate
128   them, and write files back from. Arbitraty portions of the buffer may be used
129   as scratch space.
130  
# Line 121 | Line 132 | as scratch space.
132   Commands
133   --------
134  
135 < The following commands are available in mon ('[]' marks a parameter than can be
136 < left out):
135 > The following commands are available in cxmon ('[]' marks a parameter than
136 > can be left out):
137  
138  
139 <  x                        Quit mon
139 >  x                        Quit cxmon
140  
141 < quits mon and returns to the shell.
141 > quits cxmon and returns to the shell.
142  
143  
144    h                        Show help text
# Line 142 | Line 153 | displays a short list of available comma
153  
154    ver                      Show version
155  
156 < shows the version number of mon.
156 > shows the version number of cxmon.
157  
158  
159    ? expression             Calculate expression
# Line 166 | Line 177 | characters. Entering "i" without argumen
177   of "." is set to the address after the last address displayed.
178  
179  
180 +  b [start [end]]          Binary memory dump
181 +
182 + displays the buffer contents from address "start" to address "end" in a binary
183 + format. Entering "b" without arguments is equivalent to "b .". The value of
184 + "." is set to the address after the last address displayed.
185 +
186 +
187    m [start [end]]          Hex/ASCII memory dump
188  
189   displays the buffer contents from address "start" to address "end" as hex
# Line 180 | Line 198 | Entering "d" without arguments is equiva
198   set to the address after the last address displayed.
199  
200  
201 <  d65 [start [end]]          Disassemble 6502 code
201 >  d65 [start [end]]        Disassemble 6502 code
202  
203   disassembles the buffer contents from address "start" to address "end".
204   Entering "d65" without arguments is equivalent to "d65 .". The value of
205   "." is set to the address after the last address displayed.
206  
207  
208 <  d68 [start [end]]          Disassemble 680x0 code
208 >  d68 [start [end]]        Disassemble 680x0 code
209  
210   disassembles the buffer contents from address "start" to address "end".
211   Entering "d68" without arguments is equivalent to "d68 .". The value of
212   "." is set to the address after the last address displayed.
213  
214  
215 <  d80 [start [end]]          Disassemble 8080 code
215 >  d80 [start [end]]        Disassemble Z80 code
216  
217   disassembles the buffer contents from address "start" to address "end".
218   Entering "d80" without arguments is equivalent to "d80 .". The value of
219   "." is set to the address after the last address displayed.
220  
221  
222 <  d86 [start [end]]          Disassemble 80x86 code (very incomplete)
222 >  d86 [start [end]]        Disassemble 80x86 (32-bit) code
223  
224   disassembles the buffer contents from address "start" to address "end".
225   Entering "d86" without arguments is equivalent to "d86 .". The value of
226   "." is set to the address after the last address displayed.
227  
228  
229 +  d8086 [start [end]]      Disassemble 80x86 (16-bit) code
230 +
231 + disassembles the buffer contents from address "start" to address "end".
232 + Entering "d8086" without arguments is equivalent to "d8086 .". The value
233 + of "." is set to the address after the last address displayed.
234 +
235 +
236    : start string           Modify memory
237  
238   puts the specified byte string at the address "start" into the buffer. The
# Line 323 | Line 348 | is omitted, the variable "var" is cleare
348   clears all currently defined variables.
349  
350  
326 rmon
327 ----
328
329 When mon is started as "rmon", it enters "real mode". That is, all memory
330 related functions no longer operate on the buffer but on "real" (virtual)
331 memory. Unless you are writing Mac emulators, this is probably of not much
332 use. :-)
333
334
351   Examples
352   --------
353  
354 < Here are some simple examples for what is possible with mon.
354 > Here are some simple examples for what is possible with cxmon.
355  
356   Join "file1" and "file2" to "file3":
357  
# Line 348 | Line 364 | Remove the first 24 bytes (e.g. an unnee
364    [ 0 "file"
365    ] 18 .-18 "file"
366  
367 < Load the mon executable and search for PowerPC "nop" commands:
367 > Load the cxmon executable and search for PowerPC "nop" commands:
368  
369 <  [ 0 "mon"
369 >  [ 0 "cxmon"
370    h 0 . 60,00,00,00
371  
372 < Create a modified version of mon so that the prompt has " $" instead of "->":
372 > Create a modified version of cxmon so that the prompt has " $" instead of
373 > "->":
374  
375 <  [ 0 "mon"
375 >  [ 0 "cxmon"
376    set size=.
377    h 0 . "->"
378    : . " $"
379 <  ] 0 size "mon1"
379 >  ] 0 size "cxmon1"
380  
381   Convert a binary file which contains 16-bit numbers in little-endian format
382   to big-endian format (or vice-versa):
# Line 374 | Line 391 | Load a BeBox boot ROM image and start di
391    d 100
392  
393  
394 + Using cxmon in your own programs
395 + --------------------------------
396 +
397 + cxmon provides a simple interface for integration in other programs. It can,
398 + for example, be used as a monitor/debugger for an emulator (it is used in
399 + Basilisk II in this way).
400 +
401 + Here's how to do it (all functions are defined in the mon.h header file):
402 +
403 + 1. Link all the cxmon object files, except main.o, to your program.
404 + 2. In your program, call mon_init() before using any other cxmon functions.
405 + 3. After calling mon_init(), set the mon_read_byte and mon_write_byte
406 +    function pointers to the routines used for accessing memory.
407 + 4. You can use mon_add_command() to add new commands to cxmon by specifying
408 +    the command name, function and help text. From within your command
409 +    function, you can use mon_get_token() and mon_expression() to parse the
410 +    arguments and the mon_read/write_*() functions to access memory.
411 + 5. To enter cxmon, call the mon() function like this:
412 +
413 +      char *args[3] = {"mon", "-r", NULL};
414 +      mon(2, args);
415 +
416 + 6. If you're done with cxmon, call mon_exit().
417 +
418 +
419   History
420   -------
421  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines