ashepps@telesci.UUCP (Anton C Shepps) (11/16/89)
How often does this happen to YOU? I have inherited some old Z80 code and don't have any manuals. In fact, I hardly have a development system! Anyway, included is a batch file to link everything. After linking is complete, it calls ZSID with the following commands: ZSID PROG.COM A80 LD HL,6100 LD DE,6200 LD BC,6001 LDDR NOP NOP . P8B G80 IPROG.COM R GO SAVE 32 CPROG.COM I can figure what the code is doing. What are the ZSID commands? Would it have anything to do with the fact that the target machine for this program is NOT a 100% CP/M box? Many, many thanks in advance! -- - Anton Shepps - ashepps@telesci.uucp - "Get back to work, you!" -M.Groening -
" Maynard) (11/17/89)
In article <881@telesci.UUCP> ashepps@telesci.UUCP (Anton C Shepps (Tony)) writes: ZSID PROG.COM invoke ZSID, read in PROG.COM A80 assemble the following to memory, starting at 80H: LD HL,6100 LD DE,6200 LD BC,6001 LDDR NOP NOP . terminate assembler input P8B set breakpoint at 8BH G80 start execution at 80H IPROG.COM reset ZSID's input file name to PROG.COM R read the program into memory again G0 (not GO) goto 0: warm boot to the CCP SAVE 32 CPROG.COM save 100H-80FFH to CPROG.COM >I can figure what the code is doing. What are the ZSID commands? See above comments. >Would it have anything to do with the fact that the target machine for this >program is NOT a 100% CP/M box? Could very well be: looks like the net effect of this is to create a file with 6100H-61FFH as a copy of 6200H-62FFH; I'd bet the machine's memory map is weird. -- Jay Maynard, EMT-P, K5ZC, PP-ASEL | Never ascribe to malice that which can jay@splut.conmicro.com (eieio)| adequately be explained by stupidity. {attctc,bellcore}!texbell!splut!jay +---------------------------------------- Shall we try for comp.protocols.tcp-ip.eniac next, Richard? - Brandon Allbery
" Maynard) (11/17/89)
In article <3048@splut.conmicro.com> jay@splut.conmicro.com (Jay "you ignorant splut!" Maynard) writes: > SAVE 32 CPROG.COM save 100H-80FFH to CPROG.COM I screwed up. Would you believe 100H-2100H? Of course, if the machine isn't standard CP/M, then the starting point of SAVE may very well be different. -- Jay Maynard, EMT-P, K5ZC, PP-ASEL | Never ascribe to malice that which can jay@splut.conmicro.com (eieio)| adequately be explained by stupidity. {attctc,bellcore}!texbell!splut!jay +---------------------------------------- Shall we try for comp.protocols.tcp-ip.eniac next, Richard? - Brandon Allbery
willy (William Gonnason) (11/26/89)
I don't have a copy of ZSID, so you may have to take the following analysis with a grain of salt. However, it's not too different in syntax from some other CP/M debuggers I've used... With the previous warning in mind, here is my analysis of your batch file: ZSID PROG.COM - invokes ZSID (Symbolic Debugger for Z80 ) and loads "PROG.COM" to transient Program Area (typically 0100H on conventional CP/M systems) A80 - assemble the following code beginning at address 0080H LD HL,6100 \ LD DE,6200 \ Relocates a large block of memory (I would LD BC,6001 / suspect the BIOS... ???) LDDR / (ie, shift 6001H bytes down by 0100H (assuming NOP the default assembler base is hexadecimal!) NOP . - end of code... P8B - got me, but I think this sets a breakpoint in ZSID at location 008BH, returning control to ZSID when address 008BH is encountered. It would appear to prevent the need for a "RET" instruction in the assembly code segment... G80 - execute code stating @ 0080H ( effectively a jump, which will relocate memory, then return control to ZSID... ) IPROG.COM - set up File Control Block for filename "PROG.COM" R - read in file set up with previous "I" command GO - execute program in TPA without reloading it (usually, this is effectively a JMP to 0100H ) - GO is a CCP command, meaning that you have exitted ZSID somehow between the "R" command and the "GO" command, although I don't see how (perhaps an embedded ^C in the batch file ???) SAVE 32 CPROG.COM - save 32 pages starting @ 0100H to the file "CPROG.COM" (one page being 256 bytes) - "SAVE" is also a CCP command, which makes me sure you have left ZSID by this point... The code is quite likely a quick and dirty way to read in a program, offset said program (somehow) and then write it out again. However, it sure plays hell on absolute addressing schemes... But, I can't offer any more information than this. Perhaps someone else on the net? - OS/2 - the other half takes EVEN MORE RAM ... [ willy@amc-vlsi.CA ] OS/2 - the other half takes EVEN MORE RAM ... [ willy@amc-vlsi.CA ]
GEHRI@cc.usu.edu (Gehri Grimaud) (11/29/89)
> GO - execute program in TPA without reloading it > (usually, this is effectively a JMP to 0100H ) > - GO is a CCP command, meaning that you > have exitted ZSID somehow between the "R" > command and the "GO" command, although I don't > see how (perhaps an embedded ^C in the batch > file ???) > Actually, this starts execution at location 0. I.e., it does a warm boot. =============================================================================== Roger Ivie Shamefully wasting even more of Gehri Grimaud's precious money-like substance. ===============================================================================
tilmann@cosmo.UUCP (Tilmann Reh) (11/29/89)
Hello. Is it true? Does really NOONE of you know the LDDR command of Z80? It's quite unbelievable for me, so here is a lesson in Z80 Assembler Programming: The LDDR command - takes the byte from address (HL) - puts it to the address (DE) - decrements BC, DE and HL - until BC is zero. Got it? So the tiny program of "ashepps" will take all memory from 0100h (including) to 6100h (including, too) and move it up to 0200h to 6200h. Nothing else, and especially no down-move! The LDDR command is used instead of the LDIR command cause the segment is overlapping in the high-part. The 'G0' command is indeed the system reboot command (just as ^C, but better for batch file use). SAVE 32 will also save the memory from 0100h to 20FFh, as mentioned by jay maynard. The function of that batchfile depends on the original length of PROG.COM: If it's more than 8k, the generated file will be unchanged. Else, the file will lengthened up to 8k, and the added part will be a copy of the original (moved up by 100h), plus eventually some old stuff that was in memory that time. I can't imagine what kind of purpose that batchfile could have. But surely it has nothing to do with the BIOS, as someone guessed before. Tilmann.