Interactive Debugger
Contents
Introduction
Debug is an interactive debugger that aids in diagnosing system programs and testing machine-language programs for the 6809 microprocessor. You can also use it to gain direct access to the computer's memory. Debug's calculator mode can simplify address computation, radix conversion, and other mathematical problems.
Calling Debug
To run Debug, type the following command at the OS-9 system prompt:
DEBUG[ENTER]
Basic Concepts
Debug responds to 1-line commands entered from the keyboard. The screen shows the DB: prompt when Debug expects a command.
Terminate each line by pressing [ENTER]
. Correct a typing error by using the backspace key, or delete the entire line by pressing X
while pressing [CLEAR]
.
Each command starts with a single character, which you can follow with text or one or two arithmetic expressions, depending on the command. You can use upper- or lowercase letters or a mixture. When you use the spacebar to insert a space before a specific expression, the screen shows the results in hexadecimal and decimal notation. For example, in the calculator mode, to obtain the hexadecimal and decimal notation for the hexadecimal operation A+2
, type:
[SPACEBAR][A][+][2]
Debug displays:
DB: A+2 $000C #00012
Expressions
Debug's integral expression interpreter lets you type simple or complex expressions wherever a command calls for an input value. Debug expressions are similar to those used with high-level languages such as BASIC, expect that some extra operators and operands are unique to Debug.
Numbers in expressions are 16-bit unsigned integers--the 6809's native arithmetic representation. The allowable range of numbers is 0 to 65535. Debug performs two's complement addition and subtraction correctly, but displays all results as positive numbers in decimal form.
Some commands require byte values. The screen shows an error message if the result of an expression is too large to be stored in a byte; that is, if the result is greater than 255. Some operands, such as individual memory locations and some registers, are only one byte long, and Debug automatically converts them to 16-bit words without sign extension.
Spaces, other than a space at the beginning of a command, do not affect evaluation of the expression. Use them as necessary between operators and operands to improve readability.
Constants
Constants can be in base 2 (binary), base 10 (decimal), or base 16 (hexadecimal). Binary constants require the prefix %. Decimal constants require the prefix #. Debug assumes all other numbers to be hexadecimal. They can have the optional prefix $. The following table shows examples of each type of constant.
Decimal | Hexadecimal | Binary |
#100 | 64 | %1100100 |
#255 | FF | %11111111 |
#6000 | 1770 | %1011101110000 |
65535 | FFFF | %1111111111111111 |
You can use character constants. Use a single quotation mark (') for 1-character constants and a double quotation mark (") for 2-character constants. Quotation marks produce the numerical value of the ASCII codes for the character(s) that follow. For example:
'A | = | $0041 |
'0 | = | $0030 |
"AB | = | $4142 |
"99 | = | $3939 |
Special Names
Dot (.) refers to Debug's current working address in memory. You can examine it, change it, update it, use it in expressions, and recall it. Dot eliminates a tremendous amount of memory address typing.
Dot-Dot (..) is the value of Dot before the last time it was changed. Use Dot-Dot to restore Dot from an incorrect value, or use it as a second memory address.
Register Names
Specify the MPU registers with a colon (:) followed by the mnemonic name of the register, as follows:
:A | = | Accumulator A |
:B | = | Accumulator B |
:D | = | Accumulator D |
:X | = | X Register |
:Y | = | Y Register |
:U | = | U Register |
:DP | = | Direct Page Register |
:SP | = | Stack Pointer |
:PC | = | Program Counter |
:CC | = | Condition Codes Register |
The values returned are the test program's registers, which are stacked when Debug is active. Debug increases 1-byte registers to a word when used in expressions.
Note: When a break point interrupts a program, the SP register points at the bottom of the MPU register stack.
Operators
Operators specify arithmetic or logical operations to be performed within an expression. Debug executes operators in the following order:
- | (negative numbers) |
& and ! | (logical AND and OR) |
* and / | (multiplication and division) |
+ and - | (addition and subtraction) |
Operators that are in a single expression and that have equal precedence (for example, + and -) are evaluated left to right. You can use parentheses, however, to override precedence.
Forming Expressions
An expression is composed of any combination of constants, register names, special names, and operators. The following are valid expressions:
#1024 + #128 :X - :Y - 2 . + 20 :Y * (:X + :A) :U & FFFE
Indirect Addressing
Indirect addressing returns the data at the memory address, using a value (expression, constant, special name, and so on) as the memory address. The two Debug indirect addressing modes are:
<expression> | returns the value of a memory bytes using expression as an address |
[expression] | returns the value of a 16-bit word using expression as an address |
For example:
<200> | returns the value of the byte at Address 200 |
[:X] | returns the value of the word pointed by Register X |
[.+10] | returns the word value ad Address Dot plus 10 |
Debug Commands
This chapter describes Debug's available commands. Following the description for each command, there is an example. The left side of the example shows what you type, and the right side shows what the screen displays. Be sure to execute these examples in the order they appear so you obtain the screen display shown. Many of the examples' results depend on examples previously executed. Also, remember to press [ENTER] after each command.
Calculator Commands
The [SPACEBAR] expression command evaluates the specified expression and displays the result in both hexadecimal and decimal. For example:
You Type | The Screen Shows |
[SPACEBAR]5000+200[ENTER] | $5200 #20992 |
[SPACEBAR]8800/2[ENTER] | $4400 #17408 |
[SPACEBAR]#100+#12[ENTER] | $0070 #00112 |
You can also use this command to convert values from one representation to another. For example:
You Type | The Screen Shows |
[SPACEBAR]%11110000[ENTER] | $00F0 #00240 |
[SPACEBAR]'A[ENTER] | $0041 #00065 |
[SPACEBAR]#100[ENTER] | $0054 #00100 |
[SPACEBAR].[ENTER] | $0000 #00000 |
The examples show: (1) a conversion from binary to both hexadecimal and decimal, (2) a character constant conversion to hexadecimal and decimal ASCII, and (3) a decimal to hexadecimal conversion. The last example used indirect addressing to examine memory without changing Dot's value.
In addition, you can use indirect addressing to simulate 6809 indexed or indexed indirect instructions. The following example is the same as the assembly-language syntax [D,Y]
.
You Type | The Screen Shows |
[SPACEBAR][:D+:Y][ENTER] | $0110 *00272 |
Dot and Memory Examine/Change Commands
You can display the current value of Dot (the current memory address), using the DOT command. For example:
You Type | The Screen Shows |
. | 2201 B0 |
This shows that the present value of Dot is 2201. That memory address contains the value B0.
Incrementing Dot
You can use [ENTER] to increment the value of Dot and display its new value and contents:
You Type | The Screen Shows |
[ENTER] | 2202 05 |
[ENTER] | 2203 C2 |
[ENTER] | 2204 82 |
Decrementing Dot
Use the minus (-) key to decrement the value of Dot. As when you use the [ENTER] key, Debug displays both the new value and the contents of that address:
You Type | The Screen Shows |
[ENTER] | 2204 82 |
[ENTER] | 2203 C2 |
[ENTER] | 2202 05 |
Changing Dot
You can enter an expression after the DOT command to change the value of Dot.
Debug evaluates the expression, and sets Dot to that value. For example:
You Type | The Screen Shows |
. 500[ENTER] | 0500 12 |
Debug displays the new value of Dot and its contents.
The DOT-DOT command (..) restores Dot to its previous value:
You Type | The Screen Shows |
.[ENTER] | 0050 12 |
. 200[ENTER] | 2000 9C |
..[ENTER] | 0050 12 |
Changing Dot's Contents
You can change the contents of Dot with the EQUAL (=) command:
= expression
Debug evaluation expression, and stores the result at Dot. Debug then increments Dot and displays the next address and its contents.
The EQUAL command also checks Dot, after the new value is stored, to see that it changed to the correct value. If it did not, the screen shows an error message. This happens when you attempt to alter non-RAM memory. In particular, the registers of many 6800-family interface devices (such as PIAs and ACIAs) do not read the same as when written to.
For example:
You Type | The Screen Shows |
.[ENTER] | 2203 C2 |
=FF[ENTER] | 2204 01 |
-[ENTER] | 2203 FF |
Note: The EQUAL command can change any memory location. Be careful when changing addresses so that you do not accidentally alter the Debug program, the program being testing, or OS-9.
Register Examine/Change Command
You can use any of several forms of the colon (:) register command to examine one or all registers or to change a specific register's contents.
The registers affected by these commands are actually images of the register values of the program under test. These values are stored on a stack when the program is not running. Although a dummy stack is established automatically when you start Debug, use the E command to give the register images valid data before using the G command to run the program. The registers are valid after breakpoints are encountered and are passed back to the program upon the next G command. (See the "Program Setup" and "GOTO Command" sections later in this chapter for information on the E and G commands.
Note: If you change the SP register, you move your stack and change register contents. In addition, Bit 7 of Register CC (the E flag) must always be set for the G command to work. If it is not set, Debug does not return to the program correctly.
This form of the register command displays the contents of a specific register:
: register
Omitting register causes Debug to display all register contents:
You Type | The Screen Shows |
:PC[ENTER] | C499 |
:B[ENTER] | 007E |
:SP[ENTER] | 42FD |
:[ENTER] | PC=B264 A=01 B=0B CC=80 DP=0C |
SP=0CF4 X=FF0D Y=000B U=00AE |
Use the following form of the register command to assign a new value to a register:
:register expression
Debug evaluates the expression, and stores the result in the specified register. If you specify 8-bit registers, the expression value must fit in one byte. Otherwise, Debug displays an error message and does not change the value of the register. Here is an example of this command:
You Type | The Screen Shows |
:X #4096 | :X #4096 |
Breakpoint Commands
The breakpoint capabilities of Debug let you specify addresses at which you want to suspend execution of the program under test and reenter Debug. When you encounter a breakpoint, the screen shows the values of the MPU registers and the DB: prompt. After the program reaches a breakpoint, you can examine or change registers, alter memory, and resume program execution. You can insert breakpoints at as many as 12 addresses.
The inserted breakpoints use the 6809 SWI instruction, which interrupts the program and saves its complete state on the stack. Debug automatically inserts and removes SWI instructions at the right times; so you not see them in memory.
Because SWIs operate by temporarily replacing an instruction OP code, there are three restrictions on their use:
- You cannot use breakpoints in programs in ROM.
- You must position breakpoints at the first byte (OP code) of the instruction.
- You cannot use the SWI instruction in user programs for other purposes. (You can use SWI2 and SWI3.)
When you encounter the breakpoint during execution of the program under test, reenter Debug by typing : register [ENTER], where register is a mnemonic as discussed in Chapter 2. The screen shows the program's register contents.
Setting Breakpoints
Use the breakpoint (B) command to insert breakpoints:
B expression
Debug evaluates the expression, and sets the breakpoint at that address. If you omit expression, Debug displays all present breakpoint addresses. Note in the following examples that the B . command sets a breakpoint at the address of Dot.
You Type | The Screen Shows |
B 1C00[ENTER] | B 1C00 |
B 4FD3[ENTER] | B 4FD3 |
.[ENTER] | 1277 39 |
B .[ENTER] | B . |
B[ENTER] | 1C00 4FD3 1277 |
Removing Breakpoints
Use the kill (K) command to remove breakpoints:
K expression
Debug evaluates expression for the address at which to remove the breakpoint. Omitting expression causes Debug to remove all breakpoints. For example:
You Type | The Screen Shows |
B[ENTER] | 1C00 4FD3 1277 |
K 4FD3[ENTER] | |
B[ENTER] | 1C00 1277 |
K[ENTER] | |
B[ENTER] |
Program Setup and Run Commands
The ESTABLISH (E) command prepares Debug for testing a specific program module:
E module-name
This command's function is similar to that of the OS-9 Shell in starting a program. The E command does not, however, redirect I/O or override (#) memory size. The E command sets up a stack, parameters, registers, and data memory area in preparation for executing the program to be tested. The G command starts the program.
Note: The E commands allocates program and data area memory as appropriate. The new program uses Debug's current standard I/O paths, but can open other paths as necessary. In effect, Debug and the program become co-routines.
The E command is acknowledged by a register dump showing the program's initial register values. The G command begins program execution. The E command sets up the MPU registers as if you had just performed an F$Chain
service request as shown in the following table:
For example:
You Type: | The Screen Shows: |
---|---|
E my prog | SP C A B DP |
X Y PC | |
0CF3 C8 00 01 0C | |
0CFF 0D00 9214 |
GOTO Command
To start (or resume) program execution, use the G command. The G command goes to (resumes) program execution after a breakpoint. If a breakpoint exists at a present program counter address, Debug does not insert that breakpoint. If you wish to suspend execution during each pass in a loop, you must insert two breakpoints in that loop.
Note: Usually you use the E command before the first G command to set up the program to be tested. Debug initially sets up a default stack, so you can use G expression to start a program, using the results of the expression as a starting address.
Examples:
DB: G 4C00 DB: G :PC+100 DB G [.]
LINK Command
The LINK (L) command sets a link to the specified module:
L module-name
If successful, LINK sets Dot to the address of the first byte of the program and displays it.
You can use L to find the starting address of an OS-9 memory module. For example:
You Type: | The Screen Shows: |
---|---|
L FPMATH | C000 87 |
You can also use the LINK command to reset Dot to the first byte of a module:
You Type: | The Screen Shows: |
---|---|
L FPMATH | C000 87 |
. .+A10 | CA10 FF |
L FPMATH | C000 87 |
Utility Commands
Clearing Memory
The CLEAR MEMORY (C) command performs a walking bit memory test and clears all memory between the two evaluated expressions:
C expression1 expression2
Expression1 specifies the starting address and expression2 specifies the ending address, which must be higher. If any byte fails the test, the C command displays its address. You can test and clear random access memory only.
Note: Use this command carefully. Be sure of the memory address you are clearing.
Some examples of this command are:
You Type: | The Screen Shows: |
---|---|
C ..+FF | |
C 15FF 2000 | 17E4 |
17E7 |
The first example clears all memory between the last value of Dot and Dot plus FF. Because Debug displayed a blank line (nothing), all memory tested good.
The second example indicates that there is bad memory at addresses 17E4 and 17E7.
Displaying Memory
The MEMORY (M) command produces a screen-sized tabular display of the contents of memory in both hexadecimal and ASCII form:
M expression1 expression2
Expression1 specifies the starting address. Expression2 specifies the ending address, which must be higher.
Each line's starting address displays on the left, followed by the contents of the subsequent memory locations. On the far right, Debug displays the ASCII representation of the same memory locations.
Debug substitutes periods (.) for nondisplayable characters.
Searching Memory
The SEARCH (S) command searches an area of memory for a 1- or 2-byte pattern, beginning at Dot.
S expression1 expression2
Expression1 specifies the ending address. Expression2 is the data for which to search. If expression2 is less than 256, Debug uses a 1-byte comparison. If it is greater than 256, Debug uses a 2-byte comparison.
If Debug finds a match, it sets Dot to the address at which the match occurred. If Debug does not find a match, it displays the DB: prompt.
Shell Command
To call the OS-9 shell from within Debug, use the $ command:
$ shell-command
This command executes the specified shell-command and returns to Debug. If you omit the shell-command, Debug calls the OS-9 Shell, which responds with prompts for one or more command lines.
You can also use the $ command to call the system utility programs and the assembler from within Debug. For example:
$dir
Quitting Debug
The QUIT (Q) command lets you exit Debug and return to the OS-9 Shell. To exit Debug, Type:
Q
The system returns you to OS-9.
Note: Any modules you load using I$Load
module-name, or any modules you link using L module-name, remain linked in memory. See the unlink
command in the OS-9 Level 2 Operating System manual for information about unlinking modules from memory.
Using Debug
You can use Debug primarily to test system memory and I/O devices, to patch the operating system or other programs, and to test hand-written or compiler-generated programs.
Sample Program
The simple assembly-language program shown here illustrates the use of Debug commands. This program prints HELLO WORLD and then waits for a line of input.
NAM EXAMPLE * Useful Numbers PRGRM equ $10 OBJCT equ $01 STK equ 200 * Data Section csect LinLen RMB 2 Line length InpBuf RMB 80 Line input buffer endsect * Program Section psect example,PRGRM+OBJCT,$81,0,STK,Entry Entry EQU * Module entry point LEAX OutStr,PCR Output string address LDY #StrLen Get String length LDA #1 Standard output path OS9 I$WritLn Write the line BCS Error Branch if any errors LEAX InpBuf,U Address of input buffer LDY #80 Max of 80 characters LDA #0 Standard input path OS9 I$ReadLn Read the line BCS Error Branch if any I/O errors STY LinLen Save the line length LDB #0 Return with no errors Error OS9 F$Exit Terminate the process OutStr FCC 'HELLO WORLD' Output string FCB $0D End of line character StrLen EQU *-OutStr String length endsect End of PSect
Following is the listing (RMA output) for the Example program:
Microware OS-9 RMA - V1.1 87/03/16 17:33 example.a Page 1 EXAMPLE - 00001 NAM EXAMPLE 00002 00003 * Useful Numbers 00004 0010 PRGRAM equ $10 00005 0001 OBJCT equ $01 00006 00c8 STK equ 200 00007 00008 * Data Section 00009 0000 csect 00010 0000 LinLen RMB 2 Line length 00011 0002 InpBuf RMB 80 Line input buffer 00012 0052 endsect 00013 00014 * Program Section 00015 psect example,PRGRM+OBJCT,$81,0,STK,Entry 00016 00017 0000 Entry EQU * Module entry point 00018 0000 308d0020 LEAX OutStr,PCR Output string address 00019 0004 108e000c LDY #StrLen Get String length 00020 0008 8601 LDA #1 Standard output path 00021 000a=103f00 OS9 I$WritLn Write the line 00022 000d 2512 BCS Error Branch if any errors 00023 000f 3042 LEAX InpBuf,U Address of input buffer 00024 0011 108e0050 LDY #80 Max of 80 characters 00025 0015 8600 LDA #0 Standard input path 00026 0017=103f00 OS9 I$ReadLn Read the line 00027 001a 2505 BCS Error Branch if any I/O errors 00028 001c 109f00 STY LinLen Save the line length 00029 001f c600 LDB #0 Return with no errors 00030 0021=103f00 Error OS9 F$Exit Terminate the process 00031 00032 0024 48454c4c OutStr FCC 'HELLO WORLD' Output string 00033 992f 0d FCB $0D End of line character 00034 000c StrLen EQU *-OutStr String length 00035 00036 0030 endsect End of PSect
Following is the linkage map (RLink output) for the Example program:
Linkage map for example FILE - /h0/CMDS/color/example Section Code IDat UDat IDpD UDpD File example 0015 0000 0000 00 00 RELS/example.r dpsiz updp 0000 end udat 0000 edata ldat 0000 btext code 0000 etext code 0045 os9defs_a 00450000 0000 00 00 ../LIB/sys.l I$ReadLn cnst 008b I$WritLn cnst 008c F$Exit cnst 00D6 ========= ==== ==== ==== 003000000 0000 00 00
Note: This PSect example has a value of $15, which is the offset from the beginning of the final moddule.
Following is the display created by using OS-9's dump
command on the Example module:
OS9:dump /d0/cmds/example Addr 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 2 4 6 8 A C E ---- ---- ---- ---- ---- ---- ---- ---- ---- ---------------- 0000 87CD 0058 000D 11C1 3000 1500 C865 7861 .M.X...A0...Hexa 0010 6D70 6CE5 0030 8D00 2010 8E00 0C86 0110 mple.0.. ....... 0020 3F8C 2512 3042 108E 0050 8600 103F 8B25 ?.%.0B...P...?.% 0030 0510 9F00 C600 103F 0648 454C 4C4F 2057 ....F..?.HELLO W 0040 4F52 4C44 0D00 0000 0000 0000 0065 7861 ORLD.........exa 0050 6D70 6C65 0091 A48B mple..$8
Using Debug
Following is a sample session using the OS-9 Interactive Debugger:
First, run Debug by typing:
debug
The screen displays the Debug prompt DB:. To load the Example program module, type:
$load example
The dollar sign ($) tells Debug that you want to use an OS-9 system command and load
reads the example module from the current directory to your computer's memory.
You now need to tell Debug what module you want to use. Do so with the L (LINK) command. Type:
l example
Debug links to Example and displays the module's address:
C000 87
Redisplay the current address and its value using the DOT command. Type:
.
The screen shows
C000 87
To display the contents of the entire module, use the M (display memory) command. Type:
m . .+57
The screen displays:
C000 87CD 0058 000D 11C1 3000 1500 C865 7861 .M.X...A0...Hexa C010 6D70 6CE5 0030 8D00 2010 8E00 0C86 0110 mple.0.. ....... C020 3F8C 2512 3042 108E 0050 8600 103F 8B25 ?.%.0B...P...?.% C030 0510 9F00 C600 103F 0648 454C 4C4F 2057 ....F..?.HELLO W C040 4F52 4C44 0D00 0000 0000 0000 0065 7861 ORLD.........exa C050 6D70 6C65 0091 A48B mple..$8
Note: PSect of example program starts at an offset of $15 from the beginning of the linked module.
Prepare to run the Example program be typing:
e example
The screen displays the program's initial register values:
SP CC A B DP X Y U PC 2F3 A8 00 01 02 02FF 0300 0200 C015
To set a breakpoint at BCS ERROR, type:
b .+2f
Then, display the breakpoint by typing:
b
The screen displays:
C02F
To run the program, type:
g
The module displays HELLO WORLD. to complete the program, type a message and press [ENTER], such as:
hello computer
Debug now encounters the breakpoint and displays the current register values:
BKPT: SP CC A B DP X Y U PC 02F3 A0 00 01 02 0202 000F 0200 C02F
You can display the module's data area by typing:
m :u :u+20
The screen displays:
0200 D109 6865 6C6C 6F20 636F 6D70 7574 6572 ..hello computer 0210 0D86 A6A4 847F 8D06 A6A0 2AF6 8620 3410 ..........*...4. 0220 9E01 A780 9F01 3590 3432 860D 8DF0 304D ......5.42....0M
Display the relative data area at offset 2 by typing:
:u+2
To step through the data, press the [ENTER] one or more times. The screen displays the addresses and address values, such as:
0202 68 0203 65 0204 6C 0205 6C 0206 6F
To end the Debug session, type:
q
The OS9:
prompt reappears on the screens.
Patching Programs
To patch a program (to change its object code), follow these steps:
- Load the program into memory, using OS-9's
load
command. - Use Debug's LINK, DOT, and EQUAL commands to link to and change the program in memory.
- Save the new, patched version of the program on a disk file, using OS-9's
save
command. - Update the program module's CRC check value, using OS-9's
verify
command. Be sure to use the U option. - Set the module's execute status, using OS-9's
attr
command.
Step 4 is essential because OS-9 cannot load the patched program into memory until the program's CRC check value is updated and correct.
The example that follows shows how the sample program is patched. In this case, the ldy #80
instruction is changed to ldy #32
.
OS9: debug call debug Interactive Debugger DB: $load example call OS-9 to load the program DB: l example set dot to beg addr of program 2000 87 actual address will vary DB: . .+29 add offset of byte to change 2029 50 current value is 80 DB: =#32 change to decimal 32 202A 86 next byte is displayed DB: - back up 1 byte 2029 20 confirm changed DB: q exit Debug OS9: save temp example save in file called "temp" OS9: verify U temp newex update CRC and copy to "newex" OS9: attr newex e pe set execution status OS9: del temp delete temporary file
Patching OS-9 Component Modules
Patching modules that are part of OS-9 (are contained in the OS-9 Boot file) is different than patching a regular program because you must use cobbler
and os9gen
programs to create a new OS-9 Boot file. This example shows how an OS-9 device descriptor module is permanently patched, in this case to change the uppercase lock of the device /term
from on to off. This example assumes that a blank, freshly formatted diskette is in Drive 1 (/d1
).
Note: Always use a copy of the OS-9 System Disk when patching, in case something goes wrong.
OS9: debug call Debug Interactive Debugger DB: l term set dot to addr of TERM module CA82 87 actual address will vary DB: . .+13 add offset of byte to change CA95 01 current value is 01 DB: =0 change value to 00 for "OFF" CA96 01 DB: - move back one byte CA95 00 change confirmed DB: q exit Debug OS9: cobbler /d1 write new bootfile on /d1 OS9: verify </d1/OS9BOOT > /d0/temp U update CRC value OS9: del /d1/OS9Boot delete old boot file OS9: copy /d0/temp /d1/OS9BOOT install updated boot file
You can now use the dsave
command to build a new system disk.
Debug Command Summary and Error Codes
Debug Command Summary
[SPACEBAR]expression | Evaluate; display in hexadecimal and decimal form |
Dot Commands | |
. | Display Dot address and contents |
.. | Restore last Dot address; display address and contents |
.expression | Set Dot to result of expression; display address and contents |
=expression | Set memory at Dot to result of expression |
- | Decrement Dot; display address and contents |
[ENTER] | Increment Dot; display address and contents |
Register Commands
: | Display all registers' contents |
:register | Display the specified registers contents |
:register expression | Set register to the result of expression |
Program Setup and Run Commands
E module-name | Prepare for execution |
G | Go to the program |
G expression | Go to the program at the address specified by the result of expression |
L module-name | Link to the module named; display address |
Breakpoint Commands
B | Display all breakpoints |
B expression | Set a breakpoint at the result of expression |
K | Kill all breakpoints |
K expression | Kill the breakpoint at the address specified by expression |
Utility Commands
M expression1 expression2 | Display memory dump in tabular form |
C expression1 expression2 | Clear and test memory |
S expression1 expression2 | Search memory for pattern |
$ text | Call OS-9 Shell |
Q | Quit (exit) Debug |
Debug Error Codes
Debug detects several types of errors, and displays a corresponding error message and code number in decimal notation. The various codes and descriptions are listed here. Error codes other than those listed are standard OS-9 error codes returned by various system calls.
0 | Illegal Constant | The expression includes a constant that has an illegal character or that is greater than 65,535. |
1 | Divide by Zero | You are trying to use a divisor of zero. |
2 | Multiplication Overflow | The product of the multiplication is greater than 65,535. |
3 | Operand Missing | An operator is not followed by a legal operand. |
4 | Right Parenthesis Missing | Parentheses are not correctly nested. |
5 | Right Bracket Missing | Brackets are not correctly nested. |
6 | Right Angle Bracket Missing | A byte-indirect is not properly nested. |
7 | Incorrect Register | A misspelled, missing, or illegal register name follows the colon. |
8 | Byte Overflow | You are trying to store a value grater than 255 in a byte-sized destination. |
9 | Command Error | A command is misspelled, missing, or illegal. |
10 | No Change | The memory location does not match the value assigned to it. |
11 | Breakpoint Table Full | Twelve breakpoints already exist. |
12 | Breakpoint Not Found | No breakpoint exists at the address given. |
13 | Illegal SWI | Debug encountered an SWI instruction in the user program at an address other than a breakpoint. |