Files
Digital-Research-Source-Code/CONTRIBUTIONS/cpm-handbook/cpmsrc/FIG5-20.ASM
Sepp J Morris 31738079c4 Upload
Digital Research
2020-11-06 18:50:37 +01:00

38 lines
768 B
NASM
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

; Figure 5-20
;
; CF
; Create File
; This subroutine creates a file. It erases any previous
; File before creating the new one.
;
; Entry Parameters
;
; DE -> File Control Block for new file
;
; Exit Parameters
;
; Carry Clear if operation successful (A = 0,1,2,3)
; Carry Set if error (A = 0FFH)
;
; Calling Sequence
;
; LXI D,FCB
; CALL CF
; JC ERROR
;
B$ERASE EQU 19 ;Erase File
B$CREATE EQU 22 ;Create File
BDOS EQU 5 ;BDOS Entry Point
;
;
CF:
PUSH D ;Preserve FCB Pointer
MVI C,B$ERASE ;Erase any existing file
CALL BDOS
POP D ;Recover FCB Pointer
MVI C,B$CREATE ;Create (and open new file)
CALL BDOS
CPI 0FFH ;Carry set if OK, Clear if Error
CMC ;Complete to use Carry set if Error
RET