+ + + + ZDEBUG17 (VER 1.7) + + + + Page 1. + + + + ZDEBUGT7.COM (VER 1.7) + + COPYRIGHT 1983, E. J. Card, 35 Ormskirk Ave., Apt. 622, TORONTO, Ont. M6S 1A8 416- 767-8310 CompuServe 72355,1650 DISTRIBUTION: This software may be used and distributed among CP/M users strictly on a non-profit basis, and any use other that this, without prior approval from the author is prohibited. RESTRICTIONS: ZDEBUG17, Version 1.7, is being released for use as an object file only, for the following reason. ZDEBUG17 is written using Zilog Mnemonics and complied using The Software Toolworks "UVMAC" Macro compiler, which has a slightly different format from other macro complers. All file management uses my own "FILEMAC" library, and several other macros, including the "Uncode" (disassembler) are taken from my "Z80MAC" library. In addition to the object program, ZDEBUG17.COM, the file ZDEBUGT7.COM is required on either "A" or "B" at program load time. ZDEBUGT7.COM is a standalone table, compiled using "AS", a companion, non-macro assembler of "UVMAC". This table has a 5 byte entrys for each Z80 machine instruction, the mnemonics used for the "Uncode" option, and a defalt table of the Z80 instructins that may initiate a change in the PC register. (ie. JPs, JRs, RETs, CALLs, JP (hl), etc). ZDEBUGT7.COM is essencial for the opertion of "Uncode", "Quick trace" and "Trap" routines. ZDEBUG17 is not relocatable as such, but is compiled to run at location 9800h, with the stack being initialized at 9800h. At load time the ZDEBUGT7.COM table will be opened as a source/read only file and "relocated" to the end of ZDEBUG17, overlapping the last 14 bytes of ZDEBUG17. These 14 bytes are tags in ZDEBUG17 and ZDEBUGT7 which will be adjusted with the relocation base. I am interested on any comments or suggestions by anyone who would like to take the time to document any problems encountered. I can be reached at the above number, or leave a message on the Toronto, RCP/M 1, 2, 3, 4 or CompuServe 72355,1650. ZDEBUG17.COM AND ZDEBUGT7.COM Page 2 LIMITATIONS: ZDEBUG17: Does not have an assembler function. does not have Symbolic debug feature. used upper memory, starting at 9800H, plus stack, growing downward from 9800H. uses 6 of the RST instructions. Not used RST 0 and RST 28H "Q"uick trace will repeat the register display for a given location when a "TRAP" has been encountered. "Q"uick trace must go back and analyse the command before setting up a subsequent trace. The "TRAP" routine stores the address of the instruction just trapped as the next for "Q"uick trace. "Q"uick trace will start command execution at location 0100H only or from a "TRAP" taken address. "Q"uick trace does not trace an RST 0H or RST 28H, but will set up next trace trap at address following "RST" "Q"uick trace can function with traps. If a trap is encountered while doing "Q" trace, the following will be displayed. display of RST ?? display of "TRAP" data repeat display of the "TRAP" data. FEATURES AND FUNCTIONS: * 5 memory traps. * "Q"uick trace of 1 to nnnn instructions. * file to file compare.(both files must be in memory at the same time, by using "P" function. * load program or file anywhere in memory.(default 100h) * simple hex add and subtract routine of two hex values. * hex add and subtract of multiple hex values (use 'K' command) * enter hex of ascii data to memory. * write file, and location, any size. * Optional display of alternate register set. * "L"oad - display and patch memory. * memory move, search, fill, zero, etc. * alternate register display option. * standard cp/m printer on/off function. (^P). * Toggle to turn on/off z80 alternate registers (^R) LOAD OPTIONS: ZDEBUG17, or ZDEBUG17 B:Z80TEST.COM CHANGE HISTORY: PAGE 3. Dec 4, 1983 - Routine added to permit addition or subtracting hex values using the 'K' function and no operand. Oct 11, 1983 - Changes made to allow tracing to enter the BIOS routines by using ^B to toggle On/Off. SEPT 4, 1983 - Changes to the all TRAP entry points to cancel the last address on the stack, which is the link from the RST command just executed. JUNE 25,1983 - Previous to 1.2 all input was converted to upper case. Version Wsave2 permits keyboard entry of both upper and lower case. Very handy for Ascii Search (AS), and Ascii load (AD) to memory. It should be noted that the last record written using the "W" option will be padded at the end with 00h, which will show up as a pattern of ^@^@'s if using wordstar. The padding can be easily removed from within WordStar using the "^Y" command. * Changes to ZDEBUG and ZDEGUGT to correct errors found in the "Q"uick tracing and "U"ncoding of commands * AL and AD rewritten to simplify operation, with use of key for carriage return and new line. * AS and S rewritten to allow for a search on a maximum of 10 byte field, and used Z80 block CPIR command. * P function will display memory address of last block of file read to assist "W"rite, "S"earch and "M"ove functins. * The ^S has been added to stop the display, and space bar or any key to continue. * "M"ove function rewritten to use Z80 block moves (LDIR, LDDR) commands. The move will now move forward or backward, depending on destination address in relation to start address. (example M2000 5000 2001 will move the block of 3000H bytes backwards by one byte to 2001.) NOTE: it is a good practice to use the "Z"ero memory function before doing "P" file reads, and/or memory moves, as it is mush easier to find your way around memory. The "W"rite function is handy to move blocks of memory to disc when coping source code from a section of a program. IF writing source code lines be sure to include the "0D" and "0A" which terminates most source code lines. Use the "D"ump hex and ascii to be sure. PAGE 4. The following pages show the 4 menus provided "on-line" in the ZDEBUG17 program, with examples. ZDEBUG17.COM AND ZDEBUGT7.COM MENU 1. ADaaaa eeee = dump memory in ascii ALaaaa = ascii key input to memory ASaaaa eeee a*10 = ascii search 10 bytes max. Daaaa = display 272 bytes from addrs aaaa Daaaa eeee = display memory Faaaa eeee hh = fills memory/hex Gaaaa = restore regs/go to Hhhhh hhhh = add/sub hex. K = enter hex repeated add/sub routine Laaaa = display/change. 'A = Ascii entry(^X to end) Maaaa eeee dddd = move mem start/end/dist P = load file at 0100H Q / nn = instruction trace for nn Raaaa eeee dd hh = sch mem for dd/replace with hh Saaaa eeee hh*10 = search memory for 10 bytes max. Taaaa = insert trap address - 5 maximum Uaaaa / nnnn = dissamble machine code Vaaaa eeee dddd = compares aaaa to dddd Waaaa eeee = write disc file start/end Zaaaa eeee = zeros memory ? = this menu * & % = additional help Functions: AD,AL,AS work with ascii data. (Upper and lower case) Load Ascii to memory. AL2500 (load ascii to memory from keyboard at memory location 2500h. The is used for line feed, and carriage return. "AS" - search memory for string of ascii characters, max 10. AS1100 5000 Osborne 1 "AD" - Dump memory in ascii format. Useful for source files. AD1100 6000 (^S will half display). "D"UMP MEMORY: D2500 2550 Will display memory in hex and ascii to and including the two specified address. "F"ILL MEMORY: F2800 2880 FF Will fill memory starting at 2800 to 2880 with hex ff. "G"O TO ADDRESS: G0100 This function will load registers with the user values from the last trap or "Q"uick trace and go to the address specified. Register and flag values may be changes using the "X" or "Y" function before using "G"o to. "H"ex Math. H1213 5403 will display the sum and difference of the two hex numbers. also "K" to enter hex routine. exit with ^X. Page 5 display and "L"oad memory. **MEMORY PATCH** L1200 will display memory, one byte at a time in ascii and hex. Enter 2 hex digits to change location or (CR) for next address display. ^X to terminate function. note: the single quote ' may be used to enter Ascii data. L1200 (CR) 1200 1 31 (CR) = display only 1201 A 41 43 (CR) = display and change. 1202 B 42 'P (CR) = display and Ascii change. 1202 C 43 ^X = display and terminate function. > "M"ove memory. M500 575 2250. Will move memory block at memory location 0500h to and including 0575h to memory starting at location 2250h. Ver 1.1 will move memory forward or backward by the use of the Z80 block move commands, LDIR and LDDR. It is possible to move forward or backward by a mimumium of 1 byte (M2000 4000 2001 - will move 2000H block backward 1 byte to 2001) "P"rogram/file load function. File name will be requested. "ENTER PROGRAM NAME" B:Z80TEST.COM (does not use FCB at 5Ch at this time) IN = 0100 The file will be read into location 0100h, or enter (aaaa) read in location (CR). The last memory position filled by the read function will be displayed. If another file is to be read, the default value of the "IN" will be the byte immediately following the last byte of the file previously read. "Q"uick trace Q - will display one trace enter starting at location 0100h, unless "T"rap has been used. Q25 - trace 25 trace locations. search and "R"eplace. R1200 1280 5f ee. Search memory starting at 1200h to 1280h for value of 5fh, if found replace with eeh. "S"earch memory for 1 to 10 bytes. Full bytes only - no spaces between bytes, in upper case. FF should not be part of key. S1200 1280 edfe1920ab. Search memory from 1200h to 1280h for "ED"hex using CPIR command. If found will continue compares on fe1920ab. A address list of locations containing the data will be displayed. Insert "T"rap address. T148 Will set up a trap at memory location 0148h. If G0100 is also used, entry to ZDEBUG will occur when trap address is reached. Five trap addresses permitted. Trap cancelled when hit only. Page 6. "U"ncode (disassemble) machine instruction. U1280. Will disassemble 20 machine instructions. Enter "U" to continue with next 20 instructions. "V"erify 2 memory blocks. V1200 1280 2400. Will compare the memory block starting at 1200h TO 127Fh with memory block at memory starting at 2400h. Bytes now matching will be listed on console. (compare 2 files by using 2 "P" functins and the "V". "W"rite memory to disc. W1200 1875. Write out memory to disc from 1200h to and including 1875h. Last partial block will be filled with 00h. Routine will ask for file name. If file on disc will ask if you want to erase. "ENTER FILE NAME" B:testfile.doc "X"/"Y" Displays and allows change of registers/flags and alternate registers (Y). See REGISTER HELP for more information. "Z"ero memory. Z100 1500. Zero fill memory from memory location 0100h to 1500h. "?","*","&","%" = Prompts for on-line memory HELP memus. ZDEBUG17.COM AND ZDEBUGT7.COM Page 7. ZDEBUG HELP -ZHENC A0=00 - FLAGS AND ACCUMULATOR. + O :::::::...... = carry flag ( c = on/or 1 ) ::::::....... = subtract flag ( n = on/or 1 ) :::::........ = parity/overflow (odd/even) ::::......... = half-carry flag indicator :::.......... = zero flag ( z = on/or 1 ) ::........... = sign flag ( - = on/or 1 ) ^H = back space (also <- works) ^P = toggle switch for printer ^R = toggle on/off alt register display (load off) ^S = stop display - space bar or any key to continue. ^X = aborts/terminates certain commands (ie ALaaaa) aaaa = command start address (omit leading zero) eeee = command end address (omit leading zeros) dddd = destinatin address A = 1 ascii byte A/A = 2 ascii bytes. hhhh = 2 bytes hex value hh = 1 byte hex value nnnn = number of times to execute command NOTE: ALaaaa line terminated with key. Terminate function with ^X. Processor flags: The value in the flags register is displayed to the extreme left of the register display on a "Q"uick track or "T"rap function. Other that the sign and parity flags, the flags show the symbol for on or "1" and no display if off or "0". The sign will display + or _, and the parity flag "E" for even of "O" for odd. The same values are also in ZDEBUGT7.COM for a quick compare on values for conditional transfer of value in register PC. ZDEBUG17.COM AND ZDEBUGT7.COM Page 8. REGISTER HELP XA = (aaff) display/change accumulator and flags. aa - 1 byte accumulator ff - flags --> 7 6 5 4 3 2 1 0 <-- ff byte sign flag ......: : : : : : : : zero flag ........: : : : : : : not used ..........: : : : : : half carry flag ......: : : : : not used ..............: : : : parity/overflow ..........: : : subtract flag (N)...........: : carry flag (C) ...............: XB = (hhhh) display/change register pair BC XD = (hhhh) display/change register pair DE XH = (hhhh) display/change register pair HL XX = (hhhh) display/change index reg pair IX XY = (hhhh) display/change index reg pair IY XS = (hhhh) display/change register pair SP YA = (aaff) same as XA but for alt/accum/flags YB = (hhhh) display/change alt reg pair BC YD = (hhhh) display/change alt reg pair DE YH = (hhhh) display/change alt reg pair HL HELP HELP HEXIDECIMAL CONVERSION TABLE - 0000 = 00 = 00 0001 = 01 = 01 NOTE: in some cases it will be 0010 = 02 = 02 necessary to convert to a hex 0011 = 03 = 03 value, such as changing the 0100 = 04 = 04 value of the processor flags. 0101 = 05 = 05 to change the accum/flags four 0110 = 06 = 06 hexidecimal characters are 0111 = 07 = 07 required. The chart to the 1000 = 08 = 08 right and "&" help menu are 1001 = 09 = 09 provided. Example: 1010 = 0A = 10 to change a/f from 5014 to 50C0 1011 = 0B = 11 14 = sign -, parity even 1100 = 0C = 12 C0 = sign -, zero on,parity odd 1101 = 0D = 13 1110 = 0E = 14 * * * * * * * * * * * * * * * 1111 = 0F = 15 0001 0000 = 0100 = 16 The menus in the program are provided as a quick reference when in the process of program debug. *** NOTE ** Version 1.4 and less do not permit "Q"uick trace to enter Bdos or Cbios, due to unpredictable results when memory banks are switched on the Osborne 1, for memory mapped I/O and/or entry to ROM routines. A BDOS/CBIOS toggle ^B has beem implemented for version > 1.4 to permit experiences assembler language programmers to enter the OS, "at your own risk".