home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / help / bdos.hzp / BDOS.HLP
Encoding:
Text File  |  1987-01-15  |  10.0 KB  |  202 lines

  1. BDOS - Basic I/O Operations/Functions
  2. BDOS - Basic Disk Operations/Functions
  3. Console Read Buffer Organization/Meaning (re: BDOS Function 10)
  4. File Control Block Organization/Meaning
  5. :BDOS - Basic I/O Operations
  6.      Function and Number      Input Parameters    Output Parameters
  7.  
  8.      System Reset      0      None                None
  9.      Read Console      1      None                ASCII Char in A
  10.      Write Console     2      ASCII Char in E     None
  11.      Read Reader       3      None                ASCII Char in A
  12.      Write Punch       4      ASCII Char in E     None
  13.      Write List        5      ASCII Char in E     None
  14.      Direct Con I/O    6      ASCII Char in E     I/O Status in A if E=0FFH
  15.  
  16.            *All function numbers are passed in Reg C.
  17. ~
  18.      Function and Number      Input Parameters    Output Parameters
  19.  
  20.      Get I/O Status    7      None                I/O Status in A
  21.      Put I/O Status    8      I/O Status in E     None
  22.      Print Buffer      9      Address of string   None
  23.                                terminated by $
  24.                                in DE
  25.      Read Buffer      10      Address of Read     Read Buffer is filled
  26.                                Buffer in DE       (See Section on Organization)
  27.      Console Ready    11      None                LSB of A is 1 if char
  28.                                                    ready
  29.      Return Version # 12      None                Version Info in HL
  30.                                                   H=0 CP/M, H=1 MP/M
  31.                                                   L=00 CP/M 1.x, 2x 2.x
  32.  
  33.            *All function numbers are passed in Reg C.
  34. :BDOS - Basic Disk Operations
  35.      Function and Number      Input Parameters    Output Parameters
  36.  
  37.      Init BDOS        13      None                None
  38.      Log-In Disk      14      Value in Reg E      None
  39.                                A=0, B=1, C=2,
  40.                                D=3
  41.      Open File        15      Address of FCB      Byte address of FCB
  42.                                in DE               if found or 0FFH if not
  43.      Close File       16      Address of FCB      Byte address of FCB
  44.                                in DE               if found or 0FFH if not
  45.      Search for File  17      Address of FCB      Byte address of FCB (0-3)
  46.                                in DE               if found or 0FFH if not
  47.      Search for Next  18      Address of FCB      Byte address of next FCB
  48.                                in DE               if found or 0FFH if not
  49.      Delete File      19      Address of FCB      Byte address of FCB (0-3)
  50.                                in DE               if found or 0FFH if not
  51.  
  52.            *All function numbers are passed in Reg C.
  53. ~
  54.      Function and Number      Input Parameters    Output Parameters
  55.  
  56.      Read Next Record 20      Address of FCB      0=successful read
  57. è                               in DE              1=read past EOF
  58.                                                   2=reading random data
  59.      Write Next Rec   21      Address of FCB      0=successful write
  60.                                in DE              1=error in extending
  61.                                                   2=end of disk data
  62.                                                   255=no more dir space
  63.      Make File        22      Address of FCB      Byte address of FCB or
  64.                                in DE               255 if no more dir space
  65.      Rename FCB       23      Address of FCB      Byte Address of Dir entry
  66.                                in DE               or 255 if no match
  67.      Return Log Code  24      None                Login vector in HL
  68.      Read Drive No    25      None                Number of logged-in drive
  69.                                                    (A=0, B=1, C=2, D=3)
  70.      Set DMA Address  26      Address of 128      None
  71.                               byte buffer in DE
  72.  
  73.            *All function numbers are passed in Reg C.
  74. ~
  75.      Function and Number      Input Parameters    Output Parameters
  76.  
  77.      Ge⌠áAlloπ Vec⌠   2╖      Nonσ                Allocatioε  Vec⌠ Add≥á iε ì
  78.                                                    HL
  79.      Write Prot Disk  28      None                None
  80.      Get R/O Vect     29      None                HL=R/O Vect Val
  81.      Set File Attrib  30      Ptr to FCB in DE    Dir code in A
  82.      Get Disk Parms   31      None                HL=DPB Address
  83.      Set/Get Usr Code 32      E=0FFH (get)/Code   A=Current code (get)/no
  84.                                (set)               value (set)
  85.  
  86.            *All function numbers are passed in Reg C.
  87.  
  88. NOTE: Functions 28-32 should be avoided in application programs in order to
  89.       maintain upward compatibility with CP/M.
  90. ~
  91.      Function and Number      Input Parameters    Output Parameters
  92.  
  93.      Read Random      33      DE=FCB addr         A=return code
  94.                                                   1=reading unwritten data
  95.                                                   2=(not used)
  96.                                                   3=can't close curr ext
  97.                                                   4=seek to unwritten ext
  98.                                                   5=(not used)
  99.                                                   6=seek past end of disk
  100.      Write Random     34      DE=FCB addr         A=return code
  101.                                                   1=reading unwritten data
  102.                                                   2=(not used)
  103.                                                   3=can't close curr ext
  104.                                                   4=seek to unwritten ext
  105.                                                   5=dir overflow
  106.                                                   6=seek past end of disk
  107.  
  108.            *All function numbers are passed in Reg C.
  109.  
  110. NOTE: Functions 28-32 should be avoided in application programs in order to
  111.       maintain upward compatibility with CP/M.
  112. ~
  113.      Function and Number      Input Parameters    Output Parameters
  114.  
  115.      Compute File Siz 35      DE=FCB addr         Random Rec Field set
  116.                                                    to file size
  117.      Set Random Rec   36      DE=FCB addr         Random Rec Field set
  118.      Reset Drive      37      DE=Drive Vector     A=return code, Always 00h
  119.      Write Random     40      DE=FCB addr         A=return code
  120.      (w/zero fill)                                1=reading unwritten data
  121.                                                   2=(not used)
  122.                                                   3=can't close curr ext
  123.                                                   4=seek to unwritten ext
  124.                                                   5=dir overflow
  125.                                                   6=seek past end of disk
  126.  
  127.             *All function numbers are passed in Reg C
  128.  
  129. NOTE: Functions 28-32 should be avoided in application programs in order to
  130.       maintain upward compatibility with CP/M.
  131. :Console Read Buffer Organization/Meaning (re: BDOS Function 10)
  132.     Refer to BDOS function 10 'Read Console Buffer'
  133.  
  134.      Byte      Function
  135.        1       Maximum Buffer Length (1 to 255)
  136.        2       Current Buffer Length (returned value)
  137.                No. of characters in the buffer
  138.      3-n       Data (returned values)
  139.                The actual characters read from the console and in the buffer.
  140.  
  141. If the number of characters in the buffer is less than the length of the
  142. buffer, then uninitialized positions follow the last character.  Also note
  143. that certain functions that return the carriage return to the leftmost
  144. position (e.g., ctl-X), do so only to the column position where the prompt
  145. ended.
  146. :File Control Block Organization/Meaning
  147.     In file operations, starting with Function 15, Register DE usually
  148. addresses a file control block.  Transient programs often use the default
  149. file control block at location BOOT+005Ch (normally 005Ch), for simple file
  150. operations.
  151.     The basic unit of file information is a 128-byte record used for all
  152. file operations; thus, a default location for disk I/O is provided by CP/M at
  153. location BOOT+0080h (normally 0080h), which is the initial default DMA address
  154. (see function 26).  All directory operations take place in a reserved area that
  155. does not effect write buffers, with the exception of Search First and Search
  156. Next.
  157.     The FCB data area consists of a sequence of 33 bytes for sequential
  158. access and a series of 36 bytes in the case when the file is accessed randomly.
  159. The default FCB, normally located at 005Ch, can be used for random access
  160. files, since the three bytes starting at BOOT+007Dh are available for this
  161. purpose.
  162. ~
  163. The FCB format is as follows:
  164.        dr f1 f2 / / f8 t1 t2 t3 ex s1 s2 rc d0 / / dn cr r0 r1 r2
  165.        00 01 02 ... 08 09 10 11 12 13 14 15 16 ... 31 32 33 34 35
  166.  
  167. where    dr        drive code (0-16)
  168.             0  use default drive for file
  169.             1  auto disk select drive A
  170.             2  auto disk select drive B
  171.             ....
  172.             16 auto disk select drive P
  173.  
  174.     f1...f8        contain the file name in ASCII upper case,
  175.             with high bit = 0
  176.  
  177.     t1,t2,t3    contain the file type in ASCII upper case, with high
  178.             bit = 0 t1, t2 and t3 denote the bit of these positions
  179.                          t1 Read Only file
  180.              t2 Systom File, not Directory listing
  181. ~
  182.        dr f1 f2 / / f8 t1 t2 t3 ex s1 s2 rc d0 / / dn cr r0 r1 r2
  183.        00 01 02 ... 08 09 10 11 12 13 14 15 16 ... 31 32 33 34 35
  184.  
  185. where    ex        contains the current extent number, normally set to 00
  186.             by the user, but in the range of 0-31 during file I/O
  187.  
  188.     s1        reserved for internal system use
  189.  
  190.     s2        reserved for internal system use, set to zero on call
  191.             to OPEN, MAKE, SEARCH
  192.  
  193.     rc        record count of extent 'ex'.  value from 0-127.
  194.  
  195.     d0...dn        filled-in by CP/M, reserved for system use
  196.  
  197.     cr        current record to read or write in a sequential file
  198.             operation.  normally set to zero by the user.
  199.  
  200.     r0,r1,r2    optional random record number in the range 0-65535,
  201.             with overflow to r2,r0,r1 constitute a 16 bit value
  202.             with low byte r0, and high byte r1.
  203.