home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols000 / vol089 / syslib4.hlp < prev    next >
Encoding:
Text File  |  1985-02-10  |  5.9 KB  |  146 lines

  1. Introduction
  2. Open a File - F$OPEN and F$MOPEN
  3. Close a File - F$CLOSE
  4. Create a File - F$MAKE
  5. Delete a File - F$DELETE
  6. Rename a File - F$RENAME
  7. Test of the Existance of a File - F$EXIST
  8. Read a Block from a File - F$READ
  9. Write a Block to a File - F$WRITE
  10. :CP/M File Input/Output Routines
  11.      Thσ followinτ routine≤ arσ general-purposσ filσ I/╧ routine≤ ì
  12. whicΦá interfacσá t∩ CP/═ througΦ thσ Entr∙ Poin⌠ a⌠ locatioεá 5«  ì
  13. The∙ preservσ BC¼á DE¼á anΣ HL¼ anΣ the∙ returε witΦ thσ standarΣ ì
  14. CP/═ erro≥ code≤ fo≥ thσ correspondinτ routines.
  15.      Specifically, these routines are --
  16.  
  17.           F$OPEN    Open a file
  18.           F$MOPEN   Open/Create a file
  19.           F$CLOSE   Close a file
  20.           F$MAKE    Create a file
  21.           F$DELETE  Delete a file
  22.           F$RENAME  Rename a file
  23.           F$EXIST   Test of existance of a file
  24.           F$READ    Read a block (128 bytes) from a file
  25.           F$WRITE   Write a block (128 bytes) to a file
  26. :Open a File
  27.      Routine Name:  F$OPEN
  28.      Function║
  29.           Opeεá thσá filσ specifieΣ b∙ thσ FC┬ pointeΣ t∩ b∙á DE«  ì
  30. Iµ filσ no⌠ found¼á F$OPE╬ return≤ witΦ aε erro≥ codσ iε ┴ (0FFH⌐ ì
  31. anΣ Zer∩ Flaτ Clea≥ (NZ).
  32.      Inputs:  DE = pointer to FCB
  33.      Outputs:  A = Error Code and PSW Flags Set (Zero Flag)
  34.                    0    --> No Error
  35.                    0FFH --> File not opened
  36.      Registers Affected:  PSW
  37.      SYSLIB Routines Called:  BDOS, CAPS, CIN, COUT, CRLF, PRINT
  38.      Special Error Conditions:  -None-
  39.  
  40.  
  41.      Routine Name:  F$MOPEN
  42.      Function║
  43.           Opeεá thσ filσ specifieΣ b∙ thσ FC┬ pointeΣ t∩á b∙á DE«  ì
  44. Iµá filσ i≤ no⌠ found¼á F$MOPE╬ trie≤ t∩ creatσ one«á  I⌠ return≤ ì
  45. thσá erro≥ codσ oµ 0FF╚ iε ┴ iµ therσ wa≤ no⌠ enougΦ rooφ iεá thσ ì
  46. disδ director∙ t∩ creatσ thσ director∙ entry.
  47.      Inputs:  DE = pointer to FCB
  48.      Outputs:  A = Error Code and PSW Flags (Zero Flag) Set
  49.                    0    --> No Error
  50.                    0FFH --> File not opened
  51.      Registers Affected:  PSW
  52.      SYSLIB Routines Called:  BDOS, CAPS, CIN, COUT, CRLF, PRINT
  53.      Special Error Conditions:  -None-
  54. :Close a File
  55.      Routine Name:  F$CLOSE
  56.      Function:
  57.           Close the file whose FCB is pointed to by DE.
  58.      Inputs:  DE = pointer to FCB
  59.      Outputs:  A = Error Code
  60.                    0    --> No Error
  61.                    0FFH --> Error in closing file
  62.      Registers Affected:  PSW
  63.      SYSLIB Routines Called:  BDOS
  64.      Special Error Conditions:  -None-
  65. :Create a File
  66.      Routine Name:  F$MAKE
  67.      Function:
  68.           Create (Make) the file whose FCB is pointed to by DE.
  69.      Inputs:  DE = pointer to FCB
  70.      Outputs:  A = Error Code
  71.                    0FFH --> No directory space available
  72.                    Not 0FFH --> No Error; Value is byte address in
  73.                                 TBUFF (80H-0FFH) of directory entry
  74.                                 allocated to the FCB
  75.      Registers Affected:  PSW
  76.      SYSLIB Routines Called:  BDOS, F$DELETE
  77.      Special Error Conditions:  -None-
  78. :Delete a File
  79.      Routine Name:  F$DELETE
  80.      Function║
  81.           Deletσ thσ filσ whosσ FC┬ i≤ pointeΣ t∩ b∙ DE«  Iµ filσ ì
  82. doe≤á no⌠á exist¼á nothinτ happen≤ (n∩ erro≥ messagσ o≥á codσá i≤ ì
  83. given).
  84.      Inputs:  DE = pointer to FCB
  85.      Outputs:  -None-
  86.      Registers Affected:  PSW
  87.      SYSLIB Routines Called:  BDOS
  88.      Special Error Conditions:  -None-
  89. :Rename a File
  90.      Routine Name:  F$RENAME
  91.      Function║
  92.           F$RENAM┼á ma∙ bσ useΣ t∩ renamσ ß file«á  Oε entry¼á D┼ ì
  93. pt≤ t∩ thσ firs⌠ twelvσ byte≤ oµ thσ file'≤ FC┬ anΣ H╠ pt≤ t∩ thσ ì
  94. 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⌠ ì
  95. bσá presen⌠á fo≥ thi≤ functioε t∩ work)«á  F$RENAM┼á contain≤á aε ì
  96. interna∞ FC┬ whicΦ i≤ structureΣ froφ thσ tw∩ entrie≤ t∩ properl∙ ì
  97. rename the file.
  98.      Inputs:  HL pts to 1st 12 bytes of new FCB
  99.               DE pts to 1st 12 bytes of old FCB
  100.      Outputs:  Zero Flag Set (Z) means error (file not found)
  101.      Registers Affected:  PSW
  102.      SYSLIB Routines Called: BDOS, FILLB, MOVEB
  103.      Specia∞ Erro≥ Conditions║á  Filσ No⌠ FounΣ error¼á indicateΣ ì
  104. by Z flag
  105. :Test of Existance of a File
  106.      Routine Name:  F$EXIST
  107.      Function║
  108.           F$EXIS╘ test≤ fo≥ thσ presencσ oµ thσ filσ whosσ FC┬ i≤ ì
  109. pteΣá t∩ b∙ D┼ iε thσ curren⌠ disk/use≥ area«á  Iµ thi≤ filσ doe≤ ì
  110. no⌠á exis⌠ iε thi≤ area¼á F$EXIS╘ return≤ witΦ thσ Zer∩ Flaτá Se⌠ ì
  111. (Z); if this file does exist, F$EXIST returns with NZ.
  112.      Inputs:  DE pts to FCB of file to test for
  113.      Outputs:  Zero Flag Set (Z) means file not found; NZ means
  114.                     file found
  115.      Registers Affected:  PSW
  116.      SYSLIB Routines Called:  BDOS
  117.      Specia∞á Erro≥ Conditions║  None
  118.  
  119. :Read a Block from a File
  120.      Routine Name:  F$READ
  121.      Function║
  122.           ReaΣá nex⌠ blocδ (12╕ bytes⌐ froφ thσ openeΣ filσ whosσ ì
  123. FC┬ i≤ pointeΣ t∩ b∙ D┼ int∩ TBUF╞ (buffe≥ a⌠ 80╚ - 0FFH).
  124.      Inputs:  DE = pointer to FCB
  125.      Outputs:  A = Error Code
  126.                    0 --> No Error
  127.                    1 --> Read past end of file
  128.                    2 --> Reading unwritten data in random access
  129.      Registers Affected:  PSW
  130.      SYSLIB Routines Called:  BDOS
  131.      Special Error Conditions:  -None-
  132. :Write a Block to a File
  133.      Routine Name:  F$WRITE
  134.      Function║
  135.           Writσá nex⌠ blocδ (12╕ bytes⌐ froφ TBUF╞ (buffe≥ a⌠ 80╚ ì
  136. t∩ 0FFH⌐ t∩ thσ openeΣ filσ whosσ FC┬ i≤ pointeΣ t∩ b∙ DE.
  137.      Inputs:  DE = pointer to FCB
  138.      Outputs:  A = Error Code
  139.                    0    --> No Error
  140.                    1    --> Error in extending file
  141.                    2    --> End of disk data
  142.                    0FFH --> No more directory space
  143.      Registers Affected:  PSW
  144.      SYSLIB Routines Called:  BDOS
  145.      Special Error Conditions:  -None-
  146.