home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Oakland CPM Archive
/
oakcpm.iso
/
cpmug
/
cpmug014.ark
/
PUT.ASM
< prev
next >
Wrap
Assembly Source File
|
1984-04-29
|
2KB
|
177 lines
;CONTRIBUTED TO CP/M USERS' GROUP BY:
;
; MEMORY MERCHANTS
; 1350 BUFFALO ROAD
; ROCHESTER NY 14624
;
.I8080
.PABS
.PHEX
.XLINK
.LOC 100H
TBUFF = 080H
TFCB = 05CH
BDOS = 5H
CPM = 0H
BEGIN: LXI H,0
SHLD LOADAD
DAD SP
SHLD OSTACK
LXI SP,STACK
XRA A
STA EXEC
STA HEX.AD
LXI H,TBUFF+2
LXI D,FILE.NM
..LOOP: MOV A,M
STAX D
CPI " "
JZ HEXAD
INX H
INX D
JMP ..LOOP
HEXAD: LXI D,HEX.AD+1
INX H
..LOOP: MOV A,M
STAX D
CPI " "
JZ GO
PUSH H
LXI H,HEX.AD+5
MOV A,D
CMP H
JNZ ..GO.ON
MOV A,E
CMP L
JNZ ..GO.ON
POP H
JMP GO
..GO.ON:
POP H
INX H
INX D
JMP ..LOOP
GO: INX H
MOV A,M
CPI "G"
JNZ NOGO
MVI A,0FFH
STA EXEC
NOGO: LXI H,HEX.AD+2
..LOOP: MOV A,M
CPI " "
JZ HEX
INX H
JMP ..LOOP
HEXDIG: SUI 30H
JC HEXERR
CPI 0AH
JNC ..ALPHA
RET
..ALPHA:
SUI 07H
CPI 10H
JNC HEXERR
RET
HEX: DCX H
MOV A,M
CALL HEXDIG
STA LOADAD
DCX H
MOV A,M
ORA A
JZ OPEN
CALL HEXDIG
RLC
RLC
RLC
RLC
MOV B,A
LDA LOADAD
ADD B
STA LOADAD
DCX H
MOV A,M
ORA A
JZ OPEN
CALL HEXDIG
STA LOADAD+1
DCX H
MOV A,M
ORA A
JZ OPEN
CALL HEXDIG
RLC
RLC
RLC
RLC
MOV B,A
LDA LOADAD+1
ADD B
STA LOADAD+1
OPEN: MVI C,15
LXI D,TFCB
CALL BDOS
CPI 0FFH
JZ FINDERR
LHLD LOADAD
SHLD LOAD
XCHG
CALL SETDMA
..READ: MVI C,20
LXI D,TFCB
CALL BDOS
ORA A
JNZ ENDFILE
LHLD LOAD
LXI D,0080H
DAD D
SHLD LOAD
XCHG
CALL SETDMA
JMP ..READ
SETDMA: MVI C,26
CALL BDOS
RET
CLOSE:
ENDFILE:
MVI C,16
LXI D,TFCB
CALL BDOS
LDA EXEC
ORA A
JZ CPM
LHLD LOADAD
PCHL
HEXERR: MVI C,9
LXI D,..MSG
CALL BDOS
LHLD OSTACK
SPHL
JMP CPM
..MSG: .ASCIS "ERROR IN HEX ADDRESS $"
FINDERR:
MVI C,9
LXI D,..MSG
CALL BDOS
LHLD OSTACK
SPHL
JMP CPM
..MSG: .ASCIS "OPEN ERROR ***** CAN NOT FIND FILE $"
OSTACK: .BLKW 1
EXEC: .BLKB 1
HEX.AD: .BLKB 6
FILE.NM:
.BLKB 13
LOADAD: .BLKW 1
LOAD: .BLKW 10
STACK: .BLKB 1
.END