Z. D. P. VERSION 1.2 Copyright (C) 1980,1986 Robert D. Nashner (Copyable for Personal Use Only-Not for Commercial Use or Resale) 1 Z. D. P. A Z-80/8080 Development, Debugging, and Dis-assembly Program (Preliminary Documentation) ZDP (Z-80 Debugging Package) is a self-contained routine which includes a de-bugging monitor, program tracing/stepping controller, and dis-assembler. The main features of this package may be summarized as follows:. MEMORY MANAGEMENT: Commands include block moves and fills, hexadecimal and ASCII display/mod ification, plus a complete set of search and compare operations, including doubleword searches and searches for strings up to 32 bytes long. REGISTER CONTROL: All Z-80 registers, including PC, SP, and individual flags plus referenced memory are displayed and can be modified. The modification can also include adding/subtracting constants or bit changing. The instruction referenced by the current PC is shown in hex followed by its mneumonic form. A similiar disassembly list ing can be made of any other section of memory. Using optional symbol table, word locations and constants can also be displayed symbollicaly, either as labels or operands. PROGRAM EXECUTION CONTROL: Programs can be stepped manually by typing 1 SPACE for each step, or continuously (using the 'TR' command). Under break- point control, 1 to 8 breakpoints can be inserted into user programs being tested; and they can be set to repeatedly display all registers and the instruction before continuing or else re- enter ZDP after n-number of encounters. The operating program can be generated to occupy a 4K memory block starting on any 256 byte page boundary; also it can be generated to display code with either Zilog or Extended Intel (TDL) mneumonics. The basic syntax for all of the memory management commands has the form, > [p1 [p2 [p3]]] where the string is an alphanumeric ASCII string, without embedded blanks, that represents the command; and (p1,p2,p3) are valid hex digit strings representing 1 to 3 parameter values. All of these strings are separated by one or more blanks. The command is followed by either the CR or the ESC character, which termi- nates the command entry and begins executing it. Entering com- mands with CR simply process it and returns to command mode; while using the ESC processes the commands, displays any results, and follows immediately by a complete Register Display. A current Regiser Display alone can be obtained simply by typing ESC. Normally, extra parameters not used by a command are ignored. Also, trailing parameters that are omitted will be interpreted as zero values, unless otherwise illegal. Before a command is entered, individual chacacters can be deleted by typing BS (ASCII CTL-H); also and entire partial com- 2 Z. D. P. mand can be canceled before entry by typing CTL-X, and a new command prompt occurs on the next line. Listings in progress such as those started by 'DU' or 'LI' commands, etc. may be temporarily stopped by typing CTL-S, then resumed by hitting any key. Although the string can be of arbitrary length, only the first 1 to 3 characters that may define a valid command are significant. Also, no matter how many digits a parameter has; only the last 2 or 4 digits are used if the parameter represents a byte or word value respectively. Similiarly, for short digit strings, the value represents the least significant bits of the parameter value. For example both commands below, >FI 20 1FF 2E >FILL 0020 FF01FF 202E would fill the memory block from 0020H to 01FFH with the byte 2EH ("."). I. THE REGISTER DISPLAY: The Z80 Register display, which includes curent PC, Stack, Condition Flags, & also memory referenced by all register pairs and SP can be obtained in the command mode by typing an ESC or will appear after executing a command terminated by an ESC instead of a CR. The Register Display also occurs upon entry to ZDP following a breakpoint and after each step while running programs under trace control. A sample Register Display appears below. AF BC DE HL IX @B @D @H @X 00C1 0000 0000 0000 0000 31 31 31 31 AF' BC' DE' HL' IX @B'@D'@H'@Y IR SP @SP 0000 0000 0000 0000 0000 31 31 31 31 0000 5B0C 0080 PC @PC FLGS 0000 310010 LD SP,1000 MZ C It is possible to restrict all Register Displays to only the bottom line, eg. show the next instruction & current flags; this is done by entering the command >DI 1 . For additional functions of the DI command, see the BASIC COMMANDS, PROGRAM CONTROL, and SYMBOL TABLE sections. In addi- tion to SPACE and ESC and additional single key commmand of CLEAR (Form feed or CTL-L) is sent directly to the display device to clear the screen and home the cursor, provided that the current Terminal Display device supports this operation. II.THE BASIC COMMANDS The basic commands are described in this section includ- ing any range or value requirement of their corresponding parame- ters. When the first 2 parameters are specified as , they refer to an address range such that <= . 3 Z. D. P. 2.1 The DUMP Command: DU A hex dump is given for the adress range of through . On the first line of the dump, the starting location is displayed; and at each 16-byte address boundary, a new line is begun with the location displayed followed by 16 hex byte values or a line that ends with location . An extra space is always inserted at each 4-byte boundary for clarity. 2.2 The ASCII TYPE Command: TY A dump of memory of the range specified is given as ASCII characters. The memory location of each line is displayed, as with DU, followed by the ASCII data. A new line is begin at each 32 byte boundary. The character equivalent of every printable byte is displayed, including those with bit 7 set high; however, control codes (between 00H and 1FH) will appear as dots. 2.3 Dis-assembly Listings--The LIST Command: The form of the command to dis-assemble a block of memory is, LI [al [au]] . The specified memory block is displayed, one instruc- tion per line, in the same manner as the PC,@PC portion of a Register Display. If [au] is not given, then the list continues on until terminated by CTL-X; If no parameters are given, then the listing starts from the PC location and continues until CTL-X terminates it. For example, if a 'DU 2000 200F' command produces the following display: 2000 31 00 02 21 FE 01 CD 2B 00 BD 28 FA 2D 77 20 F6 Then a 'LIST 2000 200F' command would give the following: 2000 310002 LD SP,0200 2003 21FE01 LD H,01FE 2006 CD2B00 CALL 002B 2009 BD CP L 200A 28FA JR Z,2006-$ 200C 2D DEC L 200D 77 LD (HL),A 200E 20F6 JR NZ,2006-$ 2.4 The FILL Command: FI [b3] The block of memory from locations through is filled with the byte [b3]; if [b3] is not specified, then this 4 Z. D. P. block is filled with 00H. 2.5 The CHARACTER FILL Command: CF[b] The ASCII character designated [b] immediately following CF fills the memory block through . If character [b] is not specified, then this block is filled with blanks (20H). 2.6 The BLOCK MOVE Commands: There are three types of move commands; their forms are, MOV MVL MVR . The MOV command takes the string from through and transfers it to the location starting at . Any portion of the source string not overlapped by the destination string space is left unchanged. For the last two commands, is the source location, the destination, and is the length of the move opera- tion. In the case of MVL, the source and destination locations are DECREMENTED after each byte transfer; and for MVR, these locations are INCREMENTED (the same as for LDDR & LDIR instruc- tions respectively). WARNING: A ZERO VALUE FOR WILL BE INTERPRETED AS THE ENTIRE ADDESS RANGE (0000H to FFFFH)! MVL & MVR commands may be useful for creating certain string patterns in memory; since they pay no attention to source and destination overlaps. For example, if location 2000H contains the string 30H 31H 32H, theh the command, >MVR 2000 2003 3C will fill locations 2000H to 203CH with 20 occurrences of the repeating string 30H 31H 32H. 2.7 The Byte SEARCH Command: SEA [b3] Address range through is scanned for occurrenc- es of byte [b3]. In this and in the next two Search commands, an unspecified [b3] implies an 00H value. For every location where this byte is found, that location, followed by byte [b3], is listed on the next line. 2.8 The NON-OCCURRENCE Search: SRN [b3] The address range is scanned for non-occurrences of the byte [b3]. Each such location is displayed, followed by the non- matching byte at that location. 5 Z. D. P. 2.9 The DOUBLE WORD Search: SRW [p3] Parameter [p3] is interpreted as a right justified, then byte-reversed double word; and the address range is scanned for occurrences of this word. The locations containing it are listed, along with [p3] in its unreversed form. 2.10 The Memory Block COMPARE Command: COM Block#1 defined by the address range is com- pared byte-by-byte to Block #2 whose starting address is and whose size is the same as that of Block #1. Any data mismatch at corresponding locations will be displayed on one line in the following form: loc.#1 byte@1 loc.#2 byte@2 For example, suppose a 'DU 2000 200F' command produced the following display: 2000 00 01 02 03 04 05 06 00 01 02 03 05 05 07 00 00 . Then a 'COM 2000 2006 2007' command would produce the output. 2004 04 200B 05 2006 06 200D 07 2.11 String Searches - The FIND Command: Memory can be searched for each occurrence of a string of up to 32 bytes. The search is initiated by entering the command, FIN , where defines the memory range to be searched. After entering this, the system will go to the next line and wait for entry of the string to be searched. The string consists of 1 or more elements of the form

or <.p> where 'p' is a hex digit string; and each element is separated from the next by 1 or more spaces. An element of the form

represents one byte of the string; while <.p> means the hex string will be used as a byte- reversed double word. After the entire string is specified, it is terminated and entered by typing RETURN. Alternatively, enter ing a total of 32 bytes automatically forces string entry and initiation of the search. The memory range is examined, stepping forward 1 byte at a time, for each occurrence of the entered string. For each occurrence found, the starting address plus the first byte of the string is displayed in hex on one line. (Note: any string occurr- ence whose STARTING address falls within will have its address shown.) 6 Z. D. P. For example, if a 'DU 2000 200F' command produced the following display: 2000 FE 10 20 C3 00 FE 10 20 C3 00 FE 10 00 00 00 00 Then we could enter the following String Search command: >FIN 2000 2009 FE 10 20 C3 .FE00 10 and then the following display would result: 2000 FE 2005 FE 2.12 Displaying & Entering data - The ENTER Command: Individual data words are displayed and/or modified with the ENTER command of the form, EN

. After entering this command, ZDP goes to a display/modify mode; the location

followed by the byte at that location will be displayed on the next line in the form shown and with the cursor immediately following the "-". For example, >EN 2000 2000 00- If a space is typed after the "-", then the value of the next byte is displayed followed by "-" and the cursor. If one types an entry of the form

or <.p> followed by space, where (p) is a valid hex string, then this value replaces the previous- ly displayed value; The <.p> entry indicates that the entry is to be a right jusified, then byte reversed doubleword entry; in this case the display advances two position, showing the high-order part of <.p> at the final step. The above process can be repeated up to a 32 byte line. If a RETURN is substituted for the space, then a new line is started for the next location which functions as above. Note that 32 display/modify steps will automatically force the start of a new display/modify line. Also, typing any other non-hex character will restart the present line and redisplay the start address; this feature can be used to correct invalid entries on a line, because the current line does not update actual memory until the RETURN is hit or the EN command is terminated. Typing slash "/" immediatedy after the last space or RETURN terminates the EN command. For example, supposed we wanted to enter at loc. 8000H, the hex string C5 D5 E5, followed by the instruction, 'JMP 4B00'. The command might look like the following: >EN 8000 8000 00-C5 FF-D5 00-E5(CR) 8003 FF-C3 00-.4B00 4B- 00-/ > 7 Z. D. P. 2.13 ASCII Byte Entry: The form of this command is ASC

. After entering the command, a new line is begun; the command will then accept any chacacters available from the keyboard, and place them in successive memory locations. Incorrect entries may be deleted by typing BS or CTL-H which backs up the entry pointer and the display cursor by one position. The command is terminted by entering either CTL-X or CTL-Y; the CTL-Y terminator will set bit 7 high in the last chacacter entered. Upon termination, the last location modified is displayed along with the hex equivalent of the last character entered. 2.14 The memory and Register EXCHANGE Commands: XR XA XM The first two commands exchange respectively Z-80 regis- ters B through L or Accumulator & Flags with the corresponding primed set (the same as executing EXX or EX AF,AF' instructions). The XM command swaps memory locations beginning at with those beginning at and continuing the swap through a length of bytes. As with MVL & MVR commands, overlap is ignored. 2.15 The HEX Arithmetic Command: HEX The sixteen bit values of p1+p2 and p1-2 are displayed on successive lines; both displays are followed by a hex display of the byte at the computed location. 2.16 The RESTART Command: RST In the parameter , only the least 3 bits are used. The result value from 0 to 7 will determine which RST instruction will be used for tracing and breakpoint operation. A jump vector to ZDP will be inserted at the corresponding vector location from 0 to 38H. At cold start time, a restart value (usually 'RST 3') is automatically inserted. 2.17 The DISPLAY Command: DI [b] The DISPLAY command determines the Register Display mode. Only the lowest order three binary bits of [b] are significant. Each of bits 0,1, & 2 when high in [b] has the effect on the display listed below: 8 Z. D. P. BIT 0: Suppresses all of a Register Display except the bottom line containing the current PC instruction listing and the set condition flags. BIT 1: Before each Register Display, performs a cursor home (a CTL-K to the display device). This is useful for in-place updat- ing of the state of execution during single stepping or tracing. BIT 2: Enables location symbols in the optional symbol table to be displayed as labels or in place of a hex doubleword operand (See the Symbol Table section for additional information.) For example, if a 'DI 4' is entered, then each subsequent Regis ter Display will be complete and will show symbolic labels and operands wherever they are defined. If 'DI 3' is entered, then each display will show the current flags and next instruc- tion only; and it will appear on the top screen line. 'DI' (or 'DI 0') always returns the normal display mode, all registers, scrolling up if necessary, and no symbols. III. REGISTER MODIFICATION ZDP provides register operations on all single registers, pairs, and memory indexed by register pairs. The commands all consist of a register name followed by 1 or 2 hex parameters, all separated by one or more blanks. The set of possible register names is the following: (1) Single Register Names: B C D E H L A F I B' C' D' E' H' L' A' F' (2) Register Reference Names: @B @D @H @X @PC @B' @D' @H' @Y @SP (3) Register Pair Names: BC DE HL PC SP BC' DE' HL' IX IX 3.1 The simple modify case has the form Name

where the name can be from any of the three cases. The parameter value replaces the current contents of the register, pair, or referenced memory location. For all Single Register Names and all Register Reference Names EXCEPT @SP, the

must be a byte value (not over 2 digits). For the Pair Names and @SP,

is used as a double word to modifies the high order register or the high order byte on the stack). Only a Register Reference Name may be specified with no parameters. In his case, a 16 byte memory string referenced by the pair is displayed. The display produces a hex, then an ASCII display of memory 8 bytes below then 8 above the location in the register. For example, suppose HL conatined 3008H, and at loc. 3000H the string "Show Registers" was stored. An '@H' command would produce, 9 Z. D. P. -3008 53 68 6F 77 20 52 65 67 69 73 74 65 72 73 0D 0A S h o w R e g i s t e r s . . When a register command has two parameters in the form, Name

the parameter must have one of four values "A", "D", "0", or "1". In the first two cases the

parameter is ADDED to or DECREMENTED (Subtracted) from the current register or location value, with any resulting overflows ignored. When is specified "0" or "1" then

must be in the range 0 to F for Register Pair Names and @SP, and must be from 0 to 7 for all other cases. The corresponding bit position speci- fied by

is set high or low for = "1" or "0" respectively. IV. Flag Modification The commands for setting or resetting individual condi- tion flags appear below (and require no parameters). They are FZ FNZ FC FNC FPE FPO FH FNH FM FP and are used respectively to set & reset the ZERO, CARRY, EVEN PARITY, HALF CARRY, and SIGN flags. (Note: all primed or unprimed condition flags may also be simultaneously or individually changed by specifying F or F' in a Register Modify command.) For example, suppose we had a Register Display like the following: AF BC DE HL IX @B @D @H @X 00C1 0000 0000 0000 0000 31 31 31 31 AF' BC' DE' HL' IY @B'@D'@H'@Y IR SP @SP 0000 0000 0000 0000 0000 31 31 31 31 0000 5B0C 0080 PC @PC FLGS 0000 310010 LD SP,1000 MZ C Then suppose we entered the following commands: >E 7F >DE' 4B00 >@SP 400C >@Y D 1E >B 1 6 >FNC >PC A 2000 The final Register Display then might look like the following: AF BC DE HL IX @B @D @H @X 00C0 4000 007F 0000 0000 00 20 13 13 AF' BC' DE' HL' IY @B'@D'@H'@Y IR SP @SP 0000 0000 4B00 0000 0000 13 00 13 13 0000 5B0C 400C PC @PC FLGS 4000 00 NOP MZ 10 Z. D. P. V. EXECUTION CONTROL Execution control of a user's program has two basic modes of operation. Under BREAKPOINT control, a program is executed or continued, starting from the current register state, with poss- ible temporary or permanent breakpoints inserted just prior to entering. Upon encountering the breaks, the ZDP command mode is entered after showing a Register Display reflecting the CPU state just prior to encountering the break (RST instruction). Under TRACE control, each step in the user's program is executed individually under ZDP control; and the register state is displayed by ZDP after each step. Provision is made for either manual stepping or automatic continuous stepping. 4.1 Permanent Breakpoints Permanent breakpoints are set using a SET command, and remain in effect until they are cleared with the CLR command. Prior to entering the user's program, the selected Restart opcode is placed at the break address (after saving the original byte there). When execution encounters that RST instruction, the coresponding vector interrupt location has a JMP to a ZDP entry point which saves the Z80 registers and PC before giving a Regis- ter Display and entering the Command Mode. The PC will show the address at where the break occurred (but with the original in- struction there). Note that breakpoint Restarts never appear in program code during ZDP displays; breakpoints are not inserted into the code until after initiating an EXECUTE, CONTINUE, or RETURN command. Then upon breakpoint entry, the original byte is always restored. However, if the current RST code is encountered in a program, but was not a set breakpoint, then ZDP will be entered with the current PC one byte past the RST instruction; and this instruction will remain in the code. The form of the Permanent Breakpoint commands are SET

CLR [b#] . For the SET command, is the permanent breakpoint number being set. It must be from 1 to 4 and cannot be a previously Set & uncleared breakpoint.

is the 2 byte location of the break being set. For CLR, if is not specified or zero, than any permanent breakpoints previously set will be cleared. Otherwise, must be a previously set breakpoint number from 1 to 4; in which case that particular one is cleared. 4.2 Displaying Breakpoints: BR This command will display any set permanent breakpoints, in ascending order. For each one set, a separate line will dis- play the number (01 to 04), the location, and the remaining REPEAT count if greater than 1 (see the REP command decription). 11 Z. D. P. 4.3 Program Execution: The EXECUTE command starts a program at a specified address. It has two general forms. EX EX [p1 [p2 [p3]]] . In the first case, a user program is entered at the location specified by after restoring all other saves Z80 registers and stack, etc. In the second case, any location para- meters (up to 3) entered before will be inserted as Tempo- rary Breakpoints. Temporary breakpoints function similiar to the permanent ones; except that they are in effect only from program entry until re-entry to ZDP command mode. When ANY breakpoint causes re-entry to ZDP, ALL Temporary breakpoints are cleared and do not function again (unless re-specified). Note that if a prograam entered via an 'EX' command is written as a subroutine, then the final RET instruction executed will return to the ZDP Command Mode. However, the PC will not show the location of this RET or the instruction just following it; since in this case, no Breakpoint was inserted at this final RETURN location. 4.4 Program Continuation: The CONTINUE command continues execution at the current saved PC after restoring the saved registers and stack. CON [p1] [p2] [p3] [p4] The parameters, if specified, will be used as Temporary Breakpoints, as with 'EX'. 4.5 The Return Command: RET [p1] [p2] [p3]] This command is similiar to the 'CON' command; except that one temporary breakpoint is placed at the address on top of the current stack (@SP). Thus, if the current PC is wihin a subroutine whose return address is @SP; then a 'RET' command completes execution of this routine before returning to ZDP with PC at the return location. This command is useful when stepping through code which calls a known subroutine one does not need to trace; one simply steps to the entry instruction of that subrou- tine, then enters a 'RET' command. 4.6 The Breakpoint REPEAT Commmand: REP [b# [n]] This command is used to (1) run a program, breaking out into ZDP after encountering a certain breakpoint a specified number of times; and (2) to run a program and give a Register Display when ecountering any breakpoint, but then continue normal execution. If specified, must be a set permanent break as 12 Z. D. P. before. If specified, [n] will be used as a byte value repeat count (1 to 255). After entering REP, execution is continued from PC. When breakpoint is ecountered by ZDP, if the repeat count [n] equals 1 then the command mode is entered; otherwise [n] is decremented by 1 and execution continues. Thus this break- point traps to ZDP only after it is encountered n times. However if if another non-repeating breakpoint is encoun- tered during execution, ZDP always traps to the command mode. Any remaining breakpoint repeat counts will be retained; and on continuation of execution, these remaining counts will go into effect. Remaining repeat counts greater than 1 will be displayed with the corresponding breakpoint when a Display Set Breakpoints (BR) command is entered. If both parameters are unspecified or zero, then the Repeat-and-Show mode is entered. Each time a breakpoint is encountered, ZDP gives a Register Display for that location and continues execution until another break is encountered and dis- played, etc. This process will continue until halted (by a Con- sole BREAK) or when the user's program jumps out of the section containing the ZDP breakpoints. If is a set breakpoint but [n] is unspecified or zero, this has the effect of clearing followed by continua- tion at PC. 4.7 Trace Mode Program Control In the trace mode of execution, every instruction step of a program is executed under ZDP control; and after each step, a Register display is shown. As mentioned in the first section, a program can be stepped from PC to the next PC by simply typing one SPACE after the command prompt. Continuous stepping and register displaying will occur if the TRACE command (or 'TR') is entered. The trace can also be temporarily halted with a CTL-S and is terminated by a CTL-X. As in the case of the breakpoint mode runs, each Regiser Display after a trace step indicates (1), the current PC value pointing to & displaying te NEXT instruction to be executed; and (2), the Register, Flag, & Stack values existing just PRIOR to executing the instruction @PC. Unlike execution under beakpoint control, in which break- point Restarts are inserted into RAM; the ZDP trace mode uses an out-of-line tracing technique. That is, the next instruction to be run is moved to a special workspace location where it is scanned for branch attributes or else test-executed with the final machine state being saved. Therefore any code in RAM or ROM can be run under the Trace Mode. Programs can be traced showing only the instruction and flags after each step by entering the 'DI 1' command. Alterna- tively, one can specify a cursor home before each Register Dis- play by entering a 'DI 2' (or a 'DI 3' to display the instruction line only). Thus by doing a CTL-L screen clear followed by a 'DI 2' then 'TR', one starts running the program and sees an in-place updating of all registers and the next instruction after each step. Note: when using the Trace Mode or running with break- points, ZDP requires 2 bytes of stack space BELOW the location specified by SP just prior to entering the command. ZDP initially sets SP at 100H when running under CP/M. Normally this position is satisfactory for tracing; however, some systems 13 Z. D. P. may have special I/O handling ,timer, or some other background routines that use more stack space during ZDP computations. In this case the value of SP should be changed just prior to tracing operations. Also, when stepping through Return-from-Interrupt instructions in the Trace Mode (either RETI or RETN), only the simple RETURN type is actually executed. If a Z-80 Peripheral Support device (such as a Z-80 PIO) expects one of these special Returns in the code being stepped; then a small section of code containing the RETI or RETN should be executed under Breakpoint Control (with a temporary break placed just after the RETURN, if necessary). Similiarly, if a ZDP breakpoint trapped into a routine that was entered via a PIO or SIO generated vector interrupt; then that service routine can be properly exited after ZDP trac- ing simply by using a 'CONT' com mand just prior to the RETI step. VI. THE SYMBOL TABLE Symbolic address and word operand capabilities are possi- ble when the workspace block is assigned outside the 4K block containing ZDP, and when symbol table space is allocated. The symbolic labels defined are up to 6 characters long and can contain any printable ASCII characters, except imbedded blanks; and these characters can be arranged in any order, including special symbols or numbers first. 6.1 The symbol table space must be allocated before symbols can be defined. The table, which also must be ouside of the 4K ZDP space, is allocated by the command, SY . The value of is the starting location of the table; the first 3 binary digits of will always be zeroed, and the table is always located on the last 8 byte boundary at or before . The value , in hex, is the number of symbols the table may contain. The actual table size in bytes will be 8 times the vales given by . This entire space is initialized to zeros after entering this command; also any previous symbol table, along with symbol definitions within it, are deleted. 6.2 An operand is assigned a symbol definition by the command shown below. = Here, reresents a string of ASCII symbols immedi- ately following '=' and not containing blanks; and is the doubleword value with that symbolic name. If contains over 6 symbols, only the first 6 will be involved in the definition. If the value has already been assigned a symbol, then on the next line, followed by the previously assigned symbol is displayed. Othewise, will be redisplayed with the newly defined symbol. 14 Z. D. P. 6.3 For example, suppose a 'LI 84C1 84DB' command produces the following listing: 84C1 21948B LD HL,8B94 84C4 010004 LD BC,0400 84C7 110500 LD DE,0005 84CA BE CP (HL) 84CB 2806 JR Z,84D3-$ 84CD 19 ADD HL,DE 84CE 0C INC C 84CF 10F9 DJNZ 84CA-$ 84D1 1815 JR 84E8-$ 84D3 59 LD E,C 84D4 CD368B CALL 8B36 84D7 FE3D CP 3D 84D9 20F9 JR NZ,84D4-$ If now the following commands were entered, >SY 7000 80 >=ORG 84C1 84C1 ORG >=CMPTABL 8B94 8B94 CMPTABL >=LOOP 84D3 84D3 LOOP >DI 4 >LI 84C1 84DB then the previous section of code would display 84C1 21948B ORG: LD HL,CMPTABL 84C4 010004 LD BC,0400 84C7 110500 LD DE,0005 84CA BE CP (HL) 84CB 2806 JR Z,LOOP-$ 84CD 19 ADD HL,DE 84CE 0C INC C 84CF 10F9 DJNZ 84CA-$ 84D1 1815 JR 84E8-$ 84D3 59 LOOP: LD E,C 84D4 CD368B CALL 8B36 84D7 FE3D CP 3D 84D9 20F9 JR NZ,84D4-$ . 6.4 To delete a previously defined symbol for a word value, the form of the command is, /

where

is the hex word value whose symbol definition is to be deleted from the table. If that value, in fact, had a symbol assigned to it; then just prior to deletion, the value is redis- played followed by its symbol before returning to Command Mode. 15 Z. D. P. 6.5 In using the symbol definition feature, it is important to note that in the Dis-Assembly procedure, symbol handling functions opposite to that of a standard symbolic assembler(in which each symbol encountered is assigned only only once to a numeric value which could also have other symbols assigned to it). But in ZDP displays, hex doubleword operands in memory are encountered first; therefore any such word can be assigned to and displayed as only one symbol at any given time(even though one ASCII symbol can have more than one word operands assigned to it). This multiple symbol assignment to different addresses may be useful for "local" symbolic address and data definition; two similiar blocks of code in different memory locations can use the same names for their corresponding routines and data. 6.6 The entire symbol table can be displayed by entering the command. TA The defined values are displayed, each followed by its symbol definition, in descending order. For example, if a 'TA' command were entered following the '=' commands of Sec. (6.2), the following display will occur: 8B94 CMPTABL 84D3 LOOP 84C1 ORG > 6.7 Invalid Op-Code Combinations Certain byte values are not valid when following the Z80 prefix op-codes 'ED', 'DD', & 'FD'; for example the code 0ED4CH & 0FD40H are both invalid codes. Such codes will result in display of double explanation marks (!!) on any Register Display or listing, appearing either alone or following some other mneumonic. Note that prefix codes 'DD' & 'FD' prefix all instruc- tions involving index register IX, (IX) or IY, (IY) operations respectively. To be a valid Z80 code, these must be followed by some 8080 HL or (HL) e.g. M operation, so that the corresponding Index register can be substituted for the HL pair. If some other code follows, then the Register display or listing will display the corresponding mneumonic followed by the '!!' display. For example the code 0FD3E80H would display as 'MVI A,80!!'. The one exception to the above principle occurs with codes 0CB30H through 0CB37H. Although not defined as valid Z80 operations; on the Zilog Z80A chips, these codes will cause a left shift with a 1 propagating into bit 0 (or a Shift Left & Increment) for operands B,C,D,E,H,L,(HL), & A respectively. Therefore ZDP defines these codes with the mneumonic 'SLI' or 'SLIR' in Intel mneumonics, followed by the proper operand. For example 0CB36H means 'SLI (HL)' or 'SLIR M'. 16 Z. D. P. VII. ENTERING THE ZDP PROGRAM There are several ways of entering or re-entering ZDP, in addition to its own breakpoint re-entries. An entry at the defined starting address is a cold start entry; it has the same effect as would executing ZDP as a command file from the Operating System. The sign-on message is shown; and all registers, breakpoints, display modes, etc. are cleared or initialized to zero values. The entry point 3 bytes away from the starting location is the warm start loation; the sign-on message is also displayed, but all saved registers, breakpoints, and display modes retain the same value as when ZDP was last. Note: if ZDP had previously been exited (to the Operating System or to BASIC etc.) using an 'EX' command, then the PC shown upon warmstart will be the desti- nation address specified in that command. This is because execu- tion of a user program in ZDP involves an initial saved PC modification followed by a program continuation. ZDP may also be entered from a user's program containing the RESTART instruction currently being used for breakpoints and tracing. In this case, ZDP will restart with a Register Display corresponding to the user's register & stack state upon encountering that Restart. However if this RESTART was externally coded (e.g. not a ZDP-set breakpoint), then the PC will be show- ing the next instruction following that Restart; this is because the Restart in question has already been executed as part of the user's code, and a ZDP Register Display always shows the NEXT user's instruction to be executed. Also as part of the user's code, such a RESTART always shows up upon any ZDP 'LI' or 'LIST' command. 17 Z. D. P. VIII. GENERATING A WORKING ZDP PROGAM (CP/M version) Note: both the ZDPGEN program and the working copy it generates must reside on the same disk in Drive 0. The program for generating a copy of ZDP that runs in the desired location in RAM is called ZDPGEN. Using it, one generates a package to load and run starting at any 256 byte page boundary which occupies 18 consecutive pages including RAM area for the program's stack and workspace. Run the program by typing >ZDPGEN xx where xx is a two-digit hex constant greater than or equal to 01, and less than or equal to the CCP starting page (because the length is the same, ZDP can be made to run in the same space as DDT). After ZDPGEN returns to the CP/M command level, a working copy named ZDPxx will appear in the directory. When executed, ZDP will locate itself and sign on at the memory location xx00H. From the ZDP command mode, an 'EX 0' command will restart CP/M. As long as the space ZDP occupies remains intact, either DDT or any other application program may re-enter it (as described in Sec. VIII). Note: ZDPxx is self locating, and will remain at location xx00H after exited; but like other CP/M transient programs, it must be brought up from the transient program start location of 0100H. If it is to be downloaded and executed from DDT or ZSID, it should be downloaded into the usual location (by using 'IZDPxx' followed by an 'R' or 'R100' command). 18