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