-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmon.guide
More file actions
1526 lines (1142 loc) · 53 KB
/
mon.guide
File metadata and controls
1526 lines (1142 loc) · 53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
@database mon.guide
@node main
Amiga Monitor v1.65 instructions
================================
This is a machine code monitor/debugger program for the Amiga.
The first version was created many years ago, and many of the
features and commands of the monitor were made similar to those
of the monitors available for the Commodore 64. However, because
the Amiga is a quite different machine many new commands and
features were needed. Later versions of the monitor add many more
useful features, such as expressions and variables. This version
is quite close to an actual symbolic debugger as it can read symbol
table information from executable files and display them in disassembly
listings. It also has a built-in @{"script language" link Scripts}.
Topics:
@{"Starting the monitor" link Starting}
@{"List of useful things" link Useful}
@{"List of monitor commands" link CommandList}
@{"Copyright & author info" link Copyright}
@endnode
@node Starting "Starting the monitor"
The monitor can be started both from CLI and from workbench. If you
want to start the monitor from workbench, you must first make an icon
for it. (starting the monitor from workbench is not recommended,
because the programs that are run under the control of the monitor
may require the CLI environment or else they may wait for workbench
startup message forever...but you can use IconX to start the monitor
from workbench as a CLI process)
The monitor is re-entrant (pure) code and can be made resident (for
example using the Workbench 1.3/2.0/3.0 resident command or ARP 1.3 ares)
The monitor works with 68000, 68020, 68030 and 68040 processors.
However, the assembler/disassembler only understand 68000 instructions.
Operating system version 2.04 or later is required for reliable operation
with the 68040 CPU.
Command Line Arguments:
options:
-w <window width>
-h <window height>
-o <options> (see @{"Options Flags" link OptionFlags})
-s <initial-script-filename> (see @{"Scripts" link Scripts})
An optional filename can also be given in the command line. The monitor
will try to load the named executable file immediately after starting.
The filename must be in quotes if it contains spaces. If there is anything
on the command line after the file name, that will be used as the command
line for the program loaded to the monitor (a0/d0 registers, see {"@-command" link EnterCmdLine})
If a `+' character is used before the filename, the monitor tries to load
symbol information from the file (see also @{"`l'-command" link LoadSeg}).
See also @{"Using the monitor from a serial terminal" link FromTerminal}.
@endnode
@node FromTerminal "Using the monitor from a serial terminal"
The monitor can be used from a terminal connected to the Amiga serial
port. If you want to do this, first set the correct baud rate and other
serial settings using the preferences program. Then mount AUX:
if necessary, and start a new CLI/Shell with the command NewShell AUX:
(or NewCLI AUX:). You get the normal CLI/Shell prompt to the terminal.
Now simply start the monitor by typing `mon' <cr> to the terminal
(do not `run' the monitor from the terminal; if you do it, the
monitor opens a window on the Amiga display). If the terminal is not
vt100/ansi compatible, you may need to use the `Dumb Terminal'
@{"option flag" link OptionFlags} (flag #3) to disable some features of the monitor
(such as command line editing and history, but you can still delete
the last character with backspace/delete). Easies way to do that is
to start the monitor with the command `mon -o4'.
@endnode
@node Useful "List of useful things"
Some useful things to know:
@{"Option Flags" link OptionFlags}
@{"Line editing/Command history" link LineEditing}
@{"Stopping/restarting output" link StoppingOutput}
@{"Numbers" link Numbers}
@{"Expressions" link Expressions}
@{"Byte strings" link ByteStrings}
@{"Address ranges" link AddressRanges}
@{"Tracing trap instructions" link TracingTraps}
@{"Stack usage" link StackUsage}
@{"File/directory names" link FileNames}
@{"Version history" link VersionHistory}
@endnode
@node OptionFlags "Option flags"
Commands `opt +n' and `opt -n' where `n' is a number between 1 and 4
can be used to set and reset monitor option flags. Currently five
flags are implemented:
- flag #1
Switches on the narrow disassembly output mode
(does not show the data as hex digits)
- flag #2
Causes characters $a0-$ff to be considered printable in
@{"`m'" link MemDisplay} and @{"`i'" link AsciiDump} memory dump commands (and `?' command ascii display).
- flag #3
This is the `Dumb terminal' mode flag. When this is set on,
the command line history and editing features of the monitor
are disabled, and the monitor does not use any vt100/ansi-
escape sequences. This may be useful when using the monitor
from a @{"serial terminal" link FromTerminal}.
- flag #4
When this flag is set, the monitor echoes each command to its
output window/file before actually executing the commands.
This is mainly useful with scripts.
- flag #5
Normally the monitor automatically resets the stack pointer
to point to the normal stack area if it originally was out
of range in the j/g/w/e/q-commands. This automatic stack reset
can be disabled with this option flag. This is useful when
debugging programs that allocate their own stacks and change
the stack pointer there. The stack pointer can be reset manually
with the @{"sr-command" link Execute 45}.
Command `opt' without parameters lists the current flag settins.
This includes a hexadecimal `flag value' that can be used on
the command line with the `-o' option to set initial flags when the
monitor is started (That flag value is simply a bit map of the option
flags, option #1 is bit #0).
@endnode
@node LineEditing "Input line editing and command line history"
You can edit the input lines by using the left/right cursor keys to move
left and right, backspace to delete the character before the cursor and
del to delete the character under the cursor. You can use the up/down
cursor keys to get the old command lines (the monitor remembers 10 last
command lines). Shift-cursor-up gets the last command and enters it
automatically (you don't need to press <CR>). In assembler mode you can
press Ctrl-E to edit the assembler instruction currently stored in that
address.
These features are not available if the `Dumb terminal' mode is
selected (see @{"Option flags" link OptionFlags}). In that case the only editing function
is deleting the last character with backspace or delete key.
@endnode
@node StoppingOutput "Stopping the output"
In most cases the output of the monitor can be suspended by pressing SPACE
or control-S and continued by pressing control-S or SPACE again.
To permanently stop the output, press Ctrl-C.
@endnode
@node Numbers "Numbers"
Default number base is hexadecimal but it can be changed with the @{"ba" link NumberBase}-
command (the argument of the ba-command is always decimal).
the prefixes used to identify number bases are:
`$' hexadecimal
`@' octal
`%' binary
`_' decimal
Numbers can also be entered as ASCII strings in single quotes, for example:
'FORM' --> hex 464f524d
See also @{"Expressions" link Expressions}.
@endnode
@node Expressions "Expressions"
The monitor accepts expressions in most places where you need a number.
The @{"calculator" link Calculator} (`?') command allows you to directly display
values of expressions.
The following operators are available:
== equality test
!= inequality test
< less than these tests return 1 if true and 0 if false
> greater than they are most useful in scripts
<= less or equal than
>= greater or equal than
+ addition
- subtraction
| bitwise or
^ bitwise exclusive or (xor)
& bitwise and
* multiplication
/ division (integer only, truncated)
% modulo
<< left shift
>> right shift
parenthesis can be used to group the operations in the expressions.
`*' represents the `current address'.
[reg_name] represents the value of register `reg_name'.
All calculations are done in 32-bit integer arithmetic. No overflow
checking is done.
See also @{"Functions" link Functions} and @{"Variables" link Variables} and @{"Numbers" link Numbers}.
@endnode
@node Functions "Functions"
The expression parser currently accepts the following built-in functions:
hunk(n) -- start address of nth hunk of currently loaded seglist
hlen(n) -- length of nth hunk of currently loaded seglist
hend(n) -- end address of nth hunk of currently loaded seglist
nhunks -- number of hunks in the currently loaded seglist
abs(x) -- absolute value of a number
peek(a) -- 8-bit contents of a memory location
peekw(a) -- 16-bit contents of a memory location
peekl(a) -- 32-bit contents of a memory location
avail(x) -- call AvailMem() with the argument x. for example
avail(0) returns total available memory,
avail(2) returns available chip memory
avail($20000) return largest available block.
The following functions can be used to examine exec library, device,
resource, task and port lists. Note that the pointers returned by these
functions may become invalid any time if the library/device/task/port
is expunged/removed from the system.
lib("libname.library") -- returns base address of a named library.
note that this does not try to load
the library from disk, it only searches
ExecBase->LibList.
dev("devname.device") -- returns base address of a named device.
note that this does not try to load
the device from disk, it only searches
ExecBase->DeviceList.
res("resname.resource") -- returns base address of a named resource.
task("taskname") -- returns pointer to named task.
task(number) -- returns pointer to CLI process with the
given number.
task(0) -- returns pointer to current task (the CLI
process that runs the monitor)
port("portname") -- returns pointer to the public message port
names "portname".
board(manufacturer,product) -- returns base address of an autoconfig
board with the specified manufacturer and
product codes.
lib, dev, res, task and port-functions fail with error if the requested
library/device etc. is not found, unless option flag #6 is set. In that
case they return zero in error situations.
Function names are not case sensitive.
@endnode
@node Variables "Variables"
In addition to numbers and functions, variables can be used in
expressions if they have been previously defined (Symbols in symbol
hunks of an executable file are automatically defined as monitor
variables when a file is loaded with the '+' option @{"(see `l' command)" link LoadSeg}.
Variables are defined with the set-command. All variable values are
32-bit integers. Variable names can contain alphanumeric characters and
underscores (`_'), but they cannot begin with a number. Variable names are
case sensitive in this version.
(There are some problems using variables with the assembler.
Especially variables with names starting with `a',`d' or `s' may
not be accepted in the assembler because it tries to interpret them
as register names. You can get around this by using expressions
like `0+variable')
@endnode
@node ByteStrings "Byte strings"
Strings are used in the fill command, the hunt command, the modify memory
command and the assembler directive dc.b .
Byte strings are series of bytes, represented by numbers or ASCII-
characters in single quotes or both together separated by commas.
Note: the single quote itself may be included in a quoted string if it
is duplicated.
examples:
'this is a byte string'
12,34,56
'''' -- this means one single quote
'both',$0A,'text',10,'and','numbers'
@endnode
@node AddressRanges "Address Range syntax"
The following forms can be used to specify an address range:
<Address>..<EndAddress>
<Address>:<Length>
Address ranges can be used with the following commands: @{"disassemble" link Disassemble},
@{"memory dump" link MemDisplay}, @{"ascii dump" link AsciiDump} and @{"memory save" link RWAbs}.
Address Ranges are new in monitor version 1.65. The commands that use
them also have older compatible syntax forms.
@endnode
@node TracingTraps "Note about tracing Trap-instructions"
There is a problem with the walk (trace) command and several instructions
that cause processor exceptions. These instructions are chk, trap #n,
trapv and divu/divs (with divisions by zero). If you try to trace these
instructions, a trace-exception occurs in supervisor-mode, out of the
control of the monitor and you get a software failure alert with number
00000009.
Included with the monitor distribution is a program called patchtrace
that changes directly the processor hardware trace-exception vector to
point a new routine that removes the trap-trace problem.
(The monitor does not support executing code in supervisor mode, so there
is not normally any reason to trace any of the instructions that can
cause problems. However, because you can accidentally cause the machine
to crash by tracing these instructions, the patchtrace-program
may be useful.)
@endnode
@node StackUsage "Stack usage"
The monitor allocates 2K of stack for its own use and the rest of
the stack can be used by the program being debugged. If you need
a larger stack, you can use the CLI `stack' command before you
start the monitor.
@endnode
@node FileNames "File/directory names"
When the monitor requires a file or directory name or the device name
for the `dev'-command, the name must be in double quotes if it contains
spaces. Also, some escape processing is done to the filename strings
and the arguments of the echo-command. See the entry for @{"echo-command" link Echo}
for details.
@endnode
@node CommandList "List of all monitor commands"
?? -- Show a short list of commands.
ver -- Show monitor version
help -- (also h or the HELP key) Show a help screen.
x -- Exit the monitor.
@{"? -- Calculator" link Calculator}.
@{"exec -- Execute scripts" link Exec}.
@{"quit -- Quit a script" link ScriptControlCommands}.
@{"goto -- Jump to another position in a script" link ScriptControlCommands}.
@{"if -- Conditional execution in a script" link ScriptControlCommands}.
@{"echo -- Display text/numbers" link Echo}.
@{"pokel -- Write a longword to memory" link Poke}.
@{"pokew -- Write a word to memory" link Poke}.
@{"poke -- Write a byte to memory" link Poke}.
@{"ba -- Set/Show number base" link NumberBase}.
\ -- @{" Shell command/New shell" link Shell}.
cls -- Clear display.
dir [@{"name" link FileNames}] -- Display disk directory.
del @{"<name>" link FileNames} -- Delete a file.
cd <dir> -- Change current directory.
@{"o -- Redirect output" link Redirect}.
@{"i -- Display memory in ASCII" link AsciiDump}.
@{"m -- Display memory in hex/ASCII" link MemDisplay}.
@{"mf -- Formatted memory display" link FormattedM}.
@{"mi -- Information about a memory location" link MemInfo}.
@{"f -- Fill memory" link Fill}.
@{"t -- Transfer memory" link Transfer}.
@{"c -- Compare memory" link CompMem}.
@{"h -- Hunt (search) memory" link Hunt}.
@{": -- Write to memory" link ModifyMem}.
@{"opt -- Set/Show option flags" link OptionFlags}.
@{"rb -- Set/Show addr. reg. relative base" link RelBase}.
@{"! -- Play digisound" link Digisound}.
@{"# -- Correct bootblock checksum" link Checksums}.
@{"= -- Correct disk block checksum" link Checksums}.
@{"< -- Read disk sectors" link DiskRW}.
@{"> -- Write disk sectors" link DiskRW}.
@{"dev -- Set disk device name" link DiskRW}.
@{"[ -- Read from file to memory " link RWAbs}.
@{"] -- Write from memory to file" link RWAbs}.
@{"& -- Allocate memory at absolute address" link MemoryAlloc}.
@{"( -- Allocate memory" link MemoryAlloc}.
@{") -- Free memory" link MemoryAlloc}.
@{"sm -- Show allocated memory" link MemoryAlloc}.
@{"l -- Load AmigaDOS executable" link LoadSeg}.
@{"u -- Unload executable" link LoadSeg}.
@{"sl -- Display segment list" link LoadSeg}.
@{"@ -- Enter a command line" link EnterCmdLine}.
@{"r -- Set/Show registers" link Registers}.
@{"sr -- Reset stack" link Execute}.
@{"g -- Go/Execute code" link Execute}.
@{"j -- Jump to subroutine" link Execute}.
@{"w -- Walk/Trace" link Execute}.
@{"e -- Extended trace" link Execute}.
@{"q -- Quicktrace" link Execute}.
@{"z -- Skip instruction" link Execute}.
@{"b -- Set breakpoint" link Breakpoints}.
@{"br -- Remove breakpoint" link Breakpoints}.
@{"bl -- List breakpoints" link Breakpoints}.
@{"set -- Set/Show variables" link Set}.
@{"cv -- Clear all variables" link Set}.
@{"d -- Disassemble" link Disassemble}.
@{"a -- Assemble" link Assemble}.
@{"vt -- Show tasks" link ListThings}.
@{"vl -- Show libraries" link ListThings}.
@{"vd -- Show devices" link ListThings}.
@{"vr -- Show resources" link ListThings}.
@{"vp -- Show public message ports" link ListThings}.
@{"vs -- Show public semaphores" link ListThings}.
@{"vi -- Show interrupts" link ListThings}.
@{"ve -- Show Autoconfig devices" link ListThings}.
@endnode
@node NumberBase
ba [num] -- Set/show current number base
ba without parameters displays the current number base. ba <num> sets
the base to <num> which is always decimal. this is the default base
used in number input if no base prefix is specified. initially it is 16
(hexadecimal).
@endnode
@node FormattedM "Formatted Memory Display"
mf -- Formatted memory display
Usage:
mf "formatstring"
mf <addr> "formatstring"
mf <addr> <endaddr> "formatstring"
This command displays memory in user-specified format. The format string
can contain normal text that is printed directly and c-printf-style
format specifiers. The following format specifiers are currently supported:
%b -- hex byte
%w -- hex word
%l -- hex longword
%db -- decimal byte
%dw -- decimal word
%dl -- decimal longword
%a -- current address (in hex)
%c -- ASCII character (printable ones only, others show as `.')
%s -- string (longword pointer to a NUL-terminated string)
%x -- BCPL string (longword pointer to a string with length byte)
(non-printable characters in strings are printed as `.'
Strings longer than 100 characters are truncated)
The escape sequences described in the @{"echo" link Echo}-command entry
can also be used in the format string.
Note1: words and longs that are displayed must be at even addresses. If
the current address is odd when a word or longword value is going to be
displayed, the address is incremented to the next even address and
an asterisk is printed as a warning to the user.
Note2: a space is required between this command and its arguments.
Example:
mf lib("foobar.library") "Succ=%l Pred=%l Type=%b Pri=%b Name=`%s'"
This displays the contents of the node structure in the library
structure of foobar.library.
@endnode
@node AsciiDump
i -- Display memory in ASCII
Usage:
i -- display a screenful from current address
i <addr> -- display a screenful from <addr>
i <addr> <end-addr> -- display from <addr> to <end-addr>
i <addr>..<end-addr> or m <addr>:<length> (see @{"address ranges" link AddressRanges})
If the ASCII dump was started inside a hunk of currently loaded
executable, it automatically stops at the end of that hunk.
@endnode
@node MemDisplay
m -- Display memory in hex and ASCII
Usage:
m -- display a screenful from current address
m <addr> -- display a screenful from <addr>
m <addr> <end-addr> -- display from <addr> to <end-addr>
m <addr>..<end-addr> or m <addr>:<length> (see @{"address ranges" link AddressRanges})
If the memory display was started inside a hunk of currently loaded
executable, it automatically stops at the end of that hunk.
@endnode
@node MemInfo
mi <addr> -- Display information about memory locations
The mi-command tells you if the address `addr' is in the system memory
list, is it allocated or not and is it inside any of the hunks
of the currently loaded segment.
@endnode
@node ModifyMem
: -- Modify memory
Usage:
: <addr> <string>
Puts the @{"<string>" link ByteStrings} in memory at <addr>
This can also be done with the command `a <addr> dc.b <string>'
(but then <addr> must be even)
@endnode
@node Transfer
t -- Transfer (move) memory
Usage:
t <start-addr> <end-addr> <destination-addr>
The command works correctly even if the source and destination memory
blocks overlap. (if destination is at a higher address than source,
the block is moved backwards, starting at the end)
@endnode
@node Fill
f -- Fill memory with a byte or a string of bytes
Usage:
f <start-addr> <end-addr> <byte> ;fills with <byte>
f <start-addr> <end-addr> <string> ;fills with the string
Example:
f $60000 $601FF $4E,$71 fills from $60000 to $601FF with NOP-instruction
@endnode
@node Hunt
h -- Hunt (find) string in memory
Usage:
h <start-addr> <end-addr> <string>
Displays all addresses in the range <start-addr>..<end-addr>
where the @{"<string>" link ByteStrings} is found.
@endnode
@node CompMem
c -- Compare memory
Usage:
c <start-addr> <end-addr> <string>
Displays all addresses in the range <start-addr>..<end-addr>
where is corresponding byte in the destination block is different from
the source.
@endnode
@node Calculator
? [expr] -- Calculator
Displays the value of the @{"expression" link Expressions} in hex, decimal, octal, binary
and ASCII characters. If the number is negative, displays it as signed
and unsigned.
@endnode
@node Redirect
o -- Redirect output
usage:
o name -- redirects monitor output to file or device `name'
o -- returns to normal, output comes to the monitor window
For example, to send the output to printer use `o PRT:'.
If the file specified in the `o'-command already exists, the monitor
output will be appended to the end of the file.
@endnode
@node Set
set [var[=expr]] -- Set/show variables
The set-command without parameters displays the values of all currently
defined variables. The form `set var=expr' sets the value of `var' to
the value of the expression. `set var' removes the definition of `var'.
cv -- Clear all variables
Asks if you really want to do it, answer `y' to clear them.
@endnode
@node Assemble
a -- Assemble
usage:
a : assemble to the current address
a <addr> : assemble to <addr>
a <addr> <instruction> : assemble <instruction> at <addr>
After assembling an instruction the monitor prompts with the address of
the location following the instruction just assembled and waits a new
instruction to be entered. To exit this mode, simply press <CR> without
entering an instruction. To edit an existing instruction, press Ctrl-E when
the monitor is waiting an assembler instruction.
The assembler understands all the normal 68000 instructions and also
the `pseudo-instructions' dc.b, dc.w and dc.l, which can be used to
directly put data in memory.
See also @{"Some notes about the assembler" link AssemblerNotes}.
@endnode
@node AssemblerNotes "Some notes about using the assembler"
When entering assembler instructions which have an implicit size, no
size specifier is allowed in the monitor assembler. These instructions
are for example btst, bchg, bclr, btst, lea, move to/from sr/ccr/usp,
andi/ori/eori #data,sr/ccr Scc (set according to condition),
abcd/sbcd/nbcd and shifts with memory operands.
Instructions that can have different sizes must have the size specifier,
there is no `default size' (normal assemblers use a default size of word.
The omission of default size is intentional, because it is so easy to
forget the size specifier when you really don't mean the size to be word).
Branch instructions with no size specifier or the .l-specifier assemble
to normal (16-bit offset) branches, if given the .s-size specifier they
assemble to the short form (8-bit offset). The dbxx-(decrement and branch)
-instructions allow no size specifier.
The assembler converts add/sub/and/or/eor with immediate data source
automatically to adda/addi/subi/andi/eori. It does not convert move or
add/sub to the quick form nor does it convert branches automatically to
the short form. You must specify those yourself (so you must use the
moveq/addq/subq- instructions or specify the size .s to branches
as noted above). Also cmp-memory instruction must be entered as cmpm,
the assembler does not convert cmp (an)+,(an)+ to cmpm.
The above conversion rules do not apply to andi/ori/eori with status
register or condition code register. In these cases you must enter the
instruction as andi/ori/eori (don't leave the `i' out). Also, you
can't enter any size specifier in this case.
(In fact I want to make the assembler more flexible than it currently is,
but that is not an easy task...maybe in some future version...)
@endnode
@node Disassemble
d -- Disassemble
Usage:
d -- disassemble a screenful from current address
d <addr> -- disassemble a screenful from <addr>
d <addr> <end-addr> -- disassemble from <addr> to <end-addr>
d <addr>..<end-addr> or m <addr>:<length> (see @{"address ranges" link AddressRanges})
The disassembles supports only 68000 opcodes (with one exeception, 68020+
32-bit long branches are supported).
If the address of a disassembled instruction is inside a hunk of currently
loaded executable file, the hunk number and offset are shown as follows:
H0+$000 07A8D220 2648 movea.l a0,a3
^ ^ ^ ^ ^
| | | \- instruction bytes \ instruction
| | |
| | \- address
| |
| \- offset
|
\- hunk number
If the disassembly was started inside a hunk of currently loaded executable,
it automatically stops at the end of that hunk.
@endnode
@node Registers "Show/Change registers"
r -- Show or change registers
Usage:
r -- displays all registers
r <reg>=<number> or
r <reg> <number> -- puts the value <number> into <reg>
examples:
r D0=0
r A5 $60000
@endnode
@node Breakpoints "Set/Remove/List Breakpoints"
b -- Set breakpoints
Usage:
b <addr> [count] -- sets a breakpoint to <addr> with optional count
Breakpoints are implemented by putting an illegal opcode ($4AFC) in the
breakpoint locations when a G or J command is given. After returning to
the monitor the original contents of the breakpoints are restored. This
means that you can not put breakpoints to ROM (but you can trace ROM code).
If no count is specified, default count of one is used. That means that
the execution of a program stops and control returns to the monitor
immediately when the breakpoint is encountered. If the breakpoint has
a count that is greater than one, then control returns to the monitor
when the breakpoint has been `hit' as many times as the count is.
Breakpoint counts do not work with the `q' (quicktrace) command.
br -- Remove breakpoints
usage:
br <addr> -- removes the breakpoint at <addr>
br #<num> -- removes breakpoint number <num>
br all -- removes all breakpoints
bl -- List breakpoints
Usage:
bl -- display a list of all breakpoints.
The g, j, w, q and e-commands use the current program counter value
(displayed with the r-command) if you don't give them an address.
The stack pointer is reset and a return address to the monitor is
put in the stack if the stack pointer is out of range. This automatic
stack pointer reset can be disabled with @{"option flag" link OptionFlags} #5. The stack
pointer can be manually reset with the 'rs'-command.
@endnode
@node Execute "Go/Jump/Walk/ExtTrace/QuickTrace/Skip"
g [addr] -- Go (execute machine code)
j [addr] -- Jump to subroutine
As g-command but pushes return address first. this return address will
give control back to the monitor when rts-instructions is executed.
w [addr] -- Walk (single step trace)
This single steps code using the 68000 processor built-in trace mode.
It works even with ROM code (but the e-command doesn't).
(This command does not activate breakpoints)
e [addr] -- Extended trace (execute with temporary breakpoint)
This command allows you to execute subroutine calls in full speed
when tracing and you don't need to manually place a breakpoint after
the calls. when the e-command is executed, a temporary breakpoint is
placed in the location after the instruction to be executed. this break-
point is automatically removed after the control returns to the monitor.
The e-command can be used instead of the w-command to trace most of the
instructions, but it is recommended that you use the w-command for
tracing and when tracing code until you get to a subroutine call
instruction. then enter the e-command and the subroutine is executed
normally, but after that the monitor interrupts execution to the
invisible breakpoint.
Note that if you use the e-command in an address that contains a flow-
control instruction, the code flow may never come to the temporary
breakpoint. Normally it is better to trace using the w-instruction,
but for example, system calls cannot always be traced, and even if
they can, you most probably don't want to do it.
q [addr] -- QuickTrace (execute until flow-control instruction)
This command executes code one instruction at time (in the 68000 trace mode)
until it encounters a program flow control instruction (jump, branch,
subroutine call or return, trap).
z -- skip current instruction
This command can be used to advance the PC register over one instruction.
Note that this does not actually execute or trace code, it only changes
the monitor internal register values. An address can also be given as
a parameter to this command but it is normally not useful (the current
PC value will normally be used).
sr -- reset stack pointer.
This resets the stack pointer to the value it has when monitor
has just been started.
Note: there is no easy way to run BCPL programs (CLI commands) or other
programs that use the internal BCPL library from the monitor.
@endnode
@node EnterCmdLine "Enter command line"
\@ -- Enter command line
Usage:
@ [command line].
If you don't specify a command line (enter only @<cr>) then the monitor
will prompt for command line. The command line will be put in a special
memory area and the register a0 will contain pointer to the string and
d0 will contain length of the string (with a linefeed appended to end).
If you want an empty command line, enter the @-command without parameters
and press return on the `Cmdline>'-prompt. The purpose of this command
is to specify a command line for the program that you are running from
the monitor. If you start the monitor with a filename, anything after
the filename is automatically used as the command line.
The dos.library 2.0+ ReadArgs()-routine reads arguments from the standard
input filehandle buffer. Monitor versions 1.60+ set the command line
so that it works with ReadArgs(). Older versions of the monitor didn't
support ReadArgs().
@endnode
@node LoadSeg "Load/Unload AmigaDOS executable"
l -- Load AmigaDOS executable
Usage:
l [+] @{"<name>" link FileNames} -- loads the executable file @{"<name>" link FileNames} in memory and displays
the starting address of the first hunk, also sets PC to this address.
only one executable file be loaded at the same time. Before loading a
new file you must unload the old file with the u-command. To display
the starting & ending addresses of all the hunks in the file, use the
sl-command.
Command `l + <name>' loads symbol table and hunk type information in
addition to the actual file hunks. Those symbols are like the variables
defined by `set' command, but they also have a hunk number associated with
them (it shows in square brackets in the `set' listing). Also, the symbols
are automatically removed when the file is unloaded with the `u'-command.
The command line (see @{"@-command" link EnterCmdLine}) is initialized as empty when this
command is executed.
Overlays are not supported.
u -- Unload AmigaDOS executable
Usage:
u -- unload the currently loaded executable file.
symbol information loaded by `l +' is removed by this command.
sl -- Segment list
Usage:
sl -- displays the starting & ending addresses and length of each hunk
of the currently loaded file. If the `l +' command has been used to
load the file, also the type of each hunk is displayed (including chip/fast
memory types and data/bss byte counts of split data/bss hunks).
@endnode
@node RelBase "Set base address of address register relative symbols"
rb -- set base address for address register relative symbols
Usage:
rb addr -- sets base address of a4-relative addressing to addr.
typically this is in the beginning of the data hunk
of a program with programs compiled with Lattice/SAS C.
rb addr reg -- as above but allows selection of address register
other than a4.
rb 0 -- removes the base address setting.
rb -- displays current base address setting.
When the base address setting is active, the disassembler will check all
xx(a4) (or other addr reg, if selected) addressing modes and if
baseaddr + offset equals a symbol, the symbol is displayed.
@endnode
@node MemoryAlloc "Allocate/Free memory"
( -- Allocate memory
Usage:
( <length> -- allocate <length> bytes any type of memory
( <length> C -- allocate <length> bytes of chip memory
Displays the start & end addresses of the allocated memory block.
Sets current address ('*') to the address of the allocated memory
block. This can be used to assign the block address to a variable
(see @{"Expressions" link Expressions} and the @{"set-command" Link Set}).
& -- Allocate absolute memory location
Usage:
& <addr> <length> -- allocate <length> bytes at <addr>
) -- Free memory
Usage:
) <addr> -- frees the memory block starting at <addr>
) #<num> -- frees memory block number <num>.
) all -- frees all the memory allocated with the (- and &-commands
sm -- Show allocated memory
Usage:
sm -- display all memory blocks allocated with the (- and &-commands
@endnode
@node RWAbs "Read/Write files"
[ -- Read file to memory
Usage:
[ <addr> @{"<name>" link FileNames} -- reads the file <name> to memory starting at <addr>
] -- Write memory to file
Usage:
] <addr> <length> @{"<name>" link FileNames} -- creates a file named <name> and writes <length>
bytes of memory starting at <addr> to the file.
@endnode
@node DiskRW "Read/Write disk sectors"
< -- Read disk sectors
Usage:
< <addr> <unit> <start-sector> <number-of-sectors>
Reads <number-of-sectors> sectors from the disk in unit <unit> to memory
starting at <addr>. <unit> is the unit number to be used in OpenDevice().
with the default device (trackdisk.device) units 0..3 correspond DOS
devices DF0: -- DF3:
the read destination address does not need to be in chip memory.
> -- Write disk sectors
Usage:
> <addr> <unit> <start-sector> <number-of-sectors>
Writes <number-of-sectors> sectors to the disk in unit <unit> from memory
starting at <addr>. <unit> is the unit number to be used in OpenDevice().
with the default device (trackdisk.device) units 0..3 correspond DOS
devices DF0: -- DF3:
The write source address does not need to be in chip memory, even when
using 1.3 trackdisk.device.
dev -- set/show current disk device
Usage:
dev -- show current disk device
dev devname -- set current disk device
devname is an exec device name, given without quotes and with the `.device'-