home *** CD-ROM | disk | FTP | other *** search
- 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-