home *** CD-ROM | disk | FTP | other *** search
/ For Beginners & Professional Hackers / cd.iso / docum / hadware.doc / chapter.004 < prev    next >
Encoding:
Text File  |  1992-03-15  |  150.3 KB  |  3,718 lines

  1.                                     -72-
  2.  
  3.  
  4.    **  Programmer's  Technical    Reference  for    MSDOS  and  the  IBM  PC **
  5. ─────────────────────────┤ Registered User Version ├───────────────────────────
  6.              not for public distribution
  7.          Copyright (c) 1987, 1988, 1989 Dave Williams
  8.  
  9.  
  10.                C H A P T E R    F O U R
  11.  
  12.                DOS INTERRUPTS AND FUNCTION CALLS
  13.  
  14.  
  15.                 C O N T E N T S
  16.  
  17. General Programming Guides ............................................ 4**
  18. DOS Registers ......................................................... 4**1
  19. DOS Stacks ............................................................ 4**2
  20. DOS Interrupts ........................................................ 4**3
  21. Interrupt 20h (Terminate) ............................................. 4**4
  22. DOS Services (quick list) ............................................. 4**5
  23. Calling the DOS Services .............................................. 4**6
  24. Version Specific Information .......................................... 4**7
  25. DOS Services in Detail ................................................ 4**8
  26.  
  27.  
  28. General Programming Guides ............................................ 4**
  29.  
  30.  Microsoft recommends avoiding the "old style" (01h-0Ch and 26h) system calls
  31. wherever possible. Programmers are urged to use the "new style" (DOS 2.0+)
  32. handle calls instead.
  33.  
  34.  Do not use "undocumented" functions unless they are critical to your
  35. application and no other reasonable workaround can be found. Remember that
  36. your programs may have to run under various versions of DOS, DOS clones such
  37. as Digital's DR-DOS, the OS/2 Compatibility Box, or Unix DOS Window. Such
  38. environments or OS simulations do not always implement the undocumented calls.
  39.  
  40.  DOS 2.x lacks many of the enhancements found in later versions. Your
  41. application should check the DOS version if DOS 3.x+ features are required.
  42.  
  43.  Direct disk access via hardware or the BIOS should be avoided unless your
  44. program will only be run on specific hardware or under certain circumstances.
  45. Some versions of DOS 2.x treat their disks in a manner much like 3.x. Some
  46. vendors added multiple DOS partitions or oversize drive support prior to the
  47. "official" 3.3 release. Not all these systems work in the same way! New-type
  48. SCSI or ESDI hard disk controllers do not always emulate all the standard BIOS
  49. calls.
  50.  
  51.                                     -73-
  52.  
  53.  
  54. DOS Registers ......................................................... 4**1
  55.  
  56.  DOS uses the following registers, pointers, and flags when it executes
  57. interrupts and function calls:
  58.  
  59. ┌───────────────────┬──────────┬───────────────────────────────────────────────┐
  60. │GENERAL REGISTERS  │ register │          definition               │
  61. │            ├──────────┼───────────────────────────────────────────────┤
  62. │            │     AX    │  accumulator            (16 bit)       │
  63. │            │     AH    │  accumulator high-order byte    ( 8 bit)       │
  64. │            │     AL    │  accumulator low order byte    ( 8 bit)       │
  65. │            │     BX    │  base                (16 bit)       │
  66. │            │     BH    │  base high-order byte        ( 8 bit)       │
  67. │            │     BL    │  base low-order byte        ( 8 bit)       │
  68. │            │     CX    │  count             (16 bit)       │
  69. │            │     CH    │  count high order byte     ( 8 bit)       │
  70. │            │     CL    │  count low order byte        ( 8 bit)       │
  71. │            │     DX    │  data                (16 bit)       │
  72. │            │     DH    │  date high order byte        ( 8 bit)       │
  73. │            │     DL    │  data low order byte        ( 8 bit)       │
  74. ├───────────────────┼──────────┼───────────────────────────────────────────────┤
  75. │SEGMENT REGISTERS  │ register │          definition               │
  76. │            ├──────────┼───────────────────────────────────────────────┤
  77. │            │     CS    │  code    segment (16 bit)               │
  78. │            │     DS    │  data    segment (16 bit)               │
  79. │            │     SS    │  stack segment (16 bit)               │
  80. │            │     ES    │  extra segment (16 bit)               │
  81. ├───────────────────┼──────────┼───────────────────────────────────────────────┤
  82. │INDEX REGISTERS    │ register │          definition               │
  83. │            ├──────────┼───────────────────────────────────────────────┤
  84. │            │     DI    │  destination index (16 bit)               │
  85. │            │     SI    │  source      index (16 bit)               │
  86. ├───────────────────┼──────────┼───────────────────────────────────────────────┤
  87. │POINTERS        │ register │          definition               │
  88. │            ├──────────┼───────────────────────────────────────────────┤
  89. │            │     SP    │  stack       pointer (16 bit)               │
  90. │            │     BP    │  base          pointer (16 bit)               │
  91. │            │     IP    │  instruction pointer (16 bit)               │
  92. ├───────────────────┴──────────┴───────────────────────────────────────────────┤
  93. │FLAGS             AF, CF, DF, IF, OF, PF, SF, TF, ZF               │
  94. └──────────────────────────────────────────────────────────────────────────────┘
  95.  
  96.  These registers, pointers, and flags are "lowest common denominator" 8088-8086
  97. CPU oriented. DOS makes no attempt to use any of the special or enhanced
  98. instructions availible on the later CPUs which will execute 8088 code, such as
  99. the 80186, 80286, 80386, or NEC V20, V30, V40, or V50.
  100.  
  101.  User registers except AX are preserved unless information is passed back to
  102. the register as indicated in specific function calls.
  103.  
  104.                                     -74-
  105.  
  106.  
  107. DOS Stacks ............................................................ 4**2
  108.  
  109.  When DOS takes control after a function call, it switches to an internal
  110. stack. Registers which are not used to return information (other than AX) are
  111. preserved. The calling program's stack must be large enough to accomodate the
  112. interrupt system - at least 128 bytes in addition to other interrupts.
  113.  
  114.  DOS actually maintains three stacks -
  115.  
  116. stack 1: 384 bytes (in DOS 3.1)
  117.      for functions 00h and for 0Dh and up, and for ints 25h and 26h.
  118.  
  119. stack 2: 384 bytes (in DOS 3.1)
  120.      for function calls 01h through 0Ch.
  121.  
  122. stack 3: 48 bytes (in DOS 3.1)
  123.      for functions 0Dh and above. This stack is the initial stack used by
  124.      the int 21h handler before it decides which of the other two to use.
  125.      It is also used by function 59h (get extended error), and 01h to 0Ch if
  126.      they are called during an int 24h (critical error) handler. Functions
  127.      33h (get/set break flag), 50h (set process ID), 51h (get process ID)
  128.      and 62h (get PSP address) do not use any DOS stack under DOS 3.x
  129.      (under 2.x, 50h and 51h use stack number 2).
  130.  
  131.  IBM and Microsoft made a change back in DOS 3.0 or 3.1 to reduce the size of
  132. DOS. They reduced the space allocated for scratch areas when interrupts are
  133. being processed. The default seems to vary with the DOS version and the
  134. machine, but 8 stack frames seems to be common. That means that if you get
  135. more than 8 interrupts at the same time, clock, disk, printer spooler,
  136. keyboard, com port, etc., the system will crash. It seems to happen usually on
  137. a network. STACKS=16,256 means allow 16 interrupts to interrupt each other and
  138. allow 256 bytes for each for scratch area. Eight is marginal.
  139.  
  140.  DOS 3.2 does some different stack switching than previous versions. The
  141. interrupts which are switched are 02h, 08h, 09h, 0Ah, 0Bh, 0Ch, 0Dh, 0Eh, 70h,
  142. 72h, 73h, 74h, 75h, 76h, and 77h. DOS 3.2 has a special check in the
  143. initialization code for a PCjr and don't enable stack switching on that machine.
  144. DOS 3.3 was changed so that no stack switching occurs on PC, PC-XT, or the PC-
  145. Portable, and defaults to 9 stacks of 128 bytes in an AT.
  146.  
  147.  
  148.  
  149. DOS Interrupts ........................................................ 4**3
  150.  
  151.  Microsoft recommends that a program wishing to examine or set the contents of
  152. any interrupt vector use the DOS function calls 35h and 25h provided for those
  153. purposes and avoid referencing the interrupt vector locations directly.
  154.  
  155.  DOS reserves interrupt numbers 20h to 3Fh for its own use. This means absolute
  156. memory locations 80h to 0FFh are reserved by DOS.
  157.  
  158.                                     -75-
  159.  
  160.  
  161. ┌─────────────────────────────────────────────────────────────────────────────┐
  162. │Interrupt 20h    Terminate Current Program                4**4  │
  163. └─────────────────────────────────────────────────────────────────────────────┘
  164. (0:0080h)
  165.  Issue int 20h to exit from a program. This vector transfers to the logic in
  166. DOS to restore the terminate address, the Ctrl-Break address,and the critical
  167. error exit address to the values they had on entry to the program. All the file
  168. buffers are flushed and all handles are closed. You should close all files
  169. changed in length (see function calls 10h and 3Eh) before issuing this
  170. interrupt. If the changed file is not closed, its length, time, and date are
  171. not recorded correctly in the directory.
  172.  
  173.  For a program to pass a completion code or an error code when terminating, it
  174. must use either function call 4Ch (Terminate a Process) or 31h (Terminate
  175. Process and Stay Resident). These two methods are preferred over using
  176. int 20h and the codes returned by them can be interrogated in batch processing.
  177.  
  178. Important: Before you issue an interrupt 20h, your program must ensure that
  179.        the CS register contains the segment of its Program Segment Prefix.
  180.  
  181. Interrupt 20h    DOS - Terminate Program
  182. entry    no parameters
  183. return    The following vectors are restored from the Program Segment Prefix:
  184.     0Ah    Program Terminate
  185.     0Eh    Control-C
  186.     12h    Critical Error
  187. note 1) IBM and Microsoft recommend using int 21 Fn 4Ch. Using int 20 is
  188.     officially frowned upon since the introduction of DOS 2.0
  189.      2) In DOS 3.2 at least, int 20h merely calls int 21h, fn 00h.
  190.  
  191.  
  192.  
  193. DOS Services (quick list) ............................................. 4**5
  194.  
  195. ┌─────────────────────────────────────────────────────────────────────────────┐
  196. │Interrupt 21h    Function Call Request                          │
  197. └─────────────────────────────────────────────────────────────────────────────┘
  198. (0:0084h)
  199.  DOS provides a wide variety of function calls for character device I/O, file
  200. management, memory management, date and time functions,execution of other
  201. programs, and more. They are grouped as follows:
  202.  
  203.       call            description
  204.     00h        program terminate
  205.     01h-0Ch     character device I/O, CP/M compatibility format
  206.     0Dh-24h     file management,      CP/M compatibility format
  207.     25h-26h     nondevice functions,  CP/M compatibility format
  208.     27h-29h     file management,      CP/M compatibility format
  209.     2Ah-2Eh     nondevice functions,  CP/M compatibility format
  210.     2Fh-38h     extended functions
  211.     39h-3Bh     directory group
  212.     3Ch-46h     extended file management
  213.     47h        directory group
  214.     48h-4Bh     extended memory management
  215.     54h-57h     extended functions
  216.     5Eh-5Fh     networking
  217.     60h-62h     extended functions
  218.     63h-66h     enhanced foreign language support
  219.  
  220.                                     -76-
  221.  
  222. List of DOS services:    * = undocumented
  223.     00h    terminate program
  224.     01h    get keyboard input
  225.     02h    display character to STDIO
  226.     03h    get character from STDAUX
  227.     04h    output character to STDAUX
  228.     05h    output character to STDPRN
  229.     06h    direct console I/O - keyboard to screen
  230.     07h    get char from std I/O without echo
  231.     08h    get char from std I/O without echo, checks for ^C
  232.     09h    display a string to STDOUT
  233.     0Ah    buffered keyboard input
  234.     0Bh    check STDIN status
  235.     0Ch    clear keyboard buffer and invoke keyboard function
  236.     o    0Dh    flush all disk buffers
  237.     o    0Eh    select disk
  238.     0Fh    open file with File Control Block
  239.     10h    close file opened with File Control Block
  240.     11h    search for first matching file entry
  241.     12h    search for next matching file entry
  242.     13h    delete file specified by File Control Block
  243.     14h    sequential read from file specified by File Control Block
  244.     15h    sequential write to file specified by File Control Block
  245.     16h    find or create firectory entry for file
  246.     17h    rename file specified by file control block
  247.     18h*    unknown
  248.     o    19h    return current disk drive
  249.     o    1Ah    set disk transfer area (DTA)
  250.     1Bh    get current disk drive FAT
  251.     1Ch    get disk FAT for any drive
  252.     1Dh*    unknown
  253.     1Eh*    unknown
  254.     1Fh*    read DOS disk block, default drive
  255.     20h*    unknown
  256.     21h    random read from file specified by FCB
  257.     22h    random write to file specified by FCB
  258.     23h    return number of records in file specified by FCB
  259.     24h    set relative file record size field for file specified by FCB
  260.     o    25h    set interrupt vector
  261.     26h    create new Program Segment Prefix (PSP)
  262.     27h    random file block read from file specified by FCB
  263.     28h    random file block write to file specified by FCB
  264.     29h    parse the command line for file name
  265.     o    2Ah    get the system date
  266.     o    2Bh    set the system date
  267.     o    2Ch    get the system time
  268.     o    2Dh    set the system time
  269.     o    2Eh    set/clear disk write VERIFY
  270.     o    2Fh    get the Disk Transfer Address (DTA)
  271.     o    30h    get DOS version number
  272.     31h    TSR, files opened remain open
  273.     32h*    read DOS Disk Block
  274.     o    33h    get or set Ctrl-Break
  275.     34h*    INDOS  Critical Section Flag
  276.     o    35h    get segment and offset address for an interrupt
  277.     o    36h    get free disk space
  278.     37h*    get/set option marking character (SWITCHAR)
  279.     o    38h    return country-dependent information
  280.     o    39h    create subdirectory
  281.     o    3Ah    remove subdirectory
  282.     o    3Bh    change current directory
  283.     o    3Ch    create and return file handle
  284.     o    3Dh    open file and return file handle
  285.     o    3Eh    close file referenced by file handle
  286.  
  287.                                     -77-
  288.  
  289.  
  290.     o    3Fh    read from file referenced by file handle
  291.     o    40h    write to file referenced by file handle
  292.     o    41h    delete file
  293.     o    42h    move file pointer (move read-write pointer for file)
  294.     o    43h    set/return file attributes
  295.     o    44h    device IOCTL (I/O control) info
  296.     o    45h    duplicate file handle
  297.     o    46h    force a duplicate file handle
  298.     o    47h    get current directory
  299.     o    48h    allocate memory
  300.     o    49h    release allocated memory
  301.     o    4Ah    modify allocated memory
  302.     o    4Bh    load or execute a program
  303.     o    4Ch    terminate prog and return to DOS
  304.     o    4Dh    get return code of subprocess created by 4Bh
  305.     o    4Eh    find first matching file
  306.     o    4Fh    find next matching file
  307.     50h*    set new current Program Segment Prefix (PSP)
  308.     51h*    puts current PSP into BX
  309.     52h*    pointer to the DOS list of lists
  310.     53h*    translates BPB (Bios Parameter Block, see below)
  311.     o    54h    get disk verification status (VERIFY)
  312.     55h*    create PSP: similar to function 26h
  313.     o    56h    rename a file
  314.     o    57h    get/set file date and time
  315.     58h    get/set allocation strategy        (DOS 3.x)
  316.     o    59h    get extended error information
  317.     o    5Ah    create a unique filename
  318.     o    5Bh    create a DOS file
  319.     o    5Ch    lock/unlock file contents
  320.     5Dh*    network
  321.     5Eh*    network printer
  322.     5Fh*    network redirection
  323.     60h*    parse pathname
  324.     61h*    unknown
  325.     62h    get program segment prefix (PSP)
  326.     63h*    get lead byte table            (DOS 2.25)
  327.     64h*    unknown
  328.     65h    get extended country information    (DOS 3.3)
  329.     66h    get/set global code page table        (DOS 3.3)
  330.     67h    set handle count            (DOS 3.3)
  331.     68h    commit file                (DOS 3.3)
  332.     69h    disk serial number            (DOS 4.0)
  333.     6Ah    unknown
  334.     6Bh    unknown
  335.     6Ch    extended open/create            (DOS 4.0)
  336.  
  337.  Items marked with 'o' are explicitly supported in the OS/2 Compatibility Box
  338. according to MicroSoft.
  339.  
  340.                                     -78-
  341.  
  342.  
  343. Calling the DOS Services .............................................. 4**6
  344.  
  345.  The DOS services are invoked by placing the number of the desired function in
  346. register AH, subfunction in AL, setting the other registers to any specific
  347. requirements of the function, and invoking int 21h.
  348.  
  349.  When the interrupt is called, all register and flag values are pushed into the
  350. stack. Int 21h contains a pointer into an absolute address in the IBMDOS.COM
  351. file. This address is the main loop for the DOS command handler. The handler
  352. pops the register values, compares them to its list of functions, and executes
  353. the function if valid. When the function is complete, it may pass values back
  354. to the command handler. The handler will push the values into the stack and
  355. then return control to the calling program.
  356.  
  357.  Most functions will return an error code; some return more information.
  358. Details are contained in the listings for the individual functions. Extended
  359. error return codes for most functions may be obtained by calling function 59h.
  360.  
  361.  Register settings listed are the ones used by DOS. Some functions will return
  362. with garbage values in unused registers. Do not test for values in unspecified
  363. registers; your program may exhibit odd behavior.
  364.  
  365.  DS:DX pointers are the data segment register (DS) indexed to the DH and DL
  366. registers (DX). DX always contains the offset address, DS contains the segment
  367. address.
  368.  
  369.  The File Control Block services (FCB services) were part of DOS 1.0. Since
  370. the release of DOS 2.0, Microsoft has recommended that these services not be
  371. used. A set of considerably more enhanced services (handle services) were
  372. introduced with DOS 2.0. The handle services provide support for wildcards and
  373. subdirectories, and enhanced error detection via function 59h.
  374.  
  375.  The data for the following calls was compiled from various Intel, Microsoft,
  376. IBM, and other publications. There are many subtle differences between MSDOS
  377. and PCDOS and between the individual versions. Differences between the
  378. versions are noted as they occur.
  379.  
  380.  There are various ways of calling the DOS functions. For all methods, the
  381. function number is loaded into register AH, subfunctions and/or parameters are
  382. loaded into AL or other registers, and call int 21 by one of the following
  383. methods:
  384.  
  385.  A) call interrupt 21h directly  (the recommended procedure)
  386.  B) perform a long call to offset 50h in the program's PSP.
  387.      1) This method will not work under DOS 1.x
  388.      2) Though recommended by Microsoft for DOS 2.0, this method takes more
  389.     time and is no longer recommended.
  390.  C) place the function number in CL and perform an intrasegment call to
  391.     location 05h in the current code segment. This location contains a long
  392.     call to the DOS function dispatcher.
  393.      1) IBM recommends this method be used only when using existing programs
  394.     written for different calling conventions. (such as converting CP/M
  395.     programs). This method should be avoided unless you have some specific
  396.     use for it.
  397.      2) AX is always destroyed by this method.
  398.      3) This method is valid only for functions 00h-24h.
  399.  
  400.                                     -79-
  401.  
  402.  
  403.  There are also various ways of exiting from a program. (assuming it is not
  404. intended to be a TSR). All methods except call 4Ch must ensure that the
  405. segment register contains the segment address of the PSP.
  406.  
  407.  A) Interrupt 21h, function 4Ch (Terminate with Result Code). This is the
  408.     "official" recommended method of returning to DOS.
  409.  B) Interrupt 21h, function 00h (Exit Program). This is the early style
  410.     int 21 function call. It simply calls int 20h.
  411.  C) Interrupt 20h (Exit).
  412.  D) A JMP instruction to offset 00h (int 20h vector) in the Program Segment
  413.     Prefix. This is just a roundabout method to call int 20h. This method
  414.     was set up in DOS 1.0 for ease of conversion for CP/M programs. It is no
  415.     longer recommended for use.
  416.  E) A JMP instruction to offset 05h (int 21 vector) in the Program Segment
  417.     Prefix, with AH set to 00h or 4Ch. This is another CP/M type function.
  418.  
  419.  
  420.  
  421. Version Specific Information .......................................... 4**7
  422.  
  423. * Function Calls:
  424.  
  425.     DOS 2.x supports function calls 00h to 57h.
  426.  
  427.     DOS 2.25  is the only version to support function 63h (foreign keyboard)
  428.  
  429.     DOS 3.x has more sophisticated error handling and detection function
  430.         calls availible than 2.x.
  431.  
  432.     DOS 3.0 supports function calls 00h to 5Ch and 62h, including new and
  433.         changed function calls for version 3.0:
  434.         3Dh  Open File
  435.         59h  Get Extended Error
  436.         5Ah  Create Temporary File
  437.         5Bh  Create New File
  438.         5Ch  Lock/Unlock File Access
  439.         62h  Get Program Segment Prefix Address
  440.  
  441.     DOS 3.1 supports function calls 00h to 62h, including the new and
  442.         changed function calls for DOS 3.1:
  443.         5E00h  Get Machine Name
  444.         5E02h  Set Printer Setup
  445.         5E03h  Get Printer Setup
  446.         5F02h  Get Redirection List Entry
  447.         5F03h  Redirect Device
  448.         5F04h  Cancel Redirection
  449.  
  450.     DOS 3.2 supports the following new functions:
  451.         44h    extended IOCTL functions
  452.  
  453.     DOS 3.3 supports the following new functions:
  454.         44h    extended IOCTL functions
  455.         65h    get extended country information (DOS 3.3)
  456.         66h    get/set global code page table (DOS 3.3)
  457.         67h    set handle count (DOS 3.3)
  458.         68h    commit file (DOS 3.3)
  459.  
  460.     DOS 4.0 supports the following new functions:
  461.         44h    extended IOCTL functions
  462.         69h    disk serial number
  463.         6Ch    extended open/create
  464.  
  465.                                     -80-
  466.  
  467. DOS Services in Detail ................................................ 4**8
  468.  
  469.  
  470. INT 21H   DOS services
  471.       Function (hex)
  472.  
  473. * Indicates Functions not documented in the IBM DOS Technical Reference.
  474.  Note some functions have been documented in other Microsoft or licensed OEM
  475. documentation.
  476.  
  477. Function  00h    Terminate Program
  478.       Ends program, updates, FAT, flushes buffers, restores registers
  479. entry    AH    00h
  480.     CS    segment address of PSP
  481. return    none
  482. note 1) Program must place the segment address of the PSP control block in CS
  483.     before calling this function.
  484.      2) The terminate, ctrl-break,and critical error exit addresses (0Ah, 0Eh,
  485.     12h) are restored to the values they had on entry to the terminating
  486.     program, from the values saved in the program segment prefix at
  487.     locations PSP:000Ah, PSP:000Eh, and PSP:0012h.
  488.      3) All file buffers are flushed and the handles opened by the process are
  489.     closed.
  490.      4) Any files that have changed in length and are not closed are not
  491.     recorded properly in the directory.
  492.      5) Control transfers to the terminate address.
  493.      6) This call performs exactly the same function as int 20h.
  494.      7) All memory used by the program is returned to DOS. DOS just goes up the
  495.     chain of memory blocks and marks any that are owned by the PSP which is
  496.     terminating as free.
  497.      8) TOS: $00 TERM. Returns system control to the program from which it
  498.     started. If EXECed from a program, returns to that program. If started
  499.     from DeskTop, returns to DeskTop. This is important for chaining
  500.     program segments.
  501.      9) Files opened with FCBs are not automatically closed.
  502.  
  503. Function  01h      Get Keyboard Input
  504.     Waits for char at STDIN (if nescessary), echoes to STDOUT
  505. entry    AH    01h
  506. return    AL    ASCII character from STDIN (8 bits)
  507. note 1) Checks char for Ctrl-C, if char is Ctrl-C, executes int 23h.
  508.      2) For function call 06h, extended ASCII codes require two function calls.
  509.     The first call returns 00h as an indicator that the next call will be
  510.     an extended ASCII code.
  511.      3) Input and output are redirectable. If redirected, there is no way to
  512.     detect EOF.
  513.      4) TOS: $1 CONIN. Char returns in D0. ASCII code of char in high byte,
  514.     keyboard scan code in low byte. Will return scancode on keys which have
  515.     no ASCII value.
  516.  
  517. Function  02h    Display Output
  518.       Outputs char in DL to STDOUT
  519. entry    AH    02h
  520.     DL    8 bit data (usually ASCII character)
  521. return    none
  522. note 1) If char is 08 (backspace) the cursor is moved 1 char to the left
  523.     (nondestructive backspace).
  524.      2) If Ctrl-C is detected after input, int 23h is executed.
  525.      3) Input and output are redirectable. If redirected, there is no way to
  526.     detect disk full.
  527.      4) TOS: $2 CONOUT. Char must be placed on the stack as the first word. The
  528.     ASCII value of the char goes in the low byte and the high byte is zero.
  529.     Chars are output to DEVICE #2, normal console output. Control
  530.     characters and escape sequences are interpreted normally.
  531.  
  532.                                     -81-
  533.  
  534.  
  535. Function  03h    Auxiliary Input
  536.       Get (or wait until) character from STDAUX
  537. entry    AH    03h
  538. return    AL    ASCII char from auxiliary device
  539. note 1) AUX, COM1, COM2 is unbuffered and not interrupt driven
  540.      2) This function call does not return status or error codes. For greater
  541.     control it is recommended that you use ROM BIOS routine (int 14h) or
  542.     write an AUX device driver and use IOCTL.
  543.      3) At startup, PC-DOS initializes the first auxiliary port (COM1) to 2400
  544.     baud, no parity, one stop bit, and an 8-bit word. MSDOS may differ.
  545.      4) If Ctrl-C is has been entered from STDIN, int 23h is executed.
  546.      5) TOS: $03 AUXILIARY INPUT. Function returns when the character has been
  547.     received. Char is returned in the low byte of D0.
  548.  
  549.  
  550. Function  04h    Auxiliary Output
  551.       Write character to STDAUX
  552. entry    AH    04h
  553.     DL    ASCII char to send to AUX
  554. return    none
  555. note 1) This function call does not return status or error codes. For greater
  556.     control it is recommended that you use ROM BIOS routine (int 14h) or
  557.     write an AUX device driver and use IOCTL.
  558.      2) If Ctrl-C is has been entered from STDIN, int 23h is executed.
  559.      3) Default is COM1 unless redirected by DOS.
  560.      4) If the device is busy, this function will wait until it is ready.
  561.      5) TOS: $04 AUXILIARY OUTPUT. High byte should be zero, low byte is ASCII
  562.     code.
  563.  
  564.  
  565. Function  05h    Printer Output
  566.       Write character to STDPRN
  567. entry    AL    05h
  568.     DL    ASCII code for character to send
  569. return    none
  570. note 1) If Ctrl-C is has been entered from STDIN, int 23h is executed.
  571.      2) Default is PRN or LPT1 unless redirected with the MODE command.
  572.      3) If the printer is busy, this function will wait until it is ready.
  573.      5) TOS: $05 PRINTER OUTPUT. High byte of D0 is zero, low byte is character.
  574.     Returns -1 if character is sent successfully. Times out after 30
  575.     seconds and resets D0 to zero.
  576.  
  577.  
  578. Function  06h    Direct Console I/O
  579.       Get character from STDIN; echo character to STDOUT
  580. entry    AH    06h
  581.     DL    0FFh for console input, or 00h-0FEh for console output
  582. return    ZF    set    no character availible
  583.         clear    character recieved
  584.     AL    ASCII code for character
  585. note 1) Extended ASCII codes require two function calls. The first call returns
  586.     00h to indicate the next call will return an extended code.
  587.      2) If DL is not 0FFh, DL is assumed to have a valid character that is
  588.     output to STDOUT.
  589.      3) This function does not check for Ctrl-C or Ctrl-PrtSc.
  590.      4) Does not echo input to screen.
  591.      5) If I/O is redirected, EOF or disk full cannot be detected.
  592.      6) TOS: $06 RAWCONIO. Get character from keyboard by calling with $FF in
  593.     D0. ASCII and scan codes are returned as per CONIN. If a value other
  594.     than $FF is used, it is printed to STDOUT at the current cursor
  595.     position. This call interprets all control chars and escape sequences.
  596.  
  597.                                     -82-
  598.  
  599. Function  07h    Direct Console Input Without Echo    (does not check BREAK)
  600.       Get or wait for char at STDIN, returns char in AL
  601. entry    AH    07h
  602. return    AL    ASCII character from standard input device
  603. note 1) Extended ASCII codes require two function calls. The first call returns
  604.     00h to indicate the next call will return an extended code.
  605.      2) No checking for Ctrl-C or Ctrl-PrtSc is done.
  606.      3) Input is redirectable.
  607.      4) TOS: $07 DIRECT CONIN WITHOUT ECHO. Same as function 01h only does not
  608.     echo character to screen.
  609.  
  610. Function  08h    Console Input Without Echo          (checks BREAK)
  611.       Get or Wait for char at STDIN, return char in AL
  612. entry    AH    08h
  613. return    AL    char from standard input device
  614. note 1) Char is checked for ctrl-C. If ctrl-C is detected, executes int 23h.
  615.      2) For function call 08h, extended ASCII characters require two function
  616.     calls. The first call returns 00h to signify an extended ASCII code.
  617.     The next call returns the actual code.
  618.      3) Input is redirectable. If redirected, there is no way to check EOF.
  619.      4) TOS: $08 CONIN WITHOUT ECHO. Same as previous call. (no checking for
  620.     control characters).
  621.  
  622. Function  09h    Print String
  623.       Outputs Characters in the Print String to the STDOUT
  624. entry    AH    09h
  625.     DS:DX    pointer to the Character String to be displayed
  626. return    none
  627. note 1) The character string in memory must be terminated by a $ (24h)
  628.      2) The $ is not displayed but remains in AL forever unless popped.
  629.      3) Output to STDOUT is the same as function call 02h.
  630.      4) TOS: $09 PRINT LINE. The address of the ASCIIZ string is placed on the
  631.     stack as a parameter and is printed at the current cursor position.
  632.     There is no limit to the size of the string. D0 contains the number of
  633.     characters to be printed. Control and escape codes are evaluated.
  634.  
  635. Function  0Ah    Buffered Keyboard Input
  636.       Reads characters from STDIN and places them in the buffer beginning
  637.       at the third byte.
  638. entry    AH    0Ah
  639.     DS:DX    pointer to an input buffer
  640. return    none
  641. note 1) Min buffer size = 1, max = 255.
  642.      2) Char is checked for ctrl-C. If ctrl-C is detected, executes int 23h.
  643.      3) Format of buffer DX:
  644.     byte       contents
  645.      1    Maximum number of chars the buffer will take, including CR.
  646.         Reading STDIN and filling the buffer continues until a carriage
  647.         return (<Enter> or 0Dh) is read. If the buffer fills to one less
  648.         than the maximum number the buffer can hold, each additional
  649.         number read is ignored and ASCII 7 (BEL) is output to the
  650.         display until a carriage return is read. (you must set this
  651.         value)
  652.      2    Actual number of characters received, excluding the carriage
  653.         return, which is always the last character. (the function sets
  654.         this value)
  655.      3-n    Characters received are placed into the buffer starting here.
  656.         Buffer must be at least as long as the number in byte 1.
  657.      n+1    Carriage return character (0Dh).
  658.      4) Input is redirectable. If redirected, there is no way to check EOF.
  659.      5) The string may be edited with the standard DOS editing commands as it
  660.     is being entered.
  661.      6) Extended ASCII characters are stored as 2 bytes, the first byte being
  662.     zero.
  663.  
  664.                                     -83-
  665.  
  666.  
  667.      7) TOS: $0A READLINE. Fetches CR-terminated line from CONIN. The address
  668.     of the buffer is passed as a parameter. Byte 1 is the maximum length of
  669.     the line, byte 2 is the number of characters entered, byte 3 is the
  670.     first character. Escape codes are not interpreted, but the normal
  671.     editing control characters are.
  672.  
  673.  
  674. Function  0Bh    Check Standard Input (STDIN) status
  675.       Checks for character availible at STDIN
  676. entry    AH    0Bh
  677. return    AL    0FFh    if a character is availible from STDIN
  678.         00h    if no character is availible from STDIN
  679. note 1) Checks for Ctrl-C. If Ctrl-C is detected, int 23h is executed.
  680.      2) Input can be redirected.
  681.      3) Checks for character only, it is not read into the application
  682.      4) IBM reports that this call does not work properly under the DOSSHELL
  683.     program in DOS 4.00 and 4.01. DOSSHELL will return all zeroes. This
  684.     function works correctly from the command line or application.
  685.      5) TOS: $0B CONSTAT. Checks 64-byte OS input buffer.
  686.  
  687.  
  688. Function  0Ch    Clear Keyboard Buffer & Invoke a Keyboard Function     (FCB)
  689.       Dumps buffer, executes function in AL (01h, 06h, 07h, 08h, 0Ah only)
  690. entry    AH    0Ch
  691.     AL    function number (must be 01h, 06h, 07h, 08h, or 0Ah)
  692. return    AL    00h    buffer was flushed, no other processing performed
  693.         other    any other value has no meaning
  694. note 1) Forces system to wait until a character is typed.
  695.      2) Flushes all typeahead input, then executes function specified by AL (by
  696.     moving it to AH and repeating the int 21 call).
  697.      3) If AL contains a value not in the list above, (such as 00h) the
  698.     input buffer is flushed and no other action is taken. Note that this
  699.     is the STDIN buffer, not the actual keyboard buffer. The keyboard
  700.     buffer will not be flushed if input is redirected.
  701.  
  702.  
  703. Function  0Dh    Disk Reset
  704.       Flushes all currently open file buffers to disk
  705. entry    AH    0Dh
  706. return        none
  707. note 1) Does not close files. Does not update directory entries; files changed
  708.     in size but not closed are not properly recorded in the directory.
  709.      2) Sets DTA address to DS:0080h
  710.      3) Should be used before a disk change, Ctrl-C handlers, and to flush
  711.     the buffers to disk.
  712.      4) This call is explicitly supported in the OS/2 Compatibility Box.
  713.  
  714.                                     -84-
  715.  
  716. Function  0Eh    Select Disk
  717.       Sets the drive specified in DL (if valid) as the default drive
  718. entry    AL    0Eh
  719.     DL    new default drive number (0=A:,1=B:,2=C:,etc.)
  720. return    AL    number of physical drives found unless LASTDRIVE= is included
  721.         in CONFIG.SYS and specifies a higher number than that of the
  722.         last physical drive.
  723. note 1) For DOS 1.x and 2.x, the minimum value for AL is 2.
  724.      2) For DOS 3.x and 4.x, the minimum value for AL is 5.
  725.      3) The drive number returned is not nescessarily a valid drive.
  726.      4) For DOS 1.x: 16 logical drives are availible, A-P.
  727.     For DOS 2.x: 63 logical drives are availible. (Letters are only used for
  728.              the first 26 drives. If more than 26 logical drives are
  729.              used, further drive letters will be other ASCII characters
  730.              ie {,], etc.
  731.     For DOS 3.x, 4.x: 26 logical drives are availible, A-Z.
  732.      5) TOS: $0E SETDRV. A 16-bit parameter with drivespec is passed to TOS.
  733.     On exit, D0 contains the number of the drive active before the call.
  734.     (not the total number of drives)
  735.      6) This call is explicitly supported in the OS/2 Compatibility Box.
  736.  
  737. Function  0Fh    Open Disk File                          (FCB)
  738.       Searches current directory for specified filename and place relevant
  739.       information into the File Control Block.
  740. entry    AH    0Fh
  741.     DS:DX    pointer to an unopened FCB
  742. return    AL    00h    if file found
  743.         0FFh    if file not not found
  744. note 1) If the drive code was 0 (default drive) it is changed to the actual
  745.     drive used (1=A:,2=B:,3=C:, etc). This allows changing the default drive
  746.     without interfering with subsequent operations on this file.
  747.      2) The current block field (FCB bytes C-D, offset 0Ch) is set to zero.
  748.      3) The size of the record to be worked with (FCB bytes E-F, offset 0Eh) is
  749.     set to the system default of 80h. The size of the file (offset 10h) and
  750.     the date (offset 14h) are set from information obtained in the root
  751.     directory. You can change the default value for the record size (FCB
  752.     bytes E-F) or set the random record size and/or current record field.
  753.     Perform these actions after the open but before any disk operations.
  754.      4) With DOS 3.x the file is opened in compatibility mode. (network)
  755.      5) Microsoft recommends handle function call 3Dh be used instead.
  756.      6) This call is also used by the APPEND command in DOS 3.2+
  757.      7) Before performing a sequential disk operation on the file, you must
  758.     set the Current Record field (offset 20h). Before performing a random
  759.     disk operation on the file, you must set the Relative Record field
  760.     (offset 21h). If the default record size of 128 bytes is incorrect, set
  761.     it to the correct value.
  762.  
  763. Function  10h  Close File                           (FCB)
  764.      Closes a File After a File Write
  765. entry    AH    10h
  766.     DS:DX    pointer to an opened FCB
  767. return    AL    00h    if the file is found and closed
  768.         0FFh    if the file is not found in the current directory
  769. note 1) This function call must be done on open files that are no longer needed,
  770.     and after file writes to insure all directory information is updated.
  771.      2) If the file is not found in its correct position in the current
  772.     directory, it is assumed that the diskette was changed and AL returns
  773.     0FFh. This error return is reportedly not completely reliable with DOS
  774.     version 2.x.
  775.      3) If found, the directory is updated to reflect the status in the FCB, the
  776.     buffers to that file are flushed, and AL returns 00h.
  777.      4) There is a subtle but dangerous bug in this function. If a Close
  778.     request is issued using a File Control Block that has not been
  779.     previously activated by a successful Open command, the file's length
  780.     will be truncated to zero and the clusters previously assigned to the
  781.     file are left floating.
  782.  
  783.                                     -85-
  784.  
  785.  
  786. Function  11h    Search For First Matching Entry               (FCB)
  787.       Searches current disk & directory for first matching filename
  788. entry    AH    11h
  789.     DS:DX    pointer to address of FCB
  790. return    AL    00h    successful match
  791.         0FFh    no matching filename found
  792. note 1) The FCB may contain the wildcard character ? under DOS 2.x, and ? or *
  793.     under 3.x and 4.x.
  794.      2) The original FCB at DS:DX contains information to continue the search
  795.     with function 12h, and should not be modified.
  796.      3) If a matching filename is found, AL returns 00h and the locations at the
  797.     Disk Transfer Address are set as follows:
  798.     a) If the FCB provided for searching was an extended FCB, then the first
  799.        byte at the disk transfer address is set to 0FFh followed by 5 bytes
  800.        of zeroes, then the attribute byte from the search FCB, then the
  801.        drive number used (1=A, 2=B, etc) then the 32 bytes of the directory
  802.        entry. Thus, the disk transfer address contains a valid unopened FCB
  803.        with the same search attributes as the search FCB.
  804.     b) If the FCB provided for searching was a standard FCB, then the first
  805.        byte is set to the drive number used (1=A,2=b,etc), and the next 32
  806.        bytes contain the matching directory entry. Thus, the disk transfer
  807.        address contains a valid unopened normal FCB.
  808.      4) If an extended FCB is used, the following search pattern is used:
  809.     a) If the FCB attribute byte is zero, only normal file entries are
  810.        found. Entries for volume label, subdirectories, hidden or system
  811.        files, are not returned.
  812.     b) If the attribute byte is set for hidden or system files, or
  813.        subdirectory entries, it is to be considered as an inclusive search.
  814.        All normal file entries plus all entries matching the specified
  815.        attributes are returned. To look at all directory entries except the
  816.        volume label, the attribute byte may be set to hidden + system +
  817.        directory (all 3 bits on).
  818.     c) If the attribute field is set for the volume label, it is considered
  819.        an exclusive search, and ONLY the volume label entry is returned.
  820.      5) This call is also used by the APPEND command in DOS 3.2+
  821.  
  822.  
  823. Function  12h    Search For Next Entry Using FCB              (FCB)
  824.       Search for next matching filename
  825. entry    AH    12h
  826.     DS:DX    pointer to the unopened FCB specified from the previous Search
  827.         First (11h) or Search Next (12h)
  828. return    AL    00h    if matching filename found
  829.         0FFh    if matching filename was not found
  830. note 1) After a matching filename has been found using function call 11h,
  831.     function 12h may be called to find the next match to an ambiguous
  832.     request. For DOS 2.x, ?'s are allowed in the filename. For DOS 3.x
  833.     and 4.x, global (*) filename characters are allowed.
  834.      2) The DTA contains info from the previous Search First or Search Next.
  835.      3) Do not perform any disk operations with this FCB between a previous
  836.     function 11h or 12h call and this one. "Undocumented" fields in the FCB
  837.     are used to keep information necessary for continuing the search, and
  838.     some disk operations may overwrite these areas.
  839.      4) If the file is found, an FCB is created at the DTA address and set up to
  840.     open or delete it.
  841.  
  842.                                     -86-
  843.  
  844.  
  845. Function  13h    Delete File Via FCB                      (FCB)
  846.       Deletes file specified in FCB from current directory
  847. entry    AH    13h
  848.     DS:DX    pointer to address of FCB
  849. return    AL    00h    file deleted
  850.         0FFh    if file not found or was read-only
  851. note 1) All matching current directory entries are deleted. The global filename
  852.     character "?" is allowed in the filename.
  853.      2) Will not delete files with read-only attribute set.
  854.      3) Close open files before deleting them.
  855.      4) Requires Network Access Rights.
  856.      5) This call supports wildcards and is very fast. The "new" handle call
  857.     41h is supposed to replace this one, since it knows about
  858.     subdirectories. Unfortunately, fn 41h doesn't know about wildcards.
  859.  
  860.  
  861. Function  14h    Sequential Disk File Read                  (FCB)
  862.       Reads record sequentially from disk via FCB
  863. entry    AH  14h
  864.     DS:DX    pointer to an opened FCB
  865. return    AL    00h    successful read
  866.         01h    end of file (no data read)
  867.         02h    Data Transfer Area too small for record size specified
  868.             or segment overflow
  869.         03h    partial record read, EOF found
  870. note 1) The record size is set to the value at offset 0Eh in the FCB.
  871.      2) The record pointed to by the Current Block (offset 0Ch) and the Current
  872.     Record (offset 20h) fields is loaded at the DTA, then the Current Block
  873.     and Current Record fields are incremented.
  874.      3) The record is read into memory at the current DTA address as specified
  875.     by the most recent call to function 1Ah. If the size of the record and
  876.     location of the DTA are such that a segment overflow or wraparound would
  877.     occur, the error return is set to AL=02h.
  878.      4) If a partial record is read at the end of the file, it is passed to the
  879.     requested size with zeroes and the error return is set to AL=03h.
  880.  
  881.  
  882. Function  15h    Sequential Disk Write                      (FCB)
  883.       Writes record specified by FCB sequentially to disk
  884. entry    AH    15h
  885.     DS:DX    pointer to address of FCB
  886. return    AL    00h    successful write
  887.         01h    diskette full, write canceled
  888.         02h    disk transfer area (DTA) too small or segment wrap
  889. note 1) The data to write is obtained from the disk transfer area.
  890.      2) The record size is set to the value at offset 0Eh in the FCB.
  891.      3) This service cannot write to files set as read-only.
  892.      4) The record pointed to by the Current Block (offset 0Ch) and the Current
  893.     Record (offset 20h) fields is loaded at the DTA, then the Current Block
  894.     and Current Record fields are incremented.
  895.      5) If the record size is less than a sector, the data in the DTA is written
  896.     to a buffer; the buffer is written to disk when it contains a full
  897.     sector of data, the file is closed, or a Reset Disk (function 0Dh) is
  898.     issued.
  899.      6) The record is written to disk at the current DTA address as specified
  900.     by the most recent call to function 1Ah. If the size of the record and
  901.     location of the DTA are such that a segment overflow or wraparound would
  902.     occur, the error return is set to AL=02h.
  903.  
  904.                                     -87-
  905.  
  906.  
  907. Function  16h    Create A Disk File                      (FCB)
  908.       Search and open or create directory entry for file
  909. entry    AH    16h
  910.     DS:DX    pointer to an FCB
  911. return    AL    00h    successful creation
  912.         0FFh    no room in directory
  913. note 1) If a matching directory entry is found, the file is truncated to zero
  914.     bytes.
  915.      2) If there is no matching filename, a filename is created.
  916.      3) This function calls function 0Fh (Open File) after creating or
  917.     truncating a file.
  918.      4) A hidden file can be created by using an extended FCB with the
  919.     attribute byte (offset FCB-1) set to 2.
  920.  
  921.  
  922. Function  17h    Rename File Specified by File Control Block         (FCB)
  923.       Renames file in current directory
  924. entry    AH    17h
  925.     DS:DX    pointer to an FCB (see note 4)
  926. return    AL    00h    successfully renamed
  927.         0FFh    file not found or filename already exists
  928. note 1) This service cannot rename read-only files.
  929.      2) The "?" wildcard may be used.
  930.      3) If the "?" wildcard is used in the second filename, the corresponding
  931.     letters in the filename of the directory entry are not changed.
  932.      4) A special modified FCB is used. It must have a drive number, filename,
  933.     and extension in the usual position, and a second filename starting 6
  934.     bytes after the first, at offset 11h. This is normally a "reserved"
  935.     area.
  936.      5) The two filenames cannot have the same name.
  937.      6) FCB contains new name starting at byte 17h.
  938.  
  939.  
  940. Function  18h  Internal to DOS
  941.  *   Unknown - reportedly not used
  942. entry    AH    18h
  943. return    AL    00h
  944.  
  945.  
  946. Function  19h    Get Current Disk Drive
  947.       Return designation of current default disk drive
  948. entry    AH    19h
  949. return    AL    current default drive (0=A, 1=B,etc.)
  950. note 1) Some other DOS functions use 0 for default, 1=A, 2=B, etc.
  951.      2) This call is explicitly supported in the OS/2 Compatibility Box.
  952.      3) TOS: $19 CURRENT DISK. D0 returns number of drive (0=A:)
  953.  
  954.  
  955. Function  1Ah    Set Disk Transfer Area Address (DTA)
  956.       Sets DTA address to the address specified in DS:DX
  957. entry    AH    1Ah
  958.     DS:DX    pointer to DTA buffer
  959. return    none
  960. note 1) The default DTA is 128 bytes at offset 80h in the PSP. You may set up
  961.     your own DTA with any size and location. The DTA should be large
  962.     enough to handle the largest record you intend to write.
  963.      2) Registers are unchanged.
  964.      3) No error codes are returned.
  965.      4) Disk transfers cannot wrap around from the end of the segment to the
  966.     beginning or overflow into another segment.
  967.      5) DOS uses the DTA for file I/O. (see Chapter 6)
  968.      6) This call is explicitly supported in the OS/2 Compatibility Box.
  969.      7) TOS: $1A SET DISK TRANSFER ADDRESS. Sets up a 44-byte buffer for disk
  970.     operations.
  971.  
  972.                                     -88-
  973.  
  974.  
  975. Function  1Bh    Get Current Drive File Allocation Table Information
  976.       Returns information from the FAT on the current drive
  977. entry    AH    1Bh
  978. return    AL    number of sectors per allocation unit (cluster)
  979.     CX    number of bytes per sector
  980.     DS:BX    address of the current drive's media descriptor byte
  981.     DX    number of allocation units (clusters) for default drive
  982. note 1) Save DS before calling this function.
  983.      2) This call returned a pointer to the FAT in DOS 1.x. Beginning with
  984.     DOS 2.00, it returns a pointer only to the table's ID byte.
  985.      3) IBM recommends programmers avoid this call and use int 25h instead.
  986.      4) Offset DS:[BX-1] is the dirty byte for the table: 00=clean, 01=dirty.
  987.      5) DOS 2.x+ and above do not keep the FAT in RAM. Do not use this call to
  988.     access the FAT. Function 36 is preferred.
  989.  
  990.  
  991. Function  1Ch    Get File Allocation Table Information for Specific Device
  992.       Returns information on specified drive
  993. entry    AH    1Ch
  994.     DL    drive number (1=A, 2=B, 3=C, etc)
  995. return    AL    number of sectors per allocation unit (cluster)
  996.         0FFh    invalid drive specification
  997.     DS:BX    address of media descriptor byte for drive in DL
  998.     CX    sector size in bytes
  999.     DX    number of allocation units (clusters)
  1000. note 1) Set DL = 0 for default.
  1001.      2) Save DS before calling this function.
  1002.      3) Format of media-descriptor byte:
  1003.     bits:    0    0   (clear)   not double sided
  1004.             1   (set)     double sided
  1005.         1    0   (clear)   not 8 sector
  1006.             1   (set)     8 sector
  1007.         2    0   (clear)   nonremovable device
  1008.             1   (set)     removable device
  1009.         3-7    always set (1)
  1010.      4) This call returned a pointer to the FAT in DOS 1.x. Beginning with
  1011.     DOS 2.00, it returns a pointer only to the table's ID byte.
  1012.      5) IBM recommends programmers avoid this call and use int 25h instead.
  1013.      6) This function reads the BPB only and is very fast.
  1014.  
  1015.  
  1016. Function  1Dh    Not Documented by Microsoft
  1017.  *    Unknown - reportedly not used
  1018. entry    AH    1Dh
  1019. return    AL    00h
  1020.  
  1021.  
  1022. Function  1Eh    Not Documented by Microsoft
  1023.  *    Unknown - reportedly not used
  1024. entry    AH    1Eh
  1025. return    AL    00h
  1026. note    Apparently does nothing.
  1027.  
  1028.                                     -89-
  1029.  
  1030.  
  1031. Function  1Fh    Get Default Drive Parameter Block
  1032.  *  Same as function call 32h (below), except that the table is accessed from
  1033.     the default drive
  1034. entry    AH    1Fh
  1035.     other registers unknown
  1036. return    AL    00h    no error
  1037.         0FFh    error
  1038.     DS:BX    pointer to DOS Disk Parameter Block for default drive.
  1039. note    For DOS 2, 3, 4.x, this just invokes function 32h (undocumented,
  1040.     Read DOS Disk Block) with DL=0.
  1041.  
  1042.  
  1043. Function  20h  Unknown
  1044.  *   Internal - does nothing?
  1045. entry    AH    20h
  1046. return    AL    00h
  1047.  
  1048.  
  1049. Function  21h  Random Read from File Specified by File Control Block     (FCB)
  1050.      Reads one record as specified in the FCB into the current DTA.
  1051. entry    AH    21h
  1052.     DS:DX    address of the opened FCB
  1053. return    AL    00h    successful read operation
  1054.         01h    end of file (EOF), no data read
  1055.         02h    DTA too small for the record size specified
  1056.         03h    end of file (EOF), partial data read
  1057. note 1) The current block and current record fields are set to agree with the
  1058.     random record field. Then the record addressed by these fields is read
  1059.     into memory at the current Disk Transfer Address.
  1060.      2) The current file pointers are NOT incremented this function.
  1061.      3) If the DTA is larger than the file, the file is padded to the requested
  1062.     length with zeroes.
  1063.  
  1064.  
  1065. Function  22h  Random Write to File Specified by FCB              (FCB)
  1066.      Writes one record as specified in the FCB to the current DTA
  1067. entry    AH    22h
  1068.     DS:DX    address of the opened FCB
  1069. return    AL    00h    successful write operation
  1070.         01h    disk full; no data written (write was canceled)
  1071.         02h    DTA too small for the record size specified (write was
  1072.             canceled)
  1073. note 1) This service cannot write to read-only files.
  1074.      2) The record pointed to by the Current Block (offset 0Ch) and the Current
  1075.     Record (offset 20h) fields is loaded at the DTA, then the Current Block
  1076.     and Current Record fields are incremented.
  1077.      3) If the record size is less than a sector, the data in the DTA is written
  1078.     to a buffer; the buffer is written to disk when it contains a full
  1079.     sector of data, the file is closed, or a Reset Disk (function 0Dh) is
  1080.     issued.
  1081.      4) The current file pointers are NOT incremented this function.
  1082.      5) The record is written to disk at the current DTA address as specified
  1083.     by the most recent call to function 1Ah. If the size of the record and
  1084.     location of the DTA are such that a segment overflow or wraparound would
  1085.     occur, the error return is set to AL=02h.
  1086.  
  1087.                                     -90-
  1088.  
  1089.  
  1090. Function  23h  Get File Size                         (FCB)
  1091.      Searches current subdirectory for matching file, returns size in FCB
  1092. entry    AH    23h
  1093.     DS:DX    address of an unopened FCB
  1094. return    AL    00h file found
  1095.         0FFh file not found
  1096. note 1) Record size field (offset 0Eh) must be set before invoking this function
  1097.      2) The disk directory is searched for the matching entry. If a matching
  1098.     entry is found, the random record field is set to the number of records
  1099.     in the file. If the value of the Record Size field is not an even
  1100.     divisor of the file size, the value set in the relative record field is
  1101.     rounded up. This gives a returned value larger than the actual file size
  1102.      3) This call is used by the APPEND command in DOS 3.2+
  1103.  
  1104.  
  1105. Function  24h  Set Relative Record Field                  (FCB)
  1106.      Set random record field specified by an FCB
  1107. entry    AH    24h
  1108.     DS:DX    address of an opened FCB
  1109. return    Random Record Field of FCB is set to be same as Current Block
  1110.     and Current Record.
  1111. note 1) You must invoke this function before performing random file access.
  1112.      2) The relative record field of FCB (offset 21h) is set to be same as the
  1113.     Current Block (offset 0Ch) and Current Record (offset 20h).
  1114.      3) No error codes are returned.
  1115.      4) The FCB must already be opened.
  1116.  
  1117.  
  1118. Function  25h  Set Interrupt Vector
  1119.      Sets the address of the code DOS is to perform each time the specified
  1120.      interrupt is invoked.
  1121. entry    AH    25h
  1122.     AL    int number to reassign the handler to
  1123.     DS:DX    address of new interrupt vector
  1124. return    none
  1125. note 1) Registers are unchanged.
  1126.      2) No error codes are returned.
  1127.      3) The interrupt vector table for the interrupt number specified in AL
  1128.     is set to the address contained in DS:DX. Use function 35h (Get Vector)
  1129.     to get the contents of the interrupt vector and save it for later use.
  1130.      4) When you use function 25 to set an interrupt vector, DOS 3.2 doesn't
  1131.     point the actual interrupt vector to what you requested. Instead, it
  1132.     sets the interrupt vector to point to a routine inside DOS, which does
  1133.     this:
  1134.         1. Save old stack pointer
  1135.         2. Switch to new stack pointer allocated from DOS's stack pool
  1136.         3. Call your routine
  1137.         4. Restore old stack pointer
  1138.     The purpose for this was to avoid possible stack overflows when there
  1139.     are a large number of active interrupts. IBM was concerned (this was an
  1140.     IBM change, not Microsoft) that on a Token Ring network there would be
  1141.     a lot of interrupts going on, and applications that hadn't allocated
  1142.     very much stack space would get clobbered.
  1143.      5) This call is explicitly supported in the OS/2 Compatibility Box.
  1144.  
  1145.                                     -91-
  1146.  
  1147.  
  1148. Function  26h  Create New Program Segment Prefix (PSP)
  1149.      This service copies the current program-segment prefix to a new memory
  1150.      location for the creation of a new program or overlay. Once the new PSP is
  1151.      in place, a DOS program can read a DOS COM or overlay file into the memory
  1152.      location immediately following the new PSP and pass control to it.
  1153. entry    AH    26h
  1154.     DX    segment number for the new PSP
  1155. return    Current PSP is copied to specified segment
  1156. note 1) Microsoft recommends you use the newer DOS service 4Bh (EXEC) instead.
  1157.      2) The entire 100h area at location 0 in the current PSP is copied into
  1158.     location 0 of the new PSP. The memory size information at location 6
  1159.     in the new segment is updated and the current termination, ctrl-break,
  1160.     and critical error addresses from interrupt vector table entries for
  1161.     ints 22h, 23h, and 24 are saved in the new program segment starting at
  1162.     0Ah. They are restored from this area when the program terminates.
  1163.  
  1164.  
  1165. Function  27h  Random Block Read From File Specified by FCB
  1166.      Similar to 21h (Random Read) except allows multiple files to be read.
  1167. entry    AH    27h
  1168.     CX    number of records to be read
  1169.     DS:DX    address of an opened FCB
  1170. return    AL    00h    successful read
  1171.         01h    end of file, no data read
  1172.         02h    DTA too small for record size specified (read canceled)
  1173.         03h    end of file
  1174.     CX    actual number of records read (includes partial if AL=03h)
  1175. note 1) The record size is specified in the FCB. The service updates the Current
  1176.     Block (offset 0Ch) and Current Record (offset 20h) fields to the next
  1177.     record not read.
  1178.      2) If CX contained 0 on entry, this is a NOP.
  1179.      3) If the DTA is larger than the file, the file is padded to the requested
  1180.     length with zeroes.
  1181.      4) This function assumes that the FCB record size field (0Eh) is correctly
  1182.     set. If not set by the user, the default is 128 bytes.
  1183.      5) The record is written to disk at the current DTA address as specified
  1184.     by the most recent call to function 1Ah. If the size of the record and
  1185.     location of the DTA are such that a segment overflow or wraparound would
  1186.     occur, the error return is set to AL=02h.
  1187.  
  1188.  
  1189. Function  28h  Random Block Write to File Specified in FCB
  1190.      Similar to 27h (Random Write) except allows multiple files to be read.
  1191. entry    AH    28h
  1192.     CX    number of records to write
  1193.     DS:DX    address of an opened FCB
  1194. return    AL    00h    successful write
  1195.         01h    disk full, no data written
  1196.         02h    DTA too small for record size specified (write canceled)
  1197.     CX    number of records written
  1198. note 1) The record size is specified in the FCB.
  1199.      2) This service allocates disk clusters as required.
  1200.      3) This function assumes that the FCB Record Size field (offset 0Eh) is
  1201.     correctly set. If not set by the user, the default is 128 bytes.
  1202.      4) The record size is specified in the FCB. The service updates the Current
  1203.     Block (offset 0Ch) and Current Record (offset 20h) fields to the next
  1204.     record not read.
  1205.      5) The record is written to disk at the current DTA address as specified
  1206.     by the most recent call to function 1Ah. If the size of the record and
  1207.     location of the DTA are such that a segment overflow or wraparound would
  1208.     occur, the error return is set to AL=02h.
  1209.      6) If called with CX=0, no records are written, but the FCB's File Size
  1210.     entry (offset 1Ch) is set to the size specified by the FCB's Relative
  1211.     Record field (offset 21h).
  1212.  
  1213.                                     -92-
  1214.  
  1215. Function  29h  Parse the Command Line for Filename
  1216.      Parses a text string into the fields of a File Control Block
  1217. entry    AH    29h
  1218.     DS:SI    pointer to string to parse
  1219.     ES:DI    pointer to memory buffer to fill with unopened FCB
  1220.     AL    bit mask to control parsing
  1221.         bit 0    0       parsing stops if file seperator found
  1222.              1       causes service to scan past leading chars such as
  1223.                blanks. Otherwise assumes the filename begins in
  1224.                the first byte
  1225.         1    0       drive number in FCB set to default (0) if string
  1226.                contains no drive number
  1227.              1       drive number in FCB not changed
  1228.         2    0       filename in FCB set to 8 blanks if no filename in
  1229.                string
  1230.              1       filename in FCB not changed if string does not
  1231.                contain a filename
  1232.         3    0       extension in FCB set to 3 blanks if no extension in
  1233.                string
  1234.              1       extension left unchanged
  1235.         4-7  must be zero
  1236. return    AL    00h    no wildcards in name or extension
  1237.         01h    wildcards appeared in name or extension
  1238.         0FFh    invalid drive specifier
  1239.     DS:SI    pointer to the first byte after the parsed string
  1240.     ES:DI    pointer to a buffer filled with the unopened FCB
  1241. note 1) If the * wildcard characters are found in the command line, this service
  1242.     will replace all subsequent chars in the FCB with question marks.
  1243.      2) This service uses the characters as filename separators
  1244.     DOS 1        : ; . , + / [ ] = " TAB SPACE
  1245.     DOS 2,3,4   : ; . , + = TAB SPACE
  1246.      3) This service uses the characters
  1247.     : ; . , + < > | / \ [ ] = " TAB SPACE
  1248.     or any control characters as valid filename separators.
  1249.      4) A filename cannot contain a filename terminator. If one is encountered,
  1250.     all processing stops. The handle functions will allow use of some of
  1251.     these characters.
  1252.      5) If no valid filename was found on the command line, ES:DI +1 points
  1253.     to a blank (ASCII 32).
  1254.      6) This function cannot be used with filespecs which include a path.
  1255.      7) Parsing is in the form D:FILENAME.EXT. If one is found, a corresponding
  1256.     unopened FCB is built at ES:DI.
  1257.  
  1258. Function  2Ah  Get Date
  1259.      Returns day of the week, year, month, and date
  1260. entry    AH    2Ah
  1261. return    CX    year    (1980-2099)
  1262.     DH    month    (1-12)
  1263.     DL    day    (1-31)
  1264.     AL    weekday 00h    Sunday
  1265.             01h    Monday
  1266.             02h    Tuesday
  1267.             03h    Wednesday
  1268.             04h    Thursday
  1269.             05h    Friday
  1270.             06h    Saturday
  1271. note 1) Date is adjusted automatically if clock rolls over to the next day,
  1272.     and takes leap years and number of days in each month into account.
  1273.      2) Although DOS cannot set an invalid date, it can read one, such as
  1274.     91/32/80, etc.
  1275.      3) DesQview also accepts CX = 4445h and DX = 5351h, i.e. 'DESQ' as valid.
  1276.      4) This call is explicitly supported in the OS/2 Compatibility Box.
  1277.      5) DOS will accept CH=0 (midnight) as a valid time, but if a file's time
  1278.     is set to exactly midnight the time will not be displayed by the DIR
  1279.     command. (except DR-DOS)
  1280.      6) TOS: $2A GET DATE.
  1281.  
  1282.                                     -93-
  1283.  
  1284.  
  1285. Function  2Bh  Set Date
  1286.      set current system date
  1287. entry    AH    2Bh
  1288.     CX    year    (1980-2099)
  1289.     DH    month    (1-12)
  1290.     DL    day    (1-31)
  1291. return    AL    00h    no error (valid date)
  1292.         0FFh    invalid date specified
  1293. note 1) On entry, CX:DX must have a valid date in the same format as returned
  1294.     by function call 2Ah.
  1295.      2) DOS 3.3+ also sets CMOS clock.
  1296.      3) Under the DesQview system shell, this is the DV_GET_VERSION check.
  1297.     entry    AH    2Bh
  1298.         AL    01h    DesQ call
  1299.         CX    4445h    'DE'           (invalid date used
  1300.         DX    5351h    'SQ'            for DesQview ID)
  1301.     return    AH    major version
  1302.         AL    minor version
  1303.         AX    0FFh    DesQ not installed (DOS error code)
  1304.      4) For DESQview 2.00+, installation check
  1305.     entry    AH    2Bh
  1306.         AL    subfunction (DV v2.00+)
  1307.             01h    Get Version
  1308.     return    BX    version (BH = major, BL = minor)
  1309.     note    Early copies of v2.00 return 0002h.
  1310.             02h    Get Shadow Buffer Info, and Start Shadowing
  1311.     return    BH    rows in shadow buffer
  1312.         BL    columns in shadow buffer
  1313.         DX    segment of shadow buffer
  1314.             04h    Get Shadow Buffer Info
  1315.     return    BH    rows in shadow buffer
  1316.         BL    columns in shadow buffer
  1317.         DX    segment of shadow buffer
  1318.             05h    Stop Shadowing
  1319.         CX    4445h ('DE')
  1320.         DX    5351h ('SQ')
  1321.     return    AL    0FFh    if DESQview not installed
  1322.     note    In DESQview v1.x, there were no subfunctions; this call only
  1323.         identified whether or not DESQview was loaded.
  1324.      5) PC-Tools PC-Cache (Multisoft cache) installation check.
  1325.     entry    CX=4358h
  1326.      6) This call is explicitly supported in the OS/2 Compatibility Box.
  1327.      7) TOS: GET DATE.
  1328.  
  1329. Function  2Ch  Get Time
  1330.      Get current system time from CLOCK$ driver
  1331. entry    AH    2Ch
  1332. return    CH    hours    (0-23)
  1333.     CL    minutes (0-59)
  1334.     DH    seconds (0-59)
  1335.     DL    hundredths of a second (0-99)
  1336. note 1) Time is updated every 5/100 second.
  1337.      2) The date and time are in binary format.
  1338.      3) This call is explicitly supported in the OS/2 Compatibility Box.
  1339.      4) TOS: GET TIME.
  1340.  
  1341.                                        -94-
  1342.  
  1343.  
  1344. Function  2Dh  Set Time
  1345.      Sets current system time
  1346. entry    AH    2Dh
  1347.     CH    hours    (0-23)
  1348.     CL    minutes (0-59)
  1349.     DH    seconds (0-59)
  1350.     DL    hundredths of seconds (0-99)
  1351. return    AL    00h    if no error
  1352.         0FFh    if bad value sent to routine
  1353. note 1) DOS 3.3+ also sets CMOS clock.
  1354.      2) CX and DX must contain a valid time in binary.
  1355.      3) This call is explicitly supported in the OS/2 Compatibility Box.
  1356.      4) TOS: SET TIME.
  1357.  
  1358.  
  1359. Function  2Eh  Set/Reset Verify Switch
  1360.      Set verify flag
  1361. entry    AH    2Eh
  1362.     AL    00    to turn verify off (default)
  1363.         01    to turn verify on
  1364. return    none
  1365. note 1) This is the call invoked by the DOS VERIFY command.
  1366.      2) Setting of the verify switch can be obtained by calling call 54h.
  1367.      3) This call is not supported on network drives.
  1368.      4) DOS checks this flag each time it accesses a disk.
  1369.      5) This call is explicitly supported in the OS/2 Compatibility Box.
  1370.  
  1371.  
  1372. Function  2Fh  Get Disk Transfer Address (DTA)
  1373.      Returns current disk transfer address used by all DOS read/write operations
  1374. entry    AH    2Fh
  1375. return    ES:BX    address of DTA
  1376. note 1) The DTA is set by function call 1Ah
  1377.      2) Default DTA address is a 128 byte buffer at offset 80h in that program's
  1378.     Program Segment Prefix.
  1379.      3) See Chapter 6 for a description of the DTA.
  1380.      4) This call is explicitly supported in the OS/2 Compatibility Box.
  1381.      5) TOS: GET DTA. Returns segment address of current DTA in D0.
  1382.  
  1383.  
  1384. Function  30h  Get DOS Version Number
  1385.      Return DOS version and/or user number
  1386. entry    AH    30h
  1387. return    AH    minor version number  (i.e., DOS 2.10 returns AX = 0A02h)
  1388.     AL    major version number  (0 for DOS 1.x)
  1389.     BH    OEM ID number
  1390.         00h    IBM
  1391.         16h    DEC    (others not known)
  1392.     BL:CX    24-bit user serial number
  1393. note 1) If AL returns a major version number of zero, the DOS version is
  1394.     below 1.28 for MSDOS and below 2.00 for PCDOS.
  1395.      2) IBM PC-DOS always returns 0000h in BX and CX, as does DR-DOS.
  1396.      3) OS/2 v1.0 Compatibility Box returns a value of 10 for major version.
  1397.      4) Due to the OS/2 return and the fact that some European versions of DOS
  1398.     carry higher version numbers than IBM's DOS, utilities which check
  1399.     for a DOS version should not abort if a higher version than required
  1400.     is found unless some specific problems are known.
  1401.      5) This call is explicitly supported by the OS/2 DOS Compatibility Box.
  1402.      6) TOS: $30 GET VERSION NUMBER. Returns GEMDOS version number in D0.
  1403.  
  1404.                                     -95-
  1405.  
  1406.  
  1407. Function  31h  Terminate Process and Stay Resident
  1408.      KEEP, or TSR
  1409. entry    AH    31h
  1410.     AL    exit code
  1411.     DX    program memory requirement in 16 byte paragraphs
  1412. return    AX    return code (retrieveable by function 4Dh)
  1413. note 1) Files opened by the application are not closed when this call is made.
  1414.      2) Memory can be used more efficiently if the block containing the copy of
  1415.     the DOS environment is deallocated before terminating. This can be done
  1416.     by loading ES with the segment contained in 2Ch of the PSP and issuing
  1417.     function call 49h (Free Allocated Memory).
  1418.      3) Unlike int 27h, more than 64k may be made resident with this call.
  1419.      4) TOS: $31 KEEP PROCESS.
  1420.  
  1421.  
  1422. Function  32h  Read DOS Disk Parameter Block
  1423.  *   Retrieve the pointer to the drive parameter block for a drive
  1424. entry    AH    32h
  1425.     DL    drive (0=default, 1=A:, etc.).
  1426. return    AL    00h    if drive is valid
  1427.         0FFh    if drive is not valid
  1428.     DS:BX    pointer to DOS Drive Parameter Table. Format of block:
  1429.           ┌────────┬──────┬────────────────────────────────────────────────
  1430.           │ Bytes  │ Type │             Value
  1431.           ├────────┼──────┼────────────────────────────────────────────────
  1432.           │ 00h    │ byte │ Drive: 0=A:, 1=B:, etc.
  1433.           │ 01h    │ byte │ Unit within device driver (0, 1, 2, etc.)
  1434.           │ 02h-03h│ word │ Bytes per sector
  1435.           │ 04h    │ byte │ largest sector number in cluster (one less than
  1436.           │        │      │ sectors per cluster)
  1437.           │ 05h    │ byte │ Cluster to sector shift (i.e., how far to shift-
  1438.           │        │      │ left the bytes/sector to get bytes/cluster)
  1439.           │ 06h-07h│ word │ Number of reserved (boot) sectors
  1440.           │ 08h    │ byte │ Number of copies of the FAT
  1441.           │ 09h-0Ah│ word │ Number of root directory entries
  1442.           │ 0Bh-0Ch│ word │ Sector # of 1st data. Should be same as # of
  1443.           │        │      │ sectors/track.
  1444.           │ 0Dh-0Eh│ word │ largest possible cluster number (one more than
  1445.           │        │      │ the number of data clusters)
  1446.           ├────────┴──────┼────────────────────────────────────────────────
  1447.           │ DOS 2.x only  │
  1448.           ├────────┬──────┼────────────────────────────────────────────────
  1449.           │ 0Fh    │ byte │ Number of sectors for one copy of the FAT
  1450.           │ 10h-11h│ word │ Number of first sector of root directory
  1451.           │ 12h-15h│ dword│ Address of device driver header for this drive
  1452.           │        │      │  (beginning of device driver)
  1453.           │ 16h    │ byte │ Media Descriptor Byte for this drive
  1454.           │ 17h    │ byte │ 0FFh indicates block must be rebuilt
  1455.           │        │      │ (DOS 3.x) 00h indicates block device has
  1456.           │        │      │ been accessed
  1457.           │ 18h-1Bh│ dword│ address of next DOS Disk Block (0FFFFh means
  1458.           │        │      │ last in chain)
  1459.           │ 1Ch    │ word │ starting cluster of current dir (0 = root)
  1460.           │ 1Eh    │64byts│ ASCIIZ current directory path string
  1461.           │ 22h    │ byte │ Current Working Directory (2.0 only) (64 bytes)
  1462.           └────────┴──────┴────────────────────────────────────────────────
  1463.  
  1464.                                     -96-
  1465.  
  1466.           ┌───────────────┬────────────────────────────────────────────────
  1467.           │    DOS 3.x    │
  1468.           ├────────┬──────┼────────────────────────────────────────────────
  1469.           │ 0Fh    │ byte │ number of sectors in one FAT copy
  1470.           │ 10h    │ word │ first sector of root directory
  1471.           │ 12h    │dword │ address of device driver for this drive
  1472.           │ 16h    │ byte │ media descriptor byte for medium
  1473.           │ 17h    │ byte │ 0FFh = block must be rebuilt, 00h indicates
  1474.           │        │      │ block accessed
  1475.           │ 18h    │dword │ address of next device block, offset = 0FFFFh
  1476.           │        │      │ indicates last
  1477.           │ 1Ch    │ word │ cluster at which to start search for free space
  1478.           │        │      │ when writing
  1479.           │ 1Ch    │ word │ 00h, probably unused, values left from before
  1480.           │ 1Eh    │ word │ 0FFFFh indicates block was built
  1481.           ├────────┴──────┼────────────────────────────────────────────────
  1482.           │   DOS 4.0     │
  1483.           ├────────┬──────┼────────────────────────────────────────────────
  1484.           │ 0Fh    │ word │ number of sectors in one FAT copy
  1485.           │ 11h    │ word │ first sector of root directory
  1486.           │ 13h    │dword │ address of device driver for this drive
  1487.           │ 17h    │ byte │ media descriptor byte for medium
  1488.           │ 18h    │ byte │ 0FFh = block must be rebuilt, 00h indicates
  1489.           │        │      │ block accessed
  1490.           │ 19h    │dword │ address of next device block, offset = 0FFFFh
  1491.           │        │      │ indicates last
  1492.           │ 1Dh    │ word │ cluster at which to start search for free space
  1493.           │        │      │ when writing
  1494.           │ 1Fh    │ word │ unknown
  1495.           └────────┴──────┴────────────────────────────────────────────────
  1496. note 1) Use [BX+0D] to find no. of clusters (>1000h, 16-bit FAT; if not, 12-bit
  1497.     (exact dividing line is probably a little below 1000h to allow for
  1498.     bad sectors, EOF markers, etc.)
  1499.      2) Short article by C.Petzold, PC Magazine  Vol.5,no.8, and the article
  1500.     "Finding Disk Parameters" in the May 1986 issue of PC Tech Journal.
  1501.      3) This call is mostly supported in OS/2 1.0's DOS Compatibility Box. The
  1502.     dword at 12h will not return the address of the next device driver when
  1503.     in the Compatibility Box.
  1504.      4) Used by CHKDSK.
  1505.      5) Some information from the article "Finding Disk Parameters" in the May
  1506.     1986 issue of PC Tech Journal.
  1507.  
  1508.  
  1509. Function  33h  Control-Break Check
  1510.      Get or set control-break checking at CON
  1511. entry    AH    33h
  1512.     AL    00h    to test for break checking
  1513.         01h    to set break checking
  1514.             DL    00h    to disable break checking
  1515.                 01h    to enable break checking
  1516.         02h    internal, called by PRINT.COM (DOS 3.1)
  1517.         03h    unknown
  1518.         04h    unknown
  1519.         05h    boot drive (DOS 4.0+)
  1520. return    DL    break setting (AL=00h)
  1521.         00h    if break=off
  1522.         01h    if break=on
  1523.         (if AL=05h) boot drive, A=1, B=2, etc)
  1524.     AL    0FFh    error
  1525. note    This call is explicitly supported by the OS/2 DOS Compatibility Box.
  1526.  
  1527.                                     -97-
  1528.  
  1529.  
  1530. Function  34h  Return INDOS Flag
  1531.      Returns ES:BX pointing to Critical Section Flag, byte indicating whether
  1532.      it is safe to interrupt DOS.
  1533. entry    AH    34h
  1534. return    ES:BX    points to 1-byte DOS "critical section flag"
  1535. note 1) If this byte is 0, it is safe to interrupt DOS.
  1536.      2) The byte at ES:BX+1 is used by the Print program for this same purpose,
  1537.     so it's probably safer to check the WORD at ES:BX.
  1538.      3) Reportedly, examination of DOS 2.10 code in this area indicates that the
  1539.     byte immediately following this "critical section flag" must be 00h to
  1540.     permit the PRINT.COM interrupt to be called. For DOS 3.0 and 3.1 (except
  1541.     Compaq DOS 3.0), the byte before the "critical section flag" must be
  1542.     zero; for Compaq DOS 3.0, the byte 01AAh before it must be zero.
  1543.      4) In DOS 3.10 this reportedly changed to word value, with preceding byte.
  1544.      5) This call is supported in OS/2 1.0's DOS Compatibility Box.
  1545.      6) Gordon Letwin of Microsoft discussed this call on ARPAnet in 1984. He
  1546.     stated:
  1547.     a) this is not supported under any version of the DOS
  1548.     b) it usually works under DOS 2, but there may be circumstances
  1549.        when it doesn't (general disclaimer, don't know of a specific
  1550.        circumstance)
  1551.     c) it will usually not work under DOS 3 and DOS 3.1; the DOS is
  1552.        considerably restructured and this flag takes on additional
  1553.        meanings and uses
  1554.     d) it will fail catastrophically under DOS 4.0 and forward.
  1555.     ** Obviously this information is incorrect since the call works fine
  1556.        through DOS 3.3. Microsoft glasnost? It also obviously works in US
  1557.        DOS 4.0, but it is likely Letwin was referring to what is now known
  1558.        as OS/2. Nobody has reported any additional meanings and uses so
  1559.        far, though arrangements of bits in the In_DOS byte would be able
  1560.        to reflect many more uses.
  1561.      7) This call is documented in some Zenith MS-DOS Technical References.
  1562.     It was also discussed by Microsoft in their proposed TSR standard
  1563.     documentation, so although IBM chose not to support it this call can
  1564.     hardly be considered "undocumented."
  1565.      8) PC Magazine reports it functions reliably under DOS versions 2.0
  1566.     through 3.3. Chris Dunford (of CED fame) and a number of anonymous
  1567.     messages on the BBSs indicate it may not be totally reliable.
  1568.  
  1569.  
  1570. Function  35h  Get Vector
  1571.      Get interrupt vector
  1572. entry    AH    35h
  1573.     AL    interrupt number (hexadecimal)
  1574. return    ES:BX    address of interrupt vector
  1575. note 1) Use function call 25h to set the interrupt vectors.
  1576.      2) This call is explicitly supported by the OS/2 DOS Compatibility Box.
  1577.  
  1578.  
  1579. Function  36h  Get Disk Free Space
  1580.      get information on specified drive
  1581. entry    AH    36h
  1582.     DL    drive number (0=default, 1=A:, 2=B:, etc)
  1583. return    AX    number of sectors per cluster
  1584.         0FFFFh means drive specified in DL is invalid
  1585.     BX    number of availible clusters
  1586.     CX    bytes per sector
  1587.     DX    clusters per drive
  1588.  
  1589.                                     -98-
  1590.  
  1591. note 1) Multiply AX * CX * BX for free space on disk.
  1592.      2) Multiply AX * CX * DX for total disk space.
  1593.      3) Function 36h returns an incorrect value after an ASSIGN command. Prior
  1594.     to ASSIGN, the DX register contains 0943h on return, which is the free
  1595.     space in clusters on the HC diskette. After ASSIGN, even with no
  1596.     parameters, 0901h is returned in the DX register; this is an incorrect
  1597.     value. Similar results occur with DD diskettes on a PC-XT or a PC-AT.
  1598.     This occurs only when the disk is not the default drive. Results are as
  1599.     expected when the drive is the default drive. Therefore, the
  1600.     circumvention is to make the desired drive the default drive prior to
  1601.     issuing this function call.
  1602.      4) This function supercedes functions 1Bh and 1Ch.
  1603.      5) This call is explicitly supported by the OS/2 DOS Compatibility Box.
  1604.      6) TOS: $36 GET DISK FREE SPACE.
  1605.  
  1606.  
  1607. Function  37h  SWITCHAR / AVAILDEV
  1608.  *   Get/set option marking character (is usually "/"), and device type
  1609. entry    AH    37h
  1610.     AL    00h    read switch character (returns current character in DL)
  1611.         01h    set character in DL as new switch character
  1612.     (DOS 2.x)    02h    read device availability (as set by function AL=3) into
  1613.             DL. A 0 means devices that devices must be accessed in
  1614.             file I/O calls by /dev/device. A non-zero value means
  1615.             that devices are accessible at every level of the
  1616.             directory tree (e.g., PRN is the printer and not a file
  1617.             PRN).
  1618.             AL=2 to return flag in DL, AL=3 to set from DL (0 = set,
  1619.             1 = not set).
  1620.     (DOS 2.x)    03h    get device availability, where:
  1621.             DL    00h    /dev/ must precede device names
  1622.                 01h    /dev/ need not precede device names
  1623. return    DL    switch character (if AL=0 or 1)
  1624.         device availability flag (if AL=2 or 3)
  1625.     AL    0FFh    the value in AL was not in the range 0-3
  1626. note 1) Functions 2 & 3 appear not to be implemented for DOS 3.x.
  1627.      2) It is documented on page 4.324 of the MS-DOS (version 2) Programmer's
  1628.     Utility Pack (Microsoft - published by Zenith).
  1629.      3) Works on all versions of IBM PC-DOS from 2.0 through 3.3.1.
  1630.      4) The SWITCHAR is the character used for "switches" in DOS command
  1631.     arguments (defaults to '/', as in "DIR/P"). '-' is popular to make a
  1632.     system look more like UNIX; if the SWITCHAR is anything other than '/',
  1633.     then '/' may be used instead of '\' for pathnames.
  1634.      5) Ignored by XCOPY, PKARC, LIST.
  1635.      6) SWITCHAR may not be set to any character used in a filename.
  1636.      7) In DOS 3.x you can still read the "AVAILDEV" byte with subfunction 02h
  1637.     but it always returns 0FFh even if you try to change it to 0 with
  1638.     subfunction 03h.
  1639.      8) AVAILDEV=0 means that devices must be referenced in an imaginary
  1640.     subdirectory "\dev" (similar to UNIX's /dev/*); a filename "PRN.DAT"
  1641.     can be created on disk and manipulated like any other. If AVAILDEV != 0
  1642.     then device names are recognized anywhere (this is the default):
  1643.     "PRN.DAT" is synonymous with "PRN:".
  1644.      9) These functions reportedly are not supported in the same fashion in
  1645.     various implementations of DOS.
  1646.     10) Used in DOS 3.3 by CHKDSK, BASIC, and DEBUG.
  1647.     11) SWITCHAR is not support in the OS/2 compatibility box.
  1648.  
  1649.                                     -99-
  1650.  
  1651.  
  1652. Function  38h    Return Country-Dependent Information
  1653.         (PCDOS 2.0, 2.1, MSDOS 2.00 only)
  1654. entry    AH    38h
  1655.     AL    function code  (must be 0 in DOS 2.x)
  1656.     DS:DX    pointer to 32 byte memory buffer for returned information
  1657. return    CF    set on error
  1658.         AX    error code (02h)
  1659.     BX    country code
  1660.     DS:DX    pointer to buffer filled with country information:
  1661.       bytes 00h,01h date/time format
  1662.             0000h    USA standard       H:M:S   M/D/Y
  1663.             0001h    European standard  H:M:S   D/M/Y
  1664.             0002h    Japanese standard  H:M:S   D:M:Y
  1665.         02h    ASCIIZ string currency symbol
  1666.         03h    byte of zeroes
  1667.         04h    ASCIIZ string thousands separator
  1668.         05h    byte of zeroes
  1669.         06h    ASCIIZ string decimal separator
  1670.         07h    byte of zeroes
  1671.        24 bytes 08h-1Fh reserved
  1672.  
  1673.  
  1674. Function  38h    Get Country-Dependent Information
  1675.         (PCDOS 3.x+, MSDOS 2.01+)
  1676. entry    AH    38h
  1677.     AL    function code
  1678.         00h    to get current country information
  1679.         01h-0FEh country code to get information for, for countries
  1680.             with codes less than 255
  1681.         0FFh    to get country information for countries with a code
  1682.             greater than 255
  1683.             BX    16 bit country code if AL=0FFh
  1684.     DS:DX    pointer to the memory buffer where the data will be returned
  1685.         DX    0FFFFh if setting country code rather than getting info
  1686. return    CF    0 (clear) function completed
  1687.         1 (set) error
  1688.            AX    error code
  1689.             02h    invalid country code (no table for it)
  1690.     (if DX <> 0FFFFh)
  1691.     BX    country code (usually international telephone code)
  1692.     DS:DX    pointer to country data buffer
  1693.       bytes 0,1    date/time format
  1694.             0    USA standard       H:M:S   M/D/Y
  1695.             1    European standard  H:M:S   D/M/Y
  1696.             2    Japanese standard  H:M:S   D:M:Y
  1697.       bytes 02h-06h currency symbol null terminated
  1698.       byte    07h    thousands separator null terminated
  1699.       byte    08h    byte of zeroes
  1700.       byte    09h    decimal separator null terminated
  1701.       byte    0Ah    byte of zeroes
  1702.       byte    0Bh    date separator null terminated
  1703.       byte    0Ch    byte of zeroes
  1704.       byte    0Dh    time separator null terminated
  1705.       byte    0Eh    byte of zeroes
  1706.       byte    0Fh    currency format byte
  1707.              bit 0    0  if currency symbol precedes the value
  1708.                 1  if currency symbol is after the value
  1709.              1    0  no spaces between value and currency symbol
  1710.                 1  one space between value and currency symbol
  1711.              2    set if currency symbol replaces decimal point
  1712.              3-7    not defined by Microsoft
  1713.  
  1714.                                     -100-
  1715.  
  1716.       byte    10h    number of significant decimal digits in currency
  1717.             (number of places to right of decimal point)
  1718.       byte    11h    time format byte
  1719.             bit 0    0    12 hour clock
  1720.                 1    24 hour clock
  1721.             1-7    unknown, probably not used
  1722.       bytes 12h-15h address of case map routine (FAR CALL, AL = char)
  1723.             entry    AL  ASCII code of character to be converted to
  1724.                     uppercase
  1725.             return    AL  ASCII code of the uppercase input character
  1726.       byte    16h    data-list separator character
  1727.       byte    17h    zeroes
  1728.       bytes 18h-21h 5 words reserved
  1729. note 1) When an alternate keyboard handler is invoked, the keyboard routine is
  1730.     loaded into user memory starting at the lowest portion of availible
  1731.     user memory. The BIOS interrupt vector that services the keyboard is
  1732.     redirected to the memory area where the new routine resides. Each new
  1733.     routine takes up about 1.6K of memory and has lookup tables that return
  1734.     values unique to each language. (KEYBxx in the DOS book)
  1735.      Once the keyboard interrupt vector is changed by the DOS keyboard
  1736.     routine, the new routine services all calls unless the system is
  1737.     returned to the US format by the ctrl-alt-F1 keystroke combination. This
  1738.     does not change the interrupt vector back to the BIOS location; it
  1739.     merely passes the table lookup to the ROM locations.
  1740.      2) Ctrl-Alt-F1 will only change systems with US ROMS to the US layout.
  1741.     Some systems are delivered with non-US keyboard handler routines in ROM
  1742.      3) Case mapping call: the segment/offset of a FAR procedure that performs
  1743.     country-specific lower-to-upper case mapping on ASCII characters 80h to
  1744.     0FFh. It is called with the character to be mapped in AL. If there is
  1745.     an uppercase code for the letter, it is returned in AL, if there is no
  1746.     code or the function was called with a value of less than 80h AL is
  1747.     returned unchanged.
  1748.      4) This call is fully implemented in MS-DOS version 2.01 and higher. It
  1749.     is in version 2.00 but not fully implemented (according to Microsoft).
  1750.      5) This call is explicitly supported by the OS/2 DOS Compatibility Box.
  1751.  
  1752.  
  1753. Function  38h    Set Country Dependent Information
  1754. entry    AH    38h
  1755.     AL    code    country code to set information for, for countries
  1756.             with codes less than 255
  1757.         0FFh    to set country information for countries with a code
  1758.             greater than 255
  1759.     BX    16 bit country code if AL=0FFh
  1760.     DX    0FFFFh
  1761. return    CF    clear    successful
  1762.         set    if error
  1763.             AX    error code (02h)
  1764. note 1) Some country codes are:
  1765.     061    Australia
  1766.     039    Italy
  1767.     041    Switzerland
  1768.     033    France
  1769.     351    Portugal
  1770.     002    Canada
  1771.     758    Middle East
  1772.     001    USA
  1773.     972    Israel
  1774.     046    Sweden
  1775.     358    Finland
  1776.     047    Norway
  1777.     032    Belgium
  1778.     003    S. America
  1779.     044    U.K.
  1780.  
  1781.                                     -101-
  1782.  
  1783.     049    Germany
  1784.     034    Spain
  1785.     045    Denmark
  1786.     031    Netherlands
  1787.     081    Japan
  1788.      2) The documentation for COUNTRY= will tell you which codes are valid
  1789.     for your particular DOS version.
  1790.  
  1791.  
  1792. Function  39h    Create Subdirectory (MKDIR)
  1793.         Makes a subdirectory along the indicated path
  1794. entry    AH    39h
  1795.     DS:DX    address of ASCIIZ pathname string
  1796. return    flag CF 0    successful
  1797.         1    error
  1798.             AX    error code if any  (03h, 05h)
  1799. note 1) The ASCIIZ string contains the drive and subdirectory.
  1800.      2) Drive may be any valid drive (not nescessarily current drive).
  1801.      3) The pathname cannot exceed 64 characters.
  1802.      4) This call is explicitly supported by the OS/2 DOS Compatibility Box.
  1803.      5) The characters [, ] , =, and " may not be used in subdirectory names.
  1804.      6) TOS: $39 MKDIR.
  1805.  
  1806.  
  1807. Function  3Ah    Remove Subdirectory  (RMDIR)
  1808. entry    AH    3Ah
  1809.     DS:DX    address of ASCIIZ pathname string
  1810. return    CF    clear      successful
  1811.         set      AX      error code if any  (3, 5, 16)
  1812. note 1) The ASCIIZ string contains the drive and subdirectory.
  1813.      2) Drive may be any valid drive (not nescessarily current drive).
  1814.      3) The pathname cannot exceed 64 characters.
  1815.      4) This call is explicitly supported by the OS/2 DOS Compatibility Box.
  1816.      5) TOS: $3A RMDIR.
  1817.  
  1818.  
  1819. Function  3Bh    Change Current Directory  (CHDIR)
  1820. entry    AH    3Bh
  1821.     DS:DX    address of ASCIIZ string
  1822. return    flag CF 0    successful
  1823.         1    error
  1824.     AX    error code if any (03h)
  1825. note 1) The pathname cannot exceed 64 characters.
  1826.      2) The ASCIIZ string may contain drive and subdirectory.
  1827.      3) Drive may be any valid drive (not nescessarily current drive).
  1828.      4) This call is explicitly supported by the OS/2 DOS Compatibility Box.
  1829.      5) TOS: $3B CHDIR.
  1830.  
  1831.  
  1832. Function  3Ch    Create A File (CREAT)
  1833.         Create a file with handle
  1834. entry    AH    3Ch
  1835.     CX    byte, attributes for file
  1836.         00h    normal
  1837.         01h    read only
  1838.         02h    hidden
  1839.         03h    system
  1840.     DS:DX    address of ASCIIZ filename string
  1841. return    CF    0    successful creation
  1842.         1    error
  1843.     AX    16 bit file handle
  1844.         or error code  (03h, 04h, 05h)
  1845.  
  1846.                                     -102-
  1847.  
  1848. note 1) The ASCIIZ string may contain drive and subdirectory.
  1849.      2) Drive may be any valid drive (not nescessarily current drive).
  1850.      3) If the volume label or subdirectory bits are set in CX, they are ignored
  1851.      4) The file is opened in read/write mode
  1852.      5) If the file does not exist, it is created. If one of the same name
  1853.     exists, it is truncated to a length of 0.
  1854.      6) Good practice is to attempt to open a file with fn 3Dh and jump to an
  1855.     error routine if successful, create file if 3Dh fails. That way an
  1856.     existing file will not be truncated and overwritten.
  1857.      7) This call is explicitly supported by the OS/2 DOS Compatibility Box.
  1858.      8) TOS: $3C CREAT.
  1859.  
  1860.  
  1861. Function  3Dh    Open A File
  1862.         Open disk file with handle
  1863. entry    AH    3Dh
  1864.     AL    access code byte
  1865. (DOS 2.x)  bits 0-2    file attribute
  1866.             000    read only
  1867.             001    write only
  1868.             010    read/write
  1869.         3-7    reserved, should be set to zero
  1870. (DOS 3.x)  bits 0-2    file attribute
  1871.             000    read only
  1872.             001    write only
  1873.             010    read/write
  1874.         3    reserved, should be set to zero
  1875.         4-6    sharing mode (network)
  1876.             000    compatibility mode (the way FCBs open files)
  1877.             001    read/write access denied (exclusive)
  1878.             010    write access denied
  1879.             011    read access denied
  1880.             100    full access permitted
  1881.         7    inheritance flag
  1882.             0    file inherited by child process
  1883.             1    file private to child process
  1884.     DS:DX    address of ASCIIZ pathname string
  1885. return    CF set on error
  1886.         AX    error code (01h, 02h, 03h, 04h, 05h, 0Ch)
  1887.     AX    16 bit file handle
  1888. note 1) Opens any normal, system, or hidden file.
  1889.      2) Files that end in a colon are not opened.
  1890.      3) The rear/write pointer is set at the first byte of the file and the
  1891.     record size of the file is 1 byte (the read/write pointer can be changed
  1892.     through function call 42h). The returned file handle must be used for
  1893.     all subsequent input and output to the file.
  1894.      4) If the file handle was inherited from a parent process or was
  1895.     duplicated by DUP or FORCEDUP, all sharing and access restrictions are
  1896.     also inherited.
  1897.      5) A file sharing error (error 01h) causes an int 24h to execute with an
  1898.     error code of 02h.
  1899.      6) This call is explicitly supported by the OS/2 DOS Compatibility Box.
  1900.      7) TOS: $3D OPEN.
  1901.  
  1902.                                     -103-
  1903.  
  1904. Function  3Eh    Close A File Handle
  1905.         Close a file and release handle for reuse
  1906. entry    AH    3Eh
  1907.     BX    file handle
  1908. return    flag CF 0    successful close
  1909.         1    error
  1910.     AX    error code if error (06h)
  1911. note 1) When executed, the file is closed, the directory is updated, and all
  1912.     buffers for that file are flushed. If the file was changed, the time
  1913.     and date stamps are changed to current.
  1914.      2) If called with the handle 00000h, it will close STDIN (normally the
  1915.     keyboard).
  1916.      3) This call is explicitly supported by the OS/2 DOS Compatibility Box.
  1917.      4) TOS: $3E CLOSE.
  1918.  
  1919.  
  1920. Function  3Fh    Read From A File Or Device
  1921.         Read from file with handle
  1922. entry    AH    3Fh
  1923.     BX    file handle
  1924.     CX    number of bytes to read
  1925.     DS:DX    address of buffer
  1926. return    flag CF 0    successful read
  1927.         1    error
  1928.     AX    0    pointer was already at end of file
  1929.             or number of bytes read
  1930.             or error code (05h, 06h)
  1931. note 1) This function attempts to transfer the number of bytes specified in CX
  1932.     to a buffer location. It is not guaranteed that all bytes will be read
  1933.     If AX < CX a partial record was read.
  1934.      2) If performed from STDIN (file handle 0000), the input can be redirected
  1935.      3) If used to read the keyboard, it will only read to the first CR.
  1936.      4) The file pointer is incremented to the last byte read.
  1937.      5) This call is explicitly supported by the OS/2 DOS Compatibility Box.
  1938.      6) TOS: $3F READ.
  1939.  
  1940.  
  1941. Function  40h    Write To A File Or Device
  1942.         Write to file with handle
  1943. entry    AH    40h
  1944.     BX    file handle
  1945.     CX    number of bytes to write
  1946.     DS:DX    address of buffer
  1947. return    flag CF 0    successful write
  1948.         1    error
  1949.     AX    number of bytes written
  1950.         or error code  (05h, 06h)
  1951. note 1) This call attempts to transfer the number of bytes indicated in CX
  1952.     from a buffer to a file. If CX and AX do not match after the write,
  1953.     an error has taken place; however no error code will be returned for
  1954.     this problem. This is usually caused by a full disk.
  1955.      2) If the write is performed to STDOUT (handle 0001), it may be redirected
  1956.      3) To truncate the file at the current position of the file pointer, set
  1957.     the number of bytes in CX to zero before calling int 21h. The pointer
  1958.     can be moved to any desired position with function 42h.
  1959.      4) This function will not write to a file or device marked read-only.
  1960.      5) May also be used to display strings to CON instead of fn 09h. This
  1961.     function will write CX bytes and stop; fn 09h will continue to write
  1962.     until a $ character is found.
  1963.      6) This is the call that DOS actually uses to write to the screen in DOS
  1964.     2.x and above.
  1965.      7) This call is explicitly supported by the OS/2 DOS Compatibility Box.
  1966.      8) TOS: $40 WRITE.
  1967.  
  1968.                                     -104-
  1969.  
  1970. Function  41h    Delete A File From A Specified Subdirectory  (UNLINK)
  1971. entry    AH    41h
  1972.     DS:DX    pointer to ASCIIZ filespec to delete
  1973. return    CF    0    successful
  1974.         1    error
  1975.         AX    error code if any  (02h, 05h)
  1976. note 1) This function will not work on a file marked read-only.
  1977.      2) Wildcards are not accepted.
  1978.      3) For deleting multiple files, function 13h is faster.
  1979.      4) This call is explicitly supported by the OS/2 DOS Compatibility Box.
  1980.      5) TOS: $41 UNLINK.
  1981.  
  1982.  
  1983. Function  42h    Move a File Read/Write Pointer    (LSEEK)
  1984. entry    AH    42h
  1985.     AL    method code byte
  1986.         00h    offset from beginning of file
  1987.         01h    offset from present location
  1988.         02h    offset from end of file
  1989.     BX    file handle
  1990.     CX:DX    offset into file in bytes
  1991. return    AX:AX    new file pointer
  1992.     CF    0    successful move
  1993.         1    error
  1994.         AX    error code (01h, 06h)
  1995. note 1) If pointer is at end of file, reflects file size in bytes.
  1996.      2) The value in DX:AX is the absolute 32 bit byte offset from the beginning
  1997.     of the file.
  1998.      3) This call is explicitly supported by the OS/2 DOS Compatibility Box.
  1999.      4) TOS: $42 LSEEK.
  2000.  
  2001.  
  2002. Function   43h    Get/Set file attributes  (CHMOD)
  2003. entry    AH    43h
  2004.     AL    00h    get file attributes
  2005.         01h    set file attributes
  2006.         CX    file attributes to set
  2007.             bit 0    read only
  2008.             1    hidden file
  2009.             2    system file
  2010.             3    volume label
  2011.             4    subdirectory
  2012.             5    written since backup (archive bit)
  2013.             6,7    not used
  2014.             8    shareable (Novell NetWare)
  2015.             9,F    not used
  2016.     DS:DX    pointer to full ASCIIZ file name
  2017. return    CF    set if error
  2018.     AX    error code  (01h, 02h, 03h, 05h)
  2019.     CX    file attributes on get
  2020.         attributes:
  2021.         01h    read only
  2022.         02h    hidden
  2023.         04h    system
  2024.         0FFh    archive
  2025. note 1) This call will not change the volume label or directory bits. (3&4)
  2026.      2) Any combination of file attributes may be used.
  2027.      3) This call is explicitly supported by the OS/2 DOS Compatibility Box.
  2028.      4) TOS: $43 CHANGE MODE (CHMOD).
  2029.  
  2030.                                     -105-
  2031.  
  2032. Function  44h    I/O Control for Devices (IOCTL)
  2033.         Device driver handler
  2034. entry    AH    44h
  2035.     AL    00h    Get Device Information
  2036.             BX    file or device handle
  2037.             return    CF    set on error
  2038.                     AX    error code
  2039.                 DX    device info word
  2040.                     bit 7 set = character device
  2041.                     bit 0    console input device
  2042.                     1    console output device
  2043.                     2    NUL device
  2044.                     3    CLOCK$ device
  2045.                     4    device is special
  2046.                     5    binary (raw) mode
  2047.                     6    not EOF
  2048.                     12    network device (DOS 3.x)
  2049.                     14    can process IOCTL control
  2050.                         strings (subfns 2-5)
  2051.                     bit 7 clear = file
  2052.                     bit 0-5    block device number
  2053.                     6    file has not been written
  2054.                     12    network device (DOS 3.x)
  2055.                     14    unknown        (DOS 3.x)
  2056.                     15    file is remote (DOS 3.x)
  2057.  
  2058.         01h    Set Device Information
  2059.             BX    device handle
  2060.             DH    0   (DH must be zero for this call)
  2061.             DL    device info to set (bits 0-7 from function 0)
  2062.         note    DX bits:
  2063.             0    1    console input device
  2064.             1    1    console output device
  2065.             2    1    null device
  2066.             3    1    clock device
  2067.             4    1    reserved
  2068.             5    0    binary mode - don't check for control chars
  2069.                  1    cooked mode - check for control chars
  2070.             6    0    EOF - End Of File on input
  2071.             7    device is character device if set, if not, EOF
  2072.                 is 0 if channel has been written, bits 0-5 are
  2073.                 block device number
  2074.             12    network device
  2075.             14   1    can process control strings (AL 2-5, can only be
  2076.                 read, cannot be set)
  2077.             15   n    reserved
  2078.  
  2079.         02h    Read Character Device Control String
  2080.             BX    device handle
  2081.             CX    number of bytes to read
  2082.             DS:DX    pointer to control string buffer
  2083.             return    AX    (no errors) number of bytes read
  2084.  
  2085.         03h    Write Character Device Control String
  2086.             BX    device handle
  2087.             CX    number of bytes to write
  2088.             DS:DX    pointer to buffer
  2089.             return    AX    (no errors) number of bytes written
  2090.  
  2091.         04h    Read From Block Device (drive number in BL)
  2092.             BL    drive number (0=default)
  2093.             CX    number of bytes to read
  2094.             DS:DX    pointer to buffer
  2095.             return    AX    (no errors) number of bytes read
  2096.  
  2097.                                     -106-
  2098.  
  2099.         05h    Write Block Device Control String
  2100.             BL    drive number (0=default)
  2101.             CX    number of bytes to write
  2102.             DS:DX    pointer to buffer
  2103.             return    AX    (no errors) number of bytes transfered
  2104.  
  2105.         06h    Get Input Handle Status
  2106.             BX    file or device handle
  2107.             return    AL    0FFh    device ready
  2108.                     00h    device not ready
  2109.  
  2110.         07h    Get Output Handle Status
  2111.             BX    file or device handle
  2112.             return    AL    00h    not ready
  2113.                     0FFh    ready
  2114.             note    For DOS 2.x, files are always ready for output.
  2115.  
  2116.         08h    Removable Media Bit                (DOS 3.x+)
  2117.             BL    drive number (0=default)
  2118.             return    AX    00h    device is removable
  2119.                     01h    device is nonremovable
  2120.                     0Fh    invalid drive specification
  2121.  
  2122.         09h    Test whether Local or Network Device        (DOS 3.x+)
  2123.             BL    drive number (0=default)
  2124.             return    DX    attribute word, bit 12 set if device is
  2125.                     remote
  2126.  
  2127.         0Ah    Is Handle in BX Local or Remote?        (DOS 3.x+)
  2128.             BX    file handle
  2129.             return    DX (attrib word) bit 15 set if file is remote
  2130.             note 1) If file is remote, Novell Advanced NetWare 2.0
  2131.                 returns the number of the file server on which
  2132.                 the handle is located in CX.
  2133.  
  2134.         0Bh    Change Sharing Retry Count to DX        (DOS 3.x+)
  2135.             CX     delay (default=1)
  2136.             DX     retry count (default=3)
  2137.  
  2138.         0Ch    General IOCTL (DOS 3.3 [3.2?]) allows a device driver to
  2139.             prepare, select, refresh, and query Code Pages
  2140.             BX    device handle
  2141.             CH    category code
  2142.                 00h    unknown (DOS 3.3)
  2143.                 01h    COMn:    (DOS 3.3)
  2144.                 03h    CON    (DOS 3.3)
  2145.                 05h    LPTn:
  2146.             CL    function
  2147.                 45h    set iteration count
  2148.                 4Ah    select code page
  2149.                 4Ch    start code-page preparation
  2150.                 4Dh    end code-page preparation
  2151.                 65h    get iteration count
  2152.                 6Ah    query selected code page
  2153.                 6Bh    query prepare list
  2154.             DS:DX    pointer to parameter block. Format:
  2155.            (for CL=45h) word    number of times output is attempted
  2156.                     driver assumes device is busy
  2157.        (for CL=4Ah,4Dh,6Ah) word    length of data
  2158.                 word    code page ID
  2159.            (for CL=4Ch) word    flags
  2160.                 word    length of remainder of parameter block
  2161.                 word    number of code pages following
  2162.                   n words    code page 1,...,N
  2163.  
  2164.                                     -107-
  2165.  
  2166.            (for CL=6Bh) word    length of following data
  2167.                 word    number of hardware code pages
  2168.                   n words    hardware code pages 1,...,N
  2169.                 word    number of prepared code pages
  2170.                   n words    prepared code pages 1,...,N
  2171.  
  2172.         0Dh    Block Device Request                (DOS 3.3+)
  2173.             BL    drive number (0=default, 1=A:, etc.)
  2174.             CH    category code
  2175.                 08h    disk drive
  2176.             CL    subfunction
  2177.                 40h    set device parameters
  2178.                 41h    write logical device track
  2179.                 42h    format and verify logical device track
  2180.                 46h    unknown (DOS 4.0+)
  2181.                 60h    get device parameters
  2182.                 61h    read logical device track
  2183.                 62h    verify logical device track
  2184.             DS:DX    pointer to parameter block
  2185.  
  2186.          (for fns 40h, 60h) byte    special functions
  2187.                     bit 0 set if fn to use current BPB, clear
  2188.                       if Device BIOS Parameter Block field
  2189.                       contains new default BPB
  2190.                     1 set if function to use track layout
  2191.                       fields only. Must be clear if CL=60h
  2192.                     2 set if all sectors in track same size
  2193.                       (should be set)
  2194.                       3-7 reserved
  2195.                 byte    device type
  2196.                     00h    320k/360k disk
  2197.                     01h    1.2M disk
  2198.                     02h    720k disk
  2199.                     03h    single-density 8-inch disk
  2200.                     04h    double-density 8-inch disk
  2201.                     05h    hard disk
  2202.                     06h    tape drive
  2203.                     07h    other type of block device
  2204.                 word   device attributes
  2205.                    bit 0 set if nonremovable media
  2206.                        1 set if door lock supported
  2207.                        2-15 reserved
  2208.                 word   number of cylinders
  2209.                 byte   media type
  2210.                        00h    1.2M disk (default)
  2211.                        01h    320k/360k disk
  2212.                  31 bytes  device BPB (see function 53h)
  2213.                 word   # of sectors per track (start of track
  2214.                        layout field)
  2215.              N word pairs: number,size of each sector in track
  2216.  
  2217.                 These may be defined in a structure such as:
  2218.                 DeviceParameters      Struc
  2219.                    SpecialFunctions   db      ?
  2220.                    DeviceType          db      ?
  2221.                    DeviceAttributes   dw      ?
  2222.                    NumberCylinders    dw      ?
  2223.                    MediaType          db      ?
  2224.                    DeviceBPB          A_BPB   <>
  2225.                    TrackLayout          A_TrackLayout  <>
  2226.                 DeviceParameters      EndS
  2227.  
  2228.                                     -108-
  2229.  
  2230.  
  2231.        (for functions 41h, 61h) byte   reserved, must be zero
  2232.                 word   number of disk head
  2233.                 word   number of disk cylinder
  2234.                 word   number of first sector to read/write
  2235.                 word   number of sectors
  2236.                    dword   transfer address
  2237.        (for functions 42h, 62h) byte   reserved, must be zero
  2238.                 word   number of disk head
  2239.                 word   number of disk cylinder
  2240.             note    DOS 4.01 seems to ignore the high byte of the
  2241.                 number of directory entries in the BPB for
  2242.                 diskettes.
  2243.  
  2244.         0Eh    Get Logical Device Map                (DOS 3.2+)
  2245.             Returns the logical drive letter last used to access
  2246.             the block device. Used by SUBST, JOIN, etc.
  2247.             BL    drive number (0=default)
  2248.             return    AL  0    block device has only one logical drive
  2249.                 assigned 1..n the last letter used to reference
  2250.                 the device (1=A:,etc)  (1..26 DOS 3.0+)
  2251.             note 1) This is not a network-dependent function.
  2252.                  2) This call allows you to determine if more than
  2253.                 one logical drive is assigned to a block
  2254.                 device. When this call is issued, a drive
  2255.                 number is passed in BL as input. If the block
  2256.                 device has more than one logical drive letter
  2257.                 assigned to it on output a drive number
  2258.                 corresponding to the last drive letter that
  2259.                 was used to reference the device is returned
  2260.                 in AL. If only one drive letter is assigned to
  2261.                 the device, 0 is returned in AL by this call.
  2262.  
  2263.         0Fh    Set Logical Device Map                (DOS 3.2+)
  2264.             BL    physical drive number (0=default)
  2265.             return    AL    00h    if only 1 drive letter assigned
  2266.                         to block device
  2267.                     01h...    1=A:, 2=B:,...
  2268.             note    Maps logical drives to physical drives, similar
  2269.                 to DOS's treatment of a single physical floppy
  2270.                 drive as both A: and B:
  2271.  
  2272.     BL    drive number:  0=default, 1=A:, 2=B:, etc.
  2273.     BX    file handle
  2274.     CX    number of bytes to read or write
  2275.     DS:DX    data or buffer
  2276.     DX    data
  2277. return    AX    number of bytes transferred
  2278.         or error code (call function 59h for extended error codes)
  2279.         or status  00h       not ready
  2280.                0FFh    ready
  2281.     CF    set if error
  2282. note    This call is explicitly supported by the OS/2 DOS Compatibility Box.
  2283.  
  2284.  
  2285. Function  45h    Duplicate a File Handle (DUP)
  2286. entry    AH    45h
  2287.     BX    file handle to duplicate
  2288. return    CF    clear    AX    duplicate handle
  2289.         set    AX    error code  (04h, 06h)
  2290. note 1) If you move the pointed of one handle, the pointer of the other will
  2291.     also be moved.
  2292.      2) The handle in BX must be open.
  2293.      3) This call is explicitly supported by the OS/2 DOS Compatibility Box.
  2294.      4) TOS: $45 DUP.
  2295.  
  2296.                                     -109-
  2297.  
  2298.  
  2299. Function  46h    Force Duplicate of a Handle (FORCEDUP or CDUP)
  2300.         Forces handle in CX to refer to the same file at the same
  2301.         position as BX
  2302. entry    AH    46h
  2303.     BX    existing open file handle to duplicate
  2304.     CX    new file handle
  2305. return    CF    clear    both handles now refer to existing file
  2306.         set    error
  2307.         AX    error code (04h, 06h)
  2308. note 1) If CX was an open file, it is closed first.
  2309.      2) If you move the read/write pointer of either file, both will move.
  2310.      3) The handle in BX must be open.
  2311.      4) This call is explicitly supported by the OS/2 DOS Compatibility Box.
  2312.      5) TOS $46 FORCE.
  2313.  
  2314.  
  2315. Function  47h    Get Current Directory
  2316.         Places full pathname of current directory/drive into a buffer
  2317. entry    AH    47h
  2318.     DL    drive (0=default, 1=A:, etc.)
  2319.     DS:SI    pointer to 64-byte buffer area
  2320. return    CF    clear    DS:DI    pointer to ASCIIZ pathname of current directory
  2321.         set    AX    error code (0Fh)
  2322. note 1) String does not begin with a drive identifier or a backslash.
  2323.      2) This call is explicitly supported by the OS/2 DOS Compatibility Box.
  2324.      3) TOS: $47 GETDIR.
  2325.  
  2326.  
  2327. Function  48h    Allocate Memory
  2328.         Allocates requested number of 16-byte paragraphs of memory
  2329. entry    AH    48h
  2330.     BX    number of 16-byte paragraphs desired
  2331. return    CF    clear    AX    segment address of allocated space
  2332.             BX    maximum number paragraphs available
  2333.         set    AX    error code (07h, 08h)
  2334. note 1) BX indicates maximum memory availible only if allocation fails.
  2335.      2) This call is explicitly supported by the OS/2 DOS Compatibility Box.
  2336.      3) TOS: $48 MALLOC.
  2337.  
  2338.  
  2339. Function  49h    Free Allocated Memory
  2340.         Frees specified memory blocks
  2341. entry    AH    49h
  2342.     ES    segment address of area to be freed
  2343. return    CF    clear    successful
  2344.         set    AX    error code (07h, 09h)
  2345. note 1) This call is only valid when freeing memory obtained by function 48h.
  2346.      2) A program should not try to release memory not belonging to it.
  2347.      3) This call is explicitly supported by the OS/2 DOS Compatibility Box.
  2348.      4) TOS: $49 MFREE.
  2349.  
  2350.  
  2351. Function  4Ah    Modify Allocated Memory Blocks (SETBLOCK)
  2352.         Expand or shrink memory for a program
  2353. entry    AH    4AH
  2354.     BX    new size in 16 byte paragraphs
  2355.     ES    segment address of block to change
  2356. return    CF    clear    nothing
  2357.         set    AX    error code (07h, 08h, 09h)
  2358.             or    BX    max number paragraphs available
  2359. note 1) Max number paragraphs availible is returned only if the call fails.
  2360.      2) Memory can be expanded only if there is memory availible.
  2361.      3) This call is explicitly supported by the OS/2 DOS Compatibility Box.
  2362.      4) TOS: $4A SETBLOCK.
  2363.  
  2364.                                     -110-
  2365.  
  2366.  
  2367. Function  4Bh    Load or Execute a Program  (EXEC)
  2368. entry    AH    4Bh
  2369.     AL    00h    load and execute program. A PSP is built for the program
  2370.             the ctrl-break and terminate addresses are set to the
  2371.             new PSP.
  2372.            *01h    load but don't execute (internal, DOS 3.x & DESQview)
  2373.             (see note 1)
  2374.            *02h    load but do not execute (internal, DOS 2.x only)
  2375.         03h    load overlay (do not create PSP, do not begin execution)
  2376.            *04h    start async process (Euro-DOS 4.0 only) (see note 12)
  2377.     DS:DX    points to the ASCIIZ string with the drive, path, and filename
  2378.         to be loaded
  2379.     ES:BX    points to a parameter block for the load
  2380.            (AL=00h) word    segment address of environment string to be
  2381.                 passed (0=use current)
  2382.                dword    pointer to the command line to be placed at
  2383.                 PSP+80h
  2384.                dword    pointer to default FCB to be passed at PSP+5Ch
  2385.                dword    pointer to default FCB to be passed at PSP+6Ch
  2386.           (*AL=01h) word    segment of environment (0 = use current)
  2387.                dword    pointer to command line
  2388.                dword    pointer to FCB 1
  2389.                dword    pointer to FCB 2
  2390.      (DOS 3.x+)    dword    will hold SS:SP on return
  2391.      (DOS 3.x+)    dword    will hold program entry point (CS:IP) on return
  2392.           (*AL=02h) word    segment of environment (0 = use current)
  2393.                dword    pointer to command line
  2394.                dword    pointer to FCB 1
  2395.                dword    pointer to FCB 2
  2396.            (AL=03h) word    segment address where file will be loaded
  2397.             word    relocation factor to be applied to the image
  2398. return    CF    set    error
  2399.             AX    error code (01h, 02h, 05h, 08h, 0Ah, 0Bh)
  2400.     CF    clear    if successful
  2401.         for fn 00h, process ID set to new program's PSP; get with
  2402.             function 62h
  2403.         for fn 01h and DOS 3.x+ or DESQview, process ID set to new
  2404.             program's PSP; get with function 62h
  2405.         for fn 01h and DOS 2.x, new program's initial stack and entry
  2406.             point returned in registers
  2407.         for fn 02h, new program's initial stack and entry point are
  2408.             returned in the registers
  2409. note 1) If you make this call with AL=1 the program will be loaded as if you
  2410.     made the call with AL=0 except that the program will not be executed.
  2411.     Additionally, with AL=1 the stack segment and pointer along with the
  2412.     program's CS:IP entry point are returned to the program which made the
  2413.     4B01h call. These values are put in the four words at ES:BX+0Eh. On
  2414.     entry to the call ES:BX points to the environment address, the command
  2415.     line and the two default FCBs. This form of EXEC is used by DEBUG.COM.
  2416.      2) Application programs may invoke a secondary copy of the command
  2417.     processor (normally COMMAND.COM) by using the EXEC function.  Your
  2418.     program may pass a DOS command as a parameter that the secondary
  2419.     command processor will execute as though it had been entered from the
  2420.     standard input device.
  2421.     The procedure is:
  2422.      A. Assure that adequate free memory (17k for 2.x and 3.0, 23k for 3.1
  2423.         up) exists to contain the second copy of the command processor and
  2424.         the command it is to execute. This is accomplished by executing
  2425.         function call 4Ah to shrink memory allocated to that of your current
  2426.         requirements. Next, execute function call 48h with BX=0FFFFh. This
  2427.         returns the amount of memory availible.
  2428.  
  2429.                                     -111-
  2430.  
  2431.  
  2432.     B. Build a parameter string for the secondary command processor in the
  2433.        form:
  2434.              1 byte   length of parameter string
  2435.             xx bytes  parameter string
  2436.              1 byte   0Dh (carriage return)
  2437.        For example, the assembly language statement below would build the
  2438.        string to cause execution of the command FOO.EXE:
  2439.                   DB 19,"/C C:FOO",13
  2440.     C. Use the EXEC function call (4Bh), function value 0 to cause execution
  2441.        of the secondary copy of the command processor. (The drive,
  2442.        directory, and name of the command processor can be gotten from the
  2443.        COMSPEC variable in the DOS environment passed to you at PSP+2Ch.)
  2444.     D. Remember to set offset 2 of the EXEC control block to point to the
  2445.        string built above.
  2446.      3) All open files of a process are duplicated in the newly created
  2447.     process after an EXEC, except for files originally opened with the
  2448.     inheritance bit set to 1.
  2449.      4) The environment is a copy of the original command processor's
  2450.     environment. Changes to the EXECed environment are not passed back to
  2451.     the original. The environment is followed by a copy of the DS:DX
  2452.     filename passed to the child process. A zero value will cause the
  2453.     child process to inherit the environment of the calling process. The
  2454.     segment address of the environment is placed at offset 2Ch of the
  2455.     PSP of the program being invoked.
  2456.      5) This function uses the same resident part of COMMAND.COM, but makes a
  2457.     duplicate of the transient part.
  2458.      6) How EXEC knows where to return to: Basically the vector for int 22h
  2459.     holds the terminate address for the current process. When a process
  2460.     gets started, the previous contents of int 22h get tucked away in the
  2461.     PSP for that process, then int 22h gets modified. So if Process A
  2462.     EXECs process B, while Process B is running, the vector for int 22h
  2463.     holds the address to return to in Process A, while the save location in
  2464.     Process B's PSP holds the address that process A will return to when
  2465.     *it* terminates. When Process B terminates by one of the usual legal
  2466.     means, the contents of int 22h are (surmising) shoved onto the stack,
  2467.     the old terminate vector contents are copied back to int 22h vector from
  2468.     Process B's PSP, then a RETF or equivalent is executed to return control
  2469.     to process A.
  2470.      7) To load an overlay file with 4B: first, don't de-allocate the memory
  2471.     that the overlay will load into. With the other 4Bh functions, the
  2472.     opposite is true--you have to free the memory first, with function 4Ah.
  2473.     Second, the "segment address where the file will be loaded" (first item
  2474.     in the parameter block for sub-function 03) should be a paragraph
  2475.     boundary within your currently-allocated memory. Third, if the
  2476.     procedures within the overlay are FAR procs (while they execute, CS will
  2477.     be equal to the segment address of the overlay area), the relocation
  2478.     factor should be set to zero. On the other hand, if the CS register
  2479.     will be different from the overlay area's segment address, the
  2480.     relocation factor should be set to represent the difference. You
  2481.     determine where in memory the overlay file will load by using the
  2482.     segment address mentioned above. Overlay files are .EXEs (containing
  2483.     header, relocation table, and memory image).
  2484.      8) When function 00h returns, all registers are changed, including the
  2485.     stack. You must resore SS, SP, and any other required registers.
  2486.      9) PCDOS EXEC function 3 (overlay) lives in the transient piece of
  2487.     COMMAND.COM and gets loaded when needed, thus the requirement for
  2488.     enough free space to load the EXEC loader (about 1.5k). Under MSDOS
  2489.     the EXEC system call lives in system space.
  2490.     10) If you try to overlay an .EXE file with the high/low switch set to load
  2491.     the in high memory nothing will happen. The high/low switch is only for
  2492.     process creation, not for overlays.
  2493.     11) DOS 2.x destroys all registers, including SS:SP.
  2494.     12) (AL=04h) This is DOS 4.0 as released in 1987 to various European OEMs.
  2495.     It is not related to US DOS 4.0.
  2496.  
  2497.                                     -112-
  2498.  
  2499.     13) This call is explicitly supported by the OS/2 DOS Compatibility Box.
  2500.     14) TOS: $4B EXEC.
  2501.  
  2502.  
  2503. Function  4Ch    Terminate a Process (EXIT)
  2504.         Quit with ERRORLEVEL exit code
  2505. entry    AH    4Ch
  2506.     AL    exit code in AL when called, if any, is passed to next process
  2507. return    none
  2508. note 1) Control passes to DOS or calling program.
  2509.      2) Return code from AL can be retrieved by ERRORLEVEL or function 4Dh.
  2510.      3) All files opened by this process are closed, buffers are flushed, and
  2511.     the disk directory is updated.
  2512.      4) Restores: Terminate vector from PSP:000Ah
  2513.           Ctrl-C vector from PSP:000Eh
  2514.           Critical Error vector from PSP:0012h
  2515.      5) This call is explicitly supported in the OS/2 DOS Compatibility Box.
  2516.      6) TOS: $4C TERM. Returns 2-byte errorlevel to calling program
  2517.  
  2518.  
  2519. Function  4Dh    Get Return Code of a Subprocess (WAIT)
  2520.         Gets return code from functions 31h and 4Dh  (ERRORLEVEL)
  2521. entry    AH    4Dh
  2522. return    AL    exit code of subprogram (functions 31h or 4Ch)
  2523.     AH    circumstance which caused termination
  2524.         00h    normal termination
  2525.         01h    control-break or control-C
  2526.         02h    critical device error
  2527.         03h    terminate and stay resident (function 31h)
  2528. note 1)  The exit code is only returned once (the first time).
  2529.      2) This call is explicitly supported in the OS/2 DOS Compatibility Box.
  2530.  
  2531.  
  2532. Function  4Eh    Find First Matching File (FIND FIRST)
  2533. entry    AH    4Eh
  2534.     CX    search attributes  (see function 43h)
  2535.     DS:DX    pointer to ASCIIZ filename (with attributes)
  2536. return    CF    set    AX    error code (02h, 12h)
  2537.         clear    data block written at current DTA
  2538.             format of block is:  (info from BIX)
  2539.   documented by Micro-    |00h     1 byte   attribute byte of search
  2540.   soft as "reserved for |01h     1 byte   drive letter for search
  2541.   DOS' use on subsquent |02h    11 bytes  the search name used
  2542.   Find Next calls"    |0Ch     2 bytes  word value of last entry
  2543.   function 4Fh        |0Fh     4 bytes  dword pointer to this DTA
  2544.             |13h     2 bytes  word directory start
  2545.  
  2546.             | PC-DOS 3.10 (from INTERRUP.ARC)
  2547.             |00h     1 byte   drive letter
  2548.             |01h-0Bh 11 bytes search template
  2549.             |0Ch     1 byte   search attributes
  2550.  
  2551.             | DOS 2.x (and DOS 3.x except 3.1?) (from INTERRUP.ARC)
  2552.             |00h     1 byte   search attributes
  2553.             |01h     1 byte   drive letter
  2554.             |02h-0Ch 11 bytes search template
  2555.             |0Dh-0Eh 2 bytes  entry count within directory
  2556.             |0Fh-12h 4 bytes  reserved
  2557.             |13h-14h 2 bytes  cluster number of parent directory
  2558.  
  2559.                                     -113-
  2560.  
  2561.              15h   1 byte    file attribute
  2562.              16h   2 bytes    file time, bit mask:
  2563.                     0-4    half-seconds
  2564.                     5-10    minute
  2565.                     11-15    hour
  2566.              18h   2 bytes    file date, bit mask:
  2567.                     0-4    day
  2568.                     5-8    month
  2569.                     9-15    years since 1980
  2570.              1Ah   2 bytes    low word of file size
  2571.              1Ch   2 bytes    high word of file size
  2572.              1Eh  13 bytes    name and extension of file found, plus
  2573.                     1 byte of 0s. All blanks are removed
  2574.                     from the name and extension, and if an
  2575.                     extension is present it is preceded by a
  2576.                     period.
  2577. note 1) This function does not support network operations.
  2578.      2) Wildcards are allowed in the filespec.
  2579.      3) If the attribute is zero, only ordinary files are found. If the volume
  2580.     label bit is set, only volume labels will be found. Any other attribute
  2581.     will return that attribute and all normal files together.
  2582.      4) To look for everything except the volume label, set the hidden, system,
  2583.     and subdirectory bits all to 1.
  2584.      5) This call is explicitly supported in the OS/2 DOS Compatibility Box.
  2585.      6) TOS: $4E SFIRST.
  2586.  
  2587.  
  2588. Function  4Fh    Find Next Matching File (FIND NEXT)
  2589.         Find next ASCIIZ file
  2590. entry    AH    4Fh
  2591. return    CF    clear    data block written at current DTA
  2592.         set    AX    error code (02h, 12h)
  2593. note 1) If file found, DTA is formatted as in call 4Eh.
  2594.      2) Volume label searches using 4Eh/4Fh reportedly aren't 100% reliable
  2595.     under DOS 2.x. The calls sometime report there's a volume label and
  2596.     point to a garbage DTA, and if the volume label is the only item they
  2597.     often won't find it. Most references recommend the use of the older
  2598.     FCB calls for dealing with the volume labels.
  2599.      3) This function does not support network operations.
  2600.      4) Use of this call assumes that the original filespec contained wildcards
  2601.      5) This call is explicitly supported in the OS/2 DOS Compatibility Box.
  2602.      6) TOS: $4F SNEXT.
  2603.  
  2604.  
  2605. Function  50h    "Used Internally by DOS" - Set PSP
  2606.  *        Set new Program Segment Prefix (current Process ID)
  2607. entry    AH    50h
  2608.     BX    segment address of new PSP
  2609. return    none - swaps PSPs regarded as current by DOS
  2610. note 1) By putting the PSP segment value into BX and issuing call 50h DOS stores
  2611.     that value into a variable and uses that value whenever a file call is
  2612.     made.
  2613.      2) Note that in the PSP (or PDB) is a table of 20 (decimal) open file
  2614.     handles. The table starts at offset 18h into the PSP. If there is an
  2615.     0FFh in a byte then that handle is not in use. A number in one of the
  2616.     bytes is an index into an internal FB table for that handle. For
  2617.     instance the byte at offset 18h is for handle 0, at offset 19h handle
  2618.     1, etc. up to 13h. If the high bit is set then the file associated by
  2619.     the handle is not shared by child processes EXEC'd with call 4Bh.
  2620.      3) Function 50h is dangerous in background operations prior to DOS 3.x as
  2621.     it uses the wrong stack for saving registers.  (same as functions
  2622.     0..0Ch in DOS 2.x)
  2623.      4) Under DOS 2.x, this function cannot be invoked inside an int 28h handler
  2624.     without setting the Critical Error flag.
  2625.  
  2626.                                     -114-
  2627.  
  2628.      5) Open file information, etc. is stored in the PSP DOS views as current.
  2629.     If a program (eg. a resident program) creates a need for a second PSP,
  2630.     then the second PSP should be set as current to make sure DOS closes
  2631.     that as opposed to the first when the second application finishes.
  2632.      6) See PC Mag Vol.5, No 9, p.314 for discussion, also used in BCOPY.ASM
  2633.      7) Used by DOS 3.3 PRINT & DEBUG, DesQview 2.01, Windows 1.03, SYMDEB
  2634.     from MASM 4.0.
  2635.      8) This call is availible in the OS/2 DOS Compatibility Box.
  2636.      9) DOS stores the PID in one location, but the actual address is version-
  2637.     dependent. The strategy is to find the PID and thereby find its
  2638.     address. If you have its address, you can swap PIDs from the TSR pop-up
  2639.     code by peeking and poking. In the initialization code, use GetPID
  2640.     (0x50) to get the PID. You know that DOS lives between the interrupt
  2641.     vectors 0:0 - 0:100 and that PID. Other programs might be in there, but
  2642.     DOS is too. Search that memory for a copy of the PID. When you find
  2643.     one, use SetPID (0x51) to set a phony PID. If the location where you
  2644.     found the original PID changes to the phony PID, you have found the
  2645.     address of the PID. Don't forget to reset the PID with SetPID after
  2646.     each test. DOS 2.0 and 2.1 maintain the PID in two locations, not one.
  2647.  
  2648.  
  2649. Function  51h    "Used Internally by DOS" - Get Program Segment Prefix
  2650.  *        Returns the PSP address of currently executing program
  2651. entry    AH    51h
  2652. return    BX    address of currently executing program (process ID)
  2653. note    format of PSP:
  2654.         offset    size           description
  2655.         00h   2 bytes    program exit point
  2656.         02h    word    memory size in paragraphs
  2657.         04h    byte    unused (0)
  2658.         05h   5 bytes    CP/M style entry point (far call to DOS)
  2659.         0Ah    word    terminate address (old int 22h)
  2660.         0Ch    word    terminate segment
  2661.         0Eh    word    break address (old int 23h)
  2662.         10h    word    break segment
  2663.         12h    word    error address (old int 24h)
  2664.         14h    word    error segment
  2665.         16h    word    parent PSP segment
  2666.         18h  20 bytes    DOS 2.0+ open files, 0FFh = unused
  2667.         2Ch    word    DOS 2.0+ environment segment
  2668.         2Eh    dword    far pointer to process's SS:SP
  2669.         32h    word    DOS 3.x+ max open files
  2670.         34h        DOS 3.x+ open file table address
  2671.         36h    dword    DOS 3.x+ open file table segment
  2672.         38h 24 bytes    unused by DOS versions before 3.3
  2673.         50h  3 bytes    DOS function dispatcher (FAR routine)
  2674.         53h  9 bytes    unused
  2675.         55h        FCB #1 extension
  2676.         5Ch 16 bytes    FCB #1, filled in from first cmdline argument
  2677.         6Ch 20 bytes    FCB #2, filled in from second cmdline argument
  2678.         80h128 bytes    command tail / default DTA buffer
  2679. note 1) Used in DOS 2.x, 3.x uses 62h.
  2680.      2) Function 51h is dangerous in background operations prior to DOS 3.x as
  2681.     it uses the wrong stack for saving registers.  (same as functions
  2682.     0..0Ch in DOS 2.x)
  2683.      3) 50h and 51h might be used if you have more than one process in a PC.
  2684.     For instance if you have a resident program that needs to open a file
  2685.     you could first call 51h to save the current ID and then call 50h to set
  2686.     the ID to your PSP.
  2687.      4) Under DOS 2.x, this function cannot be invoked inside an int 28h handler
  2688.     without setting the Critical Error flag.
  2689.      5) Used by DOS 3.3 PRINT, DEBUG.
  2690.      6) This call is availible in the OS/2 DOS Compatibility Box.
  2691.  
  2692.                                     -115-
  2693.  
  2694. Function  52h    "Used Internally by DOS" - IN-VARS
  2695.  *        Returns a FAR pointer to a linked list of DOS data variables
  2696. entry    AH    52h
  2697. return    ES:BX    pointer to the DOS list of lists, for disk information. Does not
  2698.         access the disk, so information in tables might be incorrect if
  2699.         disk has been changed. Returns a pointer to the following array
  2700.         of longword pointers:
  2701.         bytes    value        description
  2702. (common)    -2h,    word    segment of first memory control block available
  2703.                 through MALLOC
  2704.         00h    dword    far pointer to first DOS Disk Parameter Block
  2705.         04h    dword    far pointer to linked list of DOS open file
  2706.                 tables. (Open File Table List)
  2707.         08h    dword    far pointer to CLOCK$: device driver, whether
  2708.                 installable or resident
  2709.         0Ch    dword    far pointer to actual CON: device driver,
  2710.                 whether installable or resident
  2711.  
  2712.     (DOS 2.x only)
  2713.         10h    word    number of logical drives in system
  2714.         11h    word    largest logical sector size supported
  2715.         13h    dword    far pointer to first disk buffer used by the
  2716.                 logical drives. The size of each sector buffer
  2717.                 is equal to the logical sector size plus a 16
  2718.                 byte header. (Sector Buffer Header) The number
  2719.                 of these buffers is set by CONFIG.SYS. (Sector
  2720.                 Buffer Structure)
  2721.         17h    ----    beginning (not a pointer. The real beginning!)
  2722.                 of NUL device driver. This is the first device
  2723.                 on DOS's linked list of device drivers.
  2724.  
  2725.     (DOS 3.x+)
  2726.         10h    word    largest logical sector sector size supported
  2727.                 (most versions of DOS are hardcoded to 200h)
  2728.         12h    dword    far pointer to sector buffer structure used by
  2729.                 the logical drives. (Sector Buffer Structure)
  2730.         16h    dword    far pointer to drive path and seek information
  2731.                 table. (Drive Path Table)
  2732.         1Ah    dword    far pointer to a table of FCBs. This table is
  2733.                 only valid if FCBS=xx was used in CONFIG.SYS
  2734.         1Eh    word    size of FCB table
  2735.         20h    byte    number of logical drives presently supported
  2736.         21h    byte    value of LASTDRIVE= in CONFIG.SYS (default 5)
  2737.         22h    ----    beginning (not a pointer-the real beginning!)
  2738.                 of the NUL device driver. This is the first
  2739.                 device on DOS's linked list of device drivers.
  2740.         34h    (?)    number of JOINed drives?
  2741.  
  2742. note 1) This call is not supported in OS/2 1.0's DOS Compatibility Box.
  2743.      2) Used by DOS 4.0 MEM.EXE, DOS 3.3 ASSIGN.COM, PRINT.COM, SUBST.EXE.
  2744.      3) Article in Dr. Dobbs' Journal, June 1989.
  2745.      4) Disk Parameter Block
  2746.     offset    size    description
  2747.     00h    byte    disk unit number, 0=A, 1=B, etc. If this and the next
  2748.             byte are 0FFh this entry is the end of the list and
  2749.             is not valid
  2750.     01h    byte    disk unit number passed to the block device driver
  2751.             responsible for this logical drive
  2752.     02h    word    the drive's logical sector size in bytes
  2753.     04h    byte    number of sectors per cluster -1. The number of sectors
  2754.             per cluster must be a power of 2
  2755.     05h    byte    allocation shift. The shift value used to calculate
  2756.             the number of sectors from the number of clusters
  2757.             without having to use division. Number of sectors =
  2758.             number of clusters << allocation shift.
  2759.  
  2760.                                     -116-
  2761.  
  2762.     06h    word    number of reserved sectors at the beginning of the
  2763.             logical drive. May contain partition information.
  2764.     08h    byte    number of FATs. Default 2
  2765.     09h    word    number of root directory entries
  2766.     0Bh    word    first sector containing data (disk files)
  2767.     0Dh    word    last cluster number. Number of clusters in data area
  2768.             +1. If less than 0FF6h the FAT uses 12-bit directory
  2769.             entries, otherwise 16 bit entries
  2770.     0Fh    byte    FAT size. Size of one FAT in logical sectors
  2771.     10h    word    sector number of first root directory entry
  2772.     12h    dword    far pointer to the block device driver
  2773.     16h    byte    media descriptor byte (see Chapter 8)
  2774.     17h    byte    media flag. If this is 0, the drive has been accessed.
  2775.             If it is -1 or set to -1 DOS will rebuild all data
  2776.             structures associated with this drive on the next
  2777.             access
  2778.     18h    dword    far pointer to the next Disk Parameter Block
  2779.  
  2780.      5) Open File Table List
  2781.     offset    size    description
  2782.     00h    dword    far pointer to the next table in the list. If the
  2783.             offset of this pointer is 0FFFFh, then the next table
  2784.             is the final entry and invalid
  2785.     04h    word    number of table entries. Each table entry is 53 bytes
  2786.             long. There will be at least one entry in each table
  2787.             except the terminal entry
  2788.     06h    ---    beginning of the Open File Table entries (note 6)
  2789.  
  2790.      6) Open File Table Entry (35h bytes long)
  2791.     offset    size    description
  2792.     00h    word    number of file handles referring to this file
  2793.     02h    byte    access mode (see function 3Dh)
  2794.     03h        unknown
  2795.     05h    word    device info word (see function 44h/00h)
  2796.     06h    dword    far pointer to device info header if this is a char-
  2797.             acter device. If block device, this will be a far
  2798.             pointer to the Disk Parameter Block
  2799.     07h    dword    pointer to device driver header if character device;
  2800.             pointer to DOS Device Control Block if block device
  2801.             (see fn 32h for format)
  2802.     0Bh    word    starting cluster of file
  2803.     0Dh    word    file time in packed format
  2804.     0Fh    word    file date in packed format
  2805.     11h    dword    file size
  2806.     15h    dword    current offset in file
  2807.     19h    word    unknown
  2808.     1Bh    word    last cluster read
  2809.     1Dh    word    number of sector containing directory entry
  2810.     1Fh    byte    offset of directory entry within sector (byte offset/32)
  2811.     20h  11 bytes    filename in FCB format (no path, no period, blank
  2812.             padded)
  2813.     2Bh   6 bytes    PSP segment of file's owner
  2814.     2Dh   3 bytes    unknown - normally 0
  2815.     31h    word    PSP segment of file's owner
  2816.     33h-34h     unknown - normally 0
  2817.  
  2818.      7) Sector Buffer Header:     (DOS 2.x+)
  2819.     offset    size    description
  2820.     00h    dword    pointer to next disk buffer, FFFFh if last
  2821.     04h   4 bytes    unknown
  2822.     08h    word    logical sector number
  2823.     10h   2 bytes    unknown
  2824.     12h    dword    pointer to DOS Device Control Block (see function 32h)
  2825.  
  2826.                                     -117-
  2827.  
  2828.      8) Sector Buffer Structure, followed by 512 byte buffer
  2829.     offset    size    description
  2830.     00h    dword    far pointer to the next sector buffer. Buffers are
  2831.             filled in the order of their appearance on this
  2832.             linked list. The last buffer is valid and has the value
  2833.             0FFFFFFFFh
  2834.     04h    byte    drive number. This is the drive that the data currently
  2835.             in the buffer refers to. 0FFh if never used.
  2836.     05h    byte    data type flags. Bit fields which area of the drive
  2837.             the buffer refers to.
  2838.             bit    description
  2839.             0
  2840.             1    FAT data
  2841.             2    directory or subdirectory data
  2842.             3    file data
  2843.             4
  2844.             5    contents of buffer may be overwritten if set
  2845.             6
  2846.             7
  2847.     06h    word    logical sector number of buffered data
  2848.     08h    word    access number
  2849.     0Ah    dword    far pointer to Disk Parameter Block (see fn 32h)
  2850.     0Eh    word    not used, normally 0
  2851.  
  2852.      9) Drive Path Table Entry     (array, one 51h-byte entry per drive):
  2853.     offset    size    description
  2854.     00h  64 bytes    current default ASCIIZ pathname with drive letter,
  2855.             colon, and leading backslash
  2856.     44h    byte    flags byte. All valid entries contain a 40h, last
  2857.             entry contains 00h.
  2858.            bits 15    network drive
  2859.             14    physical drive
  2860.             13    JOINed, current path is actual path without
  2861.                 JOIN drive letter in path may differ from
  2862.                 logical drive name
  2863.             12    SUBSTed, current path is actual path without
  2864.                 SUBST drive letter in path may differ from
  2865.                 logical drive name
  2866.     45h    dword    far pointer to current Disk Parameter Block
  2867.     49h    word    current block or track/sector number for this directory
  2868.             0 if root dir, -1 if never accessed
  2869.     4Bh    dword    unknown. Far pointer to (?). Usually -1
  2870.     4Fh    word    offset of '\' in current path field representing root
  2871.             directory of logical drive (2 if not SUBSTed or JOINed,
  2872.             otherwise number of bytes in SUBST/JOIN path)
  2873.  
  2874.  
  2875. Function  53h    "Used Internally by DOS" - Translate BPB
  2876.  *        Translates BPB (BIOS Parameter Block, see below) into a DOS
  2877.         Disk Block (see function call 32h).
  2878. entry    AH    53h
  2879.     DS:SI    pointer to BPB (BIOS Parameter Block)
  2880.     ES:BP    pointer to buffer area for DOS Disk Block
  2881.         Layout of BPB:
  2882.         offset    size         description
  2883.         00h-01h word  bytes per sector, get from DDB bytes 02h-03h.
  2884.         02h    byte  sectors per cluster, get from (DDB byte 4) + 1
  2885.         03h-04h word  reserved sectors, get from DDB bytes 06h-07h
  2886.         05h    byte  number of FATs, get from DDB byte 08h
  2887.         06h-07h word  # of root dir entries, get from DDB bytes 09h-0Ah
  2888.         08h-09h word  total number of sectors, get from:
  2889.                   ((DDB bytes 0Dh-0Eh) - 1) * (sectors per cluster
  2890.                   (BPB byte 2)) + (DDB bytes 0Bh-0Ch)
  2891.  
  2892.                                     -118-
  2893.  
  2894.         0Ah    word  media descriptor byte, get from DDB byte 16h
  2895.                   for DOS 4.0+, set to 0 if partition >32Mb, then
  2896.                   set dword at 15h to actual number of sectors
  2897.         0Bh-0Ch word  number of sectors per FAT, get from DDB byte 0Fh
  2898.    for DOS 3.x: 0Dh    word  number of sectors per track
  2899.         0Fh    word  number of heads
  2900.         11h    dword  number of hidden sectors
  2901.         15h 11 bytes  reserved
  2902.    for DOS 4.x: 15h    dword  total number of sectors if word at 08h contains
  2903.                   zero
  2904. return    unknown
  2905. note    This function is documented as 'SetDPB' in the Zenith MS-DOS 3.05 TRM.
  2906.  
  2907.  
  2908. Function  54h    Get Verify Setting
  2909.         Get verify flag status
  2910. entry    AH    54h
  2911. return    AL    00h if flag off
  2912.         01h if flag on
  2913. note 1) Flag can be set with function 2Eh.
  2914.      2) This call is explicitly supported in the OS/2 DOS Compatibility Box.
  2915.  
  2916.  
  2917. Function  55h    "Used Internally by DOS" - Create "Child" PSP
  2918.  *        Create PSP: similar to function 26h (which creates a new Program
  2919.         Segment Prefix at segment in DX) except creates a "child" PSP
  2920.         rather than copying the existing one.
  2921. entry    AH    55h
  2922.     DX    segment number at which to create new PSP.
  2923. return    unknown
  2924. note 1) This call is similar to call 26h which creates a PSP except that unlike
  2925.     call 26h the segment address of the parent process is obtained from the
  2926.     current process ID rather than from the CS value on the stack (from the
  2927.     INT 21h call). DX has the new PSP value and SI contains the value to be
  2928.     placed into PSP:2 (top of memory).
  2929.      2) Function 55 is merely a substitute for function 26h. It will copy the
  2930.     current PSP to the segment address DX with the addition that SI is
  2931.     assumed to hold the new memory top segment. This means that function
  2932.     26h sets SI to the segment found in the current PSP and then calls
  2933.     function 55h.
  2934.  
  2935.  
  2936. Function  56h    Rename a File
  2937. entry    AH    56h
  2938.     DS:DX    pointer to ASCIIZ old pathname
  2939.     ES:DI    pointer to ASCIIZ new pathname
  2940. return    CF    clear    successful rename
  2941.         set    AX    error code (02h, 03h, 05h, 11h)
  2942. note 1) Works with files in same logical drive only.
  2943.      2) Global characters not allowed in filename.
  2944.      3) The name of a file is its full pathname. The file's full pathname can
  2945.     be changed, while leaving the actual FILENAME.EXT unchanged. Changing
  2946.     the pathname allows the file to be "moved" from subdirectory to
  2947.     subdirectory on a logical drive without actually copying the file.
  2948.      4) DOS 3.x allows renaming of directories.
  2949.      5) This call is explicitly supported in the OS/2 DOS Compatibility Box.
  2950.      6) TOS: $56 RENAME. Similar to MS-DOS 2.x.
  2951.  
  2952.                                     -119-
  2953.  
  2954.  
  2955. Function  57h  Get/Set a File's Date and Time
  2956.            Read or modify time and date stamp on a file's directory entry
  2957. entry    AH    57h
  2958.     AL    function code
  2959.         00h    Get Date and Time
  2960.         01h    Set Date and Time
  2961.             CX    time to be set
  2962.             DX    date to be set
  2963.         02h    unknown (DOS 4.0+)
  2964.         03h    unknown
  2965.         04h    unknown (DOS 4.0+)
  2966.     BX    file handle
  2967. return    CF    clear    CX    time of last write (if AL = 0)
  2968.             DX    date of last write (if AL = 0)
  2969.         set    AX    error code (01h, 06h)
  2970. note 1) Date/time formats are:
  2971.     CX bits 0Bh-0Fh hours (0-23)    DX bits 09h-0Fh year (relative to 1980)
  2972.         05h-0Ah minutes (0-59)        05h-08h month (0-12)
  2973.         00h-04h #2 sec. incr. (0-29)    00h-04h day of the month (0-31)
  2974.      2) This call is explicitly supported in the OS/2 DOS Compatibility Box.
  2975.      3) TOS: $57 GSDTOF.
  2976.  
  2977.  
  2978. Function  58h    Get/Set Allocation Strategy   (DOS 3.x+)
  2979. entry    AH    58h
  2980.     AL    00h    Get Current Strategy
  2981.         01h    Set New Current Strategy
  2982.     BL    new strategy if AH=1
  2983.         00h    First Fit - chooses the lowest block in memory which
  2984.             will fit (this is the default). (use first memory block
  2985.             large enough)
  2986.         01h    Best Fit - chooses the smallest block which will fill
  2987.             the request.
  2988.         02h    Last Fit - chooses the highest block which will fit.
  2989. return    CF    clear    (0)    successful
  2990.         set    (1)    error
  2991.                 AX    error code (01h)
  2992.     AX    strategy code (CF=0)
  2993. note 1) Documented in Zenith DOS version 3.1, some in Advanced MSDOS.
  2994.      2) The set subfunction accepts any value in BL; 2 or greater means last
  2995.     fit. The get subfunction returns the last value set, so programs should
  2996.     check whether the value is greater than or equal to 2.
  2997.      3) For discussion of best fit vs. first fit allocation strategies, see
  2998.     Knuth, *Fundamental Algorithms.* Very briefly, Knuth finds that first
  2999.     fit methods are far superior to best fit, which increases both
  3000.     allocation overhead and memory fragmentation.  The "last" fit that DOS
  3001.     offers is nothing other than a first fit, starting the search at the
  3002.     other end of the chain (the algorithm still takes the first fitting
  3003.     block that is encountered in the search).
  3004.  
  3005.  
  3006. Function  59h    Get Extended Error Code (DOS 3.x+)
  3007.       The Get Extended Error function call (59h) is intended to provide a common
  3008.      set of error codes and to supply more extensive information about the error
  3009.      to the application. The information returned from function call 59h, in
  3010.      addition to the error code, is the error class, the locus, and the
  3011.      recommended action. The error class provides information about the error
  3012.      type (hardware, internal, system, etc.). The locus provides information
  3013.      about the area involved in the failure (serial device, block device,
  3014.      network, or memory). The recommended action provides a default action for
  3015.      programs that do not understand the specific error code.
  3016.  
  3017.                                     -120-
  3018.  
  3019.        Newly written programs should use the extended error support both from
  3020.      interrupt 24h hard error handlers and after any int 21h function calls. FCB
  3021.      function calls report an error by returning 0FFh in AL. Handle function
  3022.      calls report an error by setting the carry flag and returning the error
  3023.      code in AX. Int 21h handle function calls for DOS 2.x continue to return
  3024.      error codes 0-18. Int 24h handle function calls continue to return error
  3025.      codes 0-12. But the application can obtain any of the error codes used in
  3026.      the extended error codes table by issuing function call 59h. Handle
  3027.      function calls for DOS 3.x can return any of the error codes. However, it
  3028.      is recommended that the function call be followed by function call 59h to
  3029.      obtain the error class, the locus, and the recommended action.
  3030.  
  3031.        The Get Extended Error function (59h) can always be called, regardless of
  3032.      whether the previous DOS call was old style (error code in AL) or new style
  3033.      (carry bit). It can also be used inside an int 24h handler.
  3034.       You can either check AL or the carry bit to see if there was no error,
  3035.      and call function 59h only if there was an error, or take the simple
  3036.      approach of always calling 59h and letting it tell you if there was an
  3037.      error or not. When you call function 59h it will return with AX=0 if the
  3038.      previous DOS call was successful.
  3039. entry    AH    59h
  3040.     BX    version code (0000 for DOS 3.0 and 3.1)
  3041. return    AX    extended error code:
  3042.         01h    Invalid function number
  3043.         02h    File not found
  3044.         03h    Path not found
  3045.         04h    Too many open files, no file handles left
  3046.         05h    Access denied
  3047.         06h    Invalid handle
  3048.         07h    Memory control blocks destroyed
  3049.         08h    Insufficient memory
  3050.         09h    Invalid memory block address
  3051.         0Ah    Invalid environment
  3052.         0Bh    Invalid format
  3053.         0Ch    Invalid access code
  3054.         0Dh    Invalid data
  3055.         0Eh    Reserved
  3056.         0Fh    Invalid drive was specified
  3057.         10h    Attempt to remove the current directory
  3058.         11h    Not same device
  3059.         12h    No more files
  3060.         13h    Attempt to write on write-protected diskette
  3061.         14h    Unknown unit
  3062.         15h    Drive not ready
  3063.         16h    Unknown command
  3064.         17h    Bad CRC check
  3065.         18h    Bad request structure length
  3066.         19h    Seek error
  3067.         1Ah    Unknown media type
  3068.         1Bh    Sector not found
  3069.         1Ch    Printer out of paper
  3070.         1Dh    Write fault
  3071.         1Eh    Read fault
  3072.         1Fh    General Failure
  3073.         20h    Sharing violation
  3074.         21h    Lock violation
  3075.         22h    Invalid disk change
  3076.         23h    FCB unavailible
  3077.         24h    Sharing buffer overflow
  3078.         25h    Reserved
  3079.         26h       "
  3080.         27h       "
  3081.         28h       "
  3082.         29h       "
  3083.  
  3084.                                     -121-
  3085.  
  3086.         2Ah       "
  3087.         2Bh       "
  3088.         2Ch       "
  3089.         2Dh       "
  3090.         2Eh       "
  3091.         2Fh       "
  3092.         30h       "
  3093.         31h    Reserved
  3094.         32h    Network: request not supported (DOS 3.1 + MS Networks)
  3095.         33h    Remote computer not listening
  3096.         34h    Duplicate name on network
  3097.         35h    Network: name not found
  3098.         36h    Network: busy
  3099.         37h    Network: device no longer exists
  3100.         38h    NETBIOS command limit exceeded
  3101.         39h    Network: adapter hardware error
  3102.         3Ah    Incorrect response from network
  3103.         3Bh    Unexpected network error
  3104.         3Ch    Incompatible remote adapter
  3105.         3Dh    Print queue full
  3106.         3Eh    Not enough space for print file
  3107.         3Fh    Print file was deleted
  3108.         40h    Network: name was deleted
  3109.         41h    Network: Access denied
  3110.         42h    Network: device type incorrect
  3111.         43h    Network: name not found
  3112.         44h    Network: name limit exceeded
  3113.         45h    NETBIOS session limit exceeded
  3114.         46h    Temporarily paused
  3115.         47h    Network: request not accepted
  3116.         48h    Print or disk redirection paused (DOS 3.1 + MS Networks)
  3117.         49h    Reserved
  3118.         4Ah       "
  3119.         4Bh       "
  3120.         4Ch       "
  3121.         4Dh       "
  3122.         4Eh       "
  3123.         4Fh    Reserved
  3124.         50h    File exists
  3125.         51h    Reserved
  3126.         52h    Cannot make directory entry
  3127.         53h    Fail on interrupt 24h
  3128.         54h    Too many redirections
  3129.         55h    Duplicate redirection
  3130.         56h    Invalid password
  3131.         57h    Invalid parameter
  3132.         58h    Network: device fault
  3133.     BH    class of error:
  3134.         01h    Out of resource
  3135.         02h    Temporary situation
  3136.         03h    Authorization (denied access)
  3137.         04h    Internal
  3138.         05h    Hardware failure
  3139.         06h    System failure
  3140.         07h    Application program error
  3141.         08h    Not found
  3142.         09h    Bad format
  3143.         0Ah    Locked
  3144.         0Bh    Media error (wrong volume ID, disk failure)
  3145.         0Ch    Already exists
  3146.         0Dh    Unknown
  3147.  
  3148.                                     -122-
  3149.  
  3150.     BL    suggested action code:
  3151.         01h    Retry
  3152.         02h    Delayed retry
  3153.         03h    Prompt user
  3154.         04h    Abort after cleanup
  3155.         05h    Immediate abort
  3156.         06h    Ignore
  3157.         07h    Retry after user intervention
  3158.     CH    locus (where error occurred):
  3159.         01h    Unknown or not appropriate
  3160.         02h    Block device
  3161.         03h    Network related
  3162.         04h    Serial device
  3163.         05h    Memory related
  3164. note 1) Not all DOS functions use the carry flag to indicate an error. Carry
  3165.     should be tested only on those functions which are documented to use it.
  3166.      2) None of the DOS functions which existed before 2.0 use the carry
  3167.     indicator.  Many of them use register AL as an error indication instead,
  3168.     usually by putting 0FFh in AL on an error. Most, but not all, the "new"
  3169.     (2.x, 3.x) functions do use carry, and most, but not all, of the "old"
  3170.     (1.x) functions use AL.
  3171.      3) On return, CL, DI, DS, DX, ES, BP, and SI are destroyed - save before
  3172.     calling this function if required.
  3173.      4) DOS 2.x Error Codes:  If you are using function calls 38h-57h with DOS
  3174.     2.x, to check if an error has occurred, check for the following error
  3175.     codes in the AX register:
  3176.     call    error code    call    error code    call    error code
  3177.     38h    2        41h    2,3,5        4Ah    7,8,9
  3178.     39h    3,5        42h    1,6        4Bh    1,2,3,5,8,10,11
  3179.     3Ah    3,5,15        43h    1,2,3,5     4Eh    2,3,18
  3180.     3Bh    3        44h    1,3,5,6     4Fh    18
  3181.     3Ch    3,4,5        45h    4,6        56h    2,3,5,17
  3182.     3Dh    2,3,4,5,12    46h    4,6        57h    1,6
  3183.     3Eh    6        47h    15
  3184.     3Fh    5,6        48h    7,8
  3185.     40h    5,6        49h    7,9
  3186.      5) Note that extended error codes 13h through 1Fh correspond to error
  3187.     codes 00h through 0Ch returned by int 24h.
  3188.      6) This call is explicitly supported in the OS/2 DOS Compatibility Box.
  3189.  
  3190.  
  3191.  
  3192.  
  3193. Function  5Ah    Create Temporary File
  3194.         Create unique filename (for temporary use) (DOS 3.x+)
  3195. entry    AH    5Ah
  3196.     DS:DX    pointer to buffer containing an ASCIIZ directory pathname
  3197.         ending with a backslash (\). The buffer must have at least 13
  3198.         bytes free following the backslash, as the file name and
  3199.         extension will be written there.
  3200.     CX    file attribute
  3201. return    CF    clear    DS:DX    new ASCIIZ pathname
  3202.             AX    handle
  3203.         set    AX    error code (03h, 05h)
  3204. note 1) The file created is not truly "temporary". It must be removed by the
  3205.     user.
  3206.      2) If the filename created already exists in the current directory, this
  3207.     function will call itself again with another unique filename until
  3208.     a unique filename is found.
  3209.      3) The temporary filename usually consists of mixed letters and numbers.
  3210.     No file extension appears to be generated.
  3211.      4) This call is explicitly supported in the OS/2 DOS Compatibility Box.
  3212.  
  3213.                                     -123-
  3214.  
  3215.  
  3216. Function  5Bh    Create a New File   (DOS 3.x+)
  3217. entry    AH    5Bh
  3218.     DS:DX    pointer to an ASCIIZ pathname
  3219.     CX    file attribute
  3220. return    CF    clear    AX    file handle
  3221.             DS:DX    new ASCIIZ pathname
  3222.         set    AX    error code (03h, 04h, 05h, 50h)
  3223. note 1) Unlike function 3Ch, function 5Bh will fail if the file already exists.
  3224.      2) The new file is opened in read/write mode.
  3225.      3) This call is explicitly supported in the OS/2 DOS Compatibility Box.
  3226.  
  3227.  
  3228. Function  5Ch    Lock/Unlock File Access   (DOS 3.x+)
  3229. entry    AH    5Ch
  3230.     AL    00h    To lock file region
  3231.         01h    To unlock file region
  3232.     BX    file handle
  3233.     CX:DX    starting offset of region to lock
  3234.     SI:DI    size of region    to lock
  3235. return    CF    clear    successful
  3236.         set    AX    error code (01h, 06h, 21h)
  3237. note 1) Unlock all files before exiting or undefined results may occur.
  3238.     Programs using file locking should trap int 23h (Control-C Handler
  3239.     Address) and int 24h (Critical Error Handler Address) and unlock files
  3240.     before returning to the caller.
  3241.      2) Programs spawned with EXEC inherit all the parent's file handles but
  3242.     not the file locks.
  3243.      3) This call is explicitly supported in the OS/2 DOS Compatibility Box.
  3244.      4) You may lock an entire file, any part of a file, or several parts of
  3245.     the same file. For example, it would be more efficient to lock an
  3246.     area in a database containing a single record than to lock the entire
  3247.     file.
  3248.      5) You should lock only as much of a file as you need and keep the lock
  3249.     only for as long as necessary. Should a file need to be shared and
  3250.     updated often, continual locking and unlocking can slow file access
  3251.     detectably.
  3252.  
  3253.  
  3254. Function  5Dh    undocumented - Multifunction
  3255.  *        DOS  Internal - partial (DOS 3.x+)
  3256. entry    AH    5Dh
  3257.     AL    subfunction
  3258.         00h    Indirect Function Call
  3259.             DS:DX    pointer to buffer containing register values
  3260.                 AX, BX, CX, DX, SI, DI, DS, ES for a call to
  3261.                 int 21h
  3262.             return    as appropriate for function being called
  3263.             note    Does not check AH. Out of range values will
  3264.                 crash the system.
  3265.         01h    SYNC?  (DOS 3.1+)
  3266.             parameters unknown
  3267.             note 1) Does something to each disk file in the system.
  3268.                 File Table which has been written to.
  3269.                  2) If remote file, calls int 2Fh/fn1107h.
  3270.                  3) Seems to update the time stamp of all open
  3271.                 files which have been written to.
  3272.         02h-05h Network functions? (DOS 3.1+)
  3273.             parameters unknown
  3274.             note    Error unless network is loaded.
  3275.         06h    Get Address of Critical Error Flag
  3276.             return    CX    unknown value
  3277.                 DX    unknown value
  3278.                 DS:SI    pointer to critical error flag
  3279.  
  3280.                                     -124-
  3281.  
  3282.     (LANtastic) 07h    Return redirected printer mode
  3283.             return    DL    00    output is being combined
  3284.                     01h    output is being separated
  3285.             note    The current printer mode (either printer output
  3286.                 combined or separated) is returned.
  3287.     (LANtastic) 08h    Set redirected printer mode (either printer output
  3288.             DL    00h    set redirected output to be combined
  3289.                 01h    set redirected output to be separated.
  3290.                     (implicitly starts a new print job)
  3291.             return    none
  3292.             note 1) The current printer mode (either printer output
  3293.                 combined or separated) can be set.
  3294.                  2) may be used by COMMAND.COM
  3295.     (LANtastic) 09h    Flush printer output
  3296.             return    none
  3297.             note 1) Printer output is flushed and a new print job
  3298.                 is started. If no output exists to be flush
  3299.                 then this function has no effect.
  3300.                  2) may be used by COMMAND.COM
  3301.         09h    unknown - may be used by COMMAND.COM
  3302.         0Ah    Set Error Info (Error, Class, Action, and Locus)
  3303.             DS:DX    address of 11-word error information table
  3304.                 words 0 to 7: values of AX,BX,CX,DX,SI,DI,DS,
  3305.                           ES that function 59h will return
  3306.                 words 8 to 10: zero (reserved)
  3307. return    CX    unknown value
  3308.     DX    unknown value
  3309.     DS:SI    (for 06h) pointer to critical error flag
  3310. note 1) This call seems to have many different functions.
  3311.      2) Function 0Ah; DOS 3.1+.
  3312.      3) Function 06h; setting CritErr flag allows use of functions 50h/51h from
  3313.     int 28h under DOS 2.x by forcing the use of the correct stack.
  3314.      4) Functions 07h, 08h, 09h are identical in DOS 3.1 and call int 2Fh
  3315.     fn1125h.
  3316.  
  3317.  
  3318.  
  3319. Function  5Eh    Network Printer  (Partially documented by Microsoft)
  3320.         DOS 3.1+ with Networks software
  3321. entry    AH    5Eh
  3322.     AL    00h    Get Machine Name
  3323.             DS:DX    pointer to 16-byte buffer for ASCIIZ name
  3324.             return    CH    0    if name not defined
  3325.                 CL    NETBIOS name number if CH <> 0
  3326.                 DS:DX    pointer to identifier if CH <> 0
  3327.             note    The ASCIIZ name is a 15 byte string padded
  3328.                 to length with zeroes.
  3329.         01h    Set Machine Name
  3330.             DS:DX    pointer to ASCIIZ name
  3331.             CH    unknown, must be nonzero
  3332.             CL    name number
  3333.         02h    Set Printer Control String
  3334.             BX    redirection list index
  3335.             CX    length of setup string (max 64 bytes)
  3336.             DS:SI    pointer to string buffer
  3337.         03h    Get Printer Control String
  3338.             BX    redirection list index
  3339.             ES:DI    pointer to 64-byte string buffer
  3340.             return    CX    length of setup string (max 64 bytes)
  3341. return    CF    clear    successful
  3342.         set    error
  3343.             AX    error code (01h for all listed subfunctions)
  3344.  
  3345.                                     -125-
  3346.  
  3347. note 1) Used in IBM's & Microsoft's Network programs.
  3348.      2) Partial documentation in Fall 1985 Byte.
  3349.      3) These services require that the network software be installed.
  3350.      4) Partial documentation in Advanced MS-DOS.
  3351.      5) SHARE must be loaded or results can be unpredictable on 00h, or fail
  3352.     with 02h or 03h.
  3353.  
  3354.  
  3355. Function  5Fh    Network Redirection
  3356.         (DOS 3.1 + Microsoft Networks)
  3357. entry    AH    5Fh
  3358.     AL     *00h    Unknown
  3359.            *01h    Unknown
  3360.         02h    Get Redirection List Entry
  3361.             BX    redirection list index (zero based)
  3362.             DS:SI    pointer to 16 byte buffer for local device name
  3363.             ES:DI    pointer to 128 byte buffer for network name
  3364.             return    BH    device status flag (bit 0=0 if valid)
  3365.                                (bit 0=1 if invalid)
  3366.                 BL    device type
  3367.                     03    printer device
  3368.                     04    drive device (file)
  3369.                 CX    stored parameter value (user data)
  3370.                 DS:SI    pointer to 16 byte local device name
  3371.                 ES:DI    pointer to 128 byte network name
  3372.             note    DX and BP are destroyed by this call.
  3373.         03h    Redirect Device - Make Assign List Entry
  3374.             Redirects a workstation drive or device to a server
  3375.             directory or device.
  3376.             BL    device type
  3377.                 03    printer device
  3378.                 04    file device
  3379.             CX    stored parameter value (0 for compatibility
  3380.                 with IBM PC Network program)
  3381.             DS:SI    pointer to 16-byte ASCIIZ source device name
  3382.             ES:DI    pointer to destination 128-byte ASCIIZ network
  3383.                 path and ASCIIZ password
  3384.                 (e.g.,'\\machine_name\path',0,'password',0)
  3385.         04h    Cancel Redirection Assignment
  3386.             DS:SI    pointer to ASCIIZ device name or network path
  3387.                 to be canceled
  3388. return    CF    clear    successful
  3389.         set    if error
  3390.             AX    error code
  3391.                 (fn 02h) 01h, 12h
  3392.                 (fn 03h) 01h, 03h, 05h, 08h
  3393.                 (fn 04h) 01h, 0Fh
  3394. note 1) Used in IBM's Network program.
  3395.      2) Partial documentation in Fall 1985 Byte.
  3396.      3) These services require that the network software be installed.
  3397.      4) Partial documentation in Advanced MS-DOS.
  3398.      5) SHARE must be loaded or the call will fail.
  3399.      6) The network device name requires a password.
  3400.  
  3401.  
  3402. Function  60h    undocumented - Parse pathname (DOS 3.x+)
  3403.  *        Perform name processing on a string (internal to DOS)
  3404. entry    AH    60h
  3405.     DS:SI    pointer to ASCIIZ source string (null terminated)
  3406.     ES:DI    pointer to destination 67 byte (?) ASCIIZ string buffer
  3407. return    ES:DI    buffer filled with qualified name in form (drive):(path)
  3408.     CF    0    no error
  3409.         1    error
  3410.             AX    error code (unknown)
  3411.  
  3412.                                     -126-
  3413.  
  3414. note 1) Documented in Zenith 3.05 Tech Ref.
  3415.      2) All name processing is performed on the input string: string
  3416.     substitution is performed on the components, current drive/directories
  3417.     are prepended, .  and ..  are removed.
  3418.      3) Example: If current drive/directory is c:\test,  myfile.x is translated
  3419.     to c:\test\myfile.x; ..\source\sample.asm is tranlated to c:\source\
  3420.     sample.asm.
  3421.      4) It is the caller's responsibility to make sure DS:SI does not point to
  3422.     a null string. If it does, SI is incremented, a null byte is stored at
  3423.     ES:DI, and the routine returns.
  3424.      5) Used by CHKDSK, at least in DOS 3.3, and DOS 3.x.
  3425.      6) If path string is on a JOINed drive, the returned name is the one that
  3426.     would be needed if the drive were not JOINed; similarly for a SUBSTed
  3427.     drive letter. Because of this, it is possible to get a qualified name
  3428.     that is not legal with the current combination of SUBSTs and JOINs.
  3429.  
  3430.  
  3431. Function  61h    undocumented - (DOS 3.x)
  3432.  *        Internal to DOS - parameters not known
  3433. entry    AH    61h
  3434. return    AL    00h
  3435. note    Supposedly documented in Zenith DOS 3.05 Tech Ref.
  3436.  
  3437.  
  3438. Function  62h    Get Program Segment Prefix (PSP) (DOS 3.x+)
  3439. entry    AH    62h
  3440. return    BX    segment address of PSP
  3441.  
  3442.  
  3443. Function  63h    Get Lead Byte Table  (MS-DOS 2.25 only)
  3444.         Added in DOS 2.25 for additional foreign character set support.
  3445. entry    AH    63h
  3446.     AL    subfunction
  3447.         00h    Get System Lead Byte Table Address
  3448.         01h    Set/Clear Interim Console Flag
  3449.             DL    0000h    to clear interim console flag
  3450.                 0001h    to set interim console flag
  3451.         02h    get interim console flag
  3452. return    DS:SI    pointer to lead byte table (AL = 00h)
  3453.     DL    interim console flag (AL = 02h)
  3454. note 1) Function 63h destroys all registers except SS:SP on return.
  3455.      2) Not supported in DOS 3.x or 4.x.
  3456.      3) Note fn 63h does not return errors in AL or CF.
  3457.  
  3458.  
  3459. Function  64h    Undocumented - Used internally by DOS
  3460. entry    AH    64h
  3461. return    unknown
  3462. note 1) DOS 3.2+ internal function of some type? May be a network function.
  3463.      2) In DOS 3.31 it seems that when you load AL with a nonzero number,
  3464.     int 28h will get called more often. AL=0 resets back to the "boot up"
  3465.     state.
  3466.  
  3467.  
  3468. Function  65h    Get Extended Country Information (DOS 3.3+)
  3469.         Returns information about the selected country formats, code
  3470.         pages, and conversion tables
  3471. entry    AH    65h
  3472.     AL    information ID code
  3473.         01h    get general internationalization info
  3474.         02h    get pointer to uppercase table (130 bytes max)
  3475.             (maps chars 80h-0FFh to their uppercase equivalents,
  3476.              if any; used mainly to map accented or other vowels
  3477.              to the corresponding plain vowels)
  3478.  
  3479.                                     -127-
  3480.  
  3481.         03h    unknown
  3482.         04h    get pointer to filename uppercase table (130 bytes max)
  3483.             (similar to table for AL = 02h)
  3484.         05h    unknown
  3485.         06h    get pointer to collating sequence table (258 bytes max)
  3486.             (maps uppercase, lower, and accented chars together
  3487.              for sorting)
  3488.         07h    get pointer to double-byte character set table
  3489.     BX    code page (0FFFFh = global code page)
  3490.     CX    size of buffer (>=5)
  3491.     DX    country ID (0FFFFh = current country)
  3492.     ES:DI    pointer to country information buffer
  3493. return    CF    set on error
  3494.         AX    error code (unknown)
  3495.             otherwise:
  3496.     CX    size of country information returned
  3497.     ES:DI    pointer to country information:
  3498.           offset   length    description
  3499.         00h   1 byte    info ID  (for all following buffers)
  3500.     If info ID <> 1:
  3501.         01h    dword  pointer to information
  3502.     If info ID = 1:
  3503.         01h    word    length of remainder of buffer (<= 38)
  3504.         03h    word    country ID
  3505.         05h    word    code page number
  3506.         07h  34 bytes    same as for int 21h function 38h
  3507.     If info ID = 2:
  3508.         01h    dword    pointer to uppercase table
  3509.         05h    word    table size
  3510.         128 bytes uppercase equivalents (if any) of chars 80h-0FFh
  3511.     If info ID = 4:
  3512.         01h    dword    pointer to collating table
  3513.         05h    word    table size
  3514.         256 bytes    values used to sort characters 00h-0FFh
  3515.     If info ID = 6:
  3516.         01h    dword    pointer to filename uppercase table
  3517.         05h    word    table size
  3518.         128 bytes    uppercase equivalents (if any) of chars 80h-0FFh
  3519.     If info ID = 7: (DOS 4.0)
  3520.         unknown
  3521. note    For AL=02h, 04h, or 06h, the first two bytes of the table give its
  3522.     length and the rest is the table itself.
  3523.  
  3524.  
  3525. Function  66h    Get/Set Global Code Page Table (DOS 3.3+)
  3526.         Query/reset code page defaults
  3527. entry    AH    66h
  3528.     AL    00h    Get Global Code Page
  3529.         01h    Set Global Page
  3530.             BX    active code page
  3531.             DX    system code page (active page at boot time)
  3532. return    CF    clear  successful
  3533.         set    AX    error code (unknown)
  3534.     if 00h           BX    active code page
  3535.                DX    system code page (active page at boot time)
  3536. note    BX = active code page: 437 = US, 860 = Portugal, 863 = Canada (French)
  3537.                    865 = Norway/Denmark, 850 = multilingual
  3538.  
  3539.  
  3540. Function  67h    Set Handle Count  (DOS 3.3+)
  3541.         Supports more than 20 open files per process
  3542. entry    AH    67h
  3543.     BX    desired number of handles (max 65,535)
  3544. return    CF    clear if OK
  3545.     CF    set if error
  3546.         AX    error code (unknown)
  3547.  
  3548.                                     -128-
  3549.  
  3550. note 1) This function changes the 20-byte handle table pointer in the PSP to
  3551.     point to a new, larger handle table elsewhere in memory.
  3552.      2) The memory the 67h call allocates is taken from the normal DOS pool,
  3553.     and is reclaimed on process termination, so nothing is lost.
  3554.      3) When calling this function you must release enough memory for DOS to
  3555.     contain the extended handle list.
  3556.  
  3557.  
  3558. Function  68h    Commit File (DOS 3.3+)
  3559.         Write all buffered data to disk
  3560. entry    AH    68h
  3561.     BX    file handle
  3562. return    CF    set    AX    error code
  3563.         clear    successful
  3564. note 1) Faster and more secure method of closing a file in a network than
  3565.     current close commands.
  3566.      2) This is effectively the same as DUPing the handle for a file and then
  3567.     closing the new one, except that this call won't fail if the system
  3568.     is out of handles.
  3569.      3) If BX <= 20, no action is taken.
  3570.      4) The file's buffers are flushed and its directory and FAT entries are
  3571.     updated.
  3572.  
  3573.  
  3574. Function  69h    Disk Serial Number  DOS 4.0+ (US versions)
  3575.         Handles "Volume Serial Number" on disks formatted with 4.0+
  3576. entry    AH    69h    Get Volume Serial Number
  3577.     DS:DX    pointer to table
  3578. return    DS:DX    data table. Format:
  3579.         word     unknown (zeroes on my system)
  3580.         dword     disk serial number (binary)
  3581.          11 bytes     volume label or "NO NAME    " if none
  3582.           8 bytes     FAT type - string "FAT12   " or "FAT16   "
  3583. note    The FAT type field refers to the number of bits per directory entry.
  3584.  
  3585.  
  3586. Function  6Ah    Unknown  (DOS 4.0?)
  3587.  
  3588.  
  3589. Function  6Bh    Unknown  (DOS 4.0?)
  3590.  
  3591.  
  3592. Function  6Ch    Extended Open/Create  DOS 4.0+ (US)
  3593.         Combines functions available with Open, Create, Create New,
  3594.         and Commit File
  3595. entry    AH    6Ch
  3596.     AL    00h  reserved  [which means there might be other subfunctions?]
  3597.     BX    mode    format    0WF0 0000 ISSS 0AAA
  3598.                 AAA is access code (read, write, read/write)
  3599.                 SSS is sharing mode
  3600.                 I    0    pass handle to child
  3601.                     1    no inherit [interesting!]
  3602.                 F    0    use int 24h for errors
  3603.                     1    disable int 24h for all
  3604.                         I/O on this handle; use own
  3605.                         error routine
  3606.                 W    0    no commit
  3607.                     1    auto commit on all writes
  3608.  
  3609.                                     -129-
  3610.  
  3611.     CX    create attribute
  3612.     DL    action if file exists/does not exists
  3613.        bits 7-4    action if file does not exist
  3614.             0000    fail
  3615.             0001    create
  3616.         3-0    action if file exists
  3617.             0000    fail
  3618.             0001    open
  3619.             0010    replace/open
  3620.     DH    00h
  3621.     DS:SI    pointer to ASCIIZ file name
  3622. return    CF    set on error
  3623.         AX    error code (unknown)
  3624.         clear
  3625.         AX    file handle
  3626.         CX    action taken
  3627.             01h    file opened
  3628.             02h    file created/opened
  3629.             03h    file replaced/opened
  3630. note    When APPEND is installed, if DX=xx1x it looks only in current
  3631.     directory, if DX=xx0x it will search the full append path. DX is
  3632.     called the open flag and gives what action to take if the file exits or
  3633.     does not exist.
  3634.  
  3635. Function  89h    undocumented - DOS_Sleep
  3636.  *        Not documented by Microsoft
  3637. entry    AH    89h
  3638. return    unknown
  3639. note 1) Function included in Microsoft C 4.0 startup code MSDOS.INC.
  3640.      2) Debugging shows that the first instruction on entry to DOS compares AH
  3641.     with 64h (at least in DOS 3.2) and aborts the call if AH > 64.
  3642.      3) Possibly used in European MSDOS 4.0?
  3643.  
  3644.  
  3645.  
  3646. Aftermarket Application Installed Function Calls:
  3647.  
  3648. Novell Netware 2.11:.
  3649.           Novell no longer recommends the int 21h method for invoking the
  3650.     Netware functions. Int 21h will be supported indefinitely, but the
  3651.     net API calls for addressing the software through the Multiplex
  3652.     Interrupt (2Fh). You may address the API through int 2Fh in the same
  3653.     manner as int 21h; only the interrupt number is different.
  3654.  
  3655.     Novell API calls are referenced in Chapter 13. Most functions from
  3656.     0B6h through 0F9h are preempted by NetWare; if your software uses any
  3657.     of these calls for another purpose it will likely not run under
  3658.     NetWare.
  3659.  
  3660. NOTE:    Novell (and most others') network software and SoftLogic's DoubleDOS
  3661.     conflict on the following int 21h functions 0EAh-0EEh. Netware must
  3662.     use int 2Fh functions instead of 21h functions if DoubleDOS will be
  3663.     used on the network.
  3664.  
  3665.  
  3666. Function  0E4h    DoubleDOS - Get active flag
  3667. entry    AX    0E4h
  3668. return    AL    00h    if DoubleDOS not active
  3669.         <>0    DoubleDOS is active
  3670.  
  3671.  
  3672. Function  0EAh    DoubleDOS - Turn off task switching
  3673. entry    AX    0EAh
  3674. return    none
  3675. note    Task switching turned off.
  3676.  
  3677.                                     -130-
  3678.  
  3679.  
  3680. Function  0EBh    DoubleDOS - Turn on task switching
  3681. entry    AH    0EBh
  3682. return    none
  3683. note    Task switching turned on.
  3684.  
  3685.  
  3686. Function  0ECh    DoubleDOS -  Get virtual screen address
  3687. entry    AH    0ECh
  3688. return    ES    segment of virtual screen
  3689. note    Screen address can change if task switching is on!
  3690.  
  3691.  
  3692. Function  0EEh    DoubleDOS - Release Timeslice
  3693.         Give away time to other tasks
  3694. entry    AH    0EEh
  3695.     AL    number of 55ms time slices to give away
  3696. return    none
  3697. note    Returns after giving away time slices.
  3698.  
  3699.  
  3700. Function  0FFh    CED   (CJ Dunford's DOS macro and command-line editor)
  3701.         CED installable commands
  3702. entry    AH    0FFh
  3703.     AL    00h    Add Installable Command
  3704.         01h    Remove Installable Command
  3705.         02h    Reserved, may be used to test for CED installation
  3706.     BL    mode byte
  3707.         bit 0    callable from DOS prompt
  3708.         1    callable from application
  3709.         2-7    not used in public domain CED
  3710.     DS:SI    pointer to CR-terminated command name
  3711.     ES:DI    pointer to far routine entry point
  3712. return    CF    set on error
  3713.     AX    01h    invalid function
  3714.         02h    command not found (subfunction 1 only)
  3715.         08h    insufficient memory (subfunction 0 only)
  3716.         0Eh    bad data (subfunction 0 only)
  3717.     AH    0FFh    if CED not installed
  3718.