home *** CD-ROM | disk | FTP | other *** search
/ Emulator Universe CD / emulatoruniversecd1998.iso / MSX / OS / MSXDOS2.ZIP / DOS2FUNC.PMA / DOS2FUNC.DOC
Encoding:
Text File  |  1993-05-16  |  118.0 KB  |  3,288 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.                   M S X -- D O S   v e r s i o n  2
  17.                   =================================
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.                   The advanced disk operating system
  31.  
  32.                          for MSX 2 computers
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67. CONTENTS                                       Page
  68.  
  69. 1.    Introduction ............................  3
  70. 2.    List of functions .......................  4
  71. 3.    Function By Function Definitions ........  7
  72.    3.1   \ 
  73.    . .    \  Definitions of each function
  74.    . .    /
  75.    3.90  /    
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.    This  manual describes  in detail  the MSX-DOS  function calls provided by 
  86. MSX-DOS version 2.20
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111. 1.   INTRODUCTION
  112.  
  113.    This document describes in detail each of the MSX-DOS 2 function calls. It 
  114. should  be read  in conjunction  with the  "Program Interface  specification" 
  115. which describes  system features  such as  file handles,  fileinfo blocks and 
  116. environment strings in general terms.
  117.  
  118.  
  119.    There are  two ways  of doing  MSX-DOS function  calls, reflecting the two 
  120. different  environments (MSX-DOS and disk BASIC) in which the system can run. 
  121. Transient  programs  running  in  the  MSX-DOS  environment  must  access the 
  122. functions with a "CALL 00005h" instruction. Disk BASIC and other MSX programs 
  123. running  in  the disk  BASIC environment  (usually executing  from ROM)  must 
  124. access the system via a "CALL 0F37Dh" instruction.
  125.  
  126.    There   are  some   limitations  when   calling  the  system  via  0F37Dh, 
  127. particularly to do with error handling and abort routines. Also no parameters 
  128. may be passed in page-1, unless they are in the master disk ROM (as they will 
  129. be for  disk BASIC)  since the master disk ROM will be paged into page-1 when 
  130. such  a function  call is  made. The individual function descriptions mention 
  131. the differences for particular functions.
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166. 2.   LIST OF FUNCTIONS
  167.  
  168.    Below there  is a  complete list  of the  functions calls. "CPM" indicates 
  169. that the function is compatible with the equivalent CP/M 2.2 function, "MSX1" 
  170. indicates  compatibility  with  MSX-DOS  version  1,  and  "NEW" indicates  a 
  171. function  which is  new to  this system. An asterisk ("*") indicates that the 
  172. function may  be safely  called from  a user disk error routine (see function 
  173. 64h and function 70h).
  174.  
  175.  
  176. List of MSX-DOS 2 Function Calls
  177.  
  178. CPM MSX1  00h -  Program terminate
  179.      CPM MSX1* 01h -  Console input
  180.      CPM MSX1* 02h -  Console output
  181.      CPM MSX1* 03h -  Auxiliary input
  182.      CPM MSX1* 04h -  Auxiliary output
  183.      CPM MSX1* 05h -  Printer output
  184.      CPM MSX1* 06h -  Direct console I/O
  185.          MSX1* 07h -  Direct console input
  186.          MSX1* 08h -  Console input without echo
  187.      CPM MSX1* 09h -  String output
  188.      CPM MSX1* 0Ah -  Buffered line input
  189.      CPM MSX1* 0Bh -  Console status
  190.  
  191.  
  192.      CPM MSX1* 0Ch -  Return version number
  193.      CPM MSX1  0Dh -  Disk reset
  194.      CPM MSX1  0Eh -  Select disk
  195.  
  196.  
  197.      CPM MSX1  0Fh -  Open file (FCB)
  198.      CPM MSX1  10h -  Close file (FCB)
  199.      CPM MSX1  11h -  Search for first entry (FCB)
  200.      CPM MSX1  12h -  Search for next entry (FCB)
  201.      CPM MSX1  13h -  Delete file (FCB)
  202.      CPM MSX1  14h -  Sequential read (FCB)
  203.      CPM MSX1  15h -  Sequential write FCB)
  204.      CPM MSX1  16h -  Create file (FCB)
  205.      CPM MSX1  17h -  Rename file (FCB)
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.      CPM MSX1* 18h -  Get login vector
  222.      CPM MSX1* 19h -  Get current drive
  223.      CPM MSX1  1Ah -  Set disk transfer address
  224.          MSX1  1Bh -  Get allocation information
  225.                1Ch -  Unused
  226.                1Dh -  Unused
  227.                1Eh -  Unused
  228.                1Fh -  Unused
  229.                20h -  Unused
  230.      CPM MSX1  21h -  Random read (FCB)
  231.      CPM MSX1  22h -  Random write(FCB)
  232.      CPM MSX1  23h -  Get file size (FCB)
  233.      CPM MSX1  24h -  Set random record (FCB)
  234.                25h -  Unused
  235.          MSX1  26h -  Random block write (FCB)
  236.          MSX1  27h -  Random block read (FCB)
  237.      CPM MSX1  28h -  Random write with zero fill (FCB)
  238.                29h -  Unused
  239.          MSX1* 2Ah -  Get date
  240.          MSX1* 2Bh -  Set date
  241.          MSX1* 2Ch -  Get time
  242.          MSX1* 2Dh -  Set time
  243.          MSX1* 2Eh -  Set/reset verify flag 
  244.          MSX1* 2Fh -  Absolute sector read
  245.          MSX1* 30h -  Absolute sector write
  246.          NEW*  31h -  Get disk parameters
  247.  
  248.  
  249.             32h - \ 
  250.             . .    \ Unused
  251.             . .    /
  252.             3Fh - /
  253.  
  254.  
  255.     NEW     40h -  Find first entry
  256.     NEW     41h -  Find next entry
  257.     NEW     42h -  Find new entry
  258.  
  259.  
  260.     NEW     43h -  Open file handle
  261.     NEW     44h -  Create file handle
  262.     NEW     45h -  Close file handle
  263.     NEW     46h -  Ensure file handle
  264.     NEW     47h -  Duplicate file handle
  265.     NEW     48h -  Read from file handle
  266.     NEW     49h -  Write to file handle
  267.     NEW     4Ah -  Move file handle pointer 
  268.     NEW     4Bh -  I/O control for devices
  269.     NEW     4Ch -  Test file handle 
  270.  
  271.     NEW     4Dh -  Delete file or subdirectory
  272.     NEW     4Eh -  Rename file or subdirectory
  273.     NEW     4Fh -  Move file or subdirectory
  274.     NEW     50h -  Get/set file attributes
  275.     NEW     51h -  Get/set file date and time
  276.  
  277.  
  278.     NEW     52h -  Delete file handle
  279.     NEW     53h -  Rename file handle
  280.     NEW     54h -  Move file handle
  281.     NEW     55h -  Get/set file handle attributes
  282.     NEW     56h -  Get/set file handle date and time
  283.  
  284.  
  285.     NEW   * 57h -  Get disk transfer address
  286.     NEW   * 58h -  Get verify flag setting
  287.     NEW     59h -  Get current directory
  288.     NEW     5Ah -  Change current directory 
  289.     NEW     5Bh -  Parse pathname
  290.     NEW     5Ch -  Parse filename
  291.     NEW   * 5Dh -  Check character
  292.     NEW     5Eh -  Get whole path string
  293.     NEW     5Fh -  Flush disk buffers 
  294.  
  295.  
  296.     NEW     60h -  Fork a child process
  297.     NEW     61h -  Rejoin parent process
  298.     NEW     62h -  Terminate with error code
  299.     NEW     63h -  Define abort exit routine
  300.     NEW     64h -  Define disk error handler routine
  301.     NEW   * 65h -  Get previous error code
  302.     NEW   * 66h -  Explain error code 
  303.  
  304.  
  305.     NEW     67h -  Format a disk
  306.     NEW     68h -  Create or destroy RAM disk
  307.     NEW     69h -  Allocate sector buffers
  308.     NEW   * 6Ah -  Logical drive assignment
  309.  
  310.  
  311.     NEW   * 6Bh -  Get environment item
  312.     NEW   * 6Ch -  Set environment item
  313.     NEW   * 6Dh -  Find environment item
  314.  
  315.  
  316.     NEW   * 6Eh -  Get/set disk check status
  317.     NEW   * 6Fh -  Get MSX-DOS version number
  318.     NEW   * 70h -  Get/set redirection status
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331. 3.   FUNCTION BY FUNCTION DEFINITIONS
  332.  
  333.    Below are detailed descriptions of each of the MSX-DOS functions including 
  334. both the  old and  new ones. The names in brackets after the function numbers 
  335. are   the  public  labels  for  the  function  codes  which  are  defined  in 
  336. "CODES.MAC". Programs should use these names whenever possible. 
  337.  
  338.    Many of  the functions below 40h return an error flag rather than an error 
  339. code.  If the  error flag  is set  then the  actual error code indicating the 
  340. cause of  the error can be obtained by the "get previous error code" function 
  341. (function  65h).  All  of the  functions above  40h return  an error  code in 
  342. register  A.  The  "Program Interface  Specification" document  describes the 
  343. general  errors  which  can  be  returned  from  many of  the functions.  The 
  344. individual  function specifications  here describe  the main error conditions 
  345. which are specific to particular functions.
  346.    Note that  many of  the function  calls which  modify the information on a 
  347. disk  do  not  automatically  flush  disk  buffers  and  so  the disk  is not 
  348. necessarily  correctly updated  immediately after  the function call is made. 
  349. Such  calls  include  all  types  of  "create", "write",  "delete", "rename", 
  350. "change file  attributes" and "change file date and time" function calls. The 
  351. only  functions which  always flush disk buffers are "flush buffers", "close" 
  352. and  "ensure".  After  these  operations the  disk will  always be  correctly 
  353. updated.
  354.  
  355.  
  356.  
  357.  
  358.   3.1   PROGRAM TERMINATE (00H)
  359.  
  360.      Parameters:    C = 00H (_TERM0)
  361.      Results:       Does not return
  362.  
  363.  
  364.  
  365.    This function  terminates program  with a zero return code. It is provided 
  366. for  compatibility with MSX-DOS 1 and CP/M, the preferred method of exiting a 
  367. program is  to use  the "terminate  with error  code" function call (function 
  368. 62h),  passing  a  zero  error  code  if  that is  what is  desired. See  the 
  369. description   of  that   function  call,  and  also  the  "Program  Interface 
  370. Specification", for  details of  what happens when a program terminates. This 
  371. function call never returns to the caller.
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.   3.2   CONSOLE INPUT (01H)
  387.  
  388.     Parameters:    C = 01H (_CONIN)
  389.     Results:     L=A = Character from keyboard
  390.  
  391.  
  392.  
  393.    A  character will be read from the standard input (file handle 0 - usually 
  394. the keyboard)  and echoed to the standard output (file handle 1 - usually the 
  395. screen).  If no  character is  ready then  this function  will wait  for one. 
  396. Various control  characters, as  specified for  the "console status" function 
  397. (function  0Bh),  will  be  trapped  by  this  function  for  various control 
  398. purposes.  If one  of these  characters is detected then it will be processed 
  399. and this function will wait for another character. Thus these characters will 
  400. never be returned to the user by this function.
  401.  
  402.  
  403.  
  404.  
  405.   3.3   CONSOLE OUTPUT (02H)
  406.  
  407.      Parameters:    C = 02H (_CONOUT)
  408.                     E = Character to be output
  409.      Results:       None
  410.  
  411.  
  412.    The character passed in register E is written to the standard output (file 
  413. handle 1 - usually the screen). If printer echo is enabled then the character 
  414. is also  written to  the printer.  Various control codes and escape sequences 
  415. are  interpreted as  screen control codes. A list of these is included in the 
  416. "Program Interface  Specification", they  are a sub-set of the standard VT-52 
  417. control codes. TABs will be expanded to every eighth column.
  418.  
  419.  
  420.  
  421.    A  console input  status check  is done, and if any of the special control 
  422. characters  described  for the  "console status"  function (function  0Bh) is 
  423. found then  it will  be processed  as for  that function. Any other character 
  424. will be saved internally for a later "console input" function call.
  425.  
  426.  
  427.  
  428.   3.4   AUXILIARY INPUT (03H)
  429.  
  430.      Parameters:    C = 03H (_AUXIN)
  431.      Results:     L=A = Input character
  432.  
  433.  
  434.  
  435.    A character is read from the auxiliary input device (file handle 3) and if 
  436. no character  is ready  then it will wait for one. The auxiliary input device 
  437. must  have been installed before this function may be used. If no such device 
  438. has been  installed then  this function  will always  return the  end of file 
  439. character ("Ctrl-Z").
  440.  
  441.   3.5   AUXILIARY OUTPUT (04H)
  442.  
  443.      Parameters:    C = 04H (_AUXOUT)
  444.                    E = Character to be output
  445.      Results:       None
  446.  
  447.  
  448.  
  449.    The character passed in register E will be written to the auxiliary output 
  450. device (file  handle 3). The auxiliary output device must have been installed 
  451. before  this function  may be used. If no such device has been installed then 
  452. this function will simply throw the character away.
  453.  
  454.  
  455.  
  456.  
  457.   3.6   PRINTER OUTPUT (05H)
  458.  
  459.      Parameters:    C = 05H (_LSTOUT)
  460.                    E = Character to be output
  461.       Results:       None
  462.  
  463.  
  464.  
  465.    The character  passed in  register E  will be sent to the standard printer 
  466. device  (file handle  4 -  usually the parallel printer). The same channel is 
  467. used for console output which is echoed to the printer. TABs are not expanded 
  468. by this  function, although they are expanded when screen output is echoed to 
  469. the printer with "Ctrl-P".
  470.  
  471.  
  472.  
  473.  
  474.   3.7   DIRECT CONSOLE I/O (06H)
  475.  
  476.      Parameters:    C = 06H (_DIRIO)
  477.                     E = 00H...FEH - character for output
  478.                       = FFH  - requests input
  479.      Results:     A=L = input - 00H - no character ready
  480.                                 else input character
  481.                        undefined for output
  482.  
  483.  
  484.    If  E=FFh on  entry then the keyboard will be examined for a characterfrom 
  485. the standard input (file handle 0) and 00h returned if no character is ready. 
  486. If a  character is  ready then  it will be read from the standard input (file 
  487. handle  0) and  returned in register A without being echoed and with no check 
  488. for control characters.
  489.  
  490.  
  491.    If  E<>FFh  on entry  then the  character in  register E  will be  printed 
  492. directly to  the standard  output (file  handle 1)  with no  TAB expansion or 
  493. printer  echo. Also  no console  status check  is done by this function. Note 
  494. that although  this function  does not  expand TABs,  the VT-52 control codes 
  495. include TAB expansion so the effect on the screen is the same.
  496.  
  497.  
  498.   3.8   DIRECT CONSOLE INPUT (07H)
  499.  
  500.      Parameters:    C = 07H (_DIRIN)
  501.      Results:     L=A = Input character
  502.  
  503.  
  504.  
  505.    This function  is identical  to the  input option  of function 06h, except 
  506. that  if no  character is  ready it  will wait for one. Like function 06h, no 
  507. echo  or  control  characters  checks  will  be  done.  This function  is not 
  508. compatible with CP/M which uses this function number for "get I/O byte".
  509.  
  510.  
  511.  
  512.  
  513.   3.9   CONSOLE INPUT WITHOUT ECHO (08H)
  514.  
  515.      Parameters:    C = 08H (_INNOE)
  516.      Results:     L=A = Input character
  517.  
  518.  
  519.  
  520.    This function is identical to function 01h except that the input character 
  521. will  not be echoed to the standard output. The same control character checks 
  522. will be  done. This  function is  not compatible  with CP/M  which uses  this 
  523. function number for "set I/O byte".
  524.  
  525.  
  526.  
  527.  
  528.   3.10   STRING OUTPUT (09H)
  529.  
  530.      Parameters:    C = 09H (_STROUT)
  531.                   DE = Address of string
  532.      Results:       None
  533.  
  534.  
  535.  
  536.    The characters  of the  string pointed  to by  register DE  will be output 
  537. using  the normal  console output  routine (function call 02h). The string is 
  538. terminated by "$" (ASCII 24h).
  539.  
  540.  
  541.  
  542.  
  543.  
  544.  
  545.  
  546.  
  547.  
  548.  
  549.  
  550.  
  551.   3.11   BUFFERED LINE INPUT (0AH)
  552.  
  553.      Parameters:    C = 0AH (_BUFIN)
  554.                    DE = Address of an input buffer
  555.      Results:       None
  556.  
  557.  
  558.    DE  must point  to a  buffer to  be used for input. The first byte of this 
  559. buffer  must  contain  the  number of  characters which  the buffer  can hold 
  560. (0...255). A  line of input will be read from the standard input device (file 
  561. handle  0 - usually the keyboard) and stored in the buffer. The input will be 
  562. terminated  when  a  CR  is  read  from  the  standard input.  The number  of 
  563. characters entered,  which does  not include the CR itself, will be stored at 
  564. (DE+1).  If there  is room in the buffer then the CR will be stored after the 
  565. last character.
  566.  
  567.  
  568.  
  569.    When inputting  from the  keyboard (which  will normally  be the  case), a 
  570. simple  line  editor  is provided,  and also  a 256  byte circular  buffer of 
  571. previous  lines which  can be  edited and  re-entered. The  details of  these 
  572. editing  facilities  are described  in the  separate "Command  Specification" 
  573. document, so  they are not included here. When the input buffer becomes full, 
  574. the console bell will be rung for each character typed which cannot be put in 
  575. the  buffer. Each character entered will be echoed to the standard output and 
  576. also to the printer if printer echo is enabled.
  577.  
  578.  
  579.  
  580.  
  581.   3.12   CONSOLE STATUS (0BH)
  582.  
  583.      Parameters:    C = 0BH (_CONST)
  584.      Results:     L=A = 00H if no key was pressed
  585.                       = FFH if a key was pressed
  586.  
  587.  
  588.    A  flag is returned in register A to indicate whether a character is ready 
  589. (that is,  a key  was pressed) for input from the keyboard. If a character is 
  590. ready then it will be read and tested for certain special control characters. 
  591. If it is not one of these then it is stored in an internal single byte buffer 
  592. and   subsequent  call   to  this  function  will  return  "character  ready" 
  593. immediately  without  checking the  keyboard. If  this function  says that  a 
  594. character is ready then the character may be read by function 02h or 08h.
  595.  
  596.  
  597.    If the  character is  "Ctrl-C" then  the program will be terminated with a 
  598. ".CTRLC"  error  via  the  user's  abort routine  if one  is defined.  If the 
  599. character  is  "Ctrl-P"  then printer  echo will  be enabled  and it  will be 
  600. disabled  if it  is "Ctrl-N".  If the  character is "Ctrl-S" then the routine 
  601. will hang  up waiting for another character to be pressed and then return "no 
  602. character  ready", thus  providing a  "wait" facility. The character typed to 
  603. continue operation  will be  ignored, except  that of it is "Ctrl-C" then the 
  604. program  will  be  terminated.  These  same input  checks are  also done  for 
  605. functions 01h, 02h, 08h, 09h and 0Ah.
  606.  
  607.  
  608.   3.13   RETURN VERSION NUMBER (0CH)
  609.  
  610.      Parameters:    C = 0CH (_CPMVER)
  611.      Results:     L=A = 22H
  612.                  H=B = 00H 
  613.  
  614.  
  615.  
  616.    This  function  simply  returns  the  CP/M version  number which  is being 
  617. emulated. This is always version 2.2 in current systems. 
  618.  
  619.  
  620.   3.14   DISK RESET (0DH)
  621.  
  622.      Parameters:    C = 0DH (_DSKRST)
  623.      Results:       None
  624.  
  625.  
  626.  
  627.    Any  data which  is waiting in internal buffers is written out to disk. It 
  628. is not  necessary to call this function in order to allow a disk change as is 
  629. the case with CP/M. The disk transfer address is also set back to its default 
  630. value of 80h by this function.
  631.  
  632.  
  633.  
  634.  
  635.   3.15   SELECT DISK (0EH)
  636.  
  637.      Parameters:    C = 0EH (_SELDSK)
  638.                     E = Drive number.  0=A:  1=B:   etc.
  639.      Results:     L=A = Number of drives (1...8)
  640.  
  641.  
  642.    This function simply selects the specified drive as the default drive. The 
  643. current  drive is  also stored  at address  0004h for CP/M compatibility. The 
  644. number  of  drives available  is returned  in register  A but  this will  not 
  645. include the RAM disk.
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.   3.16   OPEN FILE [FCB] (0FH)
  662.  
  663.      Parameters:    C = 0FH (_FOPEN)
  664.                    DE = Pointer to unopened FCB 
  665.      Results:     L=A = 0FFH if file not found
  666.                            =   0  if file is found
  667.  
  668.  
  669.    The unopened  FCB must  contain a  drive which may be zero to indicate the 
  670. current  drive  and  a filename  and extension  which may  be ambiguous.  The 
  671. current directory of the specified drive will be searched for a matching file 
  672. and if found it will be opened. Matching entries which are sub-directories or 
  673. system files will be ignored, and if the filename is ambiguous then the first 
  674. suitable matching entry will be opened.
  675.  
  676.  
  677.    Device  names may  be put in the FCB (without a colon) to allow devices to 
  678. be accessed  as if  they were  actually disk files. The standard device names 
  679. are defined in the "Program Interface Specification".
  680.  
  681.  
  682.    The  low byte  of the extent number is not altered by this function, and a 
  683. file will only be opened if it is big enough to contain the specified extent. 
  684. Normally the  transient program  will set  the extent  number to  zero before 
  685. calling this function. The high byte of the extent number will be set to zero 
  686. to ensure compatibility with CP/M.
  687.  
  688.  
  689.    The filename  and extension in the FCB will be replaced by the actual name 
  690. of  the file  opened from the directory entry. This will normally be the same 
  691. as what was there before but may be different if an ambiguous filename or one 
  692. with lower case letters in was used. 
  693.  
  694.    The  record count  will be  set to  the number  of 128 byte records in the 
  695. specified extent, which is calculated from the file size. The file size field 
  696. itself, the  volume-id and  the 8  reserved bytes  will also  be set  up. The 
  697. current record and random record fields will not be altered by this function, 
  698. it  is the  application program's  responsibility to  initialize them  before 
  699. using the read or write functions.
  700.  
  701.  
  702.  
  703.    If  the file  cannot be  found, then the "APPEND" environment item will be 
  704. examined. If  this is set then it is interpreted as a drive/path string which 
  705. specifies  a second  directory in  which to  look for the file. The specified 
  706. directory will  be searched  for the  file and  if found it will be opened as 
  707. above.  In this  case the  drive byte  of the FCB will be set to the drive on 
  708. which the  file was  found to  ensure correct  accessing of  the file  if the 
  709. original drive byte was zero (default).
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.   3.17   CLOSE FILE [FCB] (10H)
  717.  
  718.      Parameters:    C = 10H (_FCLOSE)
  719.                    DE = Pointer to opened FCB
  720.      Results:     L=A = 0FFH if not successful
  721.                      =   0  if successful
  722.  
  723.  
  724.  
  725.    The  FCB must  have previously been opened with either an OPEN or a CREATE 
  726. function  call.  If  the  file has  only been  read then  this function  does 
  727. nothing. If  the file  has been  written to  then any  buffered data  will be 
  728. written  to disk  and the directory entry updated appropriately. The file may 
  729. still be  accessed after a close, so the function can be regarded as doing an 
  730. "ensure" function.
  731.  
  732.  
  733.  
  734.  
  735.   3.18   SEARCH FOR FIRST [FCB] (11H)
  736.  
  737.      Parameters:    C = 11H (_SFIRST)
  738.                    DE = Pointer to unopened FCB
  739.      Results:     L=A = 0FFH if file not found
  740.                      =   0  if file found.
  741.  
  742.  
  743.    This function searches the current directory of the drive specified in the 
  744. FCB  (default  drive  if  FCB contains  zero) for  a file  which matches  the 
  745. filename and  extension in the FCB. The filename may be ambiguous (containing 
  746. "?"  characters) in which case the first match will be found. The low byte of 
  747. the extent  field will  be used,  and a  file will only be found if it is big 
  748. enough  to contain  this extent number. Normally the extent field will be set 
  749. to  zero  by  the  program  before  calling  this  function. System  file and 
  750. sub-directory entries will not be found.
  751.  
  752.  
  753.    If a suitable match is found (A=0) then the directory entry will be copied 
  754. to the  DTA address,  preceded by the drive number. This can be used directly 
  755. as an FCB for an OPEN function call if desired. The extent number will be set 
  756. to  the low byte of the extent from the search FCB, and the record count will 
  757. be initialized  appropriately (as  for OPEN).  The attributes  byte from  the 
  758. directory  entry will  be stored  in the  S1 byte  position, since its normal 
  759. position (immediately  after the  filename extension  field) is  used for the 
  760. extent byte.
  761.  
  762.  
  763.    If no match is found (A=0FFh) then the DTA will not be altered. In no case 
  764. will  the FCB  pointed to  by DE  be modified at all. This function remembers 
  765. sufficient information  internally to  allow it to continue the search with a 
  766. SEARCH  FOR NEXT function, so it is not necessary for the FCB to be preserved 
  767. if doing a SEARCH FOR NEXT function.
  768.  
  769.  
  770.  
  771.    In CP/M,  if the  drive number  is set  to "?"  in this  function then all 
  772. directory  entries, allocated  or free  will be  matched. Also  if the extent 
  773. field is  set to "?" then any extent of a file will be matched. Both of these 
  774. features  are normally  only used  by special purpose CP/M programs which are 
  775. generally  specific  to  the  CP/M filing  system (such  as "STAT").  Neither 
  776. feature is present in MSX-DOS 1/2.
  777.  
  778.  
  779.  
  780.  
  781.   3.19   SEARCH FOR NEXT [FCB] (12H)
  782.  
  783.      Parameters:    C = 12H (_SNEXT)
  784.      Results:     L=A = 0FFH if file not found
  785.                      =   0  if file found.
  786.  
  787.  
  788.  
  789.    It continues  the search to look for the next match with the filename. The 
  790. results returned from this function are identical to SEARCH FOR FIRST and all 
  791. the  same comments apply. The information used to continue the search is held 
  792. internally within  MSX-DOS and  so the  original FCB  used in  the SEARCH FOR 
  793. FIRST need not still exist.
  794.  
  795.  
  796.  
  797.  
  798.   3.20   DELETE FILE [FCB] (13H)
  799.  
  800.      Parameters:    C = 13H (_FDEL)
  801.                   DE = Pointer to unopened FCB
  802.      Results:     L=A = 0FFH if no files deleted
  803.                       =   0  if files deleted OK
  804.  
  805.  
  806.  
  807.    All  files in  the current directory of the disk specified by the FCB, and 
  808. which match  the ambiguous filename in the FCB, are deleted. Sub-directories, 
  809. system  files, hidden files and read only files are not deleted. If any files 
  810. at all are successfully deleted then this function returns with A=0. A return 
  811. with A=FFh indicates that no files were deleted.
  812.  
  813.  
  814.  
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.   3.21   SEQUENTIAL READ [FCB] (14H)
  827.  
  828.      Parameters:    C = 14H (_RDSEQ)
  829.                    DE = Pointer to opened FCB
  830.      Results:     L=A = 01H if error (end of file)
  831.                       =  0  if read was successful
  832.  
  833.  
  834.    This function reads the next sequential 128 byte record from the file into 
  835. the  current  disk transfer  address. The  record is  defined by  the current 
  836. extent  (high  and  low  bytes) and  the current  record. After  successfully 
  837. reading the  record, this  function increments  the current  record and if it 
  838. reaches  080h, sets  it back  to zero  and increments  the extent number. The 
  839. record count field is also kept updated when necessary.
  840.  
  841.  
  842.  
  843.    Unlike  CP/M it  is possible  to have  partially filled records, since the 
  844. file size is not necessarily a multiple of 128 bytes. If this occurs then the 
  845. partial record  is padded  out with zeroes when it is copied to the transient 
  846. program's DTA address.
  847.  
  848.  
  849.  
  850.  
  851.   3.22   SEQUENTIAL WRITE [FCB] (15H)
  852.  
  853.      Parameters:    C = 15H (_WRSEQ)
  854.                    DE = Pointer to opened FCB
  855.      Results:     L=A = 01H if error (disk full)
  856.                      =  0  if write was successful
  857.  
  858.  
  859.  
  860.    This function  writes the 128 bytes from the current disk transfer address 
  861. to  the file  at the position defined by the current record and extent, which 
  862. are then  incremented appropriately.  The record  count byte  is kept updated 
  863. correctly  if the  file is  extended or if the write moves into a new extent. 
  864. The file size in the FCB is also updated if the file is extended. 
  865.  
  866.  
  867.   3.23   CREATE FILE [FCB] (16H)
  868.  
  869.      Parameters:    C = 16H (_FMAKE)
  870.                    DE = Pointer to unopened FCB
  871.      Results:     L=A = 0FFH if unsuccessful
  872.                       =   0  if successful   
  873.  
  874.  
  875.    This function creates a new file in the current directory of the specified 
  876. drive and opens it ready for reading and writing. The drive, filename and low 
  877. byte of the extent number must be set up in the FCB and the filename must not 
  878. be  ambiguous. Checks  will be  done to ensure that invalid filenames are not 
  879. created.
  880.  
  881.    If there is already a file of the required name then the action depends on 
  882. the value  of the  extent number byte. Normally this will be zero and in this 
  883. case  the old  file will  be deleted  and a  new one  created. However if the 
  884. extent  number  is non-zero  then the  existing file  will be  opened without 
  885. creating a  new file.  This ensures compatibility with early versions of CP/M 
  886. where each extent had to be explicitly created.
  887.  
  888.  
  889.  
  890.    In all  cases the  resulting file  will be opened with the required extent 
  891. number exactly as if an OPEN function call had been done.
  892.  
  893.  
  894.  
  895.  
  896.   3.24   RENAME FILE [FCB] (17H)
  897.  
  898.      Parameters:    C = 17H (_FREN)
  899.                    DE = Pointer to unopened FCB
  900.      Results:     L=A = 0FFH not if successful
  901.                      =   0  if successful 
  902.  
  903.  
  904.    The  unopened FCB  has the  normal drive  and filename,  and also a second 
  905. filename starting  at (DE+17).  Every file  in the  current directory  of the 
  906. specified  drive which  matches the  first filename, is changed to the second 
  907. filename with  "?" characters  in the second filename leaving the appropriate 
  908. character  unchanged.  Checks  are  done  to  prevent  duplicate  or  illegal 
  909. filenames  from being  created. Entries for sub-directories, hidden files and 
  910. system files will not be renamed. 
  911.  
  912.  
  913.  
  914.  
  915.   3.25   GET LOGIN VECTOR (18H)
  916.  
  917.      Parameters:    C = 18H (_LOGIN)
  918.      Results:      HL = Login vector
  919.  
  920.  
  921.  
  922.    This function  returns a  bit set in HL for each drive which is available, 
  923. bit-0 of L corresponding to drive "A:". Up to eight drives ("A:" to "H:") are 
  924. supported  by the  system currently,  so register  H will  usually be zero on 
  925. return.
  926.  
  927.  
  928.  
  929.  
  930.   3.26   GET CURRENT DRIVE (19H)
  931.  
  932.      Parameters:    C = 19H (_CURDRV)
  933.      Results:     L=A = Current drive (0=A: etc)
  934.  
  935.    This function just returns the current drive number.
  936.  
  937.  
  938.  
  939.   3.27   SET DISK TRANSFER ADDRESS (1AH)
  940.  
  941.      Parameters:    C = 1AH (_SETDTA)
  942.                    DE = Required Disk Transfer Address
  943.      Results:       None
  944.  
  945.  
  946.  
  947.    This function simply records the address passed in DE as the disk transfer 
  948. address.  This address  will be  used for  all subsequent  FCB read and write 
  949. calls,  for  "search for  first" and  "search for  next" calls  to store  the 
  950. directory entry, and for absolute read and write calls. It is not used by the 
  951. new MSX-DOS  read and  write functions.  The address  is set back to 80h by a 
  952. DISK RESET call.
  953.  
  954.  
  955.  
  956.  
  957.   3.28   GET ALLOCATION INFORMATION (1BH)
  958.  
  959.      Parameters:    C = 1BH (_ALLOC)
  960.                     E = Drive number (0=current, 1=A: etc)
  961.      Results:       A = Sectors per cluster
  962.                    BC = Sector size (always 512)
  963.                    DE = Total clusters on disk
  964.                    HL = Free clusters on disk
  965.                    IX = Pointer to DPB
  966.                    IY = Pointer to first FAT sector  
  967.  
  968.  
  969.    This function  returns various information about the disk in the specified 
  970. drive.  It is  not compatible  with CP/M  which uses  this function number to 
  971. return the  address of an allocation vector. Note that unlike MSX-DOS 1, only 
  972. the  first sector  of the FAT may be accessed from the address in IY, and the 
  973. data there will only remain valid until the next MSX-DOS call.
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.   3.29   RANDOM READ [FCB] (21H)
  992.  
  993.      Parameters:    C = 21H (_RDRND)
  994.                    DE = Pointer to opened FCB
  995.      Results:     L=A = 01H if error (end of file)
  996.                            0  if read was successful
  997.  
  998.  
  999.    This function  reads a  128 byte  record from the file to the current disk 
  1000. transfer  address. The  file position  is defined  by the  three byte  random 
  1001. record number  in the  FCB (bytes  21h...23h). Unlike CP/M all three bytes of 
  1002. the  random record  number are  used. A partial record at the end of the file 
  1003. will be padded with zeroes before being copied to the user's DTA.
  1004.  
  1005.  
  1006.    The  random  record  number is  not altered  so successive  calls to  this 
  1007. function  will read  the same  record unless the transient program alters the 
  1008. random record number. A side effect is that the current record and extent are 
  1009. set up  to refer  to the  same record as the random record number. This means 
  1010. that  sequential reads  (or writes)  can follow  a random read and will start 
  1011. from the  same record. The record count byte is also set up correctly for the 
  1012. extent.
  1013.  
  1014.  
  1015.  
  1016.  
  1017.   3.30   RANDOM WRITE [FCB] (22H)
  1018.  
  1019.      Parameters:    C = 22H (_WRRND)
  1020.                    DE = Pointer to opened FCB
  1021.      Results:     L=A = 01H if error (disk full)
  1022.                         =  0  if no error 
  1023.  
  1024.  
  1025.    This  function writes  a 128  byte record  from the  current disk transfer 
  1026. address to  the file,  at the  record position  specified by  the three  byte 
  1027. random  record number (bytes 21h...23h). All three bytes of the random record 
  1028. number are  used. If  the record  position is  beyond the current end of file 
  1029. then un-initialized disk space will be allocated to fill the gap.
  1030.  
  1031.  
  1032.  
  1033.    The random record number field will not be changed, but the current record 
  1034. and extent  fields will  be set  up to  refer to  the same record. The record 
  1035. count  byte will be adjusted as necessary if the file is being extended or if 
  1036. the write goes into a new extent. 
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.   3.31   GET FILE SIZE [FCB] (23H)
  1047.  
  1048.      Parameters:    C = 23H (_FSIZE)
  1049.                    DE = Pointer to unopened FCB
  1050.      Results:     L=A = 0FFH if file not found
  1051.                         =   0  if file found OK
  1052.  
  1053.  
  1054.  
  1055.    This function  searches for  the first match with the filename in the FCB, 
  1056. exactly the same as OPEN FILE (function 0FH). The size of the located file is 
  1057. rounded up to the nearest 128 bytes and the number of records determined. The 
  1058. three byte random record field of the FCB is set to the number of records, so 
  1059. it is the number of the first record which does not exist. The fourth byte of 
  1060. the random record number is not altered.
  1061.  
  1062.  
  1063.  
  1064.  
  1065.   3.32   SET RANDOM RECORD [FCB] (24H)
  1066.  
  1067.      Parameters:    C = 24H (_SETRND)
  1068.                    DE = Pointer to opened FCB
  1069.      Results:       None
  1070.  
  1071.  
  1072.  
  1073.    This function simply sets the three byte random record field in the FCB to 
  1074. the record  determined by  the current  record and  extent number. The fourth 
  1075. byte  of the  random record  number is  not altered.  No check  is done as to 
  1076. whether the record actually exists in the file.
  1077.  
  1078.  
  1079.  
  1080.  
  1081.   3.33   RANDOM BLOCK WRITE [FCB] (26H)
  1082.  
  1083.      Parameters:    C = 26H (_WRBLK)
  1084.                    DE = Pointer to opened FCB
  1085.                    HL = Number of records to write
  1086.      Results:       A = 01H if error 
  1087.                       =  0  if no error
  1088.  
  1089.  
  1090.    Data  is written from the current disk transfer address to the position in 
  1091. the file  defined by  the random record number. The record size is determined 
  1092. by  the record size field in the FCB (bytes 0Eh and 0Fh) which must be set by 
  1093. the user  after opening  the file  and before  calling this  function. If the 
  1094. record  size is  less than  64 bytes then all four bytes of the random record 
  1095. number are used, otherwise only the first three are used.
  1096.  
  1097.    The number  of records to be written is specified by HL, and together with 
  1098. the  record size  this determines  the amount of data to be written. An error 
  1099. will be returned if the size exceeds 64k, thus limiting the maximum size of a 
  1100. transfer.
  1101.  
  1102.  
  1103.    After  writing the  data, the  random record field is adjusted to the next 
  1104. record number  in the file (ie. HL is added on to it). The current record and 
  1105. extent  fields are not used or altered. The file size field is updated if the 
  1106. file has been extended.
  1107.  
  1108.  
  1109.  
  1110.  
  1111.    The  record size  can be any value from 1...0FFFFh. Small record sizes are 
  1112. no less  efficient that  large record sizes so if desired the record size can 
  1113. be set to one and the record count then becomes a byte count. It is desirable 
  1114. to  write as much as possible with one function call since one large transfer 
  1115. will be quicker than several small ones.
  1116.  
  1117.  
  1118.    If  the number  of records  to write  (HL) is  zero then  no data  will be 
  1119. written, but  the size  of the file will be altered to the value specified by 
  1120. the random record field. This may be either longer or shorter than the file's 
  1121. current  size  and  disk  space  will  be  allocated  or  freed as  required. 
  1122. Additional  disk space  allocated in  this way will not be initialized to any 
  1123. particular value.
  1124.  
  1125.  
  1126.  
  1127.  
  1128.   3.34   RANDOM BLOCK READ [FCB] (27H)
  1129.  
  1130.      Parameters:    C = 27H (_RDBLK)
  1131.                    DE = Pointer to opened FCB
  1132.                    HL = Number of records to read
  1133.      Results:       A = 01H if error (usually caused by end-of-file)
  1134.                       =  0  if no error
  1135.                    HL = Number of records actually read
  1136.  
  1137.  
  1138. This  function is  the complement of the BLOCK WRITE function described above 
  1139. and most of the same comments apply as regards its use. Again if large blocks 
  1140. are read then it will be much faster than the normal CP/M operation.
  1141.    For example if it is desired to read 20k from a file, it is better to read 
  1142. the 20k  with one  function call rather than 20 separate function calls of 1k 
  1143. each.  However it  makes no  difference whether  the 20k  read is done with a 
  1144. record size  of 1  and a record count of 20k, with a record size of 20k and a 
  1145. record count of 1, or any intermediate combination.
  1146.  
  1147.  
  1148.  
  1149.  
  1150.    The number of records actually read is returned in HL. This may be smaller 
  1151. than the  number of records requested if the end of the file was encountered. 
  1152. In  this case  any partial record will be padded out with zeroes before being 
  1153. copied to  the users  DTA. The  random record  field is adjusted to the first 
  1154. record not read, ie. the value returned in HL is added on to it.
  1155.  
  1156.  
  1157.  
  1158.   3.35   RANDOM WRITE WITH ZERO FILL [FCB] (28H)
  1159.  
  1160.      Parameters:    C = 28H (_WRZER)
  1161.                    DE = Pointer to opened FCB
  1162.      Results:     L=A = 01H if error
  1163.                      = 00H if no error
  1164.  
  1165.  
  1166.    This  function is  identical to RANDOM WRITE (function 22h) except that if 
  1167. the file has to be extended, any extra allocated disk clusters will be filled 
  1168. with zeroes before writing the data. 
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.   3.36   GET DATE (2AH)
  1175.  
  1176.      Parameters:    C = 2AH (_GDATE)
  1177.      Results:      HL = Year 1980...2079
  1178.                    D = Month (1=Jan...12=Dec)
  1179.                    E = Date (1...31)
  1180.                    A = Day of week (0=Sun...6=Sat)    
  1181.  
  1182.    This function simply returns the current value of the internal calender in 
  1183. the format shown.
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.   3.37   SET DATE (2BH)
  1190.  
  1191.      Parameters:    C = 2BH (_SDATE)
  1192.                    HL = Year 1980...2079
  1193.                    D = Month (1=Jan...12=Dec)
  1194.                    E = Date (1...31)
  1195.      Results:      A = 00H if date was valid
  1196.                        FFH if date was invalid
  1197.  
  1198.  
  1199.    The supplied  date is  checked for  validity and if it is valid then it is 
  1200. stored  as the  new date.  The validity  checks include full checking for the 
  1201. number of  days in each month and leap years. If the date is invalid then the 
  1202. current  date will  be left  unaltered. The  date is  stored in the real time 
  1203. clock chip so it will be remembered when the machine is turned off.
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209.  
  1210.  
  1211.   3.38   GET TIME (2CH)
  1212.  
  1213.      Parameters:    C = 2CH (_GTIME)
  1214.      Results:       H = Hours (0...23)
  1215.                     L = Minutes (0...59)
  1216.                     D = Seconds (0...59)
  1217.                     E = Centiseconds (always zero)
  1218.  
  1219.    This function  returns the current value of the system clock in the format 
  1220. shown.
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226.   3.39   SET TIME (2DH)
  1227.  
  1228.      Parameters:    C = 2DH (_STIME)
  1229.                     H = Hours (0...23)
  1230.                     L = Minutes (0...59)
  1231.                     D = Seconds (0...59)
  1232.                     E = Centiseconds (ignored)
  1233.      Results:       A = 00H if time was valid
  1234.                         FFH if time was invalid
  1235.  
  1236.  
  1237.    This function  sets the internal system clock to the specified time value. 
  1238. If  the time  is invalid then register A will be returned as 0FFh to indicate 
  1239. an error  and the  current time will be left unaltered. The time is stored in 
  1240. the  real time  clock chip and so it will be remembered and kept correct when 
  1241. the machine is turned off.
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.   3.40   SET/RESET VERIFY FLAG (2EH)
  1248.  
  1249.      Parameters:    C = 2EH (_VERIFY)
  1250.                     E =  0 to disable verify
  1251.                       <> 0 to enable verify  
  1252.      Results:       None
  1253.  
  1254.    This function  simply enables  or disables  automatic verification  of all 
  1255. writes.  It  defaults  to off  when MSX-DOS  is started  up. Enabling  verify 
  1256. improves  system reliability  but also slows down write operations. Note that 
  1257. this function  depends on  the disk  driver and  the verification will not be 
  1258. done if the driver does not support it.
  1259.  
  1260.  
  1261.  
  1262.  
  1263.  
  1264.  
  1265.  
  1266.   3.41   ABSOLUTE SECTOR READ (2FH)
  1267.  
  1268.      Parameters:    C = 2FH (_RDABS)
  1269.                    DE = Sector number
  1270.                     L = Drive number (0=A: etc.)
  1271.                     H = Number of sectors to read
  1272.      Results:       A = Error code (0=> no error)
  1273.  
  1274.  
  1275.  
  1276.    This function  reads sectors  directly from  the disk without interpreting 
  1277. them  as files.  The disk  must be  a valid  DOS disk in order for the sector 
  1278. number to  be translated  into a  physical position  on the disk. The sectors 
  1279. will  be read  to the  current disk  transfer address. Any disk error will be 
  1280. reported by the system in the usual way.
  1281.  
  1282.  
  1283.  
  1284.  
  1285.   3.42   ABSOLUTE SECTOR WRITE (30H)
  1286.  
  1287.      Parameters:    C = 30H (_WRABS)
  1288.                    DE = Sector number
  1289.                     L = Drive number (0=A: etc.)
  1290.                     H = Number of sectors to write
  1291.      Results:       A = Error code
  1292.  
  1293.  
  1294.  
  1295.    This  function writes  sectors directly  to the  disk without interpreting 
  1296. them as  files. The  disk must  be a  valid DOS  disk in order for the sector 
  1297. number  to be  translated into  a physical  position on the disk. The sectors 
  1298. will be  written from  the current disk transfer address. Any disk errors are 
  1299. reported by the system in the usual way.
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.   3.43   GET DISK PARAMETERS (31H)
  1322.  
  1323.      Parameters:    C = 31H (_DPARM)
  1324.                    DE = Pointer to 32 byte buffer
  1325.                     L = Drive number (0=default, 1=A: etc.)
  1326.      Results:       A = Error code
  1327.                    DE = Preserved
  1328.  
  1329.  
  1330.    This functions  returns a  series of  parameters relating to the format of 
  1331. the  disk in  the specified  drive, to the buffer allocated within the user's 
  1332. program. It  is useful  for programs  which are  going to  do absolute sector 
  1333. reads  and writes,  in order  for them  to be  able to interpret the absolute 
  1334. sector numbers. The parameters returned contain some redundant information in 
  1335. order to  provide parameters which are most useful to transient programs. The 
  1336. format of the returned parameter block is:
  1337.  
  1338.  
  1339.      DE+0      - Physical drive number (1=A: etc)
  1340.      DE+1,2    - Sector size (always 512 currently)
  1341.      DE+3      - Sectors per cluster (non-zero power of 2)
  1342.      DE+4,5    - Number of reserved sectors (usually 1)
  1343.      DE+6      - Number of copies of the FAT (usually 2)
  1344.      DE+7,8    - Number of root directory entries
  1345.      DE+9,10   - Total number of logical sectors
  1346.      DE+11     - Media descriptor byte
  1347.      DE+12     - Number of sectors per FAT
  1348.      DE+13..14 - First root directory sector number
  1349.      DE+15..16 - First data sector number
  1350.      DE+17..18 - Maximum cluster number
  1351.      DE+19     - Dirty disk flag
  1352.      DE+20..23 - Volume id. (-1 => no volume id.)
  1353.      DE+24..31 - Reserved (currently always zero)  
  1354.  
  1355.    The dirty  disk flag  indicates whether  in the disk there is a file which 
  1356. can  be recovered  by UNDEL  command. It is reset when the file allocation is 
  1357. done.
  1358.  
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.   3.44   FIND FIRST ENTRY (40H)
  1377.  
  1378.      Parameters:    C = 40H (_FFIRST) 
  1379.                    DE = Drive/path/file ASCIIZ string
  1380.                                 or fileinfo block pointer
  1381.                         HL = filename ASCIIZ string (only if
  1382.                                 DE = fileinfo pointer)
  1383.                          B = Search attributes
  1384.                    IX = Pointer to new fileinfo block
  1385.      Results:       A = Error
  1386.                  (IX) = Filled in with matching entry 
  1387.  
  1388.  
  1389.    The "drive/path" portion of the string, or the fileinfo block, specifies a 
  1390. directory which  is to  be searched.  A ".IATTR"  error will be returned if a 
  1391. fileinfo  block which  specifies a  file is passed. The "file" portion of the 
  1392. string, or  the filename  ASCIIZ string in HL, determines what filenames will 
  1393. be matched. If no match is found then a ".NOFIL" error is returned, otherwise 
  1394. the  fileinfo block  pointed to  by IX  is filled  in with the details of the 
  1395. matching entry.
  1396.  
  1397.  
  1398.    The filename  may contain  ambiguous filename  characters ("?"  or "*") in 
  1399. which case the first matching entry will be returned. If the filename is null 
  1400. (either  the ASCIIZ  string pointed  to by DE is null or ends in a "\" or the 
  1401. filename string  pointed to  by HL  is null),  then this function will behave 
  1402. exactly as if the filename was "*.*" so any name will match.
  1403.  
  1404.  
  1405.    The  attributes byte  in register  B specifies  what type of entry will be 
  1406. matched. If  it is zero then only non-hidden, non-system files will be found. 
  1407. If  the directory,  hidden or  system bits in register B are set then entries 
  1408. with these  attributes will  be matched  as well  as ordinary files. The read 
  1409. only and archive bits of register B are ignored.
  1410.  
  1411.  
  1412.    If the  volume name bit of register B is set then the search is exclusive, 
  1413. only  the volume  label entry  will be  found. In this case also the fileinfo 
  1414. block  and  filename or  the drive/path/file  string are  ignored apart  from 
  1415. specifying the drive. This means that the volume name will always be found in 
  1416. the root directory if it exists whether or not it matches the filename given.
  1417.  
  1418.  
  1419.  
  1420.    If DE  points to  a fileinfo  block, then  if desired, IX can point to the 
  1421. same  fileinfo block.  In this  case when  a match  is found the new fileinfo 
  1422. block will overwrite the old one.
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.   3.45   FIND NEXT ENTRY (41H)
  1432.  
  1433.      Parameters:    C = 41H (_FNEXT) 
  1434.                         IX = Pointer to fileinfo block from
  1435.                              previous find first function. 
  1436.      Results:       A = Error
  1437.                  (IX) = Filled in with next matching entry 
  1438.  
  1439.  
  1440.  
  1441.    This function  should only  be used  after a  "find first  entry" function 
  1442. call.  It  searches  the  directory  for the  next match  to the  (presumably 
  1443. ambiguous)  filename which was given to the "find first entry" function call. 
  1444. If there  are no  more matching  entries then  a ".NOFIL"  error is returned, 
  1445. otherwise  the fileinfo block is filled in with the information about the new 
  1446. matching entry.
  1447.  
  1448.  
  1449.  
  1450.  
  1451.   3.46   FIND NEW ENTRY (42H)
  1452.  
  1453.      Parameters:    C = 42H (_FNEW) 
  1454.                         DE = Drive/path/file ASCIIZ string
  1455.                                 or fileinfo block pointer
  1456.                         HL = filename ASCIIZ string (only if
  1457.                                 DE = fileinfo pointer)
  1458.                          B = b0..b6 = Required attributes
  1459.                              b7 = Create new flag
  1460.                    IX = Pointer to new fileinfo block
  1461.                          containing template filename
  1462.      Results:       A = Error
  1463.                  (IX) = Filled in with new entry 
  1464.  
  1465.  
  1466.    This function is very similar to the "find first entry" function described 
  1467. above. The  parameters in  HL and  DE are  used in  exactly the  same way  to 
  1468. specify  a  directory  entry.  However  instead  of  searching  the  selected 
  1469. directory  for an entry which matches the specified name, a new entry will be 
  1470. created with this name. The fileinfo block pointed to by IX will be filled in 
  1471. with information  about the  new entry  just as  if it  had been found with a 
  1472. "find first entry" call.
  1473.  
  1474.  
  1475.    If there  are any  ambiguous characters ("?" or "*") in the filename, then 
  1476. they will be replaced by the appropriate character from a "template filename" 
  1477. in  the filename  position of the new fileinfo block pointed to by IX. If the 
  1478. result is  still ambiguous,  or otherwise  illegal, then  a ".IFNM"  error is 
  1479. returned. This is useful for copy operations which do an automatic rename.
  1480.  
  1481.  
  1482.    Like  "find first entry", if the filename is null, then it will be treated 
  1483. exactly as  if it  was "*.*".  For this function that means that the template 
  1484. filename will be used as the new filename to create.
  1485.  
  1486.    A  ".DRFUL"  error  will  be  returned if  there is  no room  in the  root 
  1487. directory, and a ".DKFUL" if a sub-directory must be extended and the disk is 
  1488. already full.
  1489.  
  1490.  
  1491.    The  attribute byte  passed in  register B  is the attribute which the new 
  1492. entry will be given. If the volume name bit is set then a volume name will be 
  1493. created in  the root  directory. If  the directory  bit is set then the entry 
  1494. created  will be  for a  sub-directory, otherwise  it will be for a file. The 
  1495. system, hidden  and read  only bits may be set for a file, and the hidden bit 
  1496. for a sub-directory. A file will always be created with the archive attribute 
  1497. bit set.
  1498.  
  1499.  
  1500.    A file  will be  created as  zero length with the current date and time. A 
  1501. sub-directory will have a single cluster allocated to it and the "." and ".." 
  1502. entries will be initialized appropriately.
  1503.  
  1504.  
  1505.    If there is already an entry with the specified name in the directory then 
  1506. the action depends on the "create new" flag (bit-7 of register B) and also on 
  1507. the type  of the entry. If the "create new" flag is set then a ".FILEX" error 
  1508. will  always be returned. Setting this flag thereforeensures that an existing 
  1509. file will not be deleted.
  1510.  
  1511.  
  1512.    If  an entry  already exists and the "create new" flag is not set then the 
  1513. type of  the existing  entry is  examined to see whether it can be deleted to 
  1514. make  room for the new file. An error will be returned if the entry is a read 
  1515. only file  (".FILRO" error), a system file (".SYSX" error) or a sub-directory 
  1516. (".DIRX" error) or there is a file handle already open to this file (".FOPEN" 
  1517. error). If we are trying to create a sub-directory then even an ordinary file 
  1518. will not be deleted (".FILEX" error).
  1519.  
  1520.  
  1521.    For  all  of  these  error  codes (".FILEX",  ".FILRO", ".SYSX",  ".DIRX", 
  1522. ".FOPEN"),  the  fileinfo  block will  be filed  in with  the details  of the 
  1523. already  existing entry  and this fileinfo block may be used exactly as if it 
  1524. had been returned from a "find first" function.
  1525.  
  1526.  
  1527.  
  1528.  
  1529.  
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.   3.47   OPEN FILE HANDLE (43H)
  1542.  
  1543.      Parameters:    C = 43H (_OPEN) 
  1544.                    DE = Drive/path/file ASCIIZ string
  1545.                             or fileinfo block pointer
  1546.                     A = Open mode. b0 set => no write
  1547.                                    b1 set => no read
  1548.                                    b2 set => inheritable   
  1549.                                    b3..b7   -  must be clear
  1550.      Results:       A = Error
  1551.                     B = New file handle  
  1552.  
  1553.  
  1554.    The  drive/path/file string or the fileinfo block should normally refer to 
  1555. a file  rather than  a sub-directory  or volume  name. If it is a volume name 
  1556. then a ".IATTR" error will be returned. If it is a sub-directory then ".DIRX" 
  1557. error will be returned.
  1558.  
  1559.  
  1560.    Assuming that a file is specified then it will be opened ready for reading 
  1561. and/or writing (depending on the open mode in A) and a new file handle for it 
  1562. will  be returned in register B. The lowest available file handle number will 
  1563. be used and an error will result if there are no spare file handles (".NHAND" 
  1564. error), or insufficient memory (".NORAM" error).
  1565.  
  1566.  
  1567.    If the  "no read" bit of register A is set then reads from the file handle 
  1568. will  be  rejected  and if  the "no  write" bit  is set  then writes  will be 
  1569. rejected,  in both  cases with an ".ACCV" error. Writes will also be rejected 
  1570. if  the  file is  read only  (".FILRO" error).  If the  "inheritable" bit  of 
  1571. register A  is set  then the  file handle  will be inherited by a new process 
  1572. created by the "fork" function call (see function 60h).
  1573.  
  1574.  
  1575.  
  1576.    If a  device file  handle is opened by giving a filename which matches one 
  1577. of  the built in devices (for example "CON" or "NUL"), then it will always be 
  1578. opened initially in ASCII mode. The IOCTL function (function 4Bh) can be used 
  1579. to change  this to  binary mode  but great care must be taken in reading from 
  1580. devices in binary mode because there is no end of file condition.
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.  
  1589.  
  1590.  
  1591.  
  1592.  
  1593.  
  1594.  
  1595.  
  1596.   3.48   CREATE FILE HANDLE (44H)
  1597.  
  1598.      Parameters:    C = 44H (_CREATE) 
  1599.                    DE = Drive/path/file ASCIIZ string
  1600.                     A = Open mode. b0 set => no write
  1601.                                    b1 set => no read
  1602.                                    b2 set => inheritable   
  1603.                                  b3..b7   -  must be clear
  1604.                     B = b0..b6 = Required attributes
  1605.                             b7 = Create new flag
  1606.      Results:       A = Error
  1607.                     B = New file handle  
  1608.  
  1609.  
  1610.    A file  or sub-directory,  as specified  by the  attributes in register B, 
  1611. will  be  created  with  the  name  and  in  the  directory specified  by the 
  1612. drive/path/file  string. A ".IATTR" error is returned if register B specifies 
  1613. a volume name.
  1614.  
  1615.  
  1616.    An error  will be returned if the file or sub-directory cannot be created. 
  1617. The  error conditions  in this  case are the same as for the "find new entry" 
  1618. function (function  42h) with  the main  error codes being ".FILEX", ".DIRX", 
  1619. ".SYSX",  ".FILRO",  ".FOPEN",  ".DRFUL" and  ".DKFUL". Like  the "find  new" 
  1620. function,  if the  "create new"  flag (bit-7  of register  B) is  set then an 
  1621. existing file will not be deleted and will always return a ".FILEX" error.
  1622.  
  1623.  
  1624.    If the  attributes byte  specifies a sub-directory then the hidden bit may 
  1625. also  be set to create a hidden sub-directory. For a file, the hidden, system 
  1626. or  read  only  bits  may  be  set  to  create  a  file with  the appropriate 
  1627. attributes. An  invalid attributes  bits will  simply be ignored. A file will 
  1628. always be created with the archive attribute bit set.
  1629.  
  1630.  
  1631.  
  1632.    A  file  will  automatically  be opened  just as  for the  "open" function 
  1633. described above,  and a  file handle  returned in register B. The "open mode" 
  1634. parameter  is  interpreted  in the  same way  as for  the "open"  function. A 
  1635. sub-directory  will not be opened (because this is meaningless) so register B 
  1636. will be returned as 0FFh which can never be a valid file handle.
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.   3.49   CLOSE FILE HANDLE (45H)
  1652.  
  1653.      Parameters:    C = 45H (_CLOSE) 
  1654.                     B = File handle
  1655.      Results:       A = Error
  1656.  
  1657.  
  1658.  
  1659.    This  function  releases  the  specified file  handle for  re-use. If  the 
  1660. associated file  has been written to then its directory entry will be updated 
  1661. with  a new  date and  time, the  archive attributes bit will be set, and any 
  1662. buffered data  will be  flushed to  disk. Any  subsequent attempt to use this 
  1663. file  handle will return an error. If there are any other copies of this file 
  1664. handle, created by "duplicate file handle" or "fork", then these other copies 
  1665. may still be used. 
  1666.  
  1667.  
  1668.   3.50   ENSURE FILE HANDLE (46H)
  1669.  
  1670.      Parameters:    C = 46H (_ENSURE) 
  1671.                     B = File handle
  1672.      Results:       A = Error
  1673.  
  1674.  
  1675.  
  1676.    If  the file  associated with the file handle has been written to then its 
  1677. directory  entry  will  be  updated with  a new  date and  time, the  archive 
  1678. attributes bit  will be  set, and  any buffered data will be flushed to disk. 
  1679. The file handle is not released and so it can still be used for accessing the 
  1680. file, and the current file pointer setting will not be altered.
  1681.  
  1682.  
  1683.  
  1684.  
  1685.   3.51   DUPLICATE FILE HANDLE (47H)
  1686.  
  1687.      Parameters:    C = 47H (_DUP) 
  1688.                     B = File handle
  1689.      Results:       A = Error
  1690.                     B = New file handle
  1691.  
  1692.  
  1693.    This  function creates  a copy  of the  specified file  handle. The lowest 
  1694. available  file  handle  number  will  always  be used  and a  ".NHAND" error 
  1695. returned if  there are  none available. The new file handle will refer to the 
  1696. same  file as the original and either one may be used. If the file pointer of 
  1697. one handle  is moved,  the other  one will also be moved. If either handle is 
  1698. closed the other one may still be used.
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.    Note that  because duplicate file handles created by this function are not 
  1707. "separately  opened", they  do not  count as  separate file  handles for  the 
  1708. purposes of  generating ".FOPEN" errors. So for example a "DUP"ed file handle 
  1709. may  be renamed  (function 53h) or have its attributes changed (function 55h) 
  1710. and the  effect will  apply to  both file handles. Note in particular that if 
  1711. one  copy of  a "DUP"ed  file handle  is deleted (function 54h) then the file 
  1712. really will be deleted and the other file handle, although still open, can no 
  1713. longer be  used safely.  If it  is used  (other than being closed, ensured or 
  1714. deleted) then an ".FDEL" error will be returned. 
  1715.  
  1716.  
  1717.   3.52   READ FROM FILE HANDLE (48H)
  1718.  
  1719.      Parameters:    C = 48H (_READ) 
  1720.                     B = File handle
  1721.                    DE = Buffer address
  1722.                    HL = Number of bytes to read  
  1723.      Results:       A = Error
  1724.                    HL = Number of bytes actually read
  1725.  
  1726.  
  1727.    The  specified number  of bytes are read from the file at the current file 
  1728. pointer position  and copied  to the buffer address specified in register DE. 
  1729. The file pointer is then updated to the next sequential byte. A ".ACCV" error 
  1730. will  be returned if the file handle was opened with the "no read" access bit 
  1731. set.
  1732.  
  1733.  
  1734.    The number of bytes read may be less than the number requested for various 
  1735. reasons, and  the number  read will be returned in register HL if there is no 
  1736. error.  In general  if less  is read  than requested  then this should not be 
  1737. treated as  an error  condition but  another read  should be done to read the 
  1738. next portion, until a ".EOF" error is returned. An ".EOF" error will never be 
  1739. returned  for a partial read, only for a read which reads zero bytes. Reading 
  1740. files in  this way  ensures that device file handles will work correctly (see 
  1741. below).
  1742.  
  1743.  
  1744.    For disk  files the number of bytes read will only be less than the number 
  1745. requested  if the  end of  the file is reached and in this case the next read 
  1746. operation will  read zero bytes and will return an ".EOF" error. When reading 
  1747. from a device file handle (for example the standard file handles 0 to 4), the 
  1748. behaviour  depends on  the particular device, and on whether it is being read 
  1749. in ASCII  or binary  mode (see  function 4Bh below). The "CON" device will be 
  1750. described  as an  example because  it is  the most  commonly used device, but 
  1751. other devices behave similarly.
  1752.  
  1753.  
  1754.    When reading from the "CON" device in binary mode, characters will be read 
  1755. from the keyboard, without any interpretation and without being echoed to the 
  1756. screen or  printer. The  exact number  of characters requested will always be 
  1757. read and there is no end of file condition. Because of the lack of any end of 
  1758. file indication, great care must be taken when reading from devices in binary 
  1759. mode.
  1760.  
  1761.    A  read function  call to the "CON" device in ASCII mode (the default mode 
  1762. and that  which normally  applies to  the standard  input channel), will only 
  1763. read  one line  of input.  The input line will be read from the keyboard with 
  1764. the normal  line editing  facilities available to the user, and the character 
  1765. typed  will be  echoed to the screen and to the printer if Ctrl-P is enabled. 
  1766. Special control  characters "Ctrl-P", "Ctrl-N", "Ctrl-S" and "Ctrl-C" will be 
  1767. tested  for and  will be  treated exactly  as for the console status function 
  1768. 0Bh.
  1769.  
  1770.  
  1771.    When  the user types a carriage return the line will be copied to the read 
  1772. buffer, terminated  with a  CR-LF sequence  and the read function will return 
  1773. with  an appropriate  byte count.  The next  read will start another buffered 
  1774. line input  operation. If  the number of bytes requested in the read was less 
  1775. than the length of the line input then as many character as requested will be 
  1776. returned,  and the  next read  function call will return immediately with the 
  1777. next portion of the line until it has all been read.
  1778.  
  1779.  
  1780.  
  1781.    If the  user types a line which starts with a "Ctrl-Z" character then this 
  1782. will be interpreted as indicating end of file. The line will be discarded and 
  1783. the  read function  call will  read zero  bytes and return an ".EOF" error. A 
  1784. subsequent read after this will be back to normal and will start another line 
  1785. input. The end of file condition is thus not permanent.
  1786.  
  1787.  
  1788.  
  1789.  
  1790.   3.53   WRITE TO FILE HANDLE (49H)
  1791.  
  1792.      Parameters:    C = 49H (_WRITE) 
  1793.                     B = File handle
  1794.                    DE = Buffer address
  1795.                    HL = Number of bytes to write
  1796.      Results:       A = Error
  1797.                    HL = Number of bytes actually written
  1798.  
  1799.  
  1800.    This function is very similar to the "read" function above (function 48h). 
  1801. The number  of bytes  specified will  be written  to the current file pointer 
  1802. position  in the file, and the file pointer will be adjusted to point to just 
  1803. after the  last byte  written. If  the file  was opened  with the  "no write" 
  1804. access bit set then a ".ACCV" error will be returned, and if the file is read 
  1805. only then a ".FILRO" error will be returned.
  1806.  
  1807.  
  1808.    If the  write goes  beyond the  current end  of file then the file will be 
  1809. extended  as necessary.  If the file pointer is already beyond the end of the 
  1810. file then  disk space  will be  allocated to  fill the  gap and  will not  be 
  1811. initialized.  If there  is insufficient disk space then a ".DKFUL" error will 
  1812. be returned  and no  data will be written, even if there was room for some of 
  1813. the data.
  1814.  
  1815.  
  1816.    The number of bytes written can usually be ignored since it will either be 
  1817. zero  if an  error is returned or it will be equal to the number requested if 
  1818. the write  was successful. It is very much more efficient to write files in a 
  1819. few  large blocks  rather than many small ones, so programs should always try 
  1820. to write in as large blocks as possible.
  1821.  
  1822.    This function sets a "modified" bit for the file handle which ensures that 
  1823. when the  file handle  is closed or ensured, either explicitly or implicitly, 
  1824. the  directory entry  will be  updated with the new date, time and allocation 
  1825. information. Also  the archive bit will be set to indicate that this file has 
  1826. been modified since it was last archived.
  1827.  
  1828.  
  1829.    Writing  to device  file handles is not a complicated as reading from them 
  1830. because there  are no  end of  file conditions  or line input to worry about. 
  1831. There  are some differences between ASCII and binary mode when writing to the 
  1832. "CON" device, in that a console status check is done in ASCII mode only. Also 
  1833. printer echo if enabled will only be done in ASCII mode.
  1834.  
  1835.  
  1836.  
  1837.   3.54   MOVE FILE HANDLE POINTER (4AH)
  1838.  
  1839.      Parameters:    C = 4AH (_SEEK) 
  1840.                     B = File handle
  1841.                     A = Method code
  1842.                 DE:HL = Signed offset
  1843.      Results:       A = Error
  1844.                 DE:HL = New file pointer 
  1845.  
  1846.  
  1847.    The file pointer associated with the specified file handle will be altered 
  1848. according to  the method  code and offset, and the new pointer value returned 
  1849. in DE:HL. The method code specifies where the signed offset is relative to as 
  1850. follows:
  1851.  
  1852.      A=0  Relative to the beginning of the file
  1853.      A=1  Relative to the current position
  1854.      A=2  Relative to the end of the file.
  1855.  
  1856.  
  1857.    Note  that an  offset of  zero with an method code of 1 will simply return 
  1858. the current  pointer value,  and with a method code of 2 will return the size 
  1859. of  the file.  No end  of file  check is  done so  it is  quite possible (and 
  1860. sometimes useful)  to set  the file  pointer beyond  the end  of the file. If 
  1861. there  are any  copies of  this file  handle created  by the  "duplicate file 
  1862. handle" function  (function 47h)  or the  "fork" function (function 60h) then 
  1863. their file pointer will also be changed. 
  1864.  
  1865.    The file  pointer only  has any  real meaning  on disk  files since random 
  1866. access is possible. On device files the file pointer is updated appropriately 
  1867. when  any read  or write  is done,  and can  be examined  or altered  by this 
  1868. function.  However  changing will  have no  effect and  examining it  is very 
  1869. unlikely to be useful.
  1870.  
  1871.  
  1872.  
  1873.   3.55   I/O CONTROL FOR DEVICES (4BH)
  1874.  
  1875.      Parameters:    C = 4BH (_IOCTL) 
  1876.                     B = File handle
  1877.                     A = Sub-function code
  1878.                         00H => get file handle status
  1879.                         01H => set ASCII/binary mode
  1880.                         02H => test input ready
  1881.                         03H => test output ready
  1882.                         04H => find screen size
  1883.                    DE = Other parameters
  1884.      Results:       A = Error
  1885.                    DE = Other results
  1886.  
  1887.  
  1888.    This function  allows various  aspects of  file handles to be examined and 
  1889. altered.  In particular  it can  be used  to determine  whether a file handle 
  1890. refers to  a disk file or a device. This is useful for programs which want to 
  1891. behave differently for disk files and device I/O.
  1892.  
  1893.  
  1894.    This function  is passed  the file handle in register B and a sub-function 
  1895. code  in register  A which specifies one of various different operations. Any 
  1896. other  parameters  required  by  the  particular  sub-function are  passed in 
  1897. register DE and results are returned in register DE. If the sub-function code 
  1898. is invalid then a ".ISBFN" error will be returned.
  1899.  
  1900.  
  1901.    If A=0 then the operation is "get file handle status". This returns a word 
  1902. of flags  which give various information about the file handle. The format of 
  1903. this  word is  different for  device file  handles and disk file handles, and 
  1904. bit-7 specifies which it is. The format of the word is as follows:
  1905.  
  1906.  
  1907. For devices:    DE -     b0  set  => console input device
  1908.                          b1  set  => console output device
  1909.                      b2..b4  reserved
  1910.                          b5  set  => ASCII mode
  1911.                              clear=> binary mode
  1912.                          b6  set  => end of file
  1913.                          b7  always set (=> device)
  1914.                     b8..b15  reserved 
  1915.  
  1916.  
  1917. For disk files: DE - b0..b5  drive number (0=A: etc)
  1918.                          b6  set  => end of file
  1919.                          b7  always clear (=> disk file)
  1920.                     b8..b15  reserved 
  1921.  
  1922.  
  1923.  
  1924.  
  1925.  
  1926.    Note  that the end of file flag is the same for devices as for disk files. 
  1927. For devices  it will  be set  if the previous attempt to read from the device 
  1928. produced  a ".EOF" error and will be cleared by the next read. For disk files 
  1929. it is worked out by comparing the file pointer with the file size.
  1930.  
  1931.    If  A=1 then the operation is a "set ASCII/binary mode". This operation is 
  1932. only allowed  for device file handles. An ASCII/binary flag must be passed in 
  1933. bit-5  of  register  E  (exactly  where it  is returned  by "get  file handle 
  1934. status").  This is  set for  ASCII mode  and clear for binary mode. All other 
  1935. bits of register DE are ignored.
  1936.  
  1937.  
  1938.    If A=2  or 3  then the  operation is  "test input  ready" or  "test output 
  1939. ready"  respectively. In both cases a flag is returned in register E which is 
  1940. FFh if  the file  handle is  ready for  a character and 00h if not. The exact 
  1941. meaning  of "ready  for a character" depends on the device. Disk file handles 
  1942. are always  ready for  output, and are always ready for input unless the file 
  1943. pointer is at the end of file. The "CON" device checks the keyboard status to 
  1944. determine whether it is ready for input or not.
  1945.  
  1946.  
  1947.  
  1948.    If A=4  the the  operation is  "get screen size". This returns the logical 
  1949. screen size for the file handle with the number of rows in register D and the 
  1950. number  of columns  in register  E. For  devices with no screen size (such as 
  1951. disk  files)  both  D  and  E  will be  zero. Zero  for either  result should 
  1952. therefore be interpreted as "unlimited". For example this function is used by 
  1953. the "DIR  /W" command to decide how many files to print per line, and a value 
  1954. of zero for register E is defaulted to 80.
  1955.  
  1956.  
  1957.  
  1958.   3.56   TEST FILE HANDLE (4CH)
  1959.  
  1960.      Parameters:    C = 4CH (_HTEST)
  1961.                     B = File handle
  1962.                    DE = Drive/path/file ASCIIZ string
  1963.                                  or fileinfo block pointer
  1964.      Results:       A = Error
  1965.                     B = 00H => not the same file
  1966.                         FFH => same file
  1967.  
  1968.  
  1969.    This  rather  specialist function  is passed  a file  handle and  either a 
  1970. drive/path/file  string  or  a  fileinfo block  which identifies  a file.  It 
  1971. determines if  the two  files are  actually the  same file and returns a flag 
  1972. indicating  the result.  Note that  if the file handle is for a device rather 
  1973. than a disk file then it will always return "B=00h" to indicate "not the same 
  1974. file".
  1975.  
  1976.  
  1977.    This function allows the "COPY" command to detect certain error conditions 
  1978. such as  copying file  onto themselves  and give  the user  informative error 
  1979. messages.  It may  also be useful for other programs which need to do similar 
  1980. tests.
  1981.  
  1982.  
  1983.   3.57   DELETE FILE OR SUBDIRECTORY (4DH)
  1984.  
  1985.      Parameters:    C = 4DH (_DELETE) 
  1986.                    DE = Drive/path/file ASCIIZ string
  1987.                                 or fileinfo block pointer
  1988.      Results:       A = Error
  1989.  
  1990.  
  1991.    This function  deletes the object (file or sub-directory) specified by the 
  1992. drive/path/file  string or the fileinfo block. Global filename characters are 
  1993. not  allowed  so only  one file  or sub-directory  can be  deleted with  this 
  1994. function. A  sub-directory can  only be  deleted if  it is  empty or an error 
  1995. (".DIRNE") occurs if not). The "." and ".." entries in a sub-directory cannot 
  1996. be  deleted (".DOT"  error) and neither can the root directory. A file cannot 
  1997. be deleted  if there  is a  file handle open to it (.FOPEN error) or if it is 
  1998. read only (.FILRO error).
  1999.  
  2000.    If  it is  a file  then any  disk space  which was allocated to it will be 
  2001. freed. If  the disk  is an MSX-DOS 2 disk then enough information is retained 
  2002. on  the disk  to allow the "UNDEL" utility program do undelete the file. This 
  2003. information is only retain ed until the next disk space allocation (usually a 
  2004. write to  a file) is done on this disk. After making this function call, if a 
  2005. fileinfo  block was passed then it must not be used again (other than passing 
  2006. it to  a "find  next entry"  function) since  the file  to which it refers no 
  2007. longer exists.
  2008.  
  2009.  
  2010.    If a device name such as "CON" is specified then no error will be returned 
  2011. but the device will not actually be deleted.
  2012.  
  2013.  
  2014.  
  2015.  
  2016.   3.58   RENAME FILE OR SUBDIRECTORY (4EH)
  2017.  
  2018.      Parameters:    C = 4EH (_RENAME) 
  2019.                    DE = Drive/path/file ASCIIZ string
  2020.                                 or fileinfo block pointer
  2021.                    HL = New filename ASCIIZ string 
  2022.      Results:       A = Error
  2023.  
  2024.  
  2025.    This function  renames the object (file or sub-directory) specified by the 
  2026. drive/path/file string or the fileinfo block, with the new name in the string 
  2027. pointed  to by HL. The new filename string must not contain a drive letter or 
  2028. directory path  (".IFNM" error if it does). If a device name such as "CON" is 
  2029. specified  then no error will be returned but the device will not actually be 
  2030. renamed.
  2031.  
  2032.    Global filename  characters are not allowed in the drive/path/file string, 
  2033. so  only one  object can be renamed by this function. However global filename 
  2034. characters are  allowed in the new filename passed in HL and where they occur 
  2035. the  existing filename  character will  be left unaltered. Checks are done to 
  2036. avoid creating an illegal filename, for example a file called "XYZ" cannot be 
  2037. renamed with  a new filename string of "????A" because the new filename would 
  2038. be "XYZ A" which is illegal. In this case a ".IFNM" error will be returned.
  2039.  
  2040.  
  2041.    If there is already an entry with the new filename then an error (".DUPF") 
  2042. is returned  to avoid  creating duplicate filenames. The "." and ".." entries 
  2043. in a sub-directory cannot be renamed (".IDOT" error) and neither can the root 
  2044. directory (it has noname). A file cannot be renamed if there is a file handle 
  2045. open to it (".FOPEN" error) although a read only file can be renamed.
  2046.  
  2047.  
  2048.  
  2049.    Note that  if DE pointed to a fileinfo block, this is not updated with the 
  2050. new  name of  the file.  Therefore care  must be  taken in using the fileinfo 
  2051. block after making this function call.
  2052.  
  2053.  
  2054.  
  2055.  
  2056.   3.59   MOVE FILE OR SUBDIRECTORY (4FH)
  2057.  
  2058.      Parameters:    C = 4FH (_MOVE) 
  2059.                    DE = Drive/path/file ASCIIZ string
  2060.                                 or fileinfo block pointer
  2061.                    HL = New path ASCIIZ string 
  2062.      Results:       A = Error
  2063.  
  2064.  
  2065.    This  function moves  the object  (file or sub-directory) specified by the 
  2066. drive/path/file string  or the  fileinfo block, to the directory specified by 
  2067. the  new path  string pointed to by HL. There must not be a drive name in the 
  2068. new path  string. If  a device  name such as "CON" is specified then no error 
  2069. will be returned but the device will not actually be moved.
  2070.  
  2071.  
  2072.    Global filename  characters are  not allowed in any of the strings so only 
  2073. one object (file or sub-directory) can be moved by this function, although if 
  2074. a sub-directory is moved, all its descendants will be moved with it. If there 
  2075. is  already an  entry of  the required  name in  the target  directory then a 
  2076. ".DUPF" error  is returned  to prevent  creating duplicate filenames. The "." 
  2077. and ".." entries in a sub-directory cannot be moved (".DOT" error) and also a 
  2078. directory  cannot be  moved into  one of  its own descendants (".DIRE" error) 
  2079. since this  would create an isolated loop in the filing system. A file cannot 
  2080. be moved if there is a file handle open to it (".FOPEN" error).
  2081.  
  2082.  
  2083.  
  2084.    Note  that if  a fileinfo  block is  passed to this function, the internal 
  2085. information in  the fileinfo block is not updated to reflect the new location 
  2086. of the file. This is necessary because otherwise the fileinfo block could not 
  2087. be used for a subsequent "find next" function call. However it does mean that 
  2088. the fileinfo block no longer refers to the moved file and so must not be used 
  2089. for any operations on it such as "rename" or "open".
  2090.  
  2091.  
  2092.  
  2093.   3.60   GET/SET FILE ATTRIBUTES (50H)
  2094.  
  2095.      Parameters:    C = 50H (_ATTR) 
  2096.                    DE = Drive/path/file ASCIIZ string
  2097.                                 or fileinfo block pointer
  2098.                     A = 0 => get attributes
  2099.                         1 => set attributes
  2100.                     L = New attributes byte (only if A=1)
  2101.      Results:       A = Error
  2102.                     L = Current attributes byte
  2103.  
  2104.  
  2105.    This function  is normally  used to  change the  attributes of  a file  or 
  2106. sub-directory.  It can  also be  used to  find out the current attributes but 
  2107. this is  more usually  done with  the "find  first entry"  function (function 
  2108. 40h).  If A=0  then the current attributes byte for the file or sub-directory 
  2109. will just be returned in register L.
  2110.  
  2111.  
  2112.    If A=1  then the attributes byte will be set to the new value specified in 
  2113. register  L, and this new value will also be returned in register L. Only the 
  2114. system, hidden,  read only  and archive  bits may  be altered for a file, and 
  2115. only  the hidden  bit for a sub-directory. An ".IATTR" error will be returned 
  2116. if an  attempt is made to alter any other attribute bits. If a fileinfo block 
  2117. is  passed then  the attributes  byte in  it will not be updated with the new 
  2118. setting.
  2119.  
  2120.  
  2121.  
  2122.    Global filename  characters are  not allowed  so only  one object (file or 
  2123. sub-directory)  can have  its attributes set by this function. The attributes 
  2124. of the  root directory  cannot be  changed because  it does not have any. The 
  2125. attributes  of a  file cannot be changed if there is a file handle open to it 
  2126. (".FOPEN"  error).  The  attributes  of the  "." and  ".." directory  entries 
  2127. however can  be changed.  If a device name such as "CON" is specified then no 
  2128. error  will be  returned but  the device's  attributes will  not actually  be 
  2129. changed (since it does not have any).
  2130.  
  2131.  
  2132.  
  2133.  
  2134.   3.61   GET/SET FILE DATE AND TIME (51H)
  2135.  
  2136.      Parameters:    C = 51H (_FTIME) 
  2137.                    DE = Drive/path/file ASCIIZ string
  2138.                                 or fileinfo block pointer
  2139.                     A = 0 => get date and time
  2140.                         1 => set date and time 
  2141.                    IX = New time value (only if A=1)
  2142.                    HL = New date value (only if A=1)
  2143.      Results:       A = Error
  2144.                    DE = Current file time value
  2145.                    HL = Current file date value 
  2146.  
  2147.  
  2148.    If  A=1 then  this function sets the date and time of last modification of 
  2149. the file or sub-directory specified by the drive/path/file string or fileinfo 
  2150. block. Global  filename characters  are not allowed in any part of the string 
  2151. so  only one  file can have its date and time modified by this function. If a 
  2152. device name such as "CON" is specified then no error will be returned but the 
  2153. device's date and time will not actually be changed.
  2154.  
  2155.  
  2156.    The date  and time  format are exactly as contained in the directory entry 
  2157. and  fileinfo blocks  (see the  "Program Interface Specification"). No checks 
  2158. are done for sensible dates or times, the values are simply stored. Note that 
  2159. if a fileinfo block is passed then the date and time stored in it will not be 
  2160. updated by this function.
  2161.  
  2162.  
  2163.    If  A=0 then  the current values are just returned. Note that although the 
  2164. time value is passed in IX, it is returned in DE. The date and time of a file 
  2165. cannot be altered (although it can be read) if there is a file handle open to 
  2166. the file (".FOPEN" error).
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.   3.62   DELETE FILE HANDLE (52H)
  2174.  
  2175.      Parameters:    C = 52H (_HDELETE) 
  2176.                     B = File handle
  2177.      Results:       A = Error
  2178.  
  2179.  
  2180.    This function  deletes the  file handle associated with the specified file 
  2181. and  closes the file handle. A file handle cannot be deleted if there are any 
  2182. other separately  opened file handles open to the same file (".FOPEN" error). 
  2183. If  there are any duplicates of the file handle (created by a "duplicate file 
  2184. handle" or  "fork" function), then these duplicates will be marked as invalid 
  2185. and any attempt to use them will produce an ".HDEAD" error.
  2186.  
  2187.  
  2188.  
  2189.    The  error conditions  for this  function are  the same as for the "delete 
  2190. file or  sub-directory" function  (function 4Dh). The file handle will always 
  2191. be closed, even if there is an error condition such as ".FILRO" or ".FOPEN".
  2192.  
  2193.  
  2194.  
  2195.  
  2196.  
  2197.  
  2198.  
  2199.  
  2200.  
  2201.   3.63   RENAME FILE HANDLE (53H)
  2202.  
  2203.      Parameters:    C = 53H (_HRENAME) 
  2204.                     B = File handle
  2205.                    HL = New filename ASCIIZ string 
  2206.      Results:       A = Error
  2207.  
  2208.  
  2209.    This  function renames  the file associated with the specified file handle 
  2210. with the  new name  in the  string pointed to by HL. Apart from the fact that 
  2211. the  file is  specified by  a file  handle rather  than an ASCIIZ string or a 
  2212. fileinfo  block,   this  function   is  identical  to  the  "rename  file  or 
  2213. subdirectory" function (function 4Eh), and has the same error conditions.
  2214.  
  2215.  
  2216.  
  2217.    A file  handle cannot  be renamed if there are any other separately opened 
  2218. file  handles for  this file  (".FOPEN" error), although it can be renamed if 
  2219. there are  copies of  this file  handle, and  in this case the copies will be 
  2220. renamed.  Renaming a  file handle will not alter the file pointer but it will 
  2221. do an implicit "ensure" operation.
  2222.  
  2223.  
  2224.  
  2225.  
  2226.   3.64   MOVE FILE HANDLE (54H)
  2227.  
  2228.      Parameters:    C = 54H (_HMOVE) 
  2229.                     B = File handle
  2230.                    HL = New path ASCIIZ string 
  2231.      Results:       A = Error
  2232.  
  2233.  
  2234.    This function  moves the file associated with the specified file handle to 
  2235. the  directory specified  by the new path string pointed to by HL. Apart from 
  2236. the fact  that the  file is  specified by a file handle rather than an ASCIIZ 
  2237. string  or a  fileinfo block, this function is identical to the "move file or 
  2238. subdirectory" function (function 4Fh), and has the same error conditions.
  2239.  
  2240.  
  2241.  
  2242.    A file  handle cannot  be moved  if there  are any other separately opened 
  2243. file  handles for  this file  (".FOPEN" error),  although it  can be moved if 
  2244. there are  copies of  this file handle, and in this case the copies will also 
  2245. be moved. Moving a file handle will not alter the file pointer but it will do 
  2246. an implicit "ensure" operation.
  2247.  
  2248.  
  2249.  
  2250.  
  2251.  
  2252.  
  2253.  
  2254.  
  2255.  
  2256.   3.65   GET/SET FILE HANDLE ATTRIBUTES (55H)
  2257.  
  2258.      Parameters:    C = 55H (_HATTR) 
  2259.                     B = File handle
  2260.                     A = 0 => get attributes
  2261.                         1 => set attributes
  2262.                     L = New attributes byte (only if A=1)
  2263.      Results:       A = Error
  2264.                     L = Current attributes byte
  2265.  
  2266.  
  2267.    This function gets or sets the attributes byte of the file associated with 
  2268. the specified  file handle. Apart from the fact that the file is specified by 
  2269. a file handle rather than an ASCIIZ string or a fileinfo block, this function 
  2270. is  identical to  the "get/set  file attributes" function (function 50h), and 
  2271. has the same error conditions.
  2272.  
  2273.  
  2274.  
  2275.    A  file handle  cannot have  its attributes  changed (although they can be 
  2276. read) if  there are  any other  separately opened  file handles for this file 
  2277. (".FOPEN"  error).  The  file pointer  will not  be altered  but an  implicit 
  2278. "ensure" operation will be done.
  2279.  
  2280.  
  2281.  
  2282.  
  2283.   3.66   GET/SET FILE HANDLE DATE AND TIME (56H)
  2284.  
  2285.      Parameters:    C = 56H (_HFTIME) 
  2286.                     B = File handle
  2287.                     A = 0 => get date and time
  2288.                         1 => set date and time 
  2289.                    IX = New time value (only if A=1)
  2290.                    HL = New date value (only if A=1)
  2291.      Results:       A = Error
  2292.                    DE = Current file time value
  2293.                    HL = Current file date value 
  2294.  
  2295.  
  2296.    This  function gets  or sets the date and time of the file associated with 
  2297. the specified  file handle. Apart from the fact that the file is specified by 
  2298. a file handle rather than an ASCIIZ string or a fileinfo block, this function 
  2299. is identical to the "get/set file date and time" function (function 51h), and 
  2300. has the same error conditions.
  2301.  
  2302.  
  2303.    A  file handle cannot have its date and time changed (although they can be 
  2304. read) if  there are  any other  separately opened  file handles for this file 
  2305. (".FOPEN"  error).  The  file pointer  will not  be altered  but an  implicit 
  2306. "ensure" operation will be done.
  2307.  
  2308.  
  2309.  
  2310.  
  2311.   3.67   GET DISK TRANSFER ADDRESS (57H)
  2312.  
  2313.      Parameters:    C = 57H (_GETDTA) 
  2314.      Results:      DE = Current disk transfer address
  2315.  
  2316.  
  2317.  
  2318.    This  function returns  the current disk transfer address. This address is 
  2319. only used  for the  "traditional" CP/M  style FCB  functions and the absolute 
  2320. sector read and write functions.
  2321.  
  2322.  
  2323.  
  2324.  
  2325.   3.68   GET VERIFY FLAG SETTING (58H)
  2326.  
  2327.      Parameters:    C = 58H (_GETVFY) 
  2328.      Results:       B = 00H => verify disabled
  2329.                         FFH => verify enabled
  2330.  
  2331.  
  2332.  
  2333.    This  function simply  returns the  current state of the verify flag which 
  2334. can be set with MSX-DOS function 2Eh.
  2335.  
  2336.  
  2337.  
  2338.  
  2339.   3.69   GET CURRENT DIRECTORY (59H)
  2340.  
  2341.      Parameters:    C = 59H (_GETCD) 
  2342.                     B = Drive number (0=current, 1=A: etc)
  2343.                    DE = Pointer to 64 byte buffer 
  2344.      Results:       A = Error
  2345.                    DE = Filled in with current path
  2346.  
  2347.  
  2348.  
  2349.    This  function  simply  gets  an  ASCIIZ  string representing  the current 
  2350. directory of the specified drive into the buffer pointed to by DE. The string 
  2351. will not  include a drive name or a leading or trailing "\" character, so the 
  2352. root directory is represented by a null string. The drive will be accessed to 
  2353. make sure that the current directory actually exists on the current disk, and 
  2354. if  not then  the current  directory will  be set back to the root and a null 
  2355. string returned.
  2356.  
  2357.  
  2358.  
  2359.  
  2360.  
  2361.  
  2362.  
  2363.  
  2364.  
  2365.  
  2366.   3.70   CHANGE CURRENT DIRECTORY (5AH)
  2367.  
  2368.      Parameters:    C = 5AH (_CHDIR) 
  2369.                    DE = Drive/path/file ASCIIZ string
  2370.      Results:       A = Error
  2371.  
  2372.  
  2373.  
  2374.    The drive/path/file  string must  specify a  directory rather than a file. 
  2375. The  current directory  of the drive will be changed to be this directory. If 
  2376. the  specified  directory does  not exist  then the  current setting  will be 
  2377. unaltered and a ".NODIR" error returned.
  2378.  
  2379.  
  2380.  
  2381.  
  2382.   3.71   PARSE PATHNAME (5BH)
  2383.  
  2384.      Parameters:    C = 5BH (_PARSE) 
  2385.                     B = Volume name flag (bit 4)
  2386.                         DE = ASCIIZ string for parsing
  2387.      Results:       A = Error
  2388.                    DE = Pointer to termination character
  2389.                    HL = Pointer to start of last item
  2390.                     B = Parse flags
  2391.                     C = Logical drive number (1=A: etc)
  2392.  
  2393.  
  2394.    This function is purely a string manipulation function, it will not access 
  2395. the disks  at all  and it  will not  modify the  user's string  at all. It is 
  2396. intended to help transient programs in parsing command lines.
  2397.  
  2398.  
  2399.    The volume  name flag (bit 4 of register B; it is in the same bit position 
  2400. as  the volume  name bit in an attributes byte) determines whether the string 
  2401. will be  parsed as  a "drive/path/file"  string (if  the bit is cleared) or a 
  2402. "drive/volume" string (if the bit is set).
  2403.  
  2404.  
  2405.    The pointer  returned in DE will point to the first character which is not 
  2406. valid in a pathname string, and may be the null at the end of the string. See 
  2407. the "Command Specification" for details of the syntax of pathname strings and 
  2408. also for a list of valid characters.
  2409.  
  2410.  
  2411.    The  pointer returned  in HL will point to the first character of the last 
  2412. item of  a string  (filename portion). For example, when a string "A:\XYZ\P.Q 
  2413. /F" was passed, DE will point to the white space character before "/F" and HL 
  2414. will  point to "P". If the parsed string ends with a character "\" or is null 
  2415. (apart from  drive name),  then there  will be no "last item", thus HL and DE 
  2416. will  point to the same character. In this case, some special procedures will 
  2417. be needed to all the programs which use this function.
  2418.  
  2419.  
  2420.  
  2421.    The  drive number returned in register C is the logical drive specified in 
  2422. the string.  If the  string did not start with a drive letter then register C 
  2423. will  contain the  default drive  number, since  the default  drive has  been 
  2424. implicitly specified. Register C will never be zero.
  2425.  
  2426.  
  2427.    The  parse flags  returned in  register B  indicate various  useful things 
  2428. about the  string. For  a volume  name bits  1, 4,  5, 6 and 7 will always be 
  2429. clear. For a filename, bits 3 to 7 relate to the last item on the string (the 
  2430. "filename" component). The bit assignments are as follows: 
  2431.  
  2432. b0 - set if any characters parsed other than drive name
  2433. b1 - set if any directory path specified
  2434. b2 - set if drive name specified
  2435. b3 - set if main filename specified in last item
  2436. b4 - set if filename extension specified in last item
  2437. b5 - set if last item is ambiguous
  2438. b6 - set if last item is "." or ".."
  2439. b7 - set if last item is ".."
  2440.  
  2441.  
  2442.  
  2443.  
  2444.   3.72   PARSE FILENAME (5CH)
  2445.  
  2446.      Parameters:    C = 5CH (_PFILE) 
  2447.                    DE = ASCIIZ string for parsing
  2448.                    HL = Pointer to 11 byte buffer
  2449.      Results:       A = Error (always zero)
  2450.                    DE = Pointer to termination character
  2451.                    HL = Preserved, buffer filled in
  2452.                     B = Parse flags
  2453.  
  2454.  
  2455.    This function is purely a string manipulation function, it will not access 
  2456. disks at  all and will not modify the string at all. It is intended mainly to 
  2457. help  transient programs  in printing  out filenames  in a formatted way. The 
  2458. ASCIIZ string will be parsed as a single filename item, and the filename will 
  2459. be  stored  in the  user's 11  byte buffer  in expanded  form, with  both the 
  2460. filename and the extension padded out with spaces.
  2461.  
  2462.  
  2463.    The parse  flags returned  in register  B are  identical to  those for the 
  2464. "parse  pathname" function  above (function 5Bh), except that bits 0, 1 and 2 
  2465. will always  be clear.  The user's  buffer will  always be filled in, even if 
  2466. there  is no  valid filename  in the string, in which case the buffer will be 
  2467. filled with spaces. "*" characters will be expanded to the appropriate number 
  2468. of "?"s.  If either  the filename  or the filename extension is too long then 
  2469. the excess characters will be ignored.
  2470.  
  2471.  
  2472.    The pointer  returned in  register DE will point to the first character in 
  2473. the  string which  was not part of the filename, which may be the null at the 
  2474. end of  the string.  This character  will never be a valid filename character 
  2475. (see the "Command Specification" for details of valid filename characters).
  2476.  
  2477.  
  2478.  
  2479.  
  2480.   3.73   CHECK CHARACTER (5DH)
  2481.  
  2482.      Parameters:    C = 5DH (_CHKCHR) 
  2483.                     D = Character flags
  2484.                     E = Character to be checked
  2485.      Results:       A = 0 (never returns an error)
  2486.                     D = Updated character flags
  2487.                     E = Checked (upper cased) character
  2488.  
  2489.  
  2490.    This  function allow  language independent  upper casing of characters and 
  2491. also helps with handling 16-bit characters and manipulation of filenames. The 
  2492. bit assignments in the character flags are as follows:
  2493.  
  2494.    b0   - set to suppress upper casing
  2495.    b1   - set if first byte of 16-bit character
  2496.    b2   - set if second byte of 16-bit character
  2497.    b3   - set => volume name (rather than filename)
  2498.    b4   - set => not a valid file/volume name character
  2499. b5...b7 - reserved (always clear)
  2500.  
  2501.  
  2502.    Bit 0  is used  to control upper casing. If it is clear then the character 
  2503. will be upper cased according to the language setting of the machine. If this 
  2504. bit  is  set  then the  returned character  will always  be the  same as  the 
  2505. character passed.
  2506.  
  2507.  
  2508.    The two  16-bit character  flags (bits 1 and 2) can both be clear when the 
  2509. first  character of  a string  is checked  and the  settings returned  can be 
  2510. passed straight  back to  this function  for each  subsequent character. Care 
  2511. must  be taken  with these  flags when moving backwards through strings which 
  2512. may contain 16-bit characters.
  2513.  
  2514.  
  2515.  
  2516.    Bit  4 is  set on return if the character is one of the set of filename or 
  2517. volume name  terminator characters. Bit 3 is simply used to determine whether 
  2518. to  test for filename or volume name characters since the sets are different. 
  2519. 16-bit characters  (either byte)  are never  considered as volume or filename 
  2520. terminators.
  2521.  
  2522.  
  2523.  
  2524.  
  2525.  
  2526.  
  2527.  
  2528.  
  2529.  
  2530.  
  2531.   3.74   GET WHOLE PATH STRING (5EH)
  2532.  
  2533.      Parameters:    C = 5EH (_WPATH) 
  2534.                         DE = Pointer to 64 byte buffer 
  2535.      Results:       A = Error
  2536.                    DE = Filled in with whole path string
  2537.                    HL = Pointer to start of last item 
  2538.  
  2539.  
  2540.    This  function simply copies an ASCIIZ path string from an internal buffer 
  2541. into the  user's buffer.  The string  represents the whole path and filename, 
  2542. from  the root  directory, of  a file  or sub-directory located by a previous 
  2543. "find first entry" or "find new entry" function. The returned string will not 
  2544. include a  drive, or  an initial "\" character. Register HL will point at the 
  2545. first  character of  the last  item on  the string, exactly as for the "parse 
  2546. path" function (function 5Bh).
  2547.  
  2548.  
  2549.    If a  "find first entry" or "find new entry" function call is done with DE 
  2550. pointing to an ASCIIZ string then a subsequent "get whole path" function call 
  2551. will  return a string representing the sub-directory or file corresponding to 
  2552. the  fileinfo   block  returned   by  the  "find"  function.  If  this  is  a 
  2553. sub-directory  then the  fileinfo block  may be passed back in register DE to 
  2554. another "find  first entry"  function call,  which will  locate a file within 
  2555. this  sub-directory. In  this case  the newly located file will be added onto 
  2556. the already  existing whole  path string internally, and so a subsequent "get 
  2557. whole  path string" function call will return a correct whole path string for 
  2558. the located file.
  2559.  
  2560.  
  2561.  
  2562.    Great care must be taken in using this function because the internal whole 
  2563. path  string is modified by many of the function calls, and in many cases can 
  2564. be invalid.  The "get  whole path"  function call  should be done immediately 
  2565. after  the  "find  first  entry"  or "find  new entry"  function to  which it 
  2566. relates.
  2567.  
  2568.  
  2569.  
  2570.  
  2571.   3.75   FLUSH DISK BUFFERS (5FH)
  2572.  
  2573.      Parameters:    C = 5FH (_FLUSH) 
  2574.                     B = Drive number (0=current, FFH=all)
  2575.                     D = 00H => Flush only
  2576.                       = FFH => Flush and invalidate 
  2577.      Results:       A = Error
  2578.  
  2579.  
  2580.    This  function flushes  any dirty disk buffers for the specified drive, or 
  2581. for all drives if B=FFh. If register D is FFh then all buffers for that drive 
  2582. will also be invalidated. 
  2583.  
  2584.  
  2585.  
  2586.  
  2587.   3.76   FORK TO CHILD PROCESS (60H)
  2588.  
  2589.      Parameters:    C = 60H (_FORK) 
  2590.      Results:       A = Error
  2591.                     B = Process id of parent process
  2592.  
  2593.  
  2594.    This function  informs the  system that  a child  process is  about to  be 
  2595. started.  Typically this  is a new program or sub-command being executed. For 
  2596. example COMMAND2.COM does a "fork" function call before executing any command 
  2597. or transient program.
  2598.  
  2599.  
  2600. A new set of file handles is created, and any current file handles which were 
  2601. opened with the "inheritable" access mode bit set (see the "open file handle" 
  2602. function -  function 43h),  are copied  into the new set of file handles. Any 
  2603. file handles which were  opened with  the "inheritable" bit clear will not be copied and so will 
  2604. not be  available to the child process. The standard file handles (00h...05h) 
  2605. are inheritable and so these will be copied.
  2606.  
  2607.  
  2608.    A new process id is allocated for the child process and the process id. of 
  2609. the parent  process is  returned so  that a  later "join"  function call  can 
  2610. switch  back to  the parent process. A ".NORAM" error can be produced by this 
  2611. function if there is insufficient memory to duplicate the file handles.
  2612.  
  2613.  
  2614.  
  2615.    Because  the child  process now  has a  copy of  the previous file handles 
  2616. rather than  the originals,  if one  of them is closed then the original will 
  2617. remain  open. So  for example if the child process closes the standard output 
  2618. file handle  (file handle number 1) an re-opens it to a new file, then when a 
  2619. "join" function is done to return to the parent process the original standard 
  2620. output channel will still be there.
  2621.  
  2622.  
  2623.  
  2624.  
  2625.   3.77   REJOIN PARENT PROCESS (61H)
  2626.  
  2627.      Parameters:    C = 61H (_JOIN) 
  2628.                     B = Process id of parent, or zero
  2629.      Results:       A = Error
  2630.                     B = Primary error code from child
  2631.                     C = Secondary error code from child
  2632.  
  2633.  
  2634.    This function  switches back  to the  specified parent process and returns 
  2635. the  error code  which the child process terminated with in register B, and a 
  2636. secondary error  code from the child in register C. Although the relationship 
  2637. between  parent and  childprocesses is strictly one-to-one, this function can 
  2638. jump back several levels by giving it a suitable process id. A ".IPROC" error 
  2639. will be returned if the process id is invalid.
  2640.  
  2641.  
  2642.    The child  process's set  of file handles are automatically closed and the 
  2643. parent  process's set of file handles becomes active again. Also any user RAM 
  2644. segments which the child process had allocated will be freed.
  2645.  
  2646.  
  2647.    If the  process id  passed to  this function is zero then a partial system 
  2648. re-initialisatin  is done. All file handles are closed and the standard input 
  2649. and output handles re-opened and all user segments are freed. This should not 
  2650. normally be  done by  a user  program if  it intends to return to the command 
  2651. interpreter  since the  command interpreter will not be in a consistent state 
  2652. after this.
  2653.  
  2654.  
  2655.    This function takes great care that the freeing of memory and adjusting of 
  2656. process id  is done  before actually closing any file handles and thus before 
  2657. accessing  the disk. This ensures that if a disk error occurs and is aborted, 
  2658. the join  operation will  have been  done successfully. However if a "join 0" 
  2659. produces a disk error which is aborted, then the re-initialization of default 
  2660. file  handles will not have been done. In this case another "join 0" function 
  2661. call should  be done  and this  will not attempt access disk (because all the 
  2662. files have been closed) and so will be successful.
  2663.  
  2664.  
  2665.  
  2666.    Note that  if this function call is made via 0F37Dh then registers B and C 
  2667. will  not return  the error  codes. This  is because  program termination and 
  2668. abort handling  must be  done by the application program. The error code will 
  2669. have  been passed  to the abort vector and code there must remember the error 
  2670. code if  it needs  to. See the "terminate with error code" function (function 
  2671. 62h) for the meaning of the primary and secondary error code. 
  2672.  
  2673.  
  2674.  
  2675.  
  2676.  
  2677.  
  2678.  
  2679.  
  2680.  
  2681.  
  2682.  
  2683.  
  2684.  
  2685.  
  2686.  
  2687.  
  2688.  
  2689.  
  2690.  
  2691.  
  2692.  
  2693.  
  2694.  
  2695.  
  2696.   3.78   TERMINATE WITH ERROR CODE (62H)
  2697.  
  2698.      Parameters:    C = 62H (_TERM) 
  2699.                     B = Error code for termination
  2700.      Results:       Does not return
  2701.  
  2702.  
  2703.    This  function terminates the program with the specified error code, which 
  2704. may be  zero indicating no error. This function call will never return to the 
  2705. caller  (unless a  user abort  routine executes  forces it  to - see function 
  2706. 63h). The operation of this function is different depending on whether it was 
  2707. called  from  the  MSX-DOS  environment  via  00005h or  from the  disk BASIC 
  2708. environment via 0F37Dh.
  2709.  
  2710.  
  2711.    If called  via 00005h  then if  a user  abort routine  has been defined by 
  2712. function  63h it  will be  called with  the specified  error code (and a zero 
  2713. secondary error code). Assuming that this routine returns, or if there was no 
  2714. user abort  routine defined,  then control  will be  passed back  to whatever 
  2715. loaded  the transient program via a jump at location 00000h. This will almost 
  2716. always  be  the command  interpreter, but  in some  cases it  may be  another 
  2717. transient program.  The error  code will  be remembered by the system and the 
  2718. next  "join" function  (function 61h)  which is  done will  return this error 
  2719. code. The command interpreter will print an error message for any code in the 
  2720. range 20h...FFh, but will not print a message for errors below this.
  2721.  
  2722.  
  2723.  
  2724.    If this function is called from the disk BASIC environment via 0F37Dh then 
  2725. control  will be  passed to the abort vector at location "BREAKVECT". In this 
  2726. environment there  is no  separately defined user abort routine and the error 
  2727. code  must be  remembered by  the code at "BREAKVECT" because "join" will not 
  2728. return the error code.
  2729.  
  2730.  
  2731.  
  2732.  
  2733.  
  2734.  
  2735.  
  2736.  
  2737.  
  2738.  
  2739.  
  2740.  
  2741.  
  2742.  
  2743.  
  2744.  
  2745.  
  2746.  
  2747.  
  2748.  
  2749.  
  2750.  
  2751.   3.79   DEFINE ABORT EXIT ROUTINE (63H)
  2752.  
  2753.      Parameters:    C = 63H (_DEFAB) 
  2754.                    DE = Address of abort exit routine 
  2755.                         0000H to un-define routine 
  2756.      Results:       A = 0 (never generates errors)
  2757.  
  2758.  
  2759.    This function  is only  available when  called via  location 00005h in the 
  2760. MSX-DOS  environment. It  cannot be  called at  location 0F37Dh from the disk 
  2761. BASIC environment.
  2762.  
  2763.    If  register DE  is zero  then a  previously defined abort routine will be 
  2764. undefined, otherwise  a new  one will  be defined.  The abort routine will be 
  2765. called by the system whenever the transient program is about to terminate for 
  2766. any  reason other  than a direct jump to location 0000h. Programs written for 
  2767. MSX-DOS  2  should  exit  with a  "terminate with  error code"  function call 
  2768. (function 061h) rather than a jump to location 0000h.
  2769.  
  2770.  
  2771.    The user  abort routine  will be  entered with the user stack active, with 
  2772. IX,  IY and  the alternate  register set as it was when the function call was 
  2773. made and  with the  whole TPA  paged in.  The termination  error code will be 
  2774. passed to the routine in register A with a secondary error code in register B 
  2775. and  if the  routine executes a "RET" then the values returned in registers A 
  2776. and  B  will  be  stored as  the error  codes to  be returned  by the  "join" 
  2777. function, and  normally printed out by the command interpreter. Alternatively 
  2778. the  routine may jump to some warm start code in the transient program rather 
  2779. than returning. The system will be in a perfectly stable state able to accept 
  2780. any function calls.
  2781.  
  2782.  
  2783.    The primary  error code  passed to  the routine  in register A will be the 
  2784. code  which the  program itself  passed to  the "terminate  with error  code" 
  2785. function (which  may be  zero) if this is the reason for the termination. The 
  2786. routine will also be called if a Ctrl-C or Ctrl-STOP is detected (".CTRLC" or 
  2787. ".STOP"  error), if  a disk error is aborted (".ABORT" error), or if an error 
  2788. occurred  on  one of  the standard  input or  output channels  being accessed 
  2789. through MSX-DOS function calls 01h...0Bh (".INERR" or ".OUTERR").
  2790.  
  2791.  
  2792.    The errors ".ABORT", ".INERR" and ".OUTERR" are generated by the system as 
  2793. a  result of  some other  error. For  example a  ".ABORT" can  result from  a 
  2794. ".NRDY" error,  or a  ".INERR" can result from a ".EOF" error. In these cases 
  2795. the original error code (".NRDY" or ".EOF") is passed to the abort routine in 
  2796. register  B as  the secondary  error code.  For all  other errors there is no 
  2797. secondary error code and register B will be zero.
  2798.  
  2799.  
  2800.    If the abort routine executes "POP HL : RET" (or equivalent) rather than a 
  2801. simple  return,  then  control  will  pass  to  the  instruction  immediately 
  2802. following the MSX-DOS call or BIOS call in which the error occurred. This may 
  2803. be useful in conjunction with a disk error handler routine (see function 64h) 
  2804. to  allow  an option  to abort  the current  MSX-DOS call  when a  disk error 
  2805. occurs.
  2806.  
  2807.  
  2808.  
  2809.  
  2810.   3.80   DEFINE DISK ERROR HANDLER ROUTINE (64H)
  2811.  
  2812.      Parameters:    C = 64H (_DEFER) 
  2813.                    DE = Address of disk error routine
  2814.                         0000H to un-define routine 
  2815.      Results:       A = 0 (never generates errors)
  2816.  
  2817.  
  2818.    This function specifies the address of a user routine which will be called 
  2819. if a  disk error  occurs. The routine will be entered with the full TPA paged 
  2820. in, but with the system stack in page-3 active and none of the registers will 
  2821. be preserved from when the MSX-DOS function call was made.
  2822.  
  2823.  
  2824.    The error routine can make MSX-DOS calls but must be very careful to avoid 
  2825. recursion. The list of function calls in section 2 of this document indicates 
  2826. which function  calls can  be safely  made from  a user  error routine.  This 
  2827. routine  is called  with the redirection status being temporarily invalidated 
  2828. in case  the standard  I/O channels  have been  redirected. See  the "get/set 
  2829. redirection state" function (function 70h) for details of this.
  2830.  
  2831.  
  2832.    The  specification of  parameters and results for the routine itself is as 
  2833. below. All  registers including  IX, IY and the alternate register set may be 
  2834. destroyed but the paging and stack must be preserved. The routine must return 
  2835. to the system, it must not jump away to continue the transient program. If it 
  2836. wants to do this then it should return A=1 ("abort") and a user abort routine 
  2837. will then get control and this may do whatever it wants to.
  2838.  
  2839.  
  2840.  
  2841.      Parameters:    A = Error code which caused error
  2842.                     B = Physical drive 
  2843.                     C = b0 - set if writing
  2844.                         b1 - set if ignore not recommended
  2845.                         b2 - set if auto-abort suggested
  2846.                         b3 - set if sector number is valid 
  2847.                    DE = Sector number (if b3 of C is set)
  2848.      Results:       A = 0 => Call system error routine
  2849.                         1 => Abort
  2850.                         2 => Retry
  2851.                         3 => Ignore
  2852.  
  2853.  
  2854.  
  2855.  
  2856.  
  2857.  
  2858.  
  2859.  
  2860.  
  2861.   3.81   GET PREVIOUS ERROR CODE (65H)
  2862.  
  2863.      Parameters:    C = 65H (_ERROR) 
  2864.      Results:       A = 0
  2865.                     B = Error code from previous function
  2866.  
  2867.  
  2868.  
  2869.    This  function allows  a user  program to  find out  the error  code which 
  2870. caused the  previous MSX-DOS  function call  to fail.  It is intended for use 
  2871. with the old CP/M compatible functions which do not return an error code. For 
  2872. example  if a  "create file  FCB" function  returns A=0FFh thee could be many 
  2873. reasons  for  the  failure  and  doing  this  function  call will  return the 
  2874. appropriate on, for example ".DRFUL" or ".SYSX".
  2875.  
  2876.  
  2877.  
  2878.  
  2879.   3.82   EXPLAIN ERROR CODE (66H)
  2880.  
  2881.      Parameters:    C = 66H (_EXPLAIN) 
  2882.                     B = Error code to be explained
  2883.                    DE = Pointer to 64 byte string buffer
  2884.      Results:       A = 0
  2885.                     B = 0 or unchanged
  2886.                    DE = Filled in with error message 
  2887.  
  2888.  
  2889.    This  function allows  a user  program to get an ASCIIZ explanation string 
  2890. for a  particular error  code returned by any of the MSX-DOS functions. If an 
  2891. error comes from one of the old functions then "get previous error code" must 
  2892. be  called first  to get  the real  error code  and then this function can be 
  2893. called to get an explanation string.
  2894.  
  2895.  
  2896.    The "Program Interface Specification" contains a list of all the currently 
  2897. defined  error codes  and the messages for them. Foreign language versions of 
  2898. the system  will of  course have  different messages.  If the error code does 
  2899. have  a built  in explanation  string then  this string  will be returned and 
  2900. register B  will be  set to  zero. If  there is  no explanation string then a 
  2901. string  of the  form: "System error 194" or "User error 45" will be returned, 
  2902. and register  B will  be unchanged.  (System errors  are those  in the  range 
  2903. 40h...FFh and user errors are 00h...3Fh.) 
  2904.  
  2905.  
  2906.  
  2907.  
  2908.  
  2909.  
  2910.  
  2911.  
  2912.  
  2913.  
  2914.  
  2915.  
  2916.   3.83   FORMAT A DISK (67H)
  2917.  
  2918.      Parameters:    C = 67H (_FORMAT)
  2919.                     B = Drive number (0=>current, 1=>A:)
  2920.                     A =    00H    => return choice string
  2921.                         01H...09H => format this choice
  2922.                         0AH...FDH => illegal
  2923.                         FEH, FFH  => new boot sector 
  2924.                    HL = Pointer to buffer (if A=1...9)
  2925.                    DE = Size of buffer (if A=1...9)  
  2926.      Results:       A = Error
  2927.                     B = Slot of choice string (only if A=0 on entry)
  2928.                    HL = Address of choice string (only if A=0 on entry)
  2929.  
  2930.  
  2931. This function  is used  to format  disks and  is really only provided for the 
  2932. "FORMAT"  command although other programs may use it (with care) if they find 
  2933. it useful.  It has  three different  options which  are selected  by the code 
  2934. passed in register A.
  2935.  
  2936.  
  2937.    If  A=0  then  registers  B  and  HL  return the  slot number  and address 
  2938. respectively  of an ASCIIZ string which specifies the choice of formats which 
  2939. is  available.  A ".IFORM"  error will  be returned  if this  disk cannot  be 
  2940. formatted (for  example the RAM disk). Normally the string will be read using 
  2941. the  "RDSLT" routine  and displayed  on the screen followed by a "? " prompt. 
  2942. The user  then specifies a choice "1"..."9" and this choice is passed back to 
  2943. the  "format" function,  after a  suitable warning prompt, to actually format 
  2944. the disk. If A=0, in some cases zero is returned in HL. This means that there 
  2945. is only  one kind of the format and no prompt is required. There is no way of 
  2946. knowing  what  disk  format  a  particular  choice  refers to  since this  is 
  2947. dependant on the particular disk driver.
  2948.  
  2949.  
  2950.    If A=01h...09h then this is interpreted as a format choice and a disk will 
  2951. be formatted  in the  specified drive  with no further prompting. Register HL 
  2952. and  DE must specify a buffer area to be used by the disk driver. There is no 
  2953. way of  knowing how big this buffer should be so it is best to make it as big 
  2954. as  possible. If  the buffer  crosses page boundaries then this function will 
  2955. select the largest portion of it which is in one page for passing to the disk 
  2956. driver. Many disk drivers do not use this buffer at all.
  2957.  
  2958.  
  2959.  
  2960.    If  A=FFh then  the disk  will not  actually be  formatted, but it will be 
  2961. given a  new boot  sector to  make the  disk a  true MSX-DOS  2 disk. This is 
  2962. designed  to update  old MSX-DOS 1.0 disks to have a volume id and thus allow 
  2963. the full  disk checking and undeletion which MSX-DOS 2 allows. The case A=FEh 
  2964. is  the  same  as  A=FFh  except that  only the  disk parameters  are updated 
  2965. correctly  and the  volume id does not overwrite the boot program. Also there 
  2966. are some  MSX-DOS 1.0  implementations which  put an incorrect boot sector on 
  2967. the  disk and  these disks  cannot be  used by MSX-DOS 2 until they have been 
  2968. corrected by this function.
  2969.  
  2970.  
  2971.    The  "new  boot  sector"  function  is mainly  intended for  the "FIXDISK" 
  2972. utility program, but may be used by other programs if they find it useful. If 
  2973. it  is used  then a  "get format  choice" function  call (A=0) should be done 
  2974. first and  if this  returns an  error (typically ".IFORM") then the operation 
  2975. should be aborted because this is a drive which does not like to be formatted 
  2976. and the disk could be damaged by this function.
  2977.  
  2978.  
  2979.  
  2980.   3.84   CREATE OR DESTROY RAMDISK (68H)
  2981.  
  2982.      Parameters:    C = 68H (_RAMD) 
  2983.                     B =     00H => destroy RAM disk
  2984.                         1...FEH => create new RAM disk
  2985.                             FFH => return RAM disk size
  2986.      Results:       A = Error
  2987.                     B = RAM disk size
  2988.  
  2989.  
  2990.    If  register B=0FFh  then this  routine just returns the number of 16k RAM 
  2991. segments which  are allocated  to the  RAM disk  currently. A  value of  zero 
  2992. indicates  that  there  is no  RAM disk  currently defined.  If B=0  then the 
  2993. current  RAM disk  will be destroyed, loosing all data which it contained and 
  2994. no error will be returned if there was no RAM disk.
  2995.  
  2996.  
  2997.    Otherwise, if  B is in the range 01h...FEh then this function will attempt 
  2998. to  create a  new RAM  disk using  the number  of 16k  segments specified  in 
  2999. register  B.  An  error  will  be  returned if  there is  already a  RAM disk 
  3000. (".RAMDX") or  if there is not even one segment free (".NORAM"). If there are 
  3001. insufficient  free RAM segments to make a RAM disk of the specified size then 
  3002. the largest one possible will be created. No error is returned in this case.
  3003.  
  3004.  
  3005.  
  3006.    In  all cases the size of the RAM disk will be returned in register B as a 
  3007. number of segments. Note that some of the RAM is used for the file allocation 
  3008. tables and  the root  directory so  the size  of the RAM disk as indicated by 
  3009. "DIR" or "CHKDSK" will be somewhat smaller than the total amount of RAM used. 
  3010. The  RAM will  always be  assigned the  drive letter  "H:" regardless  of the 
  3011. number of drives in the system.
  3012.  
  3013.  
  3014.  
  3015.  
  3016.  
  3017.  
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.   3.85   ALLOCATE SECTOR BUFFERS (69H)
  3027.  
  3028.      Parameters:    C = 69H (_BUFFER) 
  3029.                     B = 0 => return number of buffers
  3030.                         else number of buffers required
  3031.      Results:       A = Error
  3032.                     B = Current number of buffers 
  3033.  
  3034.  
  3035.    If  B=0 then this function just returns the number of sector buffers which 
  3036. are currently  allocated. If B<>0 then this function will attempt to use this 
  3037. number  of sector  buffers (must always be at least 2). If it cannot allocate 
  3038. as many as requested then it will allocate as many as possible and return the 
  3039. number in  register B  but will  not return  an error.  The number  of sector 
  3040. buffers can be reduced as well as increased.
  3041.  
  3042.  
  3043.  
  3044.    The  sector buffers  are allocated in a 16k RAM segment outside the normal 
  3045. 64k so  the number  of buffers  does not  detract from  the size  of the TPA. 
  3046. However  the number of buffers does affect efficiency since with more buffers 
  3047. allow more  FAT and directory sectors to be kept resident. The maximum number 
  3048. of buffers will be about 20.
  3049.  
  3050.  
  3051.  
  3052.  
  3053.   3.86   LOGICAL DRIVE ASSIGNMENT (6AH)
  3054.  
  3055.      Parameters:    C = 6AH (_ASSIGN) 
  3056.                     B = Logical drive number (1=A: etc)
  3057.                     D = Physical drive number (1=A: etc)
  3058.      Results:       A = Error
  3059.                     D = Physical drive number (1=A: etc)
  3060.  
  3061.  
  3062.    This  function controls the logical to physical drive assignment facility. 
  3063. It is  primarily intended for the "ASSIGN" command although user programs may 
  3064. want to use it to translate logical drive numbers to physical drive numbers.
  3065.  
  3066.  
  3067.    If both  B and  D are  non-zero then  a new  assignment will be set up. If 
  3068. register  B is  non-zero and  register D  is zero then any assignment for the 
  3069. logical drive  specified by B will be cancelled. If both register B and D are 
  3070. zero  then all  assignments will  be cancelled. If register B is non-zero and 
  3071. register D is FFh then the current assignment for the logical drive specified 
  3072. by register B will simply be returned in register D.
  3073.  
  3074.  
  3075.    All  drives used  in the  various function calls, including drive names in 
  3076. strings  and  drive  numbers  as parameters  to function  calls, are  logical 
  3077. drives. However  the drive number passed to disk error routines is a physical 
  3078. drive  so  if  "ASSIGN"  has  been  used  these  may  be  different  from the 
  3079. corresponding logical drive.
  3080.  
  3081.  
  3082.  
  3083.  
  3084.  
  3085.   3.87   GET ENVIRONMENT ITEM (6BH)
  3086.  
  3087.      Parameters:    C = 6BH (_GENV)
  3088.                    HL = ASCIIZ name string
  3089.                    DE = Pointer to buffer for value
  3090.                     B = Size of buffer
  3091.      Results:       A = Error
  3092.                    DE = Preserved, buffer filled in if A=0
  3093.  
  3094.  
  3095.  
  3096.    This function gets the current value of the environment item whose name is 
  3097. passed  in register  HL. A  ".IENV" error  is returned  if the name string is 
  3098. invalid. If there is no environment item of that name then a null string will 
  3099. be returned  in the  buffer. If  there is an item of that name then its value 
  3100. string  will be  copied to  the buffer.  If the  buffer is too small then the 
  3101. value string  will be truncated with no terminating null and a ".ELONG" error 
  3102. will  be returned. A buffer 255 bytes will always be large enough since value 
  3103. strings cannot be longer than this (including the terminating null).
  3104.  
  3105.  
  3106.  
  3107.  
  3108.   3.88   SET ENVIRONMENT ITEM (6CH)
  3109.  
  3110.      Parameters:    C = 6CH (_SENV)
  3111.                    HL = ASCIIZ name string
  3112.                    DE = ASCIIZ value string
  3113.      Results:       A = Error
  3114.  
  3115.  
  3116.  
  3117.    This  function sets  a new environment item. If the name string is invalid 
  3118. then a ".IENV" error is returned, otherwise the value string is checked and a 
  3119. ".ELONG" error  returned if  it is  longer than 255 characters, or a ".NORAM" 
  3120. error  if there  is insufficient memory to store the new item. If all is well 
  3121. then any  old item  of this  name is deleted and the new item is added to the 
  3122. beginning  of the  environment list.  If the  value string  is null  then the 
  3123. environment item will be removed.
  3124.  
  3125.  
  3126.  
  3127.  
  3128.  
  3129.  
  3130.  
  3131.  
  3132.  
  3133.  
  3134.  
  3135.  
  3136.   3.89   FIND ENVIRONMENT ITEM (6DH)
  3137.  
  3138.      Parameters:    C = 6DH (_FENV)
  3139.                    DE = Environment item number
  3140.                    HL = Pointer to buffer for name string
  3141.      Results:       A = Error
  3142.                    HL = Preserved, buffer filled in
  3143.  
  3144.  
  3145.  
  3146.    This  function is  used to  find out  what environment items are currently 
  3147. set. The  item number  in register DE identifies which item in the list is to 
  3148. be  found (the  first item  corresponds to  DE=1). If there is an item number 
  3149. <DE> then the name string of this item will be copied into the buffer pointed 
  3150. to by  HL. If the buffer is too small then the name will be truncated with no 
  3151. terminating null, and a ".ELONG" error returned. A 255 byte buffer will never 
  3152. be  too small.  If there  is no  item number  <DE> then a null string will be 
  3153. returned, since an item can never have a null name string.
  3154.  
  3155.  
  3156.  
  3157.  
  3158.  
  3159.   3.90   GET/SET DISK CHECK STATUS (6EH)
  3160.  
  3161.      Parameters:    C = 6EH (_DSKCHK)
  3162.                     A = 00H => get disk check status
  3163.                         01H => set disk check status
  3164.                     B = 00H => enable (only if A=01H)
  3165.                         FFH => disable (only if A=01H)
  3166.      Results:       A = Error
  3167.                     B = Current disk check setting
  3168.  
  3169.  
  3170.    If A=0  then the  current value  of the disk check variable is returned in 
  3171. register  B. If  A=01h then the variable is set to the value in register B. A 
  3172. value of 00h means that disk checking is enabled and a non-zero means that it 
  3173. is disabled. The default state is enabled.
  3174.  
  3175.  
  3176.  
  3177.    The disk check variable controls whether the system will re-check the boot 
  3178. sector of  a disk  to see  whether it  has changed,  each time a file handle, 
  3179. fileinfo  block  or  FCB  is  accessed.  If  it is  enabled then  it will  be 
  3180. impossible  to accidentally  access the  wrong disk by changing a disk in the 
  3181. middle of  an operation,  otherwise this will be possible and may result in a 
  3182. corrupted  disk. Depending  on the  type of disk interface, there may be some 
  3183. additional overhead  in having  this feature enabled although with many types 
  3184. of  disk (those with explicit disk change detection hardware) it will make no 
  3185. difference and the additional security is well worth having.
  3186.  
  3187.  
  3188.  
  3189.  
  3190.  
  3191.   3.91   GET MSX-DOS VERSION NUMBER (6FH)
  3192.  
  3193.      Parameters:    C = 6FH (_DOSVER)
  3194.      Results:       A = Error (always zero)
  3195.                    BC = MSX-DOS kernel version
  3196.                         DE = MSXDOS2.SYS version number
  3197.  
  3198.  
  3199.    This function allows a program to determine which version of MSX-DOS it is 
  3200. running  under. Two  version numbers  are returned, one in BC for the MSX-DOS 
  3201. kernel in  ROM and  the other  is DE for the MSXDOS2.SYS system file. Both of 
  3202. these  version numbers  are BCD  values with  the major version number in the 
  3203. high byte  and the  two digit  version number in the low byte. For example if 
  3204. there were a version 2.34 of the system, it would be represented as 0234h.
  3205.  
  3206.  
  3207.  
  3208.    For compatibility  with MSX-DOS 1.0, the following procedure should always 
  3209. be followed in using this function. Firstly if there is any error (A<>0) then 
  3210. it  is not  MSX-DOS at  all. Next  look at register B. If this is less than 2 
  3211. then the system is earlier than 2.00 and registers C and DE are undefined. If 
  3212. register B  is 2 or greater then registers BC and DE can be used as described 
  3213. above.  In general  the version  number which  should be  checked (after this 
  3214. procedure) is the MSXDOS2.SYS version in register DE.
  3215.  
  3216.  
  3217.  
  3218.  
  3219.  
  3220.  
  3221.  
  3222.  
  3223.  
  3224.  
  3225.  
  3226.  
  3227.  
  3228.  
  3229.  
  3230.  
  3231.  
  3232.  
  3233.  
  3234.  
  3235.  
  3236.  
  3237.  
  3238.  
  3239.  
  3240.  
  3241.  
  3242.  
  3243.  
  3244.  
  3245.  
  3246.   3.92   GET/SET REDIRECTION STATE (70H)
  3247.  
  3248.      Parameters:    C = 70H (_REDIR)
  3249.                     A = 00H => get redirection state
  3250.                         01H => set redirection state
  3251.                     B = New state.   b0 - standard input
  3252.                                      b1 - standard output
  3253.      Results:       A = Error
  3254.                     B = Redirection state before command
  3255.                          b0 set => input is redirected
  3256.                          b1 set => output is redirected
  3257.  
  3258.  
  3259.    This  function is  provided primarily  for disk  error routines  and other 
  3260. character  I/O  which  must  always  go  to  the  console  regardless  of any 
  3261. redirection.  When  the CP/M  character functions  (functions 01h...0Bh)  are 
  3262. used, they  normally refer  to the  console. However if the standard input or 
  3263. output file handles (file handles 0 and 1) have been closed and reopened to a 
  3264. disk  file, then  the CP/M character functions will also go to the disk file. 
  3265. However certain output such as disk error output must always go to the screen 
  3266. regardless.
  3267.  
  3268.  
  3269.    This  function allows  any such redirection to be temporarily cancelled by 
  3270. calling this  function with A=1 and B=0. This will ensure that any subsequent 
  3271. CP/M  console I/O  will go  to the console, and will also return the previous 
  3272. setting so  that this  can be  restored afterwards.  The system is a somewhat 
  3273. unstable  state when  the redirection  state has  been altered  like this and 
  3274. there are  many function  calls which  will reset the redirection to its real 
  3275. state   over-riding  this  function.  In  general  any  function  call  which 
  3276. manipulates file  handles, such  as "open",  "close", "duplicate"  and so on, 
  3277. will  reset the  redirection state.  The effect of this function is therefore 
  3278. purely temporary.
  3279.  
  3280.  
  3281.  
  3282.  
  3283.  
  3284.  
  3285.  
  3286.  
  3287.                 ++++++++++  END OF DOCUMENT  ++++++++++
  3288.