home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
CPM
/
MODEMS
/
MODEM
/
CP405SRC.ARK
/
CP4FET.ASM
< prev
next >
Wrap
Assembly Source File
|
1986-12-25
|
4KB
|
140 lines
;Originally by Bill Catchings, Columbia University
;From KERMIT-Manual Changed 22-May-86 B.E. EIBEN@DEC-MARLBORO
;
;Usage/Goal: Minimal [ungarded] text-capture into memory
; via transmission of CR to HOST and capture
; of sent char's till '@' seen. Saving of data
; on disk.
;
;Limits: File-length = TPA -300H roughly 40K most micro's
; Beware current CP4KER.HEX is already 36K.
; NO ERROR checking whatsoever...
;
; 1. Example [TOPS-20 and FOO.HEX assumed]
;
; TER NO PAUSE END ;let terminal run loose
; REFUSE SYSTEM-MESSAGES ;avoid interfering messages.
; REFUSE LINKS
; SET NO ALERT
; TYPE FOO.HEX ;DO NOT type confirming CR !!
;
; .. then on MICRO [assuming that RDR/PUNCH are already pointing
; to Communication-port and same is at 'right' Baud-rate ,Bits
; and Parity setting; FETCH.COM generated via DDT , enough free
; space on connected floppy . FETCH has NO ERROR-checking what-
; soever to keep brevity ]
;
; FETCH FOO.HEX ;receive/create FOO.HEX
; ;FOO.HEX can't exist already
;
; You should now see the characters being echoed on the screen
;
;Assembly [assume on disk B:] ASM FETCH.BBB or LASM FETCH.BBB
;Linkage LOAD FETCH or MLOAD FETCH
;
ORG 100H ;let's start at a standard address
MEMADR equ 300H ;Where we start storing bytes
MEMOFF equ 2H ;Linked to MEMADR [offset in 2 sector pairs]
MEMST equ MEMADR-2 ;We 'swallow' first two bytes
BYTPTR equ 200H ;Here we keep the pointer
BYTHI equ BYTPTR+1 ;High order byte
BYTLOW equ BYTPTR ;Low order byte
DMAPTR equ BYTPTR+2 ;Sector pointer to write
SECLEN equ 80H ;128 bytes are a 'sector'
SEVBIT equ 7FH ;parity mask
MONE equ 0FFFFH ;Minus one in 16 bits
BDOS equ 5H ;System call
Punch equ 4H ;Send to Punch {to Host}
Reader equ 3H ;Read from Reader {from Host}
Screen equ 2H ;Write to screen
CLSFIL equ 10H ;Close file
WRTSEC equ 15H ;Write a sector
MAKFIL equ 16H ;Write NEW file
SETDMA equ 1AH ;Set DMA address
FCB1 equ 5CH ;File Control Block 1
CR equ 0DH ;ASCII Carriage Return
CTRLZ equ 1AH ;ASCII Control-Z
;Note--The following may need to be changed when downloading from other
;systems, e.g. to '.' for TOPS-10, '$' for VAX/VMS, etc. Alternatively,
;the hex file itself can have an '@' added to it, after its last line.
ENDSIG equ 40H ;Tops-20 prompt '@'
;Here's the program:
start: lxi h,MEMST ;Where to store in memory
shld BYTPTR ;keep address there
mvi e,CR ;oct 15 is CR
mvi c,PUNCH ;Output to PUNCH {send to HOST}
call BDOS
gbyte: mvi c,READER ;Input from RDR {read from HOST}
call BDOS
ani 7FH ;mask to 7-bit {strip parity}
push psw ;save a and flags
mov e,a ;char to e for echo-call
mvi c,SCREEN ;Output to screen
call BDOS
pop psw ;restore a and flags
cpi ENDSIG ;End signal (system's prompt)?
jz donfil ;Yes, we have whole file in memory
call stuff ;No, store byte
jmp gbyte ;go back for next byte
donfil: mvi a,CTRLZ ;Control-Z is EOF
call stuff ;Store Control-Z
lxi h,MEMADR ;Pointer to file in memory
shld DMAPTR ;Save here for DMA pointer
;a long divide by 256 follows
lda BYTHI ;get HI byte
sta BYTLOW ;store as low byte
xra a ;zero a
sta BYTHI ;wipe old HI byte
mvi c,MAKFIL ;MAKE new FILE
lxi d,FCB1
call BDOS
again: call nsect ;write 128 bytes
call nsect ;and another 128 bytes
lxi h,MONE ;stick a -1
xchg ;into DE
lhld BYTPTR ;get modified pointer (per 256 bytes)
dad d ;decrement
shld BYTPTR ;and store back
mvi a,MEMOFF ; getting
cmp l ; done ?
jz done ;Yes, we hit it on the nail
jmp again ;Not quite
nsect: lhld DMAPTR ;Get the file-pointer
xchg ;move into DE
mvi c,SETDMA ;Set DMA
call BDOS
mvi c,WRTSEC ;Write sector to file
lxi d,FCB1
call BDOS
lhld DMAPTR ;Get the file-pointer
lxi d,SECLEN ;128 bytes got moved
dad d ;add them to adjust pointer
shld DMAPTR ;and save again
ret ;and return
stuff: lhld BYTPTR ;Get the pointer
mov m,a ;store the character
inx h ;Increment the pointer
shld BYTPTR ;and save again
ret ;and return
done: mvi c,CLSFIL ;Close file
lxi d,FCB1
call BDOS
jmp 0 ;Do warm-reboot to always come back
END START