; TITLE "S3FILEIO - Syslib 4.0" NAME ('FIO3') ;================================================================= ; The Libraries, Version 4, (C) 1989 by Alpha Systems Corp. ;----------------------------------------------------------------- ; Author : Harold F. Bower ; Derived from S3FILEIO.Z80 V 1.2 by Al Dunsmuir/Richard Conn ; Date : 17 Sep 89 ; Version : 1.3 ; Module : S3FILEIO ; Abstract: This module contains the routines FI3$OPEN, F3$GET, ; FI3$CLOSE, FO3$OPEN, F3$PUT, and FO3$CLOSE which implement ; a character-oriented IO capability. Input and Output file ; capability can be individually assigned, and are inter- ; nally controlled. ; NOTE: This module CAN'T be placed in ROM because of data in CSEG ; Revision: ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; Module Entry Points PUBLIC FI3$OPEN, F3$GET, FI3$CLOSE PUBLIC FO3$OPEN, F3$PUT, FO3$CLOSE ; External References EXT FI$OPEN, F$GET, FI$CLOSE EXT FO$OPEN, F$PUT, FO$CLOSE .Z80 CSEG ;=============================================================== ; NAME - FI3$OPEN ; Entry: DE - Points to FCB for requested file ; Exit : AF - A = 0 and Zero Flag Set (Z) if Ok ; A = Error Code and Zero Flag Reset (NZ) if Error ; Uses : AF ; Special Requirements: None ;=============================================================== FI3$OPEN: PUSH HL ; Save user Regs CALL SIBUFR ; Get FI3 table address. CALL FI$OPEN ; Perform Open function POP HL ; Restore entry HL RET NZ ; ..return if error condition CPL ; Else change 00 to FF LD (FIFLG),A ; Save it locally CPL ; ..return back to 0 status RET ; ...and quit ;=============================================================== ; NAME - FO3$OPEN ; Entry: DE - Points to FCB for requested file ; Exit : AF - A = 0 and Zero Flag Set (Z) if Ok ; A = Error Code and Zero Flag Reset (NZ) if Error ; Uses : AF ; Special Requirements: None ;=============================================================== FO3$OPEN: PUSH HL ; Save user REG CALL SOBUFR ; Get FO3 table address. CALL FO$OPEN ; Perform Open function POP HL ; Restore entry HL RET NZ ; ..return if error condition CPL ; Else change 00 to FF LD (FOFLG),A ; Save it locally CPL ; ..return back to 0 status RET ; ...and quit ;=============================================================== ; NAME - F3$GET ; Entry: - None ; Exit : AF - A = Input Character and Zero Flag Set (Z) if Ok ; A = Error Code and Zero Flag Reset (NZ) if Error ; Uses : AF ; Special Requirements: None ;=============================================================== F3$GET: PUSH HL ; Save user REG CALL SIBUFR ; Get FI3 table address & set flag JP F$GET ; Perform function ;=============================================================== ; NAME - F3$PUT ; Entry: A - Contains the character to Put to the file ; Exit : AF - A = 0 and Zero Flag Set (Z) if Ok ; A = Error Code and Zero Flag Reset (NZ) if Error ; Uses : AF ; Special Requirements: None ;=============================================================== F3$PUT: PUSH HL ; Save user REG PUSH AF ; Save character CALL SOBUFR ; Get FO3 table address & set flag POP AF ; Restore character JP F$PUT ; Perform function ;=============================================================== ; NAME - FI3$CLOSE ; Entry: - None ; Exit : AF - A = 0 and Zero Flag Set (Z) if Ok ; A = Error Code and Zero Flag Reset (NZ) if Error ; Uses : AF ; Special Requirements: None ;=============================================================== FI3$CLOSE: PUSH HL ; Save user REG CALL SIBUFR ; Get FI3 table address & set flag CALL NZ,FI$CLOSE ; Perform function if so POP HL ; Restore entry HL RET NZ ; ..return if error LD (FIFLG),A ; Else clear file active flag RET ; ..and quit ;=============================================================== ; NAME - FO3$CLOSE ; Entry: - None ; Exit : AF - A = 0 and Zero Flag Set (Z) if Ok ; A = Error Code and Zero Flag Reset (NZ) if Error ; Uses : AF ; Special Requirements: None ;=============================================================== FO3$CLOSE: PUSH HL ; Save user REG CALL SOBUFR ; Get FO3 table address & set flag CALL NZ,FO$CLOSE ; Perform function if so POP HL ; Restore entry HL RET NZ ; ..return if error LD (FOFLG),A ; Else clear file active flag RET ; ..and quit ;..... ; Set up pointers and transfer local flags to DSEG buffers SIBUFR: LD HL,FI3$TBL ; Get FI3 table address. LD A,(FIFLG) ; Get local file open flag LD (HL),A ; ..and initialize DSEG buffer OR A ; Is File Open? RET SOBUFR: LD HL,FO3$TBL ; Get FO3 table address. LD A,(FOFLG) ; Get Output status flag LD (HL),A ; ..and set in DSEG OR A ; Is File Open? RET ;==== Init Table and Buffers for F3 Routines ==== FIFLG: DEFB 0 ; Input file active flag in CSEG FOFLG: DEFB 0 ; Output file active flag in CSEG DSEG ; Tables here and init w/code FI3$TBL: I3$FLG: DEFS 1 ; Input file opened flag (0=NO) I3$CNT: DEFS 1 ; Input char count I3$PTR: DEFS 2 ; Input char ptr I3$FCB: DEFS 36 ; Input file FCB I3$BUF: DEFS 128 ; Input Buffer FO3$TBL: O3$FLG: DEFS 1 ; Output file opened flag (0=NO) O3$CNT: DEFS 1 ; Output char count O3$PTR: DEFS 2 ; Output char ptr O3$FCB: DEFS 36 ; Output file FCB O3$BUF: DEFS 128 ; Output Buffer END