4.2.6 The L (List) Command
The L command is used to list assembly-language mnemonics in a
particular program region. The L command takes the forms:
L
Ls
Ls,f
The first form lists twelve lines of disassembled machine code
from the current list address. The second form sets the list
address to s and then lists twelve lines of code. The last form
lists disassembled code from s through address f. In all three
cases, the list address is set to the next unlisted location in
preparation for a subsequent L command. Upon encountering an
execution breakpoint, the list address is set to the current
value of the program counter (G and T commands). Again, long
typeouts can be aborted by pressing RETURN during the list
process.
4.2.7 The M (Move) Command
The M command allows block movement of program or data areas from
one location to another in memory. The M command takes the form:
Ms,f,d
where s is the start address of the move, f is the final address,
and d is the destination address. Data is first removed from s to
d, and both addresses are incremented. If s exceeds f, the move
operation stops; otherwise, the move operation is repeated.
4.2.8 The R (Read) Command
The R command is used in conjunction with the I command to read
COM and HEX files from the disk into the transient program area
in preparation for the debug run. The R command takes the forms:
R
Rb
where b is an optional bias address that is added to each program
or data address as It is loaded. The load operation must not
overwrite any of the system parameters from 000H through 0FFH
(that is, the first page of memory). If b is omitted, then b =
0000 is assumed. The R command requires a previous I command,
specifying the name of a HEX or COM file. The load address for
each record is obtained from each individual HEX record, while an
assumed load address of 100H is used for COM files. Note that any
number of R commands can be issued following the I command to
reread the program under test, assuming the tested program does
not destroy the default area at 5CH. Any file specified with the
filetype COM is assumed to contain machine code in pure binary
form (created with the LOAD or SAVE command), and all others are
assumed to contain machine code in Intel hex format (produced,
for example, with the ASM command).
Recall that the command,
DDT filename.typ
which initiates the DDT program, equals to the following
commands:
DDT
- Ifilename.typ
- R
Whenever the R command is issued, DDT responds with either the
error indicator ? (file cannot be opened, or a checksum error
occurred in a HEX file) or with a load message. The load message
takes the form:
NEXT PC
nnnn pppp
where nnnn is the next address following the loaded program and
pppp is the assumed program counter (100H for COM files, or taken
from the last record if a HEX file is specified).
4.2.9 The S (Set) Command
The S command allows memory locations to be examined and
optionally altered. The S command takes the form:
Ss
where s is the hexadecimal starting address for examination and
alteration of memory. DDT responds with a numeric prompt, giving
the memory location, along with the data currently held in
memory. If you type a carriage return, the data is not altered.
If a byte value is typed, the value is stored at the prompted
address. In either case, DDT continues to prompt with successive
addresses and values until you type either a period or an invalid
input value is detected.
4.2.10 The T (Trace) Command
The T command allows selective tracing of program execution for 1
to 65535 program steps. The T command takes the forms:
T
Tn
In the first form, the CPU state is displayed and the next
program step is executed. The program terminates immediately,
with the termination address displayed as
*hhhh
where hhhh is the next address to execute. The display address
(used in the D command) is set to the value of H and L, and the
list address (used in the L command) is set to hhhh. The CPU
state at program termination can then be examined using the X
command.
The second form of the T command is similar to the first, except
that execution is traced for n steps (n is a hexadecimal value)
before a program breakpoint occurs. A breakpoint can be forced in
the trace mode by typing a rubout character. The CPU state is
displayed before each program step is taken in trace mode. The
format of the display is the same as described in the X command.
You should note that program tracing is discontinued at the CP/M
interface and resumes after return from CP/M to the program under
test. Thus, CP/M functions that access I/O devices, such as the
disk drive, run in real-time, avoiding I/O timing problems.
Programs running in trace mode execute approximately 500 times
slower than real-time because DDT gets control after each user
instruction is executed. Interrupt processing routines can be
traced, but commands that use the breakpoint facility (G, T, and
U) accomplish the break using an RST 7 instruction, which means
that the tested program cannot use this interrupt location.
Further, the trace mode always runs the tested program with
interrupts enabled, which may cause problems if asynchronous
interrupts are received during tracing.
To get control back to DDT during trace, press RETURN rather than
executing an RST 7. This ensures that the trace for current
instruction is completed before interruption.
4.2.11 The U (Untrace) Command
The U command is identical to the T command, except that
intermediate program steps are not displayed. The untrace mode
allows from 1 to 65535 (0FFFFH) steps to be executed in monitored
mode and is used principally to retain control of an executing
program while it reaches steady state conditions. All conditions
of the T command apply to the U command.
4.2.12 The X (Examine) Command
The X command allows selective display and alteration of the
current CPU state for the program under test. The X command takes
the forms:
X
Xr
where r is one of the 8080 CPU registers listed in the following
table.
Table 4-3. CPU Registers
Register | Meaning | Value
|
---|
C | Carry flag | (0/1)
|
Z | Zero flag | (0/1)
|
M | Minus flag | (0/1)
|
E | Even parity flag | (0/1)
|
I | lnterdigit carry | (0/1)
|
A | Accumulator | (0-FF)
|
B | BC register pair | (0-FFFF)
|
D | DE register pair | (0-FFFF)
|
H | HL register pair | (0-FFFF)
|
S | Stack pointer | (0-FFFF)
|
P | Program counter | (0-FFFF)
|
In the first case, the CPU register state is displayed in the
format:
CfZfMfEflf A=bb B=dddd D=dddd H=dddd S=dddd P=dddd inst
where f is a 0 or 1 flag value, bb is a byte value, and dddd is a
double-byte quantity corresponding to the register pair. The inst
field contains the disassembled instruction, that occurs at the
location addressed by the CPU state's program counter.
The second form allows display and optional alteration of
register values, where r is one of the registers given above (C,
Z, M, E, I, A, B, D, H, S, or P). In each case, the flag or
register value is first displayed at the console. The DDT program
then accepts input from the console. If a carriage return is
typed, the flag or register value is not altered. If a value in
the proper range is typed, the flag or register value is altered.
You should note that BC, DE, and HL are displayed as register
pairs. Thus, you must type the entire register pair when B, C, or
the BC pair is altered.
4.3 Implementation Notes
The organization of DDT allows certain nonessential portions to
be overlaid to gain a larger transient program area for debugging
large programs. The DDT program consists of two parts: the DDT
nucleus and the assembler/disassembler module. The DDT nucleus
is loaded over the CCP and, although loaded with the DDT nucleus,
the assembler/disassembler is overlayable unless used to assemble
or disassemble.
In particular, the BDOS address at location 6H (address field of
the JMP instruction at location 5H) is modified by DDT to address
the base location of the DDT nucleus, which, in turn, contains a
JMP instruction to the BDOS. Thus, programs that use this address
field to size memory see the logical end of memory at the base of
the DDT nucleus rather than the base of the BDOS.
The assembler/disassembler module resides directly below the DDT
nucleus in the transient program area. If the A, L, T, or X
commands are used during the debugging process, the DDT program
again alters the address field at 6H to include this module,
further reducing the logical end of memory. If a program loads
beyond the beginning of the assembler/disassembler module, the A
and L commands are lost (their use produces a ? in response) and
the trace and display (T and X) commands list the inst field of
the display in hexadecimal, rather than as a decoded instruction.
4.4 A Sample Program
The following example shows an edit, assemble, and debug for a
simple program that reads a set of data values and determines the
largest value in the set. The largest value is taken from the
vector and stored into LARGE at the termination of the program.
Back to title page
     Next