home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Oakland CPM Archive
/
oakcpm.iso
/
cpmug
/
cpmug014.ark
/
MOVE.ASM
< prev
next >
Wrap
Assembly Source File
|
1984-04-29
|
2KB
|
123 lines
;FROM RICH ROTH
;TSA SOFTWARE
;TERRAN SIETCH ASSOCIATES
;5 NORTH SALEM RD.
;RIDGEFIELD
;CONN 06877 (203) 438-3954
;
;
; MOVE <TO FILE> <FROM FILE>
;
; RLR UTILITY 2/25/77 REV 0.0
;
ORG 100H
LXI SP,STAK
LDA FCBTO+1 ; CHECK FIRST CHAR FOR SPACE
CPI SPC
JZ HELP ; PRINT HELP MSG IF NO FILES SPECIFIED
;
LXI H,FCBFR
LXI D,FCB2
MVI B,16 ; MOVE FROMNAME (IN FCB2)
MNLP: LDAX D ; -> FCBFR
MOV M,A
INX H
INX D
DCR B
JNZ MNLP
;
LXI D,FCBFR ; OPEN(FCBFR)
CALL FOPN
;
LXI D,FCBTO ; NEW(FCBTO)
CALL FNEW
;
MVLP: LXI D,FCBFR ; REPEAT
MVI C,20
CALL BDOS ; READ(FCBFR)
CPI 1
JZ MVEOF ; EXIT IF EOF(FCBFR)
;
LXI D,FCBTO
MVI C,21
CALL BDOS ; WRITE(FCBTO)
ORA A
JZ MVLP ; UNTIL WRITE ERR(FCBTO)
;
LXI D,EXNERR
CPI 1 ; WRITE ERROR
JZ ABORT
;
LXI D,OOSERR ; OUT OF SPACE
;
ABORT: CALL PRINT
MVI C,0
CALL BDOS
HLT
;
MVEOF: ; MOVE DONE
LXI D,FCBTO
MVI C,16
CALL BDOS ; CLOSE(FCBTO)
LXI D,MOVDNE
JMP ABORT
;
EXNERR: DB 'WRITE ERROR',CR,LF,DLR
OOSERR: DB ' OUT OF DISK (OR DIRECTORY) SPACE',CR,LF,DLR
MOVDNE: DB ' MOVE DONE',CR,LF,DLR
;
; CREATE NEW FILE & OPEN
;
FNEW: PUSH D
MVI C,19
CALL BDOS ; DELETE(FCB)
POP D
PUSH D
MVI C,22
CALL BDOS ; CREATE(FCB)
POP D
CPI 255
JNZ FOPN ; IF CREATE OK THEN OPEN(FCB)
LXI D,OOSERR ; ELSE ABORT(OUT OF SPACE)
JMP ABORT
;
; OPEN FILE
; DE^=FCB
FOPN: MVI C,15
CALL BDOS
CPI 255
RNZ ; OPEN OK
;
LXI D,FNFERR
JMP ABORT
FNFERR: DB 'FILE NOT FOUND',CR,LF,DLR
;
;
;
HELP: LXI D,HELPMSG
JMP ABORT
HELPMSG: DB 'MOVE <TOFILE> <FROMFILE>',CR,LF
DB ' E.G. MOVE NEWFILE OLDFILE ',CR,LF,DLR
;
;
; PRINT (MSG)
; DE^=MSG TERMIATED BY '$'
PRINT: MVI C,9
JMP BDOS
; CONSTANTS
CR EQU 13
LF EQU 10
DLR EQU '$'
SPC EQU 20H
BDOS EQU 5
FCBTO EQU 5CH ; CP/M FCB 1
FCB2 EQU 6CH
;
FCBFR: DS 32
DB 0
DS 30 ; STACK
STAK: DS 0