Introduction Open a File - F$OPEN and F$MOPEN Close a File - F$CLOSE Create a File - F$MAKE Delete a File - F$DELETE Rename a File - F$RENAME Test of the Existance of a File - F$EXIST Read a Block from a File - F$READ Write a Block to a File - F$WRITE :CP/M File Input/Output Routines Thå followinç routineó arå general-purposå filå I/Ï routineó � whicè  interfacå  tï CP/Í througè thå Entrù Poinô aô locatioî  5® � Theù preservå BC¬  DE¬  anä HL¬ anä theù returî witè thå standarä � CP/Í erroò codeó foò thå correspondinç routines. Specifically, these routines are -- F$OPEN Open a file F$MOPEN Open/Create a file F$CLOSE Close a file F$MAKE Create a file F$DELETE Delete a file F$RENAME Rename a file F$EXIST Test of existance of a file F$READ Read a block (128 bytes) from a file F$WRITE Write a block (128 bytes) to a file :Open a File Routine Name: F$OPEN Functionº Opeî  thå  filå specifieä bù thå FC pointeä tï bù  DE® � Iæ filå noô found¬  F$OPEÎ returnó witè aî erroò codå iî Á (0FFH© � anä Zerï Flaç Cleaò (NZ). Inputs: DE = pointer to FCB Outputs: A = Error Code and PSW Flags Set (Zero Flag) 0 --> No Error 0FFH --> File not opened Registers Affected: PSW SYSLIB Routines Called: BDOS, CAPS, CIN, COUT, CRLF, PRINT Special Error Conditions: -None- Routine Name: F$MOPEN Functionº Opeî  thå filå specifieä bù thå FC pointeä tï  bù  DE® � Iæ  filå ió noô found¬  F$MOPEÎ trieó tï creatå one®  Iô returnó � thå  erroò codå oæ 0FFÈ iî Á iæ therå waó noô enougè rooí iî  thå � disë directorù tï creatå thå directorù entry. Inputs: DE = pointer to FCB Outputs: A = Error Code and PSW Flags (Zero Flag) Set 0 --> No Error 0FFH --> File not opened Registers Affected: PSW SYSLIB Routines Called: BDOS, CAPS, CIN, COUT, CRLF, PRINT Special Error Conditions: -None- :Close a File Routine Name: F$CLOSE Function: Close the file whose FCB is pointed to by DE. Inputs: DE = pointer to FCB Outputs: A = Error Code 0 --> No Error 0FFH --> Error in closing file Registers Affected: PSW SYSLIB Routines Called: BDOS Special Error Conditions: -None- :Create a File Routine Name: F$MAKE Function: Create (Make) the file whose FCB is pointed to by DE. Inputs: DE = pointer to FCB Outputs: A = Error Code 0FFH --> No directory space available Not 0FFH --> No Error; Value is byte address in TBUFF (80H-0FFH) of directory entry allocated to the FCB Registers Affected: PSW SYSLIB Routines Called: BDOS, F$DELETE Special Error Conditions: -None- :Delete a File Routine Name: F$DELETE Functionº Deletå thå filå whoså FC ió pointeä tï bù DE® Iæ filå � doeó  noô  exist¬  nothinç happenó (nï erroò messagå oò  codå  ió � given). Inputs: DE = pointer to FCB Outputs: -None- Registers Affected: PSW SYSLIB Routines Called: BDOS Special Error Conditions: -None- :Rename a File Routine Name: F$RENAME Functionº F$RENAMÅ  maù bå useä tï renamå á file®  Oî entry¬  DÅ � ptó tï thå firsô twelvå byteó oæ thå file'ó FC anä HÌ ptó tï thå � firsô twelvå byteó oæ thå FC foò thå ne÷ filå (thaô is¬ onlù thå �ŠFÎ anä FÔ fieldó arå significant¬  sï thå resô oæ aî FC neeä noô � bå  presenô  foò thió functioî tï work)®  F$RENAMÅ  containó  aî � internaì FC whicè ió structureä froí thå twï entrieó tï properlù � rename the file. Inputs: HL pts to 1st 12 bytes of new FCB DE pts to 1st 12 bytes of old FCB Outputs: Zero Flag Set (Z) means error (file not found) Registers Affected: PSW SYSLIB Routines Called: BDOS, FILLB, MOVEB Speciaì Erroò Conditionsº  Filå Noô Founä error¬  indicateä � by Z flag :Test of Existance of a File Routine Name: F$EXIST Functionº F$EXISÔ testó foò thå presencå oæ thå filå whoså FC ió � pteä  tï bù DÅ iî thå currenô disk/useò area®  Iæ thió filå doeó � noô  exisô iî thió area¬  F$EXISÔ returnó witè thå Zerï Flaç  Seô � (Z); if this file does exist, F$EXIST returns with NZ. Inputs: DE pts to FCB of file to test for Outputs: Zero Flag Set (Z) means file not found; NZ means file found Registers Affected: PSW SYSLIB Routines Called: BDOS Speciaì  Erroò Conditionsº None :Read a Block from a File Routine Name: F$READ Functionº Reaä  nexô blocë (12¸ bytes© froí thå openeä filå whoså � FC ió pointeä tï bù DÅ intï TBUFÆ (buffeò aô 80È - 0FFH). Inputs: DE = pointer to FCB Outputs: A = Error Code 0 --> No Error 1 --> Read past end of file 2 --> Reading unwritten data in random access Registers Affected: PSW SYSLIB Routines Called: BDOS Special Error Conditions: -None- :Write a Block to a File Routine Name: F$WRITE Functionº Writå  nexô blocë (12¸ bytes© froí TBUFÆ (buffeò aô 80È � tï 0FFH© tï thå openeä filå whoså FC ió pointeä tï bù DE. Inputs: DE = pointer to FCB Outputs: A = Error Code 0 --> No Error 1 --> Error in extending file 2 --> End of disk data 0FFH --> No more directory space Registers Affected: PSW SYSLIB Routines Called: BDOS Special Error Conditions: -None-