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
/
ZSYS
/
SIMTEL20
/
SYSLIB
/
SLIB2.LBR
/
SFOPEN.Z80
< prev
next >
Wrap
Text File
|
2000-06-30
|
1KB
|
62 lines
;
; SYSLIB Module Name: SFOPEN
; Author: Richard Conn
; SYSLIB Version Number: 3.6
; Module Version Number: 1.1
public f$mopen,f$open
;
; F$OPEN -- OPEN FILE SPECIFIED BY FCB PTED TO BY DE
; RETURN W/A=0 AND ZERO FLAG SET (Z) IF NO ERROR
; RETURN W/A=0FFH AND NZ IF FILE NOT FOUND OR NO ROOM IN DIRECTORY
; F$MOPEN -- OPEN AND MAKE FILE SPECIFIED BY FCB PTED TO BY DE
; IF FILE DOES NOT EXIST, CREATE IT FIRST
; SAME RETURN CODES
;
EXT BDOS
PUTRG MACRO
PUSH BC ; SAVE BC, DE, HL
PUSH DE
PUSH HL
ENDM
GETRG MACRO
POP HL ; RESTORE HL, DE, BC
POP DE
POP BC
ENDM
F$OPEN:
PUTRG ; SAVE REGISTERS
LD C,B$OPEN ; OPEN FILE
CALL BDOS ; OPEN FILE
CP 255 ; NOT PRESENT
JP NZ,OPENOK ; OK
OPENERR:
LD A,0FFH ; ERROR FLAG
OR A ; SET FLAGS
JP OPENDN
OPENOK:
XOR A ; OK FLAG
OPENDN:
GETRG ; RESTORE REGISTERS
RET
F$MOPEN:
PUTRG ; SAVE REGISTERS
LD C,B$OPEN ; TRY TO OPEN FILE
CALL BDOS
CP 0FFH ; NOT PRESENT?
JP NZ,OPENOK ; OK
LD C,B$CREAT ; TRY TO CREATE FILE
CALL BDOS
CP 0FFH ; NOT ENOUGH ROOM?
JP NZ,OPENOK ; OK
JP OPENERR ; ERROR RETURN
B$OPEN EQU 15 ; OPEN FILE
B$CREAT EQU 22 ; CREATE FILE
END