Date : Tue, 20 May 1986 09:39:27-EDT
From : Frank da Cruz <SY.FDC@cu20b.ARPA>
Subject: CP/M DDT programming question
The following procedure is listed in the Kermit User Guide for bootstrapping a
Kermit (or any other) hex file onto a CP/M microcomputer. We recently had an
opportunity to try it on several different micros, and found that it did not
seem to work. The DDT program seemed to run OK, the data seemed to transfer
into memory as expected, and the transfer terminated at the right place, but
when it came time to save the data from memory to the disk, a chunk of random
size would almost invariably be lost from the end, even though care was taken
to supply a Control-Z after the last data character. I'm not an 8080
programmer, and it's not obvious to me what is wrong. Can anyone out there
find the problem?
The DDT program reads characters from the port into memory until an "@" is
encountered. Before running the program, the host is given the command to
"type" the desired file, but the command has not yet been terminated with a
carriage return (the DDT program does that). It is assumed that the IOBYTE is
set so that RDR: and PUN: correspond to the I/O port. When the "@" arrives,
the program is supposed to write the characters from memory to disk, and
terminate the file with a ^Z.
-a100 ;Begin assembling code at 100.
0100 lxi h,ffe ;Where to put HEX file.
0103 shld 300 ;Save the address.
0106 mvi e,d ;Get a CR.
0108 mvi c,4 ;Output function.
010A call 5 ;Send the CR
010D mvi c,3 ;Input function.
010F call 5
0112 ani 7f ;Turn off the parity.
0114 cpi 40 ;Atsign?
0116 jz 124 ;Yes, we have whole file.
0119 lhld 300 ;Get the pointer.
011C mov m,a ;Else, store the char.
011D inx h ;Increment the pointer.
011E shld 300 ;Save the pointer.
011F jmp 10d ;Go around again.
0124 mvi a,1a ;Get a control-Z.
0126 lhld 300 ;Get the pointer.
0129 mov m,a ;Store the char.
012A shld 300 ;Save the pointer.
012D lxi h,1000 ;Pointer to file.
0130 shld 310 ;Save the pointer.
0133 mvi c,16 ;Make file.
0135 lxi d,5c
0138 call 5
013B lhld 310 ;Get the file pointer.
013E xchg ;Put it in DE.
013F mvi c,1a ;Set DMA.
0141 call 5
0144 mvi c,15 ;Write DMA to file.
0146 lxi d,5c
0149 call 5
014C lhld 310 ;Get the file pointer.
014F lxi d,80 ;Get the DMA size.
0152 dad d ;Adjust file pointer.
0153 shld 310 ;Save it.
0156 lda 301 ;Get high order byte.
0159 cmp h ;Have we passed the end?
015A jm 170 ;Yes.
015D jz 163 ;Maybe.
0160 jmp 13b ;No.
0163 lda 300 ;Get low order byte.
0166 cmp l ;Passed the end?
0167 jm 170 ;Yes.
016A jz 170 ;Yes.
016D jmp 13b ;Not quite.
0170 mvi c,10 ;Close file.
0172 lxi d,5c
0175 call 5
0178 ret
0179
-^C ;(control-C):Return to CP/M
A>SAVE 1 FETCH.COM ;Save this program;
; we may need it again.
To run the program, we do:
DDT FETCH.COM
-ifilnam.hex ;Setup FCB for file called FILNAM.HEX
-g100,179 ;Execute the program.
After this, the file is supposed to be on the disk. But usually, only the
first part of the file is there. Is this a peculiarity of the systems we
were using (DEC VT180 and Vector Graphics 3), or is there something wrong
with the procedure? Thanks!