home *** CD-ROM | disk | FTP | other *** search
/ Compu-Fix / Compu-Fix.iso / referenz / terms / dosref22 next >
Encoding:
Text File  |  1993-03-01  |  721.9 KB  |  14,681 lines

  1.  
  2.        **  Programmer's Technical Reference for MSDOS and the IBM PC **
  3.                 USA copyright TXG 392-616  ALL RIGHTS RESERVED
  4. ───────────────────────────────┤ DOSREF (tm) ├────────────────────────────────
  5.                      ISBN 1-878830-02-3 (disk-based text)
  6.                     Copyright (c) 1987, 1991 Dave Williams
  7.                         ┌─────────────────────────────┐
  8.                         │ Shareware Version, 12/20/91 │
  9.                         │  Please Register Your Copy  │
  10.                         └─────────────────────────────┘
  11.  
  12.  
  13.   /* This work is registered directly with the copyright offices of the     */
  14.   /* United States and of the United Kingdom, and indirectly in many other  */
  15.   /* nations via the conventions the above are signatory to.                */
  16.   /*           Generous licensing terms are available on inquiry.           */
  17.  
  18.  
  19.  
  20.                             I N T R O D U C T I O N
  21.  
  22.  
  23.  This book is a technical reference. It is NOT a tutorial. Hopefully, this
  24. book is what you'll reach for when you want find out what Peter Norton or the
  25. "official" references glossed over.
  26.  
  27.  This manual is intended to replace the various (expensive) references needed
  28. to program for the DOS environment, that stack of magazines threatening to take
  29. over your work area, and those odd tables and charts you can never find when
  30. you need them.
  31.  
  32.  The various Microsoft and IBM publications and references don't always have
  33. the same information. This has caused some consternation about the
  34. "undocumented" features to be found in DOS. In general, if a call doesn't
  35. appear in the IBM DOS Technical Reference it is considered "undocumented"
  36. although it may be documented by other OEMs or by later Microsoft tech
  37. bulletins.
  38.  
  39.  The information here is valid for DOS 2.x through 5.x. Where there are
  40. differences between the two versions there are notes in the text. No great
  41. effort was expended on DOS 1.x.
  42.  
  43.  When I started writing this book, it was originally for my own personal use.
  44. Then I began expanding it with the idea of getting it published, since at that
  45. time there was *nothing* in print like it. (late 1987) If I had managed to
  46. send it off to the publishers early enough, I would have had it made. As it
  47. was I lost six months having a nice steel rod put in my leg after being run
  48. over by a drug addict in an uninsured car, and half a dozen similar books were
  49. published by then, and nobody was interested in mine. Six months is a long
  50. time in the PC world.
  51.  
  52.  That's why I'm uploading this file as "user-supported." It gives me a chance
  53. to recoup a few bucks for the time I've been working on this thing, and it
  54. gives some advantages that a printed book can't - first, you can load it on
  55. your hard disk and use Vern Buerg's LIST or SideKick to scan through text. You
  56. can grab a piece of something and paste it into a document, etc. If you help
  57. support the Reference you will always have the latest version available; you
  58. can't "upgrade" books.
  59.  
  60.  A project this size takes a LOT of time and effort. I've tried to verify as
  61. much of the information I've received as I could, but there's just too much for
  62. absolute certainty.  The TechRef has been in the hands of some heavy-duty code
  63. jockeys for a couple of years now with very few bug reports, though.
  64.  
  65.  If you find any typos, incorrect information, or want to see something else,
  66. let me know. If you have any more detailed information on something, PLEASE let
  67. me know!
  68.  
  69.                                                         Dave Williams
  70.  
  71.  
  72.  
  73.                          D  I  S  C  L  A  I  M  E  R
  74.  
  75. <sigh>
  76.  
  77.  As is common these days, I have to make a "Notice of Disclaimer". I take no
  78. responsibility for anything, and if anything you do with this book ruins you
  79. for life or makes your dog bite you, or anything else, that's just tough.
  80.  
  81.  I hope you find much use for this reference. It was a trip to write, too.
  82.  
  83.                                                         Dave Williams
  84.  
  85.                                                   (C) Copyright 1987, 1991
  86.  
  87. /* note: the above disclaimer is being used as an example in the University */
  88. /*       of Texas' School of Law. Whether good or bad, my respondent didn't */
  89. /*       say...                                                             */
  90.  
  91.  
  92. ______________________________________________________________________________
  93.  
  94. Copyrights and trademarks:
  95.  
  96. (3COM Corporation)
  97.  3COM, Etherlink
  98.  
  99. (Allied Telephone and Telegraph)
  100.  UNIX, AT&T
  101.  
  102. (Artisoft)
  103.  LANtastic
  104.  
  105. (AST Corporation)
  106.  AST, RAMpage!
  107.  
  108. (Atari Computer)
  109.  Atari, ST, TOS
  110.  
  111. (Borland)
  112.  Borland, Turbo C, Turbo Pascal, Turbo Lightning, Turbo Assembler, SideKick
  113.  
  114. (Commodore Business Machines)
  115.  Amiga 2000, Bridge Board
  116.  
  117. (Compaq Computer Corp.)
  118.  Compaq, Deskpro
  119.  
  120. (Cordata Computer)
  121.  Corona, Cordata
  122.  
  123. (Cove Software)
  124.  CED, PCED
  125.  
  126. (Digital Equipment Company)
  127.  DEC, Rainbow, DECMate, DOS    (uh... yeah. DEC owns the trademark to 'DOS')
  128.  
  129. (Fox Research, Inc.)
  130.  10-Net
  131.  
  132. (Graphic Software Systems)
  133.  GSS, DGIS
  134.  
  135. (Hayes)
  136.  Smartmodem
  137.  
  138. (Hercules Computer Technology)
  139.  Hercules, HGC, Hercules Graphics Card Plus, InColor Card
  140.  
  141. (IBM Corp.)
  142.  IBM, PC, PCjr, PC/XT, PC/AT, XT/286, PS/2, TopView, Micro Channel, 3270 PC,
  143.  RT PC, Token Ring, OS/2
  144.  
  145. (Intel Corp.)
  146.  Intel, iAPX286, iAPX386, LIM EMS, Communicating Applications Standard (CAS)
  147.  
  148. (Logitech, Inc)
  149.  Logitech, Logimouse
  150.  
  151. (Microsoft Corp.)
  152.  Microsoft, MS, MS DOS, OS/2, Xenix, Windows, Windows/286, Windows/386,
  153.  Microsoft Networks, LIM EMS, XMA, DPMI
  154.  
  155. (Mouse Systems Corp.)
  156.  Mouse Systems, PCMouse
  157.  
  158. (Novell Development Corp.)
  159.  Novell, NetWare
  160.  
  161. (Phar Lap)
  162.  VCPI, Virtual Control Program Interface
  163.  
  164. (Qalitas)
  165.  386-To-The-Max, 386MAX
  166.  
  167. (Quarterdeck Office Systems)
  168.  DesQview, QEMM
  169.  
  170. (SEAware, Inc)
  171.  ARC
  172.  
  173. (Softlogic)
  174.  DoubleDOS
  175.  
  176. (Sunny Hill Software)
  177.  TaskView, OmniView
  178.  
  179. (Tandy Corp.)
  180.  Tandy, Radio Shack, DeskMate
  181.  
  182. (Texas Instruments)
  183.  TI, TI Professional, Business Professional, TIGA (TI Graphics Interface)
  184.  
  185. (Zenith Radio Corporation)
  186.  Zenith, Z-100, Z-248
  187.  
  188. (ZSoft Corporation)
  189.  ShowPartner, Paintbrush
  190.  
  191.  "LIM 4.0" and "Expanded Memory Specification" are copyright Lotus Development
  192. Corp, Intel Corp, and Microsoft Corp.
  193.  
  194.  "EEMS", "AQA 3.1" and "Enhanced Expanded Memory Specification" are copyright
  195. by Ashton-Tate, Quadram, and AST
  196.  
  197.  "DPMI" and "DOS Protected Mode Interface" are copyright Lotus Development
  198. Corp, Intel Corp, Microsoft Corp, and AST
  199.  
  200. Various other names are trademarks of their respective companies.
  201.  
  202. ╔════════════════════════════════════════════════════════════════════════════╗
  203. ║     Programmer's Technical Reference for MSDOS and the IBM PC     SWv2.2   ║
  204. ╚════════════════════════════════════════════════════════════════════════════╝
  205.  
  206.   This is a user-supported technical reference.  If you find this information
  207.  to be of use, please mail your check or money order for US $20 + $1.75 S&H to:
  208.  
  209.                        ╤═════════════════════════════╤
  210.                        │    Dave Williams, DOSREF    │
  211.                        │         PO Box 181          │
  212.                        │ Jacksonville, AR 72076-0181 │
  213.                        │             USA             │
  214.                        ╧═════════════════════════════╧
  215.  
  216.   Shipping is US Postal Service Air Mail.  For non-Australian foreign orders,
  217.  see the file 'PAYMENT'.  Site licensing and product licensing terms are
  218.  available.
  219.  
  220.   If you wish to make payment in Australian dollars, please mail your check
  221.  or money order for AUS $29 or credit card information to to:
  222.  
  223.                        ╤═════════════════════════════╤
  224.                        │ Spearwood Shareware Service │
  225.                        │          PO Box 121         │
  226.                        │    Hamilton Hill, WA 6163   │
  227.                        │           Australia         │
  228.                        ╧═════════════════════════════╧
  229.  
  230.         Spearwood Shareware Service is our authorized Australian dealer.
  231.         They will forward your order to the USA and you will receive the
  232.         absolute latest version of DOSREF by airmail straight from the
  233.         author.  This means there will be about a three week delay before
  234.         your order arrives.  We appreciate your business!
  235.  
  236.         Spearwood is our dealer only; for support write or E-mail the
  237.         author, Dave Williams, at the above address.
  238.  
  239. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  240.  
  241.    Why support DOSREF instead of relying on one of those public domain
  242.  "interrupt lists"?  Sheer size, for one.  Even in LHarc format DOSREF
  243.  bulks out to over a megabyte, making it too large for most sysops to
  244.  consider keeping online.  Registered users also get support via:
  245.  
  246.         The Courts of Chaos BBS (TechRef support board)
  247.         RIME/RelayNet
  248.         BIX
  249.         CompuServe
  250.         airmail
  251.  
  252.   You get the very latest edition of this manual on disk, with no worries
  253.  about corrupted or tampered text.  DOSREF is a quality product, in use
  254.  by the US Navy, CalTech, Borland, NEC, Wang, General Motors, Citicorp,
  255.  Rockwell, Honeywell, Digital Research, Central Point Software, 20th Century
  256.  Fox, Associated Press, hospitals, universities, and government agencies
  257.  around the world.
  258.  
  259.   The Registered User reference consists of over a megabyte of the compressed
  260.  technical reference, appendices, and sample source code. That's about three
  261.  megabytes of raw data when uncompressed, or several times larger than the
  262.  shareware version.
  263.  
  264.   The Registered User version contains information on device drivers, mouse
  265.  programming, Virtual Control Program Interface, Microsoft Windows 2.x, hard
  266.  drives, hardware information, virus and Trojan programs, EMS 3.2, LIM 4.0,
  267.  EEMS 3.2, CD-ROM, network programming, DOS 5.0, and more.
  268.  
  269.   Registered users will be advised by mail of updates.
  270.  
  271.   Several people who have downloaded copies over three years old have written
  272.  to see if I was still supporting the Reference.  The answer is yes.  Not only
  273.  that, but my book contract calls for keeping the information current.  If
  274.  you're concerned, just drop a postcard.
  275.  
  276.  *****************************************************************************
  277.  
  278.  Foreign langauge versions are available!
  279.  
  280.   Klaus Overhage of Stuttgart, West Germany has licensed DOSref for
  281.  redistribution and is now able to provide versions in German.  Klaus' version
  282.  is a separate product from this one and must be purchased separately. Klaus
  283.  is providing full support for German users.  If you'd like a copy in German,
  284.  please contact:
  285.  
  286.                              Klaus Overhage
  287.                              Rosenstrasse 15 A
  288.                              7000 Stuttgart 50
  289.                              Germany
  290.  
  291.   I hope to have other languages available soon.  If you are interested in
  292. purchase or translation, please contact me for details.
  293.  
  294.  *****************************************************************************
  295.  
  296.   For payment in British pounds, Canadian dollars or EuroCheques, see
  297.  INVOICE.TRF and PAYMENT.  I fully support foreign users!  If you're having
  298.  trouble arranging payment, write (or leave EMail) and I'll try to work
  299.  something out.
  300.  
  301.   Do you live outside the US?  If so, you're probably familiar with the
  302.  hassles of keeping up with the latest information - the three to five month
  303.  lead time for US publication, plus time for local book dealers to catalog
  304.  new releases, plus problems in trying to order... plus the delays while your
  305.  book comes in on special order, goes through Customs, the inevitable price
  306.  hikes through all the middlemen, taxes...  not only is DOSREF priced
  307.  well below the price of good printed computer books in the US, it's probably
  308.  far cheaper than you could expect to pay for US books locally.  Plus your
  309.  order will show up in your very own mailbox by air mail.
  310.  
  311.  *****************************************************************************
  312.  
  313.   Printed copies of the Tech Ref are available for £16.95 or US$35.10 from
  314. Sigma Press, marketed by John Wiley & Sons UK. Address orders to:
  315.  
  316.         Programmer's Technical Reference
  317.         by Dave Williams
  318.  
  319.         ISBN 185058-199-1
  320.         John Wiley & Sons
  321.         Baffins Lane
  322.         Chichester
  323.         West Sussex PO19 1UD
  324.         England
  325.  
  326.  They accept checks, most credit cards, or purchase orders.
  327.  
  328.  *****************************************************************************
  329.  
  330.   The latest shareware version is always available on BIX the ibm.dos/listings
  331.  area, the GEnie IBM file area, or:
  332.  
  333.  The Courts of Chaos, (501)985-0059, (support BBS)  CompuCom 9600
  334.  The Cat House, (501)376-6909,  (sysop: Joe Felix)  CompuCom 9600
  335.  
  336.  RelayNet node ->CHAOS
  337.     send mail in COMMON or MULTITSK (I'm the Conference Host for Multitask)
  338.  MetroNet node ->CHAOS
  339.     send mail in METRONET
  340.  
  341.  The DRAKE BBS, (0522) 824379, (sysop: Paolo Masetti)
  342.  Langhirano, Italy  FIDOnet 2:332/502
  343.  
  344.  GroupMed, (206) 581-9088  (sysop: Ismail Arslangiray)
  345.  Tacoma WA, USA  FIDOnet 1:138/120 2400bps, 1:138/116 9600bps USR HST
  346.  instant access, latest DOSREF is FREQable
  347.  
  348.  
  349.  *****************************************************************************
  350.  
  351.  Shareware is try-before-you buy software.  If you find this package to be of
  352. use you should consider registering.  Registered users get the complete
  353. version, support, and updates.
  354.  
  355.  If you received this copy of DOSREF from a shareware vendor the money you
  356. paid was only for the diskette, not the software.
  357.  
  358.  Dave Williams is a member of the User Supported Software Association (ussa).
  359. ussa wants to make sure that the user supported software principle works for
  360. you. If you are unable to resolve a software-related problem with a ussa
  361. member by contacting the member directly, ussa may be able to help. The ussa
  362. Mediator can help you resolve a dispute or problem with a ussa member, but
  363. does not provide technical support for members' products. Please write to the
  364. ussa Mediator at Box 1000, London SE17 2UA, England.
  365.  
  366.      ┌──────┐
  367.      │┌─────┘
  368.      │└─────┐
  369.      ├┬──┬──┤  Approved
  370.      ││  │┌┐│  Author
  371.      │└──┘│││
  372.      ├┬──┬┴┴┤  User -
  373.      ││  │┌┐│  Supported
  374.      │└──┘│││  Software
  375.      ├───┬┘├┤  Association
  376.      │┌─┐│ ││
  377.      │└─┘└─┘│
  378.      └──────┘
  379.        ussa
  380.  
  381.  
  382.  
  383.                                How to use DOSREF
  384.  
  385.  This reference changes so often that any attempt to format it for pagination 
  386. would be a tremendous waste of time. Simply printing the thing out and letting 
  387. the pagebreaks fall where they may is how most people do it. The neatest 
  388. solution is Vern Buerg's LIST.COM or SideKick's file view function. If your
  389. editor has multiple-window support, you can open a small window into the 
  390. Reference and cut and paste into your source.
  391.  
  392.  An efficient method of using the Reference is to concatenate all the chapters 
  393. together with the COPY command, ie COPY CONTENTS + CHAPTER.001 + CHAPTER.002 +
  394. ..... + CHAPTER.017   REF.  (REF being the new file name for the concatenated 
  395. files.) With LIST.COM, the backslash (\) or F9 key will search for strings. 
  396. You can then dump pieces of text to a disk file or your printer.
  397.  
  398.  If you work better with a printout than scanning with a file viewer, try 
  399. setting your printer to 132 columns. This allows a nice margin for writing 
  400. notes and eliminates the problem some printers have when printing 80 
  401. character wide text. Some of the text and charts in the reference are a full 
  402. 80 columns wide; unfortunately some printers wrap automatically at 79 columns.
  403. Some printers don't handle a combination of compressed print and graphics 
  404. characters very well either. You may have to use the PRTRFIX.COM program 
  405. provided on Disk 1 to squelch the graphics for printing.
  406.  
  407.  I strongly recommend using a viewer instead of printing. If you *must* print 
  408. the Reference out, do it in stages so your printer does not overheat. Some
  409. inexpensive printers will self-destruct after a couple of hours.
  410.  
  411.  
  412.    **  Programmer's  Technical  Reference  for  MSDOS  and  the  IBM  PC **
  413.                     Copyright (c) 1987, 1991 Dave Williams
  414.  
  415.  
  416.  This is a listing of some of the new stuff added to the Reference. I didn't
  417. keep a version list until 2.0; lots of stuff gets added between version
  418. numbers.
  419.  
  420. 09/87   first shareware release of the reference
  421. 11/87   LIM 3.2 functions
  422. 01/88   LIM 4.0 spec
  423. 05/88   AST EEMS 3.2 spec
  424. 06/88   DesQview and TopView calls, NetBIOS calls
  425. 07/88   Intel CAS 1.0 spec
  426. 12/88   Microsoft XMA 2.0 standard
  427. 03/89   Microsoft Windows 1.03 API
  428. 04/89   porting between operating systems
  429. 04/89   video programming
  430. 04/89   more networking
  431. 04/89   mouse programming
  432. 04/89   table of contents at beginning of each chapter
  433. 06/89   major bugfixes and verification of data
  434. 09/89   Microsoft TSR Programming Guidelines 1.0 (provisional)
  435. 10/89   PharLap VCPI 1.0
  436. 10/89   LANtastic network API
  437. 10/89   PC-MOS/386 4.00 partial API
  438. 10/89   partial DesQview and TopView
  439. 10/89   further updates to MS Windows API
  440. 12/89   PCjr cartridge support in DOS
  441. 12/89   more info on European multitasking DOS 4.0
  442. 12/89   added some paint program formats
  443. 12/89   info on computer viruses and Trojan Horses
  444.  
  445. 06/90   expanded sysid ID codes in Chapter 2
  446. 07/90   add Connor Peripheral drives to Appendix 6
  447. 07/90   add Imprimis drives to Appendix 6
  448. 08/90   Weitek x167 math coprocessor interfaces
  449. 10/90   info on Pelican/Kodak 5.5mb 5-1/4 floppy drives
  450. 10/90   added info in IBM PC LAN and Token Ring API
  451. 11/90   int 10h functions for EGALOAD font loader, LANtastic AI-LANBIOS 2Fh
  452.         calls, CopyIIPC board ports, UMB definition in Chap2, updated Appendix
  453.         11 (glossary), added new Appendix 21 (hotkey definitions), completely
  454.         reworked partition tables in Chapter 8
  455. 12/90   added more network functions from IBM PC LAN reference
  456.  
  457. Version 2.0 released!
  458.  
  459. 01/91   EISA access ports, more Carbon Copy int 10h calls, more history of
  460.         DOS, changes to partition table info in Chapter 8, more info on
  461.         IRQ7/int17, more info on eDOS 4.0, Pelican I/O ports, CopyII board I/O
  462.         ports, added network info to int 21h calls, added DOS 1.x info to int
  463.         21h calls, added ARJ archive format to Appendix 15
  464. 02/91   added DHELP.BAT to DOSCMDS. Lots of new ravings in MISCSTUF. STB VGA
  465.         modes added to chap16, ADT SmartFAX function calls, 8250 UART coverage,
  466.         8237 DMA Controller coverage, NEC 765 floppy controller chip coverage,
  467.         more coverage on AT int 70h timer, more Novell calls, GriD ID bytes
  468.         and specific BIOS functions, Leading Edge Model M undocumented BIOS
  469.         1Ah functions, Versa-Spool interrupts, ZIPKEY int 0B3h calls
  470.  
  471. 04/91   extensive additions of network card port addresses to Chapter 2
  472.         extensive additions to hard drive listings
  473.  
  474. 05/91   added Appendix 22, Sound Blaster API
  475.         added Appendix 23, French-Canadian accented character chart
  476.         moved XMS spec from Chapter 5 to Chapter 10, since many people missed
  477.         it buried in the 2Fh calls.
  478.         added more Desqview programming information
  479.  
  480. 06/91   removed obsolete TIFF information; Aldus will give the latest spec
  481.         to anyone who asks.  Put TIFF hotline number in Appendix 20.
  482.         added CIS GIF file format, by permission of H&R Block and CIS.
  483.         added PCX file format, by permission of ZSoft.
  484.         added DOS 5 mods and new information to ASSIGN in Chapter 5.
  485.  
  486. 07/91   received permission from VESA to redistribute VESA documents.
  487.         documented SWITCHAR no longer works in 5.0
  488.         int 2Fh/fn 4Ah DOS 5 HMA services (partial)
  489.         int 21h/fn 33h DOS 5 "real" DOS version call
  490.         more information on 21h/60h (TRUENAME) and networks, Win3
  491.         added 8250 info back to Chapter 15
  492.         moved CIS GIF file format to Appendix 24
  493.         hex chart
  494.  
  495. Version 2.1 released
  496.  
  497. 08/91   added more DV info to int 10h/0FEh
  498.         added int 21h and int 2Fh calls for DOS 5.0 from MS 5.0 Tech Ref
  499.         moved DoubleDOS functions from Chapter 4 to Chapter 17
  500.         added how to detect VDISK, some DV info to chap3, 15h/87h
  501.         more info on chap3, 15h/83h and 86h, AT int70 timer functions
  502.         more into on Create Temporary File changes under MS and DR 5.0
  503.         more model ID bytes in chapter 2
  504.         noted potential problems with MSC int86() and ints 25h, 26h
  505.         added CheckIt parallel loopback tester pinout
  506.         greatly enhanced bibliography (50 new entries!)
  507.         more info on the history of the PCjr
  508.         included Raintree's nice information file on DOS4 and SHARE
  509.  
  510.         IBM-to-Mac serial cable adapter pinouts
  511.         more on 2Fh/16h, DOS give-up-time (used by OS/2 2.0 and Win3 too)
  512.         port addresses on Logitech ScanMan board
  513.  
  514.         Microsoft TSR Specification 1.0 as Appendix 26
  515.         AT&T 6300 BIOS Data Area problem, Chapter 2
  516.         more info on int 15h,fn 4Fh (OS Hook)
  517.  
  518.  
  519.        **  Programmer's Technical Reference for MSDOS and the IBM PC **
  520.                 USA copyright TXG 392-616  ALL RIGHTS RESERVED
  521. ───────────────────────────────┤ DOSREF (tm) ├────────────────────────────────
  522.                      ISBN 1-878830-02-3 (disk-based text)
  523.                     Copyright (c) 1987, 1991 Dave Williams
  524.                         ┌─────────────────────────────┐
  525.                         │ Shareware Version, 12/20/91 │
  526.                         │  Please Register Your Copy  │
  527.                         └─────────────────────────────┘
  528.  
  529.  
  530.  The rest of the chapters aren't included in this shareware demonstration
  531. package.  Since the complete manual takes about 1000k even compressed in
  532. LHarc format, something had to give somewhere.
  533.  
  534.  Here's a sample of what you're missing:
  535.  
  536.  DOS 5 information (mainly in registered chapters 4, and 5)
  537.  
  538.  
  539.  (Chapters 1, 2, and 3 are the same as the registered version, less additions
  540. since this demo was released)
  541.  
  542.  
  543.                                TABLE OF CONTENTS
  544.  
  545.  
  546. INTRO           Introduction, credits, copyrights
  547.  
  548.  
  549. CHAPTER 1       DOS and the PC
  550.  
  551. Some History .......................................................... 1**1
  552. What is DOS? .......................................................... 1**2
  553. Other Operating Systems ............................................... 1**3
  554. Specific Versions of MS/PC-DOS ........................................ 1**4
  555. The Operating System Heirarchy ........................................ 1**5
  556. DOS Structure ......................................................... 1**6
  557. DOS Initialization .................................................... 1**7
  558.  
  559.  
  560. CHAPTER 2       Low Memory and Absolute Addresses
  561.  
  562. Introduction .......................................................... 2**1
  563. System Memory Map ..................................................... 2**2
  564. A Brief Guide to Current Memory Terminology ........................... 2**3
  565. PC Port Assignment .................................................... 2**4
  566. Reserved Memory Locations ............................................. 2**5
  567. Absolute Addresses .................................................... 2**6
  568. The IBM PC System Interrupts (Overview) ............................... 2**7
  569. Quick Chart of Interrupts 00h-0FFh .................................... 2**8
  570. The IBM-PC System Interrupts 00h-0Fh (in detail) ...................... 2**9
  571.  
  572.  
  573. CHAPTER 3       The IBM ROM BIOS
  574.  
  575. Calling the ROM BIOS .................................................. 3**1
  576. Interrupt 10h  Video Services ......................................... 3**2
  577. Interrupt 11h  Equipment Check ........................................ 3**3
  578. Interrupt 12h  Memory Size ............................................ 3**4
  579. Interrupt 13h  Disk Functions ......................................... 3**5
  580. Interrupt 14h  Initialize and Access Serial Port ...................... 3**6
  581.                FOSSIL Drivers ......................................... 3**7
  582. Interrupt 15h  Cassette I/O ........................................... 3**8
  583. Interrupt 16h  Keyboard I/O ........................................... 3**9
  584. Interrupt 17h  Printer ................................................ 3**10
  585. Interrupt 18h  ROM BASIC .............................................. 3**11
  586. Interrupt 19h  Bootstrap Loader ....................................... 3**12
  587. Interrupt 1Ah  Time of Day ............................................ 3**13
  588. Interrupt 1Bh  Control-Break .......................................... 3**14
  589. Interrupt 1Ch  Timer Tick ............................................. 3**15
  590. Interrupt 1Dh  Vector of Video Initialization Parameters .............. 3**16
  591. Interrupt 1Eh  Vector of Diskette Controller Parameters ............... 3**17
  592. Interrupt 1Fh  Ptr to Graphics Character Extensions (Graphics Set 2) .. 3**18
  593.  
  594.  
  595. CHAPTER 4       DOS Function Requests
  596.  
  597. General Programming Guides ............................................ 4**1
  598. DOS Registers ......................................................... 4**2
  599. DOS Stacks ............................................................ 4**3
  600. DOS Interrupts ........................................................ 4**4
  601. Interrupt 20h (Terminate) ............................................. 4**5
  602. DOS Services (quick list) ............................................. 4**6
  603. Calling the DOS Services .............................................. 4**7
  604. Version Specific Information .......................................... 4**8
  605. Compatibility Problems With DOS 4.0+ .................................. 4**9
  606. PCjr Cartridge Support ................................................ 4**10
  607. eDOS 4.0 .............................................................. 4**11
  608. DOS Services in Detail ................................................ 4**12
  609.  
  610.  
  611. CHAPTER 5       Interrupts 22h through 0FFh
  612.  
  613. Interrupt 22h   Terminate Address ..................................... 5**1
  614. Interrupt 23h   Ctrl-Break Exit Address ............................... 5**2
  615. Interrupt 24h   Critical Error Handler ................................ 5**3
  616. Interrupt 25h   Absolute Disk Read .................................... 5**4
  617. Interrupt 26h   Absolute Disk Write ................................... 5**5
  618. Interrupt 27h   Terminate And Stay Resident ........................... 5**6
  619. Interrupt 28h   (not documented by Microsoft) ......................... 5**7
  620. Interrupt 29h   (not documented by Microsoft) ......................... 5**8
  621. Interrupt 2Ah   Microsoft Networks - Session Layer Interrupt .......... 5**9
  622. Interrupt 2Bh   Unknown ............................................... 5**10
  623. Interrupt 2Ch   Unknown ............................................... 5**11
  624. Interrupt 2Dh   Unknown ............................................... 5**12
  625. Interrupt 2Eh   Alternate EXEC (DOS 2.0+) ............................. 5**13
  626. Interrupt 2Fh   Multiplex Interrupt ................................... 5**14
  627. Interrupt 30h   FAR jump instruction for CP/M-style calls ............. 5**15
  628. Interrupt 31h   Unknown ............................................... 5**16
  629. Interrupt 32h   Unknown ............................................... 5**17
  630. Interrupt 33h   Used by Microsoft Mouse Driver Function Calls ......... 5**18
  631. Interrupt 34h   Turbo C/Microsoft languages - Floating Point emulation  5**19
  632. Interrupt 35h   Turbo C/Microsoft languages - Floating Point emulation  5**20
  633. Interrupt 36h   Turbo C/Microsoft languages - Floating Point emulation  5**21
  634. Interrupt 37h   Turbo C/Microsoft languages - Floating Point emulation  5**22
  635. Interrupt 38h   Turbo C/Microsoft languages - Floating Point emulation  5**23
  636. Interrupt 39h   Turbo C/Microsoft languages - Floating Point emulation  5**24
  637. Interrupt 3Ah   Turbo C/Microsoft languages - Floating Point emulation  5**25
  638. Interrupt 3Bh   Turbo C/Microsoft languages - Floating Point emulation  5**26
  639. Interrupt 3Ch   Turbo C/Microsoft languages - Floating Point emulation  5**27
  640. Interrupt 3Dh   Turbo C/Microsoft languages - Floating Point emulation  5**28
  641. Interrupt 3Eh   Turbo C/Microsoft languages - Floating Point emulation  5**29
  642. Interrupt 3Fh   Overlay Manager Interrupt (Microsoft LINK.EXE) ........ 5**30
  643. Interrupt 40h   Hard Disk BIOS ........................................ 5**31
  644. Interrupt 41h   Hard Disk Parameters .................................. 5**32
  645. Interrupt 42h   Pointer to screen BIOS entry .......................... 5**33
  646. Interrupt 43h   Pointer to EGA Graphics Character Table ............... 5**34
  647. Interrupt 44h   Pointer to graphics character table ................... 5**35
  648. Interrupt 45h   Reserved by IBM  (not initialized) .................... 5**36
  649. Interrupt 46h   Pointer to second hard disk parameter block ........... 5**37
  650. Interrupt 47h   Reserved by IBM  (not initialized) .................... 5**38
  651. Interrupt 48h   Cordless Keyboard Translation ......................... 5**39
  652. Interrupt 49h   Non-keyboard Scan Code Translation Table Address (PCjr) 5**40
  653. Interrupt 4Ah   Real-Time Clock Alarm (Convertible, PS/2) ............. 5**41
  654. Interrupt 4Bh   Reserved by IBM  (not initialized) .................... 5**42
  655. Interrupt 4Ch   Reserved by IBM  (not initialized) .................... 5**43
  656. Interrupt 4Dh   Reserved by IBM  (not initialized) .................... 5**44
  657. Interrupt 4Eh   Reserved by IBM  (not initialized) .................... 5**45
  658. Interrupt 4Fh   Reserved by IBM  (not initialized) .................... 5**46
  659. Interrupt 50-57 IRQ0-IRQ7 Relocation .................................. 5**47
  660. Interrupt 58h   Reserved by IBM  (not initialized) .................... 5**48
  661. Interrupt 59h   Reserved by IBM  (not initialized) .................... 5**49
  662. Interrupt 5Ah   Reserved by IBM  (not initialized)  ................... 5**50
  663. Interrupt 5Bh   Reserved by IBM  (not initialized) .................... 5**51
  664. Interrupt 5Ah   Cluster Adapter BIOS entry address .................... 5**52
  665. Interrupt 5Bh   Reserved by IBM  (not initialized) .................... 5**53
  666. Interrupt 5Ch   NETBIOS interface entry port, TOPS .................... 5**54
  667. Interrupt 5Dh   Reserved by IBM  (not initialized) .................... 5**55
  668. Interrupt 5Eh   Reserved by IBM  (not initialized) .................... 5**56
  669. Interrupt 5Fh   Reserved by IBM  (not initialized) .................... 5**57
  670. Interrupt 60h-67h  User Program Interrupts ............................ 5**58
  671. Interrupt 60h   Network OS Interface .................................. 5**59
  672. Interrupt 67h   Expanded Memory Board Driver Interrupt ................ 5**60
  673. Interrupt 68h   Not Used  (not initialized) ........................... 5**61
  674. Interrupt 69h   Not Used  (not initialized) ........................... 5**62
  675. Interrupt 6Ah   Not Used  (not initialized) ........................... 5**63
  676. Interrupt 6Bh   Not Used  (not initialized) ........................... 5**64
  677. Interrupt 6Ch   System Resume Vector (Convertible) .................... 5**65
  678. Interrupt 6Dh   Not Used  (not initialized) ........................... 5**66
  679. Interrupt 6Eh   Not Used  (not initialized) ........................... 5**67
  680. Interrupt 6Fh   10-Net API............................................. 5**68
  681. Interrupt 70h   IRQ 8, Real Time Clock Interrupt (AT, XT/286, PS/2) ... 5**69
  682. Interrupt 71h   IRQ 9, Redirected to IRQ 8 (AT, XT/286, PS/2) ......... 5**70
  683. Interrupt 72h   IRQ 10  (AT, XT/286, PS/2)  Reserved .................. 5**71
  684. Interrupt 73h   IRQ 11  (AT, XT/286, PS/2)  Reserved .................. 5**72
  685. Interrupt 74h   IRQ 12  Mouse Interrupt (PS/2) ........................ 5**73
  686. Interrupt 75h   IRQ 13, Coprocessor Error (AT) ........................ 5**74
  687. Interrupt 76h   IRQ 14, Hard Disk Controller (AT, XT/286, PS/2) ....... 5**75
  688. Interrupt 77h   IRQ 15 (AT, XT/286, PS/2)  Reserved ................... 5**76
  689. Interrupt 78h   Not Used .............................................. 5**77
  690. Interrupt 79h   Not Used .............................................. 5**78
  691. Interrupt 7Ah   Reserved .............................................. 5**79
  692. Interrupt 7Bh-7Eh  Not Used by IBM .................................... 5**80
  693. Interrupt 7Ch   REXX-PC API ........................................... 5**81
  694. Interrupt 7Fh   IBM 8514/A Graphics Adapter API ....................... 5**82
  695. Interrupt 80h-85h  Reserved by BASIC .................................. 5**83
  696. Interrupt 86h   Int 18 when relocated by NETBIOS ...................... 5**84
  697. Interrupt 86h-0F0h  Used by BASIC when BASIC interpreter is running ... 5**85
  698. Interrupt 0A4h  Right Hand Man API .................................... 5**86
  699. Interrupt 0D4h  PC-MOS/386 API ........................................ 5**87
  700. Interrupt 0E0h  Digital Research CP/M-86 function calls ............... 5**88
  701. Interrupt 0E1h  PC Cluster Disk Server Information .................... 5**89
  702. Interrupt 0E2h  PC Cluster Program .................................... 5**90
  703. Interrupt 0E4h  Logitech Modula-2 v2.0   Monitor Entry ................ 5**91
  704. Interrupt 0E5h  Not Used .............................................. 5**92
  705. Interrupt 0E6h  Not Used .............................................. 5**93
  706. Interrupt 0E7h  Not Used .............................................. 5**94
  707. Interrupt 0E8h  Not Used .............................................. 5**95
  708. Interrupt 0E9h  Not Used .............................................. 5**96
  709. Interrupt 0EAh  Not Used .............................................. 5**97
  710. Interrupt 0EBh  Not Used .............................................. 5**98
  711. Interrupt 0ECh  Not Used .............................................. 5**99
  712. Interrupt 0EDh  Not Used ............................................. 5**100
  713. Interrupt 0EEh  Not Used ............................................. 5**101
  714. Interrupt 0EFh  GEM interface (Digital Research) ..................... 5**102
  715. Interrupt 0F0h  unknown .............................................. 5**103
  716. Interrupts 0F1h-0FFh  (absolute addresses 3C4h-3FFh) ................. 5**104
  717. Interrupt 0F4h  Not Used ............ ................................ 5**105
  718. Interrupt 0F5h  Not Used ............ ................................ 5**106
  719. Interrupt 0F8h  Set Shell Interrupt (OEM) ............................ 5**107
  720. Interrupt 0F9h  Reserved ............................................. 5**108
  721. Interrupt 0FAh  USART ready (RS-232C) ................................ 5**109
  722. Interrupt 0FBh  USART RS ready (keyboard) ............................ 5**110
  723. Interrupt 0FCh  Unknown ...............................................5**111
  724. Interrupt 0FDh  reserved for user interrupt .......................... 5**112
  725. Interrupt 0FEh  reserved by IBM ...................................... 5**113
  726. Interrupt 0FFh  reserved by IBM ...................................... 5**114
  727.  
  728.  
  729.  
  730. CHAPTER 6       DOS Control Blocks and Work Areas
  731.  
  732. DOS Address Space ..................................................... 6**1
  733. Storage Blocks ........................................................ 6**2
  734. Disk Transfer Area (DTA) .............................................. 6**3
  735. Program Segment Prefix ................................................ 6**4
  736. Memory Control Blocks ................................................. 6**5
  737. DOS Program Segment ................................................... 6**6
  738.  
  739.  
  740. CHAPTER 7       DOS File Information
  741.  
  742. File Management Functions ............................................. 7**1
  743. FCB Function Calls .................................................... 7**2
  744. Handle Function Calls ................................................. 7**3
  745. Special File Handles .................................................. 7**4
  746. Raw and Cooked File I/O ............................................... 7**5
  747. Number of Open Files Allowed  ......................................... 7**6
  748. Restrictions on FCB Usage ............................................. 7**7
  749. Restrictions on Handle usage .......................................... 7**8
  750. Allocating Space to a File ............................................ 7**9
  751. MSDOS / PCDOS Differences ............................................. 7**10
  752. .COM File Structure ................................................... 7**11
  753. .EXE File Structure ................................................... 7**12
  754. The Relocation Table .................................................. 7**13
  755. "NEW" .EXE Format (Microsoft Windows and OS/2) ........................ 7**14
  756. Standard File Control Block ........................................... 7**15
  757. Extended File Control Block ........................................... 7**16
  758. Disk Transfer Area .................................................... 7**17
  759.  
  760.  
  761. CHAPTER 8       DOS Disk Information
  762.  
  763. The DOS Area .......................................................... 8**1
  764. The Boot Record ....................................................... 8**2
  765. DOS File Allocation Table (FAT) ....................................... 8**3
  766.         Media Descriptor Byte ......................................... 8**4
  767.         12 Bit FATs ................................................... 8**5
  768.         16 Bit FATs ................................................... 8**6
  769.         32 Bit FATs ................................................... 8**7
  770. DOS Disk Directory .................................................... 8**8
  771. The Data Area ......................................................... 8**9
  772. Floppy Disk Types ..................................................... 8**10
  773. Hard Disk Layout ...................................................... 8**11
  774. System Initialization ................................................. 8**12
  775. Boot Record/Partition Table ........................................... 8**13
  776. Hard Disk Technical Information ....................................... 8**14
  777. Determining Hard Disk File Allocation ................................. 8**15
  778. BIOS Disk Functions ................................................... 8**16
  779.  
  780.  
  781. CHAPTER 9       Device Drivers
  782.  
  783.  
  784. CHAPTER 10      Lotus/Intel/Microsoft Expanded Memory Specification
  785.  
  786. History ............................................................... 10**1
  787. Uses of Expanded Memory ............................................... 10**2
  788. DOS and Expanded Memory ............................................... 10**3
  789. Different Memory Types ................................................ 10**4
  790. AST/Quadram/Ashton-Tate Enhanced EMM .................................. 10**5
  791. EMS Address Space Map ................................................. 10**6
  792. Writing Programs That Use Expanded Memory ............................. 10**7
  793. Page Frames ........................................................... 10**8
  794. Calling the Manager ................................................... 10**9
  795. Detecting EMS ......................................................... 10**10
  796. Terminate and Stay Resident (TSR) Program Cooperation ................. 10**11
  797. Expanded Memory Services Quick List ................................... 10**12
  798. Expanded Memory Services .............................................. 10**13
  799.         LIM 3.2 Specification ......................................... 10**14
  800.         LIM 4.0 Specification ......................................... 10**15
  801.         AQA EEMS 3.2 Specification .................................... 10**16
  802.         VCPI API 1.0 .................................................. 10**17
  803. Expanded Memory Manager Error Codes ................................... 10**18
  804. Microsoft Extended Memory Specification 2.0 ........................... 10**19
  805.  
  806.  
  807. CHAPTER 11      Conversion Between Operating Systems
  808.  
  809. Overview .............................................................. 11**1
  810. Special Considerations ................................................ 11**2
  811. Example Operating Systems ............................................. 11**3
  812. Atari ST .............................................................. 11**4
  813. CP/M .................................................................. 11**5
  814. MacOS ................................................................. 11**6
  815. AmigaDOS .............................................................. 11**7
  816. OS/2 .................................................................. 11**8
  817. UNIX .................................................................. 11**9
  818.  
  819.  
  820. CHAPTER 12      Microsoft Windows API
  821.  
  822. Overview .............................................................. 12**1
  823. Programming Windows ................................................... 12**2
  824. Versions .............................................................. 12**3
  825. Functions ............................................................. 12**4
  826. Error Codes ........................................................... 12**5
  827.  
  828.  
  829. CHAPTER 13      Network APIs
  830.  
  831. FTP Driver - PC/TCP Packet Driver Specification ....................... 13**1
  832. 10-Net Network ........................................................ 13**2
  833. LANtastic LANOS API ................................................... 13**3
  834. Novell NetWare 2.11 API ............................................... 13**4
  835. APPC/PC ............................................................... 13**5
  836.  
  837.  
  838. CHAPTER 14      Mouse Programming
  839.  
  840. General Information ................................................... 14**1
  841. Register Usage ........................................................ 14**2
  842. Interrupt 33h Function Requests ....................................... 14**3
  843. Interrupt 10h Function Requests ....................................... 14**4
  844.  
  845.  
  846. CHAPTER 15      Register-Level Programming
  847.  
  848. 8555 Peripheral Interface ............................................. 15**1
  849. 8259 Interrupt Controller ............................................. 15**2
  850. AT CMOS RAM Configuration ............................................. 15**3
  851.  
  852.  
  853. CHAPTER 16      Video Programming
  854.  
  855. Quick List of BIOS Interrupt 10h Functions ............................ 16**1
  856. BIOS Interrupt 10h Functions in Detail ................................ 16**2
  857.  
  858.  
  859. CHAPTER 17      Multitasking Shells
  860.  
  861. Introduction .......................................................... 17**1
  862. Programming Practices ................................................. 17**2
  863. TopView/DESQview API (interrupt 15h, "System Services" interface) ..... 17**3
  864. TopView/DESQview API (interrupt 16h, "BIOS Video" interface) .......... 17**4
  865.  
  866.  
  867. CHAPTER 18      Viruses and Trojan Horses
  868.  
  869.  
  870. CHAPTER 19      Tips and Tricks
  871.  
  872.  
  873. MISCSTUF        Miscellaneous Stuff
  874.  
  875. AFTERWRD        Afterword
  876.  
  877. CREDITS         Credits and Bibliography
  878.  
  879.  
  880.  
  881.  A P P E N D I C E S
  882.  
  883. APPENDIX  1     Keyboard scan code chart
  884.  
  885. APPENDIX  2     ASCII character chart
  886.  
  887. APPENDIX  3     IBM PC character set
  888.  
  889. APPENDIX  4     IBM PC error code listing
  890.  
  891. APPENDIX  5     Addresses of various manufacturers
  892.  
  893. APPENDIX  6     Hard disk information
  894.  
  895. APPENDIX  7     Floppy and Tape Devices
  896.  
  897. APPENDIX  8     Pinouts of various connectors on the IBM PC
  898.  
  899. APPENDIX  9     Sizes of various drivers installed in CONFIG.SYS
  900.  
  901. APPENDIX  10    Common modem instruction sets
  902.  
  903. APPENDIX  11    Glossary of computer terminology
  904.  
  905. APPENDIX  12    Various busses used in MSDOS machines
  906.  
  907. APPENDIX  13    Common filename extensions
  908.  
  909. APPENDIX  14    Clock speeds of various expansion cards
  910.  
  911. APPENDIX  15    Header formats used by various archive utilities
  912.  
  913. APPENDIX  16    Miscellaneous Hardware Information
  914.  
  915. APPENDIX  17    HP LaserJet Setup Codes
  916.  
  917. APPENDIX  18    ANSI.SYS Escape Sequences
  918.  
  919. APPENDIX  19    DEC VT100 Escape Sequences
  920.  
  921. APPENDIX  20    Various Paint Program Formats
  922.  
  923. APPENDIX  21    Some Commonly Used Hot-Keys
  924.  
  925. APPENDIX  22    Sound Blaster API
  926.  
  927. APPENDIX  23    French-Canadian accented character chart
  928.  
  929. APPENDIX  24    Compuserve Graphic Image Format '89a
  930.  
  931. APPENDIX  25    Hex Chart
  932.  
  933. APPENDIX  26    Microsoft TSR Specification 1.0
  934.  
  935.        **  Programmer's Technical Reference for MSDOS and the IBM PC **
  936.                 USA copyright TXG 392-616  ALL RIGHTS RESERVED
  937. ───────────────────────────────┤ DOSREF (tm) ├────────────────────────────────
  938.                      ISBN 1-878830-02-3 (disk-based text)
  939.                     Copyright (c) 1987, 1991 Dave Williams
  940.                         ┌─────────────────────────────┐
  941.                         │ Shareware Version, 12/20/91 │
  942.                         │  Please Register Your Copy  │
  943.                         └─────────────────────────────┘
  944.  
  945.  
  946.                             C H A P T E R    O N E
  947.  
  948.                               DOS AND THE IBM PC
  949.  
  950.  
  951.                                 C O N T E N T S
  952.  
  953. Some History .......................................................... 1**1
  954. What is DOS? .......................................................... 1**2
  955. Other Operating Systems ............................................... 1**3
  956. Specific Versions of MS/PC-DOS ........................................ 1**4
  957. The Operating System Heirarchy ........................................ 1**5
  958. DOS Structure ......................................................... 1**6
  959. DOS Initialization .................................................... 1**7
  960.  
  961.  
  962.  
  963. SOME HISTORY├────────────────────────────────────────────────────────── 1**1
  964.  
  965.  Development of MSDOS/PCDOS began in October 1980, when IBM began searching
  966. the market for an operating system for the yet-to-be-introduced IBM PC.
  967. Microsoft had no 8086 real operating system to sell, but quickly made a deal
  968. to license Seattle Computer Products' 86-DOS operating system, which had been
  969. written by Tim Paterson earlier in 1980 for use on that company's line of 8086,
  970. S100 bus micros. 86-DOS (also called QDOS, for Quick and Dirty Operating System)
  971. had been written as more or less a 16-bit version of CP/M, since Digital
  972. Research was showing no hurry in introducing CP/M-86.
  973.  
  974.  This code was quickly polished up and presented to IBM for evaluation. IBM
  975. had originally intended to use Digital Research's CP/M operating system, which
  976. was the industry standard at the time.
  977.  
  978.  Folklore reports various stories about the rift between DRI and IBM. The most
  979. popular story claims Gary Kildall or DRI snubbed the IBM executives by flying
  980. his airplane when the meeting was scheduled. Another story claims Kildall
  981. didn't want to release the source for CP/M to IBM, which would be odd, since
  982. they released it to other companies. One noted industry pundit claims
  983. Kildall's wife killed the deal by insisting on various contract changes. I
  984. suspect the deal was killed by the good ol'boy network. It's hard to imagine
  985. a couple of junior IBM executives giving up when ordered to a task as simple
  986. as licensing an operating system from a vendor. Wouldn't look good on their
  987. performance reports. It would be interesting to hear IBM's story...
  988.  
  989.  IBM found itself left with Microsoft's offering of "Microsoft Disk
  990. Operating System 1.0". An agreement was reached between the two, and IBM agreed
  991. to accept 86-DOS as the main operating system for thir new PC. Microsoft
  992. purchased all rights to 86-DOS in July 1981, and "IBM Personal Computer DOS
  993. 1.0" was ready for the introduction of the IBM PC in October 1981. IBM
  994. subjected the operating system to an extensive quality-assurance program,
  995. reportedly found well over 300 bugs, and decided to rewrite the programs. This
  996. is why PC-DOS is copyrighted by both IBM and Microsoft.
  997.  
  998.  Some early OEM versions of DOS had different names, such as Compaq-DOS, Z-DOS,
  999. Software Bus 86, etc.  By version 2 Microsoft managed to persuade everyone but
  1000. IBM to refer to the product as "MS-DOS."
  1001.  
  1002.  It is sometimes amusing to reflect on the fact that the IBM PC was not
  1003. originally intended to run MSDOS. The target operating system at the end of the
  1004. development was for a (not yet in existence) 8086 version of CP/M. On the other
  1005. hand, when DOS was originally written the IBM PC did not yet exist! Although
  1006. PC-DOS was bundled with the computer, Digital Research's CP/M-86 would probably
  1007. have been the main operating system for the PC except for two things - Digital
  1008. Research wanted $495 for CP/M-86 (considering PC-DOS was essentially free) and
  1009. many software developers found it easier to port existing CP/M software to DOS
  1010. than to the new version of CP/M.
  1011.  
  1012.  The upgrade from DOS 3.3 to 4.0 was done in-house by IBM.  DOS 4.0 was a
  1013. completely IBM product, later licensed back to Microsoft. In early 1990 IBM
  1014. announced that it was ceasing development of DOS and all further work would
  1015. be done solely by Microsoft.
  1016.  
  1017.  
  1018.  Microsoft Press' "MSDOS Encyclopedia" shows a reproduction of a late
  1019. DOS 1.25 OEM brochure.  Microsoft was touting future enhancements to
  1020. 1.25 including Xenix-compatible pipes, process forks, and multitasking,
  1021. as well as "graphics and cursor positioning, kanji support, multi-user
  1022. and hard disk support, and networking."  Microsoft certainly thought
  1023. big, but, alas, the forks, multitasking, and multiuser support never
  1024. came about, at least in US versions of DOS.  Oddly, the flyer claims
  1025. that
  1026.  
  1027.  "MS-DOS has no practical limit on disk size. MS-DOS uses 4-byte XENIX
  1028. OS compatible pointers for file and disk capacity up to 4 gigabytes."
  1029.  
  1030.  Umm... yeah.  One sort of gets the idea nobody at Microsoft had a hard
  1031. disk larger than 32 megabytes...
  1032.  
  1033.  For the record they actually delivered:
  1034.  
  1035. Xenix-compatible pipes             DOS 2.0  ("|" operator)
  1036. process forks, and multitasking   eDOS 4.0  (not delivered in the US)
  1037. multi-user                         never delivered
  1038. graphics and cursor positioning    DOS 2.0  (ANSI.SYS, more than likely)
  1039. kanji support                      DOS 2.01, 2.25 (double-byte char set)
  1040. hard disk support                  DOS 2.0  (subdirectories)
  1041. networking                         DOS 3.1  (file locking, MS Networks)
  1042.  
  1043.  Early Microsoft ads pumped DOS' Xenix-like features and promised Xenix
  1044. functionality in future releases.
  1045.  
  1046.  We'll probably never know what the real story was behind eDOS/DOS 4/
  1047. DOS 5/286DOS/OS2.  Microsoft had announced their intent to build a
  1048. multitasking, multiuser version of MSDOS as early as 1982.  They shipped
  1049. betas of "DOS 4.0" in '86 and early '87, before 3.3 was even announced.
  1050. Microsoft UK announced they had licensed 4.0 to Apricot Computer, and
  1051. the French Postal Service was supposed to be running it.  I've never
  1052. been able to find out if Apricot ever shipped any 4.0 to end users.
  1053.  
  1054.  Despite Gordon Letwin's acid comments about problems with the 80286
  1055. processor, I doubt the '286 was the barrier between users and a
  1056. multitasking MSDOS.  I also doubt there was any shortage of programming
  1057. talent at Microsoft - Digital Research's Concurrent DOS and Software
  1058. Link's PC-MOS were developed without undue trouble.
  1059.  
  1060.  
  1061.  MSDOS and PC-DOS have been run on more than just the IBM-PC and clones. Some
  1062. of the following have been done:
  1063.  
  1064.  Hardware PC Emulation:
  1065.  
  1066.         Apple II                ->      TransPC 8088 board
  1067.         Apple MacIntosh         ->      AST 80286 board
  1068.         Atari 400/800           ->      Co-Power 88 board
  1069.         Atari ST                ->      PC-Ditto II cartridge
  1070.         Commodore Amiga 2000    ->      8088 or A2286D 80286 Bridge Board
  1071.         IBM PC/RT               ->      80286 AT adapter
  1072.         Kaypro 2                ->      Co-Power Plus board
  1073.  
  1074.  Software PC Emulation:
  1075.  
  1076.         Apple MacIntosh         ->      SoftPC
  1077.         Atari ST                ->      PC-Ditto I
  1078.         IBM RS/6000             ->      DOS emulation
  1079.  
  1080.  DOS Emulation:
  1081.  
  1082.         AIX (IBM RS/6000)       ->      DOS emulation with "PCSIMulator"
  1083.         OS/2                    ->      DOS emulation in "Compatibility Box"
  1084.         QNX                     ->      DOS window
  1085.         SunOS                   ->      DOS window
  1086.         Xenix                   ->      DOS emulation with DOSMerge
  1087.  
  1088.  
  1089. WHAT IS DOS?├────────────────────────────────────────────────────────── 1**2
  1090.  
  1091.  DOS exists as a high-level interface between an application program and the
  1092. computer. DOS stands for "Disk Operating System", which reflects the fact that
  1093. its main original purpose was to provide an interface between the computer and
  1094. its disk drives.
  1095.  
  1096.  DOS now lets your programs do simple memory management, I/O from the system
  1097. console, and assorted system tasks (time and date, etc) as well as managing
  1098. disk operations. Versions 3.1 and up also incorporate basic networking
  1099. functions.
  1100.  
  1101.  With the introduction of installable device drivers and TSR (terminate but
  1102. stay resident) programs in DOS 2.0, the basic DOS functions may be expanded to
  1103. cover virtually any scale of operations required.
  1104.  
  1105.  
  1106. OTHER OPERATING SYSTEMS├─────────────────────────────────────────────── 1**3
  1107.  
  1108.  There are a number of compatible replacements for Microsoft's MSDOS. Some are:
  1109.  
  1110. Alloy 386 Multiware                  (multitasking control prog, licensed DOS)
  1111. Consortium Technologies MultiDOS     (multitasking, multiuser)
  1112. Digital Research Concurrent DOS      (multitasking)
  1113. Digital Research Concurrent DOS 386  (for 80386 computers)
  1114. Digital Research Concurrent DOS XM   (multitasking, multiuser)
  1115. Digital Research DR-DOS 3.31 and 5.0 (PC-DOS clones)
  1116. Digital Research Multiuser DOS       (multitasking, multiuser)
  1117. PC-MOS/386                           (multitasking, multiuser)
  1118. Wendin-DOS                           (multitasking, multiuser)
  1119. VM/386                               (multitasking)
  1120.  
  1121.  Various other operating systems are available for the IBM PC. These include:
  1122.  
  1123. Digital Research CP/M-86
  1124. Digital Research Concurrent CP/M-86 (multitasking)
  1125. Minix (multitasking UNIX workalike)
  1126. Pick  (database-operating system)
  1127. QNX   (multitasking, multiuser)
  1128. UNIX  (various systems from IBM itself, Microsoft-SCO, Bell, and various UNIX
  1129.        clones, single and multi user) (AIX, Xenix, AT&T System V, etc.)
  1130.  
  1131.  "Shell" programs exist which use DOS only for disk management while they more
  1132. or less comprise a new operating system. These include:
  1133.  
  1134.      DesQview                        Windows                     OmniView
  1135.      GEM                             TopView                     TaskView
  1136.      GeoWorks
  1137.  
  1138.  Systems using the NEC V-series CPUs can execute Intel 8080/8085 8-bit
  1139. instructions as well as the 16-bit 8088-up instructions.  They can run standard
  1140. Digital Research 8-bit CP/M and MP/M directly, as well as other operating
  1141. systems developed for that processor.
  1142.  
  1143.  
  1144.  
  1145. SPECIFIC VERSIONS OF MS/PC-DOS├──────────────────────────────────────── 1**4
  1146.  
  1147.  DOS 1.x is essentially 86-DOS.  DOS 2.x kept the multiple file layout (the two
  1148. hidden files and COMMAND.COM) but for all practical purposes is an entirely
  1149. different operating system with backwards compatibility with 1.x.  I seriously
  1150. doubt there has been much code from 1.x retained in 2.x. DOS 3.x is merely an
  1151. enhancement of 2.x; there seems little justification for jumping a whole
  1152. version number.  The disk handling routines were considerably extended in 3.1,
  1153. allowing disk access in a "virtual" fashion, independent of whether the drive
  1154. was a local or network device.  DOS 4.0, originating as it did from outside
  1155. Microsoft, can justify a version jump.  Unfortunately, 4.0 seemed to have very
  1156. little reason to justify its existence - virtually all of its core features
  1157. could be found in one version or another of DOS 3.x.  According to Microsoft's
  1158. Gordon Letwin, DOS 5.0 was a complete rewrite with the kernel done in hand
  1159. optimized assembly language.
  1160.  
  1161.  DOS version nomenclature: major.minor.minor.  The digit to the left of the
  1162. decimal point indicates a major DOS version change.  1.0 was the first version.
  1163. 2.0 added support for subdirectories, 3.0 added support for networking, 4.0
  1164. added some minimal support for Lotus-Intel-Microsoft EMS.
  1165.  
  1166.  The first minor version indicates customization for a major application.  For
  1167. example, 2.1 for the PCjr, 3.3 for the PS/2s.  The second minor version does not
  1168. seem to have any particular meaning.
  1169.  
  1170.  The main versions of DOS are:
  1171.  
  1172.  86-DOS       February 1981  Paterson's Quick'n'Dirty DOS first runs on PC
  1173.  PC-DOS 1.0   August   1981  original IBM release
  1174.  PC-DOS 1.05  -------- ----  fixes to BASIC interpreter
  1175.  PC-DOS 1.1   June     1982  bugfix, double sided drive support
  1176.  MS-DOS 1.25  July     1982  for early compatibles. This is the first non-IBM
  1177.                              OEM version
  1178.  PC-DOS 2.0   March    1983  for PC/XT, Unix-type subdirectory support,
  1179.                              installable device drivers, I/O redirection,
  1180.                              subdirectories, hard disk support, handle calls
  1181.  PC-DOS 1.85  April    1983  internal IBM - extended 1.1 - not released
  1182.  MS-DOS 2.01  -------- 1983  first support for individual country formats, Kanji
  1183.  PC-DOS 2.1   October  1983  for IBM PCjr, bugfixes for 2.0. No country support
  1184.  MS-DOS 2.11  October  1983  basically a cross of PC-DOS 2.1 and MS-DOS 2.01
  1185.  MS-DOS 2.12  -------- ----  special version for TI Professional
  1186.  PC-DOS 3.0   August   1984  1.2 meg drive for PC/AT, some new system calls,
  1187.                              new external programs, 16-bit FAT, specific support
  1188.                              for IBM network
  1189.  MS-DOS 3.05  -------- 1984  first OEM version of 3.x
  1190.  PC-DOS 3.1   November 1984  bugfix for 3.0, implemented generic network support
  1191.  MS-DOS 2.25  October  1985  extended foreign language support
  1192.  PC-DOS 3.2   January  1986  720k 3.5 inch drive support, special support for
  1193.                              laptops (IBM PC Convertible), XCOPY
  1194.  MS-DOS 4.0   April    1986  multitasking (Europe only) - withdrawn from market
  1195.  PC-DOS 3.3   April    1987  for PS/2 series, 1.44 meg support, multiple DOS
  1196.                              partition support, code page switching, improved
  1197.                              foreign language support, some new function calls,
  1198.                              support for the AT's CMOS clock.
  1199.  MS-DOS 3.31  November 1987  over-32 meg DOS partitions. Different versions
  1200.                              from different OEMs (not Microsoft).  Compaq and
  1201.                              Wyse are most common.
  1202.  PC-DOS 3.4   -------- ----  internal IBM - not released (4.0 development)
  1203.  MS-DOS 2.11R -------- 1988  bootable ROM DOS for Tandy machines
  1204.  PC-DOS 4.0   August   1988  32mb limit officially broken, minor EMS support,
  1205.                              more new function calls, enhanced network support
  1206.                              for external commands
  1207.  MS-DOS 4.01  January? 1989  Microsoft version with some bugfixes
  1208.  MS-DOS 3.21R September1989  DOS in ROM, Flash File System for laptops
  1209.  MS-DOS 3.3R  -------- 1990  DOS in ROM, introduced for TI laptops
  1210.  MS-DOS 5.0   June     1991  new high memory support, uses up to 8 hard disks,
  1211.                              command line editor and aliasing, 2.88 floppies
  1212.  
  1213.  IBM's PC-DOS was long considered to be the "standard" version of DOS.  Now
  1214. that MS 5.0 is a commercial product most developers will probably write to it.
  1215.  
  1216.  Microsoft's policy has been to sell DOS only to OEMs.  Despite this, they
  1217. sold small quantities of DOS 3.2, 3.3, and 4.0 without insurmountable
  1218. difficulties.  DOS 5.0 was conceived from the beginning as an over-the-counter
  1219. retail product.
  1220.  
  1221.  Incidentally, IBM refers to its DOS as "The IBM Personal Computer DOS." The
  1222. term "PCDOS" is a trademark of IBM's rival DEC.
  1223.  
  1224.  Some versions of MS-DOS varied from PC-DOS in the available external commands.
  1225. Some OEMs only licensed the basic operating system code (the xxxDOS and xxxBIO
  1226. programs, and COMMAND.COM) from Microsoft, and either wrote the rest themselves
  1227. or contracted them from outside software houses like Phoenix.  Most of the
  1228. external programs for DOS 3.x and 4.x are written in "C" while the 1.x and 2.x
  1229. utilities were written in assembly language.  Other OEMs required customized
  1230. versions of DOS for their specific hardware configurations, such as Sanyo 55x
  1231. and early Tandy computers, which were unable to exchange their DOS with the IBM
  1232. version.
  1233.  
  1234.  PC-DOS 3.0 was extremely buggy on release.  It did not handle the DOS
  1235. environment correctly and there were numerous documented problems with the
  1236. batch file parser.  The network support code was also nonfunctional in that DOS
  1237. version.  It is recommended that users upgrade to at least version 3.1.
  1238.  
  1239.  DEC MSDOS versions 2.11 for the Rainbow had the ANSI.SYS device driver built
  1240. into the main code.  The Rainbow also used a unique quad density, single-sided
  1241. floppy drive and its DOS had special support for it.
  1242.  
  1243.  IBM had a version 1.85 of PC-DOS in April 1983, after the introduction of DOS
  1244. 2.0.  It was evidently for internal use only, supported multiple drive file
  1245. searches (a primitive form of PATH), builtin MODE sommands for screen support,
  1246. a /P parameter for TYPE for paused screens, an editable command stack like the
  1247. public domain DOSEDIT.COM utility, and could be set up to remain completely
  1248. resident in RAM instead of a resident/transient part like normal DOS.  It is a
  1249. pity some of the neat enhancements didn't make it into DOS 2.0.  IBM also had
  1250. an "internal use only" version 3.4, evidently used while developing DOS 4.0.
  1251.  
  1252.  Digital Research's DR-DOS is the first widely available DOS clone.  Version
  1253. 3.4, released in June 1988, was the one first available to the American public.
  1254. It was somewhat buggy and its use is not recommended.  DR 3.41 is extremely
  1255. compatible and its use should pose no problems on any machine.  DR-DOS 5.0
  1256. (released May, 1990) is functionally equivalent to MS-DOS 5.0.  For all
  1257. practical purposes, MS 5.0 is a clone of DR 5.0, since DR beat MS to market by
  1258. over a year.  According to Greg Ewald, DRI's DR-DOS product manager, DR-DOS was
  1259. developed from Concurrent DOS 386 with the multiuser and multitasking code
  1260. stripped out.
  1261.  
  1262.  Some versions of DOS used in compatibles do not maintain the 1.x, 2.x, ...
  1263. numbering system.  Columbia Data Products computers labeled DOS 1.25 as DOS
  1264. 2.0.  Early Compaqs labeled DOS 2.0 as DOS 1.x.  Other versions incorporated
  1265. special features - Compaq DOS 3.31 and Wyse DOS 3.21 both support >32mb disk
  1266. partitions in the same fashion as DOS 4.x.
  1267.  
  1268.  AT&T DOS 3.1 differs from generic MSDOS 3.10 in its use of cluster-size and
  1269. file allocation table structures.  AT&T DOS appears to use rules not from
  1270. version 3, but rather those from version 2.
  1271.  
  1272.  Epson Equity III and ComputerLand 3.10 DOS's appear to use cluster techniques
  1273. that are a cross between versions 2 and 3.  On type DOS partitions, these DOS's
  1274. use 3.x rules if the partition is larger than 32,680 sectors in total size.
  1275. This implies 16 bit FAT entries as well.  On partitions below this size, they
  1276. will use 2.x rules, including the 12 bit FAT entries.
  1277.  
  1278.  Zenith DOS 3.x and Wyse DOS 3.2 have a builtin internal device driver to
  1279. handle up to 4 32Mb DOS partitions on a single hard disk. Wyse DOS 3.31 will
  1280. handle single partitions up to 512Mb with a 32-bit FAT.
  1281.  
  1282.  According to PC Week Magazine, July 4, 1988, Arabic versions of MSDOS are
  1283. shipping with a hardware copy-protection system from Rainbow Technologies.
  1284. This is similar to the short-lived system used by AutoCAD 2.52 and a very few
  1285. other MSDOS programs, where an adapter block is plugged into the parallel port
  1286. and software makes use of coded bytes within the block.  This type of copy
  1287. protection has been common on Commodore products for several years, where it is
  1288. called a "dongle."
  1289.  The AutoCAD dongle was defeated by a small program written within weeks of
  1290. version 2.52's debut.  Version 2.62 was released 3 months later, without the
  1291. dongle.  The DOS dongle will, however, prevent the system from booting at all
  1292. unless it is found.
  1293.  This makes the Arabic version of MSDOS the first copy-protected operating
  1294. system, a dubious distinction at best.  The modifications to the operating
  1295. system to support the dongle are not known at this time.  Frankly, it would
  1296. seem that burning the operating system into ROMs would be cheaper and simpler.
  1297.  
  1298.  Versions of DOS sold in Great Britain are either newer than those sold in the
  1299. US or use a different numbering system.  DOS 3.4, 4.0, 4.1, 4.2, and 4.3 had
  1300. been released there between the US releases of 3.3 and 4.0.
  1301.  MSDOS 4.0 (eDOS) was introduced in mid-1987 in Europe (at SICOB in Paris and
  1302. sometime earlier by Apricot Computer in the UK).  It offered multitasking
  1303. provided applications were specially written for it.
  1304.  David Fraser (Microsoft UK Managing Director) is on record saying that "DOS
  1305. 4.0 is unlikely to set the world alight and is of interest only to specific
  1306. OEMs who want its features for networking and communications."   Standard DOS
  1307. applications will run under DOS 4.x as a foreground task according to uncertain
  1308. information.  It differs from earlier versions only in allowing background tasks
  1309. to run.  For further information, see Chapter 4.
  1310.  
  1311.  Microsoft changed their OEM licensing agreements between DOS versions 2.x and
  1312. 3.x.  OEM versions of DOS 3.x must maintain certain data areas and undocumented
  1313. functions in order to provide compatibility with the networking features of the
  1314. operating system.  For this reason, TSR programs will be much more reliable
  1315. when operating under DOS 3.x.
  1316.  
  1317.  Several versions of DOS have been modified to be run out of ROM.  The Sharp
  1318. PC5000 had MSDOS 1.25 in ROM, and the Toshiba 1000 and some Tandy 1000 models
  1319. have MSDOS 2.11 in ROM.  In mid September 1989 Microsoft introduced 3.21R ROMs
  1320. for laptops, and in early '90 Texas Instruments laptops were the first to get
  1321. the 3.3R ROMs.  Digital Research has also announced its DR-DOS 3.41 and 5.0 is
  1322. available in a ROM version and Award Software is marketing DOS cards to OEMs
  1323. as a plug-in to ISA-bus machines.
  1324.  
  1325.  IBM's release of DOS 4.0 (and the immediate subsequent release of a bugfix)
  1326. was a dubious step "forward."  DOS 4.0 was the first version of DOS to come with
  1327. a warranty; the catch is that IBM warranted it only for a very slim list of
  1328. IBM-packaged software.  4.0 had some minor EMS support, support for large hard
  1329. disks, and not much else.  With its voracious RAM requirements and lack of
  1330. compatibility with previous versions of DOS (many major software packages
  1331. crashed under DOS 4.0), plus the increase in price to a cool $150, there was
  1332. no great rush to go to that version of DOS.
  1333.  
  1334.  Microsoft undertook development of MSDOS 5.0 in early 1990, soliciting
  1335. input from Usenet, BIX, and Compuserve among others.  5.0 is a functional
  1336. clone of Digital Research's DR-DOS 5.0.  5.0's compatibility was assured
  1337. by what has been claimed as the largest beta-test program in history -
  1338. in his address to the Boston Computer Society, Bill Gates announced over
  1339. 7,500 testers were involved.
  1340.  
  1341.  
  1342.  
  1343.  
  1344. THE OPERATING SYSTEM HIERARCHY├──────────────────────────────────────── 1**5
  1345.  
  1346.  
  1347.  The Disk Operating System (DOS) and the ROM BIOS serve as an insulating layer
  1348. between the application program and the machine, and as a source of services
  1349. to the application program.
  1350.  
  1351.   As the term 'system' might imply, DOS is not one program but a collection
  1352. of programs designed to work together to allow the user access to programs
  1353. and data.  Thus, DOS consists of several layers of "control"programs and a set
  1354. of "utility" programs.
  1355.  
  1356.  The system hierarchy may be thought of as a tree, with the lowest level being
  1357. the actual hardware.  The 8088 or V20 processor sees the computer's address
  1358. space as a ladder one byte wide and one million bytes long.  Parts of this
  1359. ladder are in ROM, parts in RAM, and parts are not assigned.  There are also
  1360. 65,536 "ports" that the processor can use to control devices.
  1361.  
  1362.  The hardware is normally addressed by the ROM BIOS, which will always know
  1363. where everything is in its particular system.  The chips may usually also be
  1364. written to directly, by telling the processor to write to a specific address or
  1365. port.  This sometimes does not work as the chips may not always be at the same
  1366. addresses or have the same functions from machine to machine.
  1367.  
  1368.  
  1369.  
  1370. DOS STRUCTURE├───────────────────────────────────────────────────────── 1**6
  1371.  
  1372. DOS consists of four components:
  1373.  
  1374.  * The boot record
  1375.  * The ROM BIOS interface  (IBMBIO.COM, DRBIOS.SYS, or IO.SYS)
  1376.  * The DOS program file    (IBMDOS.COM, DRBDOS.SYS, or MSDOS.SYS)
  1377.  * The command processor   (COMMAND.COM or aftermarket replacement)
  1378.  
  1379.  
  1380. * The Boot Record
  1381.  
  1382.  The boot record begins on track 0, sector 1, side 0 of every diskette prepared
  1383. by the DOS FORMAT command.  The boot record is placed on diskettes to produce an
  1384. error message if you try to start up the system with a nonsystem diskette in
  1385. drive A.  For hard disks, the boot record resides on the first sector of the DOS
  1386. partition.  All media supported by DOS use one sector for the boot record.
  1387.  
  1388.  
  1389. * Read Only Memory (ROM) BIOS Interface and Extensions
  1390.  
  1391.  The file IBMBIO.COM or IO.SYS is the interface module to the ROM BIOS.
  1392. This file provides a low-level interface to the ROM BIOS device routines and
  1393. may contain extensions or changes to the system board ROMs.  Some compatibles do
  1394. not have a ROM BIOS to extend, and load the entire BIOS from disk.  (Sanyo 55x,
  1395. Viasyn machines).  Some versions of MSDOS, such as those from Compaq's MS-DOS
  1396. and Digital Research's DRDOS 5.0, are named IBMBIO.COM but are not IBM files.
  1397.  
  1398.  These low-level interface routines include the instructions for performing
  1399. operations such as displaying information on the screen, reading the keyboard,
  1400. sending data out to the printer, operating the disk drives, and so on.  It is
  1401. the operating system's means of controlling the hardware.  IBMBIO.COM contains
  1402. any modifications or updates to the ROM BIOS that are needed to correct any
  1403. bugs or add support for other types of hardware such as new disk drives.  By
  1404. using IBMBIO.COM to update the ROM BIOS on the fly when the user turns on their
  1405. computer, IBM does not need to replace the ROM BIOS chip itself, but makes any
  1406. corrections through the cheaper and easier method of modifying the IBMBIO.COM
  1407. file instead.
  1408.  
  1409.  IBMBIO.COM also keeps track of hardware operations on an internal stack or
  1410. "scratch pad" area for the operating system to save information such as
  1411. addresses it will need, etc.  An example of the use for this stack can be seen
  1412. when running a program such as a word processor.  If you have told the word
  1413. processor to save your letter, it will write the data to your disk.  During this
  1414. time, if you start typing some more information, the keyboard generates a
  1415. hardware interrupt.  Since you don't want the process of writing the information
  1416. to the disk to be interrupted, DOS allocates a slot in the stack for the
  1417. keyboard's hardware interrupt and when it gets a chance, (probably after the
  1418. data has been written to the disk), it can process that interrupt and pick up
  1419. the characters you may have been typing.  The STACKS= command in DOS 3.2+'s
  1420. CONFIG.SYS file controls the number of stack frames available for this
  1421. purpose.
  1422.  
  1423.  IBMBIO.COM also reads your CONFIG.SYS file and installs any device drivers
  1424. (i.e. DEVICE=ANSI.SYS) or configuration commands it may find there.
  1425.  
  1426.  
  1427.  
  1428. * The DOS Program
  1429.  
  1430.  The actual DOS program is the file IBMDOS.COM or MSDOS.SYS.  It provides a high-
  1431. level interface for user (application) programs.  This program consists of file
  1432. management routines, data blocking/deblocking for the disk routines, and a
  1433. variety of built-in functions easily accessible by user programs.
  1434.  
  1435.  When a user program calls these function routines, they accept high-level
  1436. information by way of register and control block contents.  When a user program
  1437. calls DOS to perform an operation, these functions translate the requirement
  1438. into one or more calls to IBMBIO.COM, MSDOS.SYS or system hardware to complete
  1439. the request.
  1440.  
  1441.  This section is often referred to as the "kernel" by systems programmers.
  1442.  
  1443.  
  1444.  
  1445. * The Command Interpreter
  1446.  
  1447.  The command interpreter, COMMAND.COM, is the part you interact with on the
  1448. command line.  COMMAND.COM has three parts.  IBM calls them the "resident
  1449. portion", the "initialization portion" and the "transient portion".
  1450.  
  1451.  IBM's original documentation spoke of installing alternate command
  1452. interpreters (programs other than COMMAND.COM) with the SHELL= statement in
  1453. CONFIG.SYS.  Unfortunately, IBM chose not to document much of the interaction
  1454. between IBMDOS.COM and IBMBIO.COM.  By the time much of the interaction was
  1455. widely understood, many commercial software programs had been written to use
  1456. peculiarities of COMMAND.COM itself.
  1457.  
  1458.  Several programs exist that perform as actual "shells" by completely replacing
  1459. COMMAND.COM and substituting their own command interpreter to use with the
  1460. hidden DOS files.  Examples are Command Plus, a commercial package, and the
  1461. shareware 4DOS and FlexShell packages.  Both supply greatly enhanced batch
  1462. language and editing capabilities.
  1463.  
  1464. NOTE: DOS 3.3+ checks for the presence of a hard disk, and will default to
  1465.       COMSPEC=C:\.  Previous versions default to COMSPEC=A:\.  Under some DOS
  1466.       versions, if COMMAND.COM is not immediately available for reloading
  1467.       (i.e., swapping to a floppy with COMMAND.COM on it) DOS may crash.
  1468.  
  1469.  
  1470. Resident Portion:
  1471.  
  1472.  The resident portion resides in memory immediately following IBMDOS.COM and its
  1473. data area.  This portion contains routines to process interrupts 22h (Terminate
  1474. Address), 23h (Ctrl-Break Handler), and 24h (Critical Error Handler), as well as
  1475. a routine to reload the transient portion if needed.  For DOS 3.x, this portion
  1476. also contains a routine to load and execute external commands, such as files
  1477. with exensions of COM or EXE.
  1478.  
  1479.  When a program terminates, a checksum is used to determine if the application
  1480. program overlaid the transient portion of COMMAND.COM.  If so, the resident
  1481. portion will reload the transient portion from the area designated by COMSPEC=
  1482. in the DOS environment.  If COMMAND.COM cannot be found, the system will halt.
  1483.  
  1484.  All standard DOS error handling is done within the resident portion of
  1485. COMMAND.COM.  This includes displaying error messages and interpreting the
  1486. replies to the "Abort, Retry, Ignore, Fail?" message.
  1487.  
  1488.  Since the transient portion of COMMAND.COM is so large (containing the
  1489. internal commands and all those error messages), and it is not needed when the
  1490. user is running an application it can be overlaid that program if that
  1491. application needs the room.  When the application is through, the resident
  1492. portion of COMMAND.COM brings the transient portion back into memory to show
  1493. the prompt.  This is why you will sometimes see the message "Insert disk with
  1494. COMMAND.COM".  It needs to get the transient portion off the disk since it was
  1495. overlaid with the application program.
  1496.  
  1497.  The initialization portion of COMMAND.COM follows the resident portion and is
  1498. given control during the bootup procedure.  This section actually processes the
  1499. AUTOEXEC.BAT file.  It also decides where to load the user's programs when they
  1500. are executed.  Since this code is only needed during startup, it is overlaid by
  1501. the first program which COMMAND.COM loads.
  1502.  
  1503.  The transient portion is loaded at the high end of memory and it is the
  1504. command processor itself.  It interprets whatever the user types in at the
  1505. keyboard, hence messages such as "Bad command or file name" for when the user
  1506. misspells a command.  This portion contains all the internal commands (i.e.
  1507. COPY, DIR, RENAME, ERASE), the batch file processor (to run .BAT files) and
  1508. a routine to load and execute external commands which are either .COM or
  1509. .EXE files.
  1510.  
  1511.  The transient portion of COMMAND.COM produces the system prompt, (C>), and
  1512. reads what the user types in from the keyboard and tries to do something with
  1513. it.  For any .COM or .EXE files, it builds a command line and issues an EXEC
  1514. function call to load the program and transfer control to it.
  1515.  
  1516.  
  1517.  
  1518. DOS INITIALIZATION├──────────────────────────────────────────────────── 1**7
  1519.  
  1520.  The system is initialized by a software reset (Ctrl-Alt-Del), a hardware reset
  1521. (reset button), or by turning the computer on.  The Intel 80x8x series processors
  1522. always look for their first instruction at the end of their address space
  1523. (0FFFF0h) when powered up or reset.  This address contains a jump to the first
  1524. instruction for the ROM BIOS.
  1525.  
  1526.  Built-in ROM programs (Power-On Self-Test, or POST, in the IBM) check machine
  1527. status and run inspection programs of various sorts.  Some machines set up a
  1528. reserved RAM area with bytes indicating installed equipment (AT and PCjr).
  1529.  
  1530.  When the ROM BIOS finds a ROM on an adapter card, it lets that ROM take
  1531. control of the system so that it may perform any set up necessary to use the
  1532. hardware or software controlled by that ROM.  The ROM BIOS searches absolute
  1533. addresses C8000h through E0000h in 2K increments in search of a valid ROM.
  1534. A valid ROM is determined by the first few bytes in the ROM.  The ROM will have
  1535. the bytes 55h, AAh, a length indicator and then the assembly language
  1536. instruction to CALL FAR (to bring in a "FAR" routine).  A checksum is done on
  1537. the ROM to verify its integrity, then the BIOS performs the CALL FAR to bring
  1538. in the executible code.  The adapter's ROM then performs its initialization
  1539. tasks and hopefully returns control of the computer back to the ROM BIOS so it
  1540. can continue with the booting process.
  1541.  
  1542.  The ROM BIOS routines then look for a disk drive at A: or an option ROM
  1543. (usually a hard disk) at absolute address C:800h.  If no floppy drive or option
  1544. ROM is found, the BIOS calls int 19h (ROM BASIC if it is an IBM) or displays
  1545. an error message.
  1546.  
  1547.  If a bootable disk is found, the ROM BIOS loads the first sector of information
  1548. from the disk and then jumps into the RAM location holding that code.  This code
  1549. normally is a routine to load the rest of the code off the disk, or to "boot"
  1550. the system.
  1551.  
  1552.  The following actions occur after a system initialization:
  1553.  
  1554.  1.  The boot record is read into memory and given control.
  1555.  
  1556.  2.  The boot record then checks the root directory to assure that the first
  1557.      two files are IBMBIO.COM and IBMDOS.COM or their OEM equivalents.  These
  1558.      must be the first two files, and they must be in that order (IBMBIO.COM
  1559.      first, with its sectors in contiguous order).
  1560.      NOTE: IBMDOS.COM need not be contiguous in version 3.x+.
  1561.  
  1562.  3.  The boot record loads IBMBIO.COM into memory.
  1563.  
  1564.  4.  The initialization code in IBMBIO.COM loads IBMDOS.COM, determines
  1565.      equipment status, resets the disk system, initializes the attached
  1566.      devices, sets the system parameters and loads any installable device
  1567.      drivers according to the CONFIG.SYS file in the root directory (if
  1568.      present), sets the low-numbered interrupt vectors, relocates IBMDOS.COM
  1569.      downward, and calls the first byte of DOS.
  1570.      NOTE: CONFIG.SYS may be a hidden file.
  1571.  
  1572.  5.  DOS initializes its internal working tables, initializes the interrupt
  1573.      vectors for interrupts 20h through 27h, and builds a Program Segment
  1574.      Prefix for COMMAND.COM at the lowest available segment.  For DOS versions
  1575.      3.10 up, DOS also initializes the vectors for interrupts 0Fh through 3Fh.
  1576.      An initialization routine is included in the resident portion and assumes
  1577.      control during startup.  This routine contains the AUTOEXEC.BAT file
  1578.      handler and determines the segment address where user application programs
  1579.      may be loaded.  The initialization routine is then no longer needed and is
  1580.      overlaid by the first program COMMAND.COM loads.
  1581.      NOTE: AUTOEXEC.BAT may be a hidden file.
  1582.  
  1583.  6.  IBMDOS.COM uses the EXEC function call to load and start the top-level
  1584.      command processor.  The default command processor is COMMAND.COM in the
  1585.      root directory of the boot drive.  If COMMAND.COM is in a subdirectory
  1586.      or another command processor is to be used, it must be specified by a
  1587.      SHELL= statement in the CONFIG.SYS file.
  1588.      A transient portion is loaded at the high end of memory.  This is the
  1589.      command processor itself, containing all of the internal command
  1590.      processors and the batch file processor.  For DOS 2.x, this portion also
  1591.      contains a routine to load and execute external commands, such as files
  1592.      with extensions of COM or EXE.
  1593.       This portion of COMMAND.COM also produces the DOS prompt (such as "A>"),
  1594.      reads the command from the standard input device (usually the keyboard or
  1595.      a batch file), and executes the command.  For external commands, it builds
  1596.      a command line and issues an EXEC function call to load and transfer
  1597.      control to the program.
  1598.  
  1599. note 1) COMMAND.COM may be a hidden file.
  1600.      2) For IBM DOS 2.x, the transient portion of the command processor
  1601.         contains the EXEC routine that loads and executes external commands.
  1602.         For MSDOS 2.x+ and IBM DOS 3.x+, the resident portion of the command
  1603.         processor contains the EXEC routine.
  1604.      3) IBMDOS only checks for a file named "COMMAND.COM".  It will load
  1605.         any file of that name if no SHELL= command is used.
  1606.  
  1607.  
  1608.  That pretty much covers the bootup process.  After the command processor is
  1609. loaded, it runs the AUTOEXEC.BAT file and then the user gets their prompt to
  1610. begin working.
  1611.  
  1612.  
  1613.  
  1614.        **  Programmer's Technical Reference for MSDOS and the IBM PC **
  1615.                 USA copyright TXG 392-616  ALL RIGHTS RESERVED
  1616. ───────────────────────────────┤ DOSREF (tm) ├────────────────────────────────
  1617.                      ISBN 1-878830-02-3 (disk-based text)
  1618.                     Copyright (c) 1987, 1991 Dave Williams
  1619.                         ┌─────────────────────────────┐
  1620.                         │ Shareware Version, 12/20/91 │
  1621.                         │  Please Register Your Copy  │
  1622.                         └─────────────────────────────┘
  1623.  
  1624.  
  1625.                              C H A P T E R   T W O
  1626.  
  1627.  
  1628.  CPU Port Assignments, System Memory Map, BIOS Data Area, Interrupts 00h to 09h
  1629.  
  1630.  
  1631.  
  1632.                                 C O N T E N T S
  1633.  
  1634. Introduction .......................................................... 2**1
  1635. System Memory Map ..................................................... 2**2
  1636. A Brief Guide to Current Memory Terminology ........................... 2**3
  1637. PC Port Assignment .................................................... 2**4
  1638. Reserved Memory Locations ............................................. 2**5
  1639. Absolute Addresses .................................................... 2**6
  1640. The IBM PC System Interrupts (Overview) ............................... 2**7
  1641. Quick Chart of Interrupts 00h-0FFh .................................... 2**8
  1642. The IBM-PC System Interrupts 00h-0Fh (in detail) ...................... 2**9
  1643.  
  1644.  
  1645.  
  1646. Introduction .......................................................... 2**1
  1647.  
  1648.  For consistency in this reference, all locations and offsets are in
  1649. hexadecimal unless otherwise specified. All hex numbers are prefaced with a
  1650. leading zero if they begin with an alphabetic character, and are terminated
  1651. with a lowercase H (h). The formats vary according to common usage.
  1652.  
  1653.  
  1654.  
  1655. System Memory Map ..................................................... 2**2
  1656.  
  1657.  The IBM PC handles its address space in 64k segments, divided into 16k
  1658. fractions and then further as necessary.
  1659.  
  1660. ┌──────┬─────┬─────┬──────────────────────────────────────────────────────────┐
  1661. │start │start│end  │                                                          │
  1662. │addr. │addr.│addr.│                          usage                           │
  1663. │(dec) │   (hex)   │                                                          │
  1664. ├──────┴───────────┴──────────────────────────────────────────────────────────┤
  1665. │   *640k RAM Area*                                                           │
  1666. ├──────┬───────────┬──────────────────────────────────────────────────────────┤
  1667. │ 0k   │           │  start of RAM, first K is interrupt vector table         │
  1668. │ 16k  │00000-03FFF│  PC-0 system board RAM ends                              │
  1669. │ 32k  │04000-07FFF│                                                          │
  1670. │ 48k  │08000-0BFFF│                                                          │
  1671. ├──────┼───────────┼──────────────────────────────────────────────────────────┤
  1672. │ 64k  │10000-13FFF│  PC-1 system board RAM ends                              │
  1673. │ 80k  │14000-17FFF│                                                          │
  1674. │ 96k  │18000-1BFFF│                                                          │
  1675. │ 112k │1C000-1FFFF│                                                          │
  1676. ├──────┼───────────┼──────────────────────────────────────────────────────────┤
  1677. │ 128k │20000-23FFF│                                                          │
  1678. │ 144k │24000-27FFF│                                                          │
  1679. │ 160k │28000-2BFFF│                                                          │
  1680. │ 176k │2C000-2FFFF│                                                          │
  1681. ├──────┼───────────┼──────────────────────────────────────────────────────────┤
  1682. │ 192k │30000-33FFF│                                                          │
  1683. │ 208k │34000-37FFF│                                                          │
  1684. │ 224k │38000-3BFFF│                                                          │
  1685. │ 240k │3C000-3FFFF│                                                          │
  1686. ├──────┼───────────┼──────────────────────────────────────────────────────────┤
  1687. │ 256k │40000-43FFF│  PC-2 system board RAM ends                              │
  1688. │ 272k │44000-47FFF│                                                          │
  1689. │ 288k │48000-4BFFF│                                                          │
  1690. │ 304k │4C000-4FFFF│                                                          │
  1691. ├──────┼───────────┼──────────────────────────────────────────────────────────┤
  1692. │ 320k │50000-53FFF│                                                          │
  1693. │ 336k │54000-57FFF│                                                          │
  1694. │ 352k │58000-5BFFF│                                                          │
  1695. │ 368k │5C000-5FFFF│                                                          │
  1696. ├──────┼───────────┼──────────────────────────────────────────────────────────┤
  1697. │ 384k │60000-63FFF│                                                          │
  1698. │ 400k │64000-67FFF│                                                          │
  1699. │ 416k │68000-6BFFF│                                                          │
  1700. │ 432k │6C000-6FFFF│                                                          │
  1701. ├──────┼───────────┼──────────────────────────────────────────────────────────┤
  1702. │ 448k │70000-73FFF│                                                          │
  1703. │ 464k │74000-77FFF│                                                          │
  1704. │ 480k │78000-7BFFF│                                                          │
  1705. │ 496k │7C000-7FFFF│                                                          │
  1706. ├──────┼───────────┼──────────────────────────────────────────────────────────┤
  1707. │ 512k │80000-83FFF│                                                          │
  1708. │ 528k │84000-87FFF│                                                          │
  1709. │ 544k │88000-8BFFF│  the original IBM PC-1 BIOS limited memory to 544k       │
  1710. │ 560k │8C000-8FFFF│                                                          │
  1711. ├──────┼───────────┼──────────────────────────────────────────────────────────┤
  1712. │ 576k │90000-93FFF│                                                          │
  1713. │ 592k │94000-97FFF│                                                          │
  1714. │ 609k │98000-9BFFF│                                                          │
  1715. │ 624k │9C000-9FFFF│  to 640k (top of RAM address space)                      │
  1716. ├──────┴───────────┴──────────────────────────────────────────────────────────┤
  1717. │A0000 ***** 64k ***** EGA/VGA starting address                               │
  1718. │A0000 ***** 64k ***** Toshiba 1000 DOS ROM (MS-DOS 2.11V)                    │
  1719. ├──────┬───────────┬──────────────────────────────────────────────────────────┤
  1720. │ 640k │A0000-A95B0│  MCGA 320x200 256 color video buffer                     │
  1721. │      │     -AF8C0│  MCGA 640x480 2 color video buffer                       │
  1722. │      │     -A3FFF│                                                          │
  1723. │ 656k │A4000-A7FFF│                                                          │
  1724. │ 672k │A8000-ABFFF│      this 64k segment may be used for contiguous DOS     │
  1725. │ 688k │AC000-AFFFF│      RAM with appropriate hardware and software          │
  1726. ├──────┴───────────┴──────────────────────────────────────────────────────────┤
  1727. │B0000 ***** 64k ***** mono and CGA address                                   │
  1728. ├──────┬───────────┬──────────────────────────────────────────────────────────┤
  1729. │ 704k │B0000-B3FFF│  4k  monochrome display   | The PCjr and early Tandy 1000│
  1730. │ 720k │B4000-B7FFF│                           | BIOS revector direct write to│
  1731. │ 736k │B8000-BBFFF│  16k CGA uses             | the B8 area to the Video Gate│
  1732. │ 756k │BC000-BFFFF│                           | Array and reserved system RAM│
  1733. ├──────┴───────────┴──────────────────────────────────────────────────────────┤
  1734. │C0000 ***** 64k *************** expansion ROM                                │
  1735. ├──────┬───────────┬──────────────────────────────────────────────────────────┤
  1736. │ 768k │C0000-C3FFF│  16k EGA BIOS C000:001E EGA BIOS signature (letters IBM  │
  1737. │ 784k │C4000-C5FFF│                                                          │
  1738. │      │C6000-C63FF│  256 bytes Professional Graphics Display comm. area      │
  1739. │      │C6400-C7FFF│                                                          │
  1740. │ 800k │C8000-CBFFF│  16k hard disk controller BIOS, drive 0 default          │
  1741. │      │CA000      │      some 2nd floppy (high density) controller BIOS      │
  1742. │ 816k │CC000-CDFFF│   8k IBM PC Network NETBIOS                              │
  1743. │      │CE000-CFFFF│                                                          │
  1744. ├──────┴───────────┴──────────────────────────────────────────────────────────┤
  1745. │D0000 ***** 64k ***** expansion ROM                                          │
  1746. ├──────┬───────────┬──────────────────────────────────────────────────────────┤
  1747. │ 832k │D0000-D7FFF│  32k IBM Cluster Adapter  | PCjr first ROM cartridge     │
  1748. │      │      DA000│  voice communications     | address area.                │
  1749. │ 848k │D4000-D7FFF│                           | Common expanded memory board │
  1750. │ 864k │D8000-DBFFF│                           | paging area.                 │
  1751. │ 880k │DC000-DFFFF│                           |                              │
  1752. │      │DE000      │  TI Pro default video buffer, 4k in length               │
  1753. ├──────┴───────────┴──────────────────────────────────────────────────────────┤
  1754. │E0000 ***** 64k ***** expansion ROM                                          │
  1755. ├──────┬───────────┬──────────────────────────────────────────────────────────┤
  1756. │ 896k │E0000-E3FFF│                           | PCjr second ROM cartridge    │
  1757. │ 912k │E4000-E7FFF│                           | address area                 │
  1758. │ 928k │E8000-EBFFF│                           |                              │
  1759. │ 944k │EC000-EFFFF│                           |    spare ROM sockets on AT   │
  1760. ├──────┴───────────┴──────────────────────────────────────────────────────────┤
  1761. │F0000 ***** 64k ***** system                                                 │
  1762. ├──────┬───────────┬──────────────────────────────────────────────────────────┤
  1763. │ 960k │F0000-F3FFF│  reserved by IBM          |    cartridge address         │
  1764. │ 976k │F4000-     │                           |    area (PCjr cartridge      │
  1765. │      │F6000      │  ROM BASIC Begins         |    BASIC)                    │
  1766. │ 992k │F8000-FB000│                           |                              │
  1767. │ 1008k│FC000-FFFFF│  ROM BASIC and original   |                              │
  1768. │      │           │  BIOS (Compatibility BIOS |                              │
  1769. │      │           │  in PS/2)                 |                              │
  1770. │ 1024k│      FFFFF│  end of memory (1024k) for 8088 machines                 │
  1771. ├──────┼───────────┴─┬────────────────────────────────────────────────────────┤
  1772. │ 384k │100000-15FFFF│ 80286/AT extended memory area, 1Mb motherboard         │
  1773. │ 15Mb │100000-FFFFFF│ 80286/AT extended memory address space                 │
  1774. │ 15Mb │160000-FDFFFF│ Micro Channel RAM expansion (15Mb extended memory)     │
  1775. │ 128k │FE0000-FFFFFF│ system board ROM            (PS/2 Advanced BIOS)       │
  1776. ├──────┼─────────────┴───┬────────────────────────────────────────────────────┤
  1777. │  64k │C0000000-C000FFFF│ Weitek "Abacus" math coprocessor memory-mapped I/O │
  1778. └──────┴─────────────────┴────────────────────────────────────────────────────┘
  1779.  
  1780.  Note that the ROM BIOS has a duplicated address space which causes it to
  1781. "appear" both at the end of the 1 megabyte real mode space and at the end of
  1782. the 16 megabyte protected mode space. The addresses from 0E0000 to 0FFFFF are
  1783. equal to 0FE0000 to 0FFFFFF. This is necessary due to differences in the memory
  1784. addressing between Real and Protected Modes.
  1785.  
  1786.  
  1787.  
  1788. A Brief Guide to Current Memory Terminology ........................... 2**3
  1789.  
  1790. LOW MEMORY - 0000h to around 0:5(something), comprising the 80x8x interrupt
  1791.              vector table, the BIOS Data Area, DOS Data Area, etc.
  1792.  
  1793. CONVENTIONAL MEMORY - from the end of low memory to the beginning of the
  1794.              "reserved by IBM" A000 segment (640k).
  1795.  
  1796. HIGH MEMORY - originally noncontiguous RAM stuffed into the "reserved for
  1797.              ROM expansion" areas, typically segments D000 and E000. DOS
  1798.              normally can't access this memory without a driver of some
  1799.              sort, but it's easy to put RAMdisks and stuff in there.
  1800.  
  1801. CONVENTIONAL MEMORY - extra RAM stuck at A000, assuming the machine already
  1802.              has 640k, appears as conventional memory accessible to DOS
  1803.              and applications. IBM clones can typically add 64k before
  1804.              bumping into a mono card or 96k before hitting a color card.
  1805.              This address is part of the EGA/VGA video RAM area and most
  1806.              EGA cards don't like system memory at A000.
  1807.  
  1808. EXPANDED MEMORY - LIM 3.2, LIM 4.0, or EEMS 3.2 bank switched memory. A
  1809.              RAM "window" allows an app to save a block of RAM to an expansion
  1810.              board. The window size and location varies according to the
  1811.              EMS standard being used.
  1812.  
  1813. EXTENDED MEMORY - this is the "native mode" address space of the 80286 and
  1814.              later chips. The "real mode", or 8088 addressing scheme,
  1815.              sees RAM as a collection of segments and offsets with a limit
  1816.              on segment size. "Protected mode" addressing uses a flat linear
  1817.              addressing scheme. 8088 and 80188 chips do not have extended
  1818.              memory.
  1819.  
  1820. HIGH MEMORY - by fiddling a bit with the segment/offset stuff, you can
  1821.              get an extra block of addressable 8088-mode memory just over
  1822.              the 1 meg address space. Microsoft issued their "HMA" (High
  1823.              Memory Area) standard to try to standardize use of this block.
  1824.              Though it really is "high" memory, "high" had for many years
  1825.              referred to memory between 640k and 1mb. This creates more
  1826.              confusion for new programmers.
  1827.  
  1828. EMS - this is expanded memory as described above
  1829.  
  1830. XMS - Microsoft is pushing an "Extended Memory Standard" which defines
  1831.       a page-switching scheme much like EMS. The only real difference is
  1832.       that XMS uses protected-mode RAM instead of a special paged RAM board.
  1833.  
  1834. XMS - some severely brain-damaged jerk at IBM issued documentation for some
  1835.       IBM *EMS* boards referring to the boards as *XMS*. This was a classic
  1836.       blunder, and now some IBM-followers are picking up the aberrant
  1837.       terminology. This is guaranteed to confuse some people. To make it
  1838.       simple, if it needs an expansion board, it is EMS no matter what the
  1839.       vendor calls it.
  1840.  
  1841.  
  1842. PC Port Assignment .................................................... 2**4
  1843.  
  1844.  
  1845.  These are functions common across the IBM range. The PCjr, PC-AT, PC
  1846. Convertible and PS/2 (both buses) have enhancements. In some cases, the
  1847. AT and PS/2 series ignore, duplicate, or reassign ports arbitrarily. If
  1848. your code incorporates specific port addresses for video or system board
  1849. control it would be wise to have your application determine the machine
  1850. type and video adapter and address the ports as required.
  1851.  
  1852.  hex address                   Function                   Models
  1853.                                                 PCjr|PC|XT|AT|CVT|M30|PS2
  1854.  
  1855.  0000-000F      8237 DMA controller                  PC
  1856.  0010-001F      8237 DMA controller                        AT         PS2
  1857.  0020-0027      8259A interrupt controller
  1858.  0020-002F      IOSGA interrupt function                              PS2
  1859.  0020-003F      8259A interrupt controller  (AT)
  1860.  0020-0021      interrupt controller 1, 8259A        PC    AT         PS2
  1861.  0040-0043      programmable timer 8253              PC
  1862.  0040-0047      programmable timers                                   PS2
  1863.  0040-005F      8253-5 programmable timers                 AT
  1864.                 note 1) 0041 was memory refresh in PCs. Not used in PS/2.
  1865.                      2) A few early 80386 machines used static RAM and did
  1866.                         not use refresh at all. The PCjr refreshes by the
  1867.                         video vertical retrace signal.
  1868.  0060-0063      keyboard controller 8255A            PC
  1869.  0060-006F      8042 keyboard controller                   AT
  1870.  0060           IOSGA keyboard input port                             PS2
  1871.  0061           speaker                         PCjr PC XT AT CVT
  1872.  0061           IOSGA speaker control                             M30 PS2
  1873.  0061           On some clones, setting or clearing bit 2 controls Turbo mode
  1874.  0061           Toshiba 1000 - system command
  1875.  0062           IOSGA configuration control                       M30 PS2
  1876.  0062           Toshiba 1000 - System Status, port C
  1877.  0063           SSGA, undocumented                                    PS2
  1878.  0063           Toshiba 1000 - mode set
  1879.  0064           keyboard auxiliary device                             PS2
  1880.  0065-006A      SSGA, undocumented                                    PS2
  1881.  006B           SSGA, RAM enable/remap                                PS2
  1882.  006C-006F      SSGA, undocumented                                    PS2
  1883.  0070           AT CMOS write internal register
  1884.  0071           AT CMOS read internal register
  1885.  0070-0071      CMOS real-time clock, NMI mask                        PS2
  1886.  0070-007F      CMOS real-time clock, NMI mask             AT
  1887.  0074-0076      reserved                                              PS2
  1888.  0800-008F      SSGA DMA page registers                               PS2
  1889.  0080-009F      DMA page registers, 74LS612                AT
  1890.  0090           central arbitration control port (Micro Channel)
  1891.  0091           card selected feedback           (Micro Channel)
  1892.  0092           system control port A            (Micro Channel)
  1893.  0093           reserved                         (Micro Channel)
  1894.  0094           system board setup               (Micro Channel)
  1895.  0096           POS "CD SETUP" selector          (Micro Channel)
  1896.  00A0-00A1      Interrupt controller 2, 8259A              AT         PS2
  1897.  00A0-00AF      IOSGA NMI mask register                               PS2
  1898.  00B0-00BF      realtime clock/calendar, (undocumented)               PS2
  1899.  00C0-00DF      reserved                        PCjr PC XT AT CVT M30
  1900.  00C0-00CF      DOS ROM register, Toshiba 1000
  1901.  00D0-00EF      "special" register, Toshiba 1000
  1902.       00C0      0C1 key register, Toshiba 1000
  1903.       00C1      keyboard transfer register, Toshiba 1000
  1904.       00C2      keyboard receive register, Toshiba 1000
  1905.       00C3      keyboard status register, Toshiba 1000
  1906.       00C8      DOS ROM page register, Toshiba 1000
  1907.       00E0      CPU speed control, Toshiba 1000
  1908.       00E1      keyboard status/0E2 key register, Toshiba 1000
  1909.       00E2      work register, Toshiba 1000
  1910.       00E3      0E4 key register, Toshiba 1000
  1911.       00E4      system control register 0, Toshiba 1000
  1912.       00E4      Weitek ABACUS NDP - bit 0=1, ABACUS is present
  1913.       00E5      0E6 key register, Toshiba 1000
  1914.       00E6      system control register 1, Toshiba 1000
  1915.       00EE      EMS unit index, Toshiba 1000
  1916.       00EF      EMS unit data, Toshiba 1000
  1917.  00C0-00DF      DMA controller 2, 8237A-5                  AT         PS2
  1918.  00E0-00EF      realtime clock/calendar  (undocumented)           M30 PS2
  1919.  00F0-00FF      PS/2 math coprocessor I/O  (Model 50+)  (diskette IO on PCjr)
  1920.  0100-0101      PS/2 POS adapter ID response            (Micro Channel)
  1921.  0102-0107      PS/2 POS adapter configuration response (Micro Channel)
  1922.  01F0-01F8      hard disk                                  AT         PS2
  1923.  0200-0201      game-control adapter (joystick)
  1924.  0200-020F      game controller                      PC    AT
  1925.  0208-0209      Chips & Technology CS8221 chipset default EMS ports
  1926.                 alternate addresses: 218h, 258h, 268h, 2A8h, 2B8h, 2E8h
  1927.  0208-020F      Toshiba 1000 - EMS unit I/O #1
  1928.  020C-020D      reserved by IBM
  1929.  0210-0217      expansion box (PC, XT)
  1930.  0218-021F      Toshiba 1000 - EMS unit I/O #2
  1931.  021F           reserved by IBM
  1932.  0258-025F      Toshiba 1000 - EMS unit I/O #3
  1933.  0258-0259      LIM EMS 3.1 (not defined in 3.2+)
  1934.  0268-026F      Toshiba 1000 - EMS unit I/O #4
  1935.  0278-027F      parallel printer port 2                    AT
  1936.  0278-027B      parallel printer port 3                               PS2
  1937.  02A2           clock chip in early Sperry PCs
  1938.  02A8-02AF      Toshiba 1000 - EMS unit I/O #5
  1939.  02B8-02BF      Toshiba 1000 - EMS unit I/O #6
  1940.  02B0-02DF      EGA (alternate)                       PC   AT
  1941.  02C0-02DF      Toshiba 1000 - realtime clock
  1942.  02E1           GPIB (adapter 0)                           AT
  1943.  02E2-02E3      data acquisition (adapter 0)               AT
  1944.  02E8           "industry standard" COM4
  1945.  02E8-02EF      Toshiba 1000 - EMS unit I/O #7
  1946.  02F8-02FF      serial communications (COM2)          PC   AT         PS2
  1947.  0300-031F      prototype card                        PC   AT
  1948.  0300-031F      Leading Edge Model D clock            -------------------
  1949.  0320-032F      hard disk controller                  PC
  1950.  0320           Perstor HD controller, primary        -------------------
  1951.  0324           Perstor HD controller, secondary      -------------------
  1952.  0340           Sony CD-ROM                           -------------------
  1953.  0348-0357      DCA 3278
  1954.  0360-0367      PC Network (low address)
  1955.  0368-036F      PC Network (high address)                  AT
  1956.  0370           Colorado Memory external tape backup control port -------
  1957.                 some "second controller" floppy cards -------------------
  1958.  0378-037F      parallel printer port                 PC   AT
  1959.  0378-037B      parallel printer port                                 PS2
  1960.  0380-038F      Eicon Technology Network Adapter (X.25) board (default)
  1961.  0380-038F      SDLC, bi-synchronous 2                PC   AT
  1962.  0380-0389      BSC communications (alternate)        PC
  1963.  0390-039F      Eicon Technology Network Adapter (X.25) board (alternate)
  1964.  0390-0393      cluster (adapter 0)                   PC   AT
  1965.  03A0-03A9      BSC communications (primary)          PC   AT
  1966.  03B0-03BF      monochrome/parallel printer adapter   PC   AT
  1967.  03B4-03B5      video subsystem                                       PS2
  1968.  03BA           video subsystem                                       PS2
  1969.  03BC-03BF      parallel printer port 1                               PS2
  1970.  03C0-03CF      Enhanced Graphics Adapter
  1971.  03C0-03DA      video subsystem and DAC                               PS2
  1972.  03DA           video status register                 AT&T 6300, Olivetti PC
  1973.  03D0-03DF      CGA, MCGA, VGA adapter control
  1974.  03DE           video mode selector register          AT&T 6300, Olivetti PC
  1975.  03E8h          "industry standard" COM3
  1976.  03F0-03F7      floppy disk controller                PC   AT         PS2
  1977.  03F0           Colorado Memory internal tape backup control port -------
  1978.  03F2           DTK high-density XT floppy controller (output only)
  1979.  03F5           DTK high-density XT floppy controller
  1980.  03F8-03FF      serial communications (COM1)          PC   AT         PS2
  1981.  06E2-06E3      data acquisition (adapter 1)               AT
  1982.  0790-0793      cluster (adapter 1)                   PC   AT
  1983.  0878           Compaq 386SX VGA BIOS relocation           AT
  1984.  0AE2-0AE3      data acquisition (adapter 2)               AT
  1985.  0B90-0B93      cluster (adapter 2)                   PC   AT
  1986.  0EE2-0EE3      data acquisition (adapter 3)               AT
  1987.  1390-1393      cluster (adapter 3)                   PC   AT
  1988.  22E1           GPIB (adapter 1)
  1989.  2390-2393      cluster (adapter 4)                   PC   AT
  1990.  4258           LIM EMS 3.1 (not defined in 3.2+)     -------------------
  1991.  42E1           GPIB (adapter 2)                           AT
  1992.  62E1           GPIB (adapter 3)                           AT
  1993.  8258           LIM EMS 3.1 (not defined in 3.2+)     -------------------
  1994.  82E1           GPIB (adapter 4)                           AT
  1995.  A2E1           GPIB (adapter 5)                           AT
  1996.  C258           LIM EMS 3.1 (not defined in 3.2+)     -------------------
  1997.  C2E1           GPIB (adapter 6)                           AT
  1998.  E2E1           GPIB (adapter 7)                           AT
  1999.  
  2000. note 1) IOSGA = I/O Support Gate Array
  2001.         SSGA = System Support Gate Array
  2002.      2) I/O Addresses, hex 000 to 0FF, are reserved for the system board I/O.
  2003.         Hex 100 to 3FF are available on the I/O channel.
  2004.      3) These are the addresses decoded by the current set of adapter cards.
  2005.         IBM may use any of the unlisted addresses for future use.
  2006.      4) SDLC Communication and Secondary Binary Synchronous Communications
  2007.         cannot be used together because their port addresses overlap.
  2008.  
  2009.  
  2010.  
  2011. Reserved Memory Locations ............................................. 2**5
  2012.  
  2013. ┌──────────────────────────────────────────────────────────────────────────────
  2014. │ 000-3FF  - 1k DOS interrupt vector table, 4 byte vectors for ints 00h-0FFh.
  2015. │   30:00  - used as a stack area during POST and bootstrap routines. This
  2016. │to 3F:FF    stack area may be revectored by an application program.
  2017. ├──────────────────────────────────────────────────────────────────────────────
  2018. │ ** The BIOS Data Area ** addresses from 400h to 4FFh
  2019. ├─────┬───────┬────────────────────────────────────────────────────────────────
  2020. │addr.│ size  │                         description
  2021. ├─────┼───────┼────────────────────────────────────────────────────────────────
  2022. │40:00│  word │ COM1 port address |   These addresses are zeroed out in the
  2023. │40:02│  word │ COM2 port address |   OS/2 DOS Compatibility Box if any of
  2024. │40:04│  word │ COM3 port address |   the OS/2 COMxx.SYS drivers are loaded.
  2025. │40:06│  word │ COM4 port address |
  2026. │40:08│  word │ LPT1 port address
  2027. │40:0A│  word │ LPT2 port address
  2028. │40:0C│  word │ LPT3 port address
  2029. │40:0E│  word │ LPT4 port address        (not valid in PS/2 machines)
  2030. │40:0E│  word │ PS/2 pointer to 1k extended BIOS Data Area at top of RAM
  2031. │40:10│  word │ equipment flag (see int 11h)
  2032. └─────┴───────┤ bits:
  2033.               │ 0       0       no floppy drive present
  2034.               │         1       if floppy drive present (see bits 6&7)
  2035.               │ 1       0       no math coprocessor installed
  2036.               │         1       if 80x87 installed  (not valid in PCjr)
  2037.               │ 2,3     system board RAM   (not used on AT or PS/2)
  2038.               │         0,0     16k             0,1     32k
  2039.               │         1,0     48k             1,1     64k
  2040.               │ 4,5     initial video mode
  2041.               │         0,0     no video adapter
  2042.               │         0,1     40 column color  (PCjr default)
  2043.               │         1,0     80 column color
  2044.               │         1,1     MDA
  2045.               │ 6,7     number of diskette drives
  2046.               │         0,0     1 drive         0,1     2 drives
  2047.               │         1,0     3 drives        1,1     4 drives
  2048.               │ 8       0       DMA present
  2049.               │         1       DMA not present (PCjr, Tandy 1400, Sanyo 55x)
  2050.               │ 9,A,B   number of RS232 serial ports
  2051.               │ C       game adapter  (joystick)
  2052.               │         0       no game adapter
  2053.               │         1       if game adapter
  2054.               │ D       serial printer (PCjr only)
  2055.               │         0       no printer
  2056.               │         1       serial printer present
  2057.        ┌──────┘ E,F     number of parallel printers installed
  2058.        │note 1) The IBM PC and AT store the settings of the system board
  2059.        └───┐    switches or CMOS RAM setup information (as obtained by the BIOS
  2060.            │    in the Power-On Self Test (POST)) at addresses 40:10h and
  2061.            │    40:13h. 00000001b indicates "on", 00000000b is "off".
  2062. ┌─────┬────┴──┐
  2063. │40:12│  byte │ reserved (PC, AT)
  2064. └─────┴───────┤  number of errors detected by infrared keyboard link (PCjr)
  2065. ┌─────┬───────┤  POST status (Convertible)
  2066. │40:13│  word │ availible memory size in Kbytes (less display RAM in PCjr)
  2067. ├─────┼───────┤  this is the value returned by int 12h
  2068. │40:15│  word │ reserved
  2069. │40:17│  byte │ keyboard flag byte 0 (see int 9h)
  2070. └─────┴───────┤ bit 7  insert mode on      3  alt pressed
  2071.               │     6  capslock on         2  ctrl pressed
  2072.               │     5  numlock on          1  left shift pressed
  2073. ┌─────┬───────┤     4  scrollock on        0  right shift pressed
  2074. │40:18│  byte │ keyboard flag byte 1 (see int 9h)
  2075. └─────┴───────┤ bit 7  insert pressed      3  ctrl-numlock (pause) toggled
  2076.               │     6  capslock pressed    2  PCjr keyboard click active
  2077.               │     5  numlock pressed     1  PCjr ctrl-alt-capslock held
  2078. ┌─────┬───────┤     4  scrollock pressed   0
  2079. │40:19│  byte │ storage for alternate keypad entry (not normally used)
  2080. │40:1A│  word │ pointer to keyboard buffer head character
  2081. │40:1C│  word │ pointer to keyboard buffer tail character
  2082. │40:1E│32bytes│ 16 2-byte entries for keyboard circular buffer, read by int 16h
  2083. │40:3E│  byte │ drive seek status - if bit=0, next seek will recalibrate by
  2084. └─────┴───────┤ repositioning to Track 0.
  2085.               │ bit 3  drive D          bit 2  drive C
  2086. ┌─────┬───────┤     1  drive B              0  drive A
  2087. │40:3F│  byte │ diskette motor status (bit set to indicate condition)
  2088. └─────┴───────┤ bit 7  write in progress    3  motor on (floppy 3)
  2089.               │     6                       2  motor on (floppy 2)
  2090.               │     5                       1  B: motor on (floppy 1)
  2091. ┌─────┬───────┤     4                       0  A: motor on (floppy 0)
  2092. │40:40│  byte │ motor off counter
  2093. │     │       │ starts at 37 and is decremented 1 by each system clock tick.
  2094. │     │       │ motor is shut off when count = 0.
  2095. │40:41│  byte │ status of last diskette operation     where:
  2096. └─────┴───────┤ bit 7 timeout failure                3 DMA overrun
  2097.               │     6 seek failure                   2 sector not found
  2098.               │     5 controller failure             1 address not found
  2099. ┌─────┬───────┤     4 CRC failure                    0 bad command
  2100. │40:42│7 bytes│ NEC floppy controller chip status
  2101. │40:49│  byte │ Video Control Data Area 1 from 0040:0049 through 0040:0066
  2102. └─────┴───────┤ current CRT mode (hex value)
  2103.               │    00h 40x25 BW      (CGA)          01h 40x25 color   (CGA)
  2104.               │    02h 80x25 BW      (CGA)          03h 80x25 color   (CGA)
  2105.               │    04h 320x200 color (CGA)          05h 320x200 BW    (CGA)
  2106.               │    06h 640x200 BW    (CGA)          07h monochrome    (MDA)
  2107.               │extended video modes (EGA/MCGA/VGA or other)
  2108.               │    08h lores,16 color               09h med res,16 color
  2109.               │    0Ah hires,4 color                0Bh n/a
  2110.               │    0Ch med res,16 color             0Dh hires,16 color
  2111. ┌─────┬───────┤    0Eh hires,4 color                0Fh hires,64 color
  2112. │40:4A│  word │ number of columns on screen, coded as hex number of columns
  2113. └─────┴───────┤ 20 col = 14h  (video mode 8, low res 160x200 CGA graphics)
  2114.               │ 40 col = 28h
  2115. ┌─────┬───────┤ 80 col = 46h
  2116. │40:4C│  word │ screen buffer length in bytes
  2117. ├─────┼───────┤(number of bytes used per screen page, varies with video mode)
  2118. │40:4E│  word │ current screen buffer starting offset (active page)
  2119. │40:50│8 words│ cursor position pages 1-8
  2120. └─────┴───────┤ the first byte of each word gives the column (0-19, 39, or 79)
  2121. ┌─────┬───────┤ the second byte gives the row (0-24)
  2122. │40:60│  byte │ end line for cursor   (normally 1)
  2123. │40:61│  byte │ start line for cursor (normally 0)
  2124. │40:62│  byte │ current video page being displayed  (0-7)
  2125. │40:63│  word │ base port address of 6845 CRT controller or equivalent
  2126. ├─────┼───────┤ for active display           3B4h=mono, 3D4h=color
  2127. │40:65│  byte │ current setting of the CRT mode register
  2128. │40:66│  byte │ current palette mask setting  (CGA)
  2129. │40:67│5 bytes│ temporary storage for SS:SP during shutdown (cassette interface)
  2130. │40:6C│  word │ timer counter low word
  2131. │40:6E│  word │ timer counter high word
  2132. │40:69│  byte │ HD_INSTALL (Columbia PCs) (not valid on most clone computers)
  2133. └─────┴───────┤ bit  0    0  8 inch external floppy drives
  2134.               │           1  5-1/4 external floppy drives
  2135.               │      1,2     highest drive address which int 13 will accept
  2136.               │              (since the floppy drives are assigned 0-3,subtract
  2137.               │              3 to obtain the number of hard disks installed)
  2138.               │      4,5     # of hard disks connected to expansion controller
  2139.               │      6,7     # of hard disks on motherboard controller
  2140.               │              (if bit 6 or 7 = 1, no A: floppy is present and
  2141. ┌─────┬───────┤              the maximum number of floppies from int 11 is 3)
  2142. │40:70│  byte │ 24 hour timer overflow 1 if timer went past midnight
  2143. ├─────┼───────┤ it is reset to 0 each time it is read by int 1Ah
  2144. │40:71│  byte │ BIOS break flag (bit 7 = 1 means break key hit)
  2145. │40:72│  word │ reset flag
  2146. └─────┴───────┤ PCjr keeps 1234h here for softboot when a cartridge is installed
  2147.               │ bits 1234h = soft reset, memory check will be bypassed
  2148.               │      4321h = preserve memory         (PS/2 only)
  2149.               │      5678h = system suspended        (Convertible)
  2150.               │      9ABCh = manufacturing test mode (Convertible)
  2151. ┌─────┬───────┤      ABCDh = system POST loop mode   (Convertible)
  2152. │40:74│  byte │ status of last hard disk operation ; PCjr special disk control
  2153. │40:75│  byte │ # of hard disks attached (0-2)     ; PCjr special disk control
  2154. │40:76│  byte │ HD control byte; temp holding area for 6th param table entry
  2155. │40:77│  byte │ port offset to current hd adapter  ; PCjr special disk control
  2156. │40:78│4 bytes│ timeout value for LPT1,LPT2,LPT3,LPT4
  2157. │40:7C│4 bytes│ timeout value for COM1,COM2,COM3,COM4 (0-0FFh secs, default 1)
  2158. │40:80│  word │ pointer to start of circular keyboard buffer, default 03:1E
  2159. │40:82│  word │ pointer to end of circular keyboard buffer, default 03:3E
  2160. └─────┴───────┤ note: early Zenith Z183 BIOS set these pointers to zero and
  2161. ┌─────┬───────┤       ignored them.
  2162. │40:84│  .... │ Video Control Data Area 2, 0040:0084 through 0040:008A
  2163. │40:84│  byte │ rows on the screen minus 1 (EGA only)
  2164. │40:84│  byte │ PCjr interrupt flag; timer channel 0  (used by POST)
  2165. │40:85│  word │ bytes per character (EGA only)
  2166. │40:85│2 bytes│ (PCjr only) typamatic character to repeat
  2167. │40:86│2 bytes│ (PCjr only) typamatic initial delay
  2168. │40:87│  byte │ mode options (EGA only)
  2169. └─────┴───────┤ bit 0   0   cursor emulation in effect
  2170.               │         1   no cursor emulation
  2171.               │     1   0   EGA is connected to a color display
  2172.               │         1   EGA is connected to monochrome TTL display
  2173.               │     2   0   wait for vertical retrace (CGA active)
  2174.               │         1   don't wait for vertical retrace (EGA or MDA active)
  2175.               │     3   0   EGA is the active display,
  2176.               │         1   "other" display is active.
  2177.               │     4       reserved
  2178.               │     5,6     EGA memory size
  2179.               │             0,0   64k
  2180.               │             0,1   128k
  2181.               │             1,0   192k
  2182.               │             1,1   256k
  2183.               │     7   0   don't clear screen on mode changes
  2184.               │         1   if the last "set mode" specified not to clear the
  2185.               │             video buffer
  2186.               │ mode combinations:
  2187.               │ bit3  bit1     Meaning
  2188.               │   0     0   EGA is active display and is color
  2189.               │   0     1   EGA is active display and is monochrome
  2190.               │   1     0   EGA is not active, a mono card is active
  2191. ┌─────┬───────┤   1     1   EGA is not active, a CGA is active
  2192. │40:87│  byte │ (PCjr only) current Fn key code
  2193. ├─────┼───────┤             80h bit indicates make/break key code?
  2194. │40:88│  byte │ feature bits and switches (EGA only) 0=on, 1=off
  2195. └─────┴───────┤ bit 0   switch 1
  2196.               │     1   switch 2
  2197.               │     2   switch 3
  2198.               │     3   switch 4
  2199. ┌─────┬───────┤     4-7 feature bits
  2200. │40:88│  byte │ (PCjr only) special keyboard status byte
  2201. └─────┴───────┤ bit 7 function flag      3 typamatic (0=enable,1=disable)
  2202.               │     6 Fn-B break         2 typamatic speed (0=slow,1=fast)
  2203.               │     5 Fn pressed         1 extra delay bef.typamatic (0=enable)
  2204. ┌─────┬───────┤     4 Fn lock            0 write char, typamatic delay elapsed
  2205. │40:89│  byte │ (PCjr) current value of 6845 reg 2 (horizontal synch) used by
  2206. └─────┴───────┤ ctrl-alt-cursor screen positioning routine in ROM
  2207.               │  (VGA)
  2208.               │ bit 0       reserved
  2209.               │     1       video summing enabled
  2210.               │     2   0   for color monitor attached
  2211.               │         1   for mono monitor
  2212.               │     3   0   for default palette loading enabled
  2213.               │     4   0   for 8x8 text font
  2214.               │         1   for 8x16 text font
  2215. ┌─────┬───────┤     5-7     reserved
  2216. │40:8A│  byte │ (PCjr) CRT/CPU Page Register Image, default 3Fh
  2217. └─────┴───────┤ (VGA)  Display Combination Code Index. This is the value
  2218.               │  set/returned by function 1Ah of the Video BIOS. This byte
  2219.               │  contains an index into the ROM BIOS Display Combination Code
  2220.               │  table, which is a list of byte pairs that specify valid
  2221.               │  combinations of one or two video subsystems. Video subsystems
  2222.               │  are designated by the following values:
  2223.               │  00h     no display
  2224.               │  01h     MDA with monochrome display
  2225.               │  02h     CGA with color display
  2226.               │  03h     reserved
  2227.               │  04h     EGA with color display
  2228.               │  05h     EGA with monochrome display
  2229.               │  06h     Professional Graphics Adapter
  2230.               │  07h     VGA with analog monochrome display
  2231.               │  08h     VGA with analog color display
  2232.               │  09h     reserved
  2233.               │  0Ah     MCGA with digital color display
  2234.               │  0Bh     MCGA with analog monochrome display
  2235.               │  0Ch     MCGA with analog color display
  2236. ┌─────┬───────┤  0FFh    unrecognized video subsystem
  2237. │40:8B│  byte │ last diskette data rate selected
  2238. └─────┴───────┤ bit 7,6 starting data transfer rate to use
  2239.               │         0,0      500 kb/sec
  2240.               │         0,1      300 kb/sec
  2241.               │         1,0      250 kb/sec
  2242.               │         1,1      reserved
  2243.               │     5,4 last step rate selected
  2244.               │     3   ending data transfer rate to use
  2245.               │     2   reserved
  2246.               │     1   reserved
  2247.               │     0   1  combination floppy/fixed disk controller detected
  2248.               │         0  XT floppy only controller (for 360kb drive) detected
  2249.               │                Data Transfer Rates
  2250.               │       Kbits/sec     Media   Drive   Sectors/Track
  2251.               │         250         360k    360k        9
  2252.               │         300         360k    1.2M        9
  2253.               │         500         1.2M    1.2M       15
  2254.               │         250         720k    720k        9
  2255.               │         250         720k    1.4M        9
  2256. ┌─────┬───────┤         500         1.4M    1.4M       18
  2257. │40:8C│  byte │ hard disk status returned by controller
  2258. │40:8D│  byte │ hard disk error returned by controller
  2259. │40:8E│  byte │ hard disk interrupt (bit 7=working interrupt)
  2260. │40:8F│  byte │ combo_card - status of drives 0 and 1
  2261. └─────┴───────┤ bit 7   reserved
  2262.               │     6   drive type determined for drive 1
  2263.               │     5   drive multiple data rate capability for drive 1
  2264.               │         0       no multiple data rate
  2265.               │         1       multiple data rate
  2266.               │     4   1 then drive 1 has 80 tracks
  2267.               │         0 then drive 1 has 40 tracks
  2268.               │     3   reserved
  2269.               │     2   drive type determined for drive 0
  2270.               │     1   drive multiple data rate capability for drive 0
  2271.               │         0       no multiple data rate
  2272.               │         1       multiple data rate
  2273.               │     0   1       the drive 0 has 80 tracks
  2274. ┌─────┬───────┤         0       the drive 0 has 40 tracks
  2275. │40:90│4 bytes│ media state drive 0, 1, 2, 3
  2276. └─────┴───────┤ floppy_media_state
  2277.               │ bit 7,6 Data transfer rate
  2278.               │         00 - 500 K/sec
  2279.               │         01 - 300 K/sec
  2280.               │         10 - 250 K/sec
  2281.               │         11 - reserved
  2282.               │     5   double stepping required
  2283.               │     4   media/drive determined
  2284.               │     3   reserved
  2285.               │     2-0 present state
  2286.               │         000  360k in 360k unestablished
  2287.               │         001  360k in 1.2M unestablished
  2288.               │         010  1.2M in 1.2M unestablished
  2289.               │         011  360k in 360k established
  2290.               │         100  360k in 1.2M established
  2291.               │         101  1.2M in 1.2M established
  2292.               │         110  reserved
  2293. ┌─────┬───────┤         111  none of the above
  2294. │40:94│2 bytes│ track currently seeked to drive 0, 1
  2295. │40:96│  byte │ keyboard flag byte 3 (see int 9h)
  2296. │40:97│  byte │ keyboard flag byte 2 (see int 9h)
  2297. │40:98│ dword │ segment:offset pointer to users wait flag
  2298. │40:9C│ dword │ users timeout value in microseconds
  2299. │40:A0│  byte │ real time clock wait function in use
  2300. └─────┴───────┤ bits 7    wait time elapsed and posted flag
  2301.               │      6-1  reserved
  2302. ┌─────┬───────┤      0    int 15h, function 86h (WAIT) has occurred
  2303. │40:A1│  byte │ LAN A DMA channel flags
  2304. │40:A2│2 bytes│ status LAN A 0,1
  2305. │40:A4│ dword │ saved hard disk interrupt vector
  2306. │40:A8│ dword │ SAVE_PTR: EGA pointer to table of 7 parameters in segment:
  2307. └─────┴───────┤           offset format. Format of table:
  2308.               │ D_1 dword   pointer to 1472 byte table of 64 video parameters
  2309.               │ D_2 dword   reserved
  2310.               │ D_3 dword   reserved
  2311.               │ D_4 dword   reserved
  2312.               │ D_5 dword   reserved for future use
  2313.               │ D_6 dword   reserved for future use
  2314. ┌─────┬───────┤ D_7 dword   reserved for future use
  2315. │40:B0│2 words│ international support                   (Tandy 1000 TX)
  2316. │40:B4│  byte │ keyboard NMI control flags              (Convertible)
  2317. │40:B4│  byte │ monochrome monitor hookup detect        (Tandy 1000 TX)
  2318. │     │       │ 00h not present   0FFh  present
  2319. │40:B5│ dword │ keyboard break pending flags            (Convertible)
  2320. │40:B5│  byte │ extended equipment detect  (5 bits)     (Tandy 1000 TX)
  2321. └─────┴───────┤ bit 0 = 0   drive A is 5¼
  2322.               │         1   drive A is 3½
  2323.               │     1 = 0   drive A is 5¼
  2324.               │         1   drive A is 3½
  2325.               │     2 = 0   Tandy 1000 keyboard layout
  2326.               │         1   IBM keyboard layout
  2327.               │     3 = 0   CPU slow mode
  2328.               │         1   CPU fast mode
  2329.               │     4 = 0   internal color video support enabled
  2330.               │         1   internal color video support disabled, external
  2331.               │             video enabled (chg from mb'd to expansion card)
  2332.               │     5 = 0   no external monochrome video installed
  2333. ┌─────┬───────┤         1   external monochrome video installed
  2334. │40:B6│  byte │ extended equipment detect  (1 bit)      (Tandy 1000 TX)
  2335. └─────┴───────┤ bit 0 = 0   drive C is 5¼
  2336. ┌─────┬───────┤         1   drive C is 3½
  2337. │40:B9│  byte │ port 60 single byte queue               (Convertible)
  2338. │40:BA│  byte │ scan code of last key                   (Convertible)
  2339. │40:BB│  byte │ pointer to NMI buffer head              (Convertible)
  2340. │40:BC│  byte │ pointer to NMI buffer tail              (Convertible)
  2341. │40:BD│16bytes│ NMI scan code buffer                    (Convertible)
  2342. │40:CE│  word │ day counter                             (Convertible and after)
  2343. │  to │ -04:8F│               end of BIOS Data Area
  2344. ├─────┴───────┴────────────────────────────────────────────────────────────────
  2345. │ ** End of BIOS Data Area **
  2346. ├─────┬───────┬────────────────────────────────────────────────────────────────
  2347. │40:90│-40:EF │ reserved by IBM
  2348. │40:F0│16bytes│ Inter-Application Communications Area (for use by applications
  2349. │40:FF│       │ to transfer data or parameters to each other)
  2350. └─────┴───────┤ 1) Used by Turbo Power's FMARK (mark memory for TSRs).
  2351.               │ 2) Used by Norton Utilities' TimeMark to store the time.
  2352.               │ 3) Used by BRIEF editor.
  2353. ┌─────┬───────┤
  2354. │50:00│ byte  │ DOS print screen status flag
  2355. └─────┴───────┤        00h    not active or successful completion
  2356.               │        01h    print screen in progress
  2357. ┌─────┬───────┤        0FFh   error during print screen operation
  2358. │50:01│       │ Used by BASIC
  2359. │50:02-03     │ PCjr POST and diagnostics work area
  2360. │50:04│  byte │ Single drive mode status byte - not used by AT&T DOS 2.11!
  2361. └─────┴───────┤         00     logical drive A was last active
  2362. ┌─────────────┤         01     logical drive B was last active
  2363. │50:05-0E     │ PCjr POST and diagnostics work area
  2364. │50:0F│       │ BASIC: SHELL flag (set to 02h if there is a current SHELL)
  2365. │50:10│  word │ BASIC: segment address storage (set with DEF SEG)
  2366. │50:12│4 bytes│ BASIC: int 1Ch clock interrupt vector segment:offset storage
  2367. │50:16│4 bytes│ BASIC: int 23h ctrl-break interrupt segment:offset storage
  2368. │50:1A│4 bytes│ BASIC: int 24h disk error int vector segment:offset storage
  2369. │50:1B-1F     │ Used by BASIC for dynamic storage
  2370. │50:20-21     │ Used by DOS for dynamic storage
  2371. │50:22-2C     │ Used by DOS for diskette parameter table. See int 1Eh for values
  2372. └─────┴───────┤ In DOS 1.0 this is located in the ROM BIOS, but in DOS 1.1 and
  2373.               │ subsequent it is a part of DOS located at 05:22. The first byte
  2374.               │ (out of eleven) of the Disk Parameter contains the hexadecimal
  2375.               │ value CF in DOS 1.0 and DF in DOS 1.1 and later.
  2376.               │ DOS 1.0   24ms
  2377. ┌─────────────┤ DOS 1.1   26ms
  2378. │50:30-33     │ Used by MODE command
  2379. │50:81│       │ number of floppies installed in the system?
  2380. │50:82│       │ first hard disk drive?
  2381. │50:83│       │ last hard disk drive?
  2382. │50:34-FF     │ Unknown - Reserved for DOS
  2383. └─────────────┴─────────────────────────────────────────────────────────────────
  2384.  
  2385.  
  2386.  
  2387. Absolute Addresses .................................................... 2**6
  2388.  
  2389. 0008:0047 IO.SYS or IBMBIO.COM IRET instruction. This is the dummy routine that
  2390.           interrupts 01h, 03h, and 0Fh are initialized to during POST.
  2391. C000:001E EGA BIOS signature (the letters IBM)
  2392. F000:FA6E table of characters 00h-7Fh used by int 10h video BIOS
  2393.           The first 128 characters are stored here and each occupies 8 bytes.
  2394.           The high bit ones are somewhere on the video adapter card.
  2395. F000:FFF5 BIOS release date
  2396. F000:FFFE PC model identification
  2397.  
  2398.      ┌─────────────────────────────────────────────────────────────────────┐
  2399.      │ ROM BIOS    ┌ model byte                                            │
  2400.      │ copyright   │    ┌ submodel byte          machine                   │
  2401.      │   date      │    │    ┌ revision                                    │
  2402.      ├──────────┼────┼────┼────┼───────────────────────────────────────────┤
  2403.      │          │ 00 │ 00 │ 00 │ AT&T 6300, Olivetti PC                    │
  2404.      │ 09/02/86 │ FA │ 00 │ 00 │ PS/2 Model 30                             │
  2405.      │ 01/10/86 │ FB │ 00 │ 00 │ XT-2 (early)                              │
  2406.      │ 01/10/86 │ FB │ 00 │ 01 │ XT Model 089                              │
  2407.      │ 05/09/86 │ FB │ 01 │ 02 │ XT-2 (revised)                            │
  2408.      │ 01/10/84 │ FC │ -- │ -- │ AT Model 099 (original)                   │
  2409.      │ 06/10/85 │ FC │ 00 │ 01 │ AT Model 239 6mHz      (6.6 max governor) │
  2410.      │ 11/15/85 │ FC │ 01 │ 00 │ AT Model 339, 339 8mHz (8.6 max governor) │
  2411.      │          │ FC │ 01 │ 00 │ Compaq 386/16                             │
  2412.      │          │ FC │ 01 │ 03 │ some Phoenix 386 BIOS                     │
  2413.      │          │ FC │ 01 │ 81 │ some Phoenix 386 BIOS                     │
  2414.      │ 04/21/86 │ FC │ 02 │ 00 │ XT/286                                    │
  2415.      │ 02/13/87 │ FC │ 04 │ 00 │ PS/2 Model 50                             │
  2416.      │ 02/13/87 │ FC │ 05 │ 00 │ PS/2 Model 60                             │
  2417.      │          │ FC │ 00 │    │ 7531/2 Industrial AT                      │
  2418.      │          │ FC │ 06 │    │ 7552 "Gearbox"                            │
  2419.      │ 04/18/88 │ FC │ 04 │ 03 │ PS/2 50Z                                  │
  2420.      │ 01/24/90 │ FC │ 01 │ 00 │ Compaq Deskpro 80386/25e                  │
  2421.      │ 10/02/89 │ FC │ 02 │ 00 │ Compaq Deskpro 386s, 386SX, 16mHz         │
  2422.      │ 06/01/83 │ FD │ -- │ -- │ PCjr                                      │
  2423.      │ 11/08/82 │ FE │ -- │ -- │ XT, Portable PC, XT/370, 3270PC           │
  2424.      │ 04/24/81 │ FF │ -- │ -- │ PC-0             (16k motherboard)        │
  2425.      │ 10/19/81 │ FF │ -- │ -- │ PC-1             (64k motherboard)        │
  2426.      │ 08/16/82 │ FF │ -- │ -- │ PC, XT, XT/370   (256k motherboard)       │
  2427.      │ 10/27/82 │ FF │ -- │ -- │ PC, XT, XT/370   (256k motherboard)       │
  2428.      │   ? 1987 │ F8 │ 00 │ 00 │ PS/2 Model 80                             │
  2429.      │  3/30/87 │ F8 │ 00 │ 00 │ PS/2 Model 80-041  16mHz                  │
  2430.      │ 08/28/87 │ F8 │ ?? │ ?? │ PS/2 Model 80-071  16mHz                  │
  2431.      │   ? 1987 │ F8 │ 01 │ 00 │ PS/2 Model 80      20mHz                  │
  2432.      │ 09/17/87 │ F8 │ 01 │ 01 │ PS/2 Model 80-111  20mHz                  │
  2433.      │        ? │ F8 │ 04 │  ? │ PS/2 Model 70-121                         │
  2434.      │ 01/18/89 │ F8 │ 0B │ 00 │  PS/2 Model 70 Portable                   │
  2435.      │ 04/11/88 │ F8 │ 09 │ 02 │  PS/2 Model 70 desktop                    │
  2436.      │ 02/20/89 │ F8 │ 0D │    │  PS/2 Model 70-A21                        │
  2437.      │ 09/13/85 │ F9 │ 00 │ 00 │ Convertible                               │
  2438.      │          │ 2D │ -- │ -- │ Compaq PC        (4.77mHz original)       │
  2439.      │          │ 9A │ -- │ -- │ Compaq Plus      (XT compatible)          │
  2440.      └──────────┴────┴────┴────┴───────────────────────────────────────────┘
  2441.  
  2442.  
  2443.  
  2444. The IBM PC System Interrupts (Overview) ............................... 2**7
  2445.  
  2446.  The interrupt table is stored in the very lowest location in memory, starting
  2447. at 0000:0000h. The locations are offset from segment 0, i.e. location 0000h has
  2448. the address for int 0, etc. The table is 1024 bytes in length and contains 256
  2449. four byte vectors from 00h to 0FFh. Each address' location in memory can be
  2450. found by multiplying the interrupt number by 4. For example, int 7 could be
  2451. found by (7x4=28) or 1Bh (0000:001Bh).
  2452.  
  2453.  These interrupt vectors normally point to ROM tables or are taken over by DOS
  2454. when an application is run. Some applications revector these interrupts to
  2455. their own code to change the way the system responds to the user. DOS provides
  2456. int 21h function 25h to change interrupts from a high level; altering the
  2457. interrupt vector table directly is not recommended, nor would it really get
  2458. you anywhere.
  2459.  
  2460.  
  2461. Quick Chart of Interrupts 00h-0FFh .................................... 2**8
  2462.  
  2463. ┌─────────────────────┬────────────────────────────────────────────────────────┐
  2464. │  Interrupt Address  │                                                        │
  2465. ├───────┬───────┬─────┘                        Function                        │
  2466. │ Number│ (Hex) │ Type                                                         │
  2467. ├───────┼───────┼─────┬────────────────────────────────────────────────────────┤
  2468. │   0   │ 00-03 │ CPU │  Divide by Zero                                        │
  2469. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2470. │   1   │ 04-07 │ CPU │  Single Step                                           │
  2471. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2472. │   2   │ 08-0B │ CPU │  Nonmaskable                                           │
  2473. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2474. │   3   │ 0C-0F │ CPU │  Breakpoint                                            │
  2475. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2476. │   4   │ 10-13 │ CPU │  Overflow                                              │
  2477. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2478. │   5   │ 14-17 │ BIOS│  Print Screen                                          │
  2479. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2480. │   6   │ 18-1B │ hdw │  Reserved                                              │
  2481. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2482. │   7   │ 1C-1F │ hdw │  Reserved                                              │
  2483. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2484. │   8   │ 20-23 │ hdw │  Time of Day                                           │
  2485. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2486. │   9   │ 24-27 │ hdw │  Keyboard                                              │
  2487. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2488. │   A   │ 28-2B │ hdw │  Reserved                                              │
  2489. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2490. │   B   │ 2C-2F │ hdw │  Communications (8259)                                 │
  2491. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2492. │   C   │ 30-33 │ hdw │  Communications                                        │
  2493. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2494. │   D   │ 34-37 │ hdw │  Disk                                                  │
  2495. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2496. │   E   │ 38-3B │ hdw │  Diskette                                              │
  2497. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2498. │   F   │ 3C-3F │ hdw │  Printer                                               │
  2499. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2500. │   10  │ 40-43 │ BIOS│  Video                                                 │
  2501. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2502. │   11  │ 44-47 │ BIOS│  Equipment Check                                       │
  2503. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2504. │   12  │ 48-4B │ BIOS│  Memory                                                │
  2505. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2506. │   13  │ 4C-4F │ BIOS│  Diskette/Disk                                         │
  2507. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2508. │   14  │ 50-53 │ BIOS│  Serial Communications                                 │
  2509. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2510. │   15  │ 54-57 │ BIOS│  Cassette, System Services                             │
  2511. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2512. │   16  │ 58-5B │ BIOS│  Keyboard                                              │
  2513. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2514. │   17  │ 5C-5F │ BIOS│  Parallel Printer                                      │
  2515. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2516. │   18  │ 60-63 │ BIOS│  ROM BASIC Loader                                      │
  2517. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2518. │   19  │ 64-67 │ BIOS│  Bootstrap Loader                                      │
  2519. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2520. │   1A  │ 68-6B │ BIOS│  Time of Day                                           │
  2521. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2522. │   1B  │ 6C-6F │ BIOS│  Keyboard Break                                        │
  2523. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2524. │   1C  │ 70-73 │ BIOS│  Timer Tick                                            │
  2525. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2526. │   1D  │ 74-77 │ BIOS│  Video Initialization                                  │
  2527. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2528. │   1E  │ 78-7B │ BIOS│  Diskette Parameters                                   │
  2529. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2530. │   1F  │ 7C-7F │ BIOS│  Video Graphics Characters, second set                 │
  2531. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2532. │   20  │ 80-83 │ DOS │  General Program Termination                           │
  2533. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2534. │   21  │ 84-87 │ DOS │  DOS Services Function Request                         │
  2535. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2536. │   22  │ 88-8B │ DOS │  Called Program Termination Address                    │
  2537. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2538. │   23  │ 8C-8F │ DOS │  Control Break Termination Address                     │
  2539. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2540. │   24  │ 90-93 │ DOS │  Critical Error Handler                                │
  2541. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2542. │   25  │ 94-97 │ DOS │  Absolute Disk Read                                    │
  2543. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2544. │   26  │ 98-9B │ DOS │  Absolute Disk Write                                   │
  2545. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2546. │   27  │ 9C-9F │ DOS │  Terminate and Stay Resident                           │
  2547. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2548. │ 28-3F │ A0-FF │ DOS │  Reserved for DOS                                      │
  2549. └───────┴───────┴─────┼────────────────────────────────────────────────────────┤
  2550.                       │ *29h   Fast Screen Write                               │
  2551.                       │ *2Ah   Microsoft Networks - Session Layer Interrupt    │
  2552.                       │  2Fh   Multiplex Interrupt                             │
  2553.                       │ *30h   Far jump instruction for CP/M-style calls       │
  2554.                       │  33h   Used by Microsoft Mouse Driver                  │
  2555. ┌───────┬───────┬─────┼────────────────────────────────────────────────────────┤
  2556. │ 40-43 │100-115│ BIOS│  Reserved for BIOS                                     │
  2557. └───────┴───────┴─────┼────────────────────────────────────────────────────────┤
  2558.                       │  40h   Hard Disk BIOS                                  │
  2559.                       │  41h   Hard Disk Parameters  (except PC1)              │
  2560.                       │  42h   Pointer to screen BIOS entry  (EGA, VGA, PS/2)  │
  2561.                       │  43h   Pointer to EGA initialization parameter table   │
  2562. ┌───────┬───────┬─────┼────────────────────────────────────────────────────────┤
  2563. │   44  │116-119│ BIOS│  First 128 Graphics Characters                         │
  2564. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2565. │ 45-47 │120-131│ BIOS│  Reserved for BIOS                                     │
  2566. └───────┴───────┴─────┼────────────────────────────────────────────────────────┤
  2567.                       │  45h   Reserved by IBM  (not initialized)              │
  2568.                       │  46h   Pointer to hard disk 2 params (AT, PS/2)        │
  2569.                       │  47h   Reserved by IBM  (not initialized)              │
  2570. ┌───────┬───────┬─────┼────────────────────────────────────────────────────────┤
  2571. │   48  │132-135│ BIOS│  PCjr Cordless Keyboard Translation                    │
  2572. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2573. │   49  │136-139│ BIOS│  PCjr Non-Keyboard Scancode Translation Table          │
  2574. └───────┴───────┴─────┼────────────────────────────────────────────────────────┤
  2575.                       │  4Ah   Real-Time Clock Alarm (Convertible, PS/2)       │
  2576. ┌───────┬───────┬─────┼────────────────────────────────────────────────────────┤
  2577. │ 50-5F │140-17F│ BIOS│  Reserved for BIOS                                     │
  2578. └───────┴───────┴─────┼────────────────────────────────────────────────────────┤
  2579.                       │  5Ah   Cluster Adapter BIOS entry address              │
  2580.                       │ *5Bh   IBM  (cluster adapter?)                         │
  2581.                       │  5Ch   NETBIOS interface entry port                    │
  2582. ┌───────┬───────┬─────┴────────────────────────────────────────────────────────┤
  2583. │ 60-67 │180-19F│  User Program Interrupts (availible for general use)         │
  2584. └───────┴───────┴─────┬────────────────────────────────────────────────────────┤
  2585.                       │  60h   10-Net Network                                  │
  2586.                       │  67h   Used by LIM & AQA EMS, EEMS                     │
  2587. ┌───────┬───────┬─────┴────────────────────────────────────────────────────────┤
  2588. │ 68-7F │1A0-1FF│  Reserved by IBM                                             │
  2589. └───────┴───────┴─────┬────────────────────────────────────────────────────────┤
  2590.                       │  6Ch   System Resume Vector (Convertible)              │
  2591.                       │  6Fh   some Novell and 10-Net API functions            │
  2592.                       │  70h   IRQ 8, Real Time Clock Interrupt (AT, PS/2)     │
  2593.                       │  71h   IRQ 9, LAN Adapter 1                            │
  2594.                       │  72h   IRQ 10  (AT, XT/286, PS/2)  Reserved            │
  2595.                       │  73h   IRQ 11  (AT, XT/286, PS/2)  Reserved            │
  2596.                       │  74h   IRQ 12  Mouse Interrupt (PS/2)                  │
  2597.                       │  75h   IRQ 13, Coprocessor Error                       │
  2598.                       │  76h   IRQ 14, Hard Disk Controller (AT, PS/2)         │
  2599.                       │  77h   IRQ 15 (AT, XT/286, PS/2)  Reserved             │
  2600.                       │  7Ch   IBM REXX88PC command language                   │
  2601. ┌───────┬───────┬─────┴────────────────────────────────────────────────────────┤
  2602. │ 80-85 │200-217│  ROM BASIC                                                   │
  2603. ├───────┼───────┼──────────────────────────────────────────────────────────────┤
  2604. │ 86-F0 │218-3C3│  Used by BASIC Interpreter When BASIC is running             │
  2605. ├───────┼───────┼──────────────────────────────────────────────────────────────┤
  2606. │ F1-FF │3C4-3FF│  Reserved by IBM                                             │
  2607. └───────┴───────┴──────┬───────────────────────────────────────────────────────┤
  2608.                        │ *0F8h  Set Shell Interrupt (OEM)                      │
  2609.                        │ *0F9h  OEM SHELL service codes                        │
  2610.                        └───────────────────────────────────────────────────────┘
  2611.  
  2612.  
  2613.  
  2614. The IBM-PC System Interrupts (in detail) .............................. 2**9
  2615.  
  2616. ┌─────────────────────────────────────────────────────────────────────────────┐
  2617. │Interrupt  00h Divide by Zero                                                │
  2618. └─────────────────────────────────────────────────────────────────────────────┘
  2619. (0:0000h) (processor error). Automatically called at end of DIV or IDIV
  2620.           operation that results in error. Normally set by DOS to display an
  2621.           error message and abort the program.
  2622.  
  2623. note    On an 8086/8088, the return address points to the following instruction
  2624.         On an 80286/80386, the return address points to the divide instruction
  2625.  
  2626.  
  2627. ┌─────────────────────────────────────────────────────────────────────────────┐
  2628. │Interrupt  01h Single step                                                   │
  2629. └─────────────────────────────────────────────────────────────────────────────┘
  2630. (0:0004h) Taken after every instruction when CPU Trap Flag indicates
  2631.           single-step mode (bit 8 of FLAGS is 1). This is what makes the "T"
  2632.           command of DEBUG work for single stepping. Is not generated after MOV
  2633.           to segment register or POP of segment register. (unless you have a
  2634.           very early 8088 with the microcode bug).
  2635.  
  2636.  
  2637. ┌─────────────────────────────────────────────────────────────────────────────┐
  2638. │Interrupt  02h Non-maskable interrupt                                        │
  2639. └─────────────────────────────────────────────────────────────────────────────┘
  2640. (0:0008h)       Vector not disabled via CLI. Generated by NMI signal in
  2641.                 hardware. This function is called in the event of a memory
  2642.                 parity error or may occur in the event of other hardware
  2643.                 problems or failures depending on the specific manufacturer's
  2644.                 hardware. Displays the appropriate error message and halts the
  2645.                 processor.
  2646.                  Some AT chip sets apparently use int 02h to signal I/O errors
  2647.                 as well as parity errors.
  2648.  
  2649.                 This signal has various uses:
  2650.         POST parity error:                  all except PCjr and Convertible
  2651.         80x87 coprocessor interrupt:        all except PCjr and Convertible
  2652.         Keyboard interrupt:                 PCjr, Convertible
  2653.         I/O channel check:                  Convertible, PS/2 50+
  2654.         Disk controller power-on request:   Convertible
  2655.         System suspend:                     Convertible
  2656.         Realtime clock:                     Convertible
  2657.         System watchdog timer:              PS/2 50+
  2658.         Timeout interrupt:                  PS/2 50+
  2659.         DMA timer time-out interrupt:       PS/2 50+
  2660.         Infrared keyboard link:             PCjr
  2661.  
  2662.  
  2663. ┌─────────────────────────────────────────────────────────────────────────────┐
  2664. │Interrupt  03h Breakpoint                                                    │
  2665. └─────────────────────────────────────────────────────────────────────────────┘
  2666. (0:000Ch)  Taken when CPU executes the 1-byte int 3 (0CCh). Similar to 8080's
  2667.  
  2668. (internal) RST instruction. Generally used to set breakpoints for DEBUG.
  2669.  
  2670. note 1)  Also used by Turbo Pascal versions 1,2,3 when {$U+} specified.
  2671.      2)  Int 3s are sometimes inserted by the Microsoft Linker in response to
  2672.          an unresolved symbol.
  2673.  
  2674.  
  2675. ┌─────────────────────────────────────────────────────────────────────────────┐
  2676. │Interrupt  04h Divide overflow                                               │
  2677. └─────────────────────────────────────────────────────────────────────────────┘
  2678. (0:0010h)  Generated by INTO instruction if OF flag is set. If flag is not set,
  2679.  
  2680. (internal) INTO is effectively a NOP. Used to trap any arithmetic errors when
  2681.            program is ready to handle them rather than immediately when they
  2682.            occur.
  2683.  
  2684.  
  2685. ┌─────────────────────────────────────────────────────────────────────────────┐
  2686. │Interrupt  05h Print Screen                                                  │
  2687. └─────────────────────────────────────────────────────────────────────────────┘
  2688. (0:0014h)  Service dumps the screen to the printer. Invoked by int 9 for shifted
  2689.            key 55 (PrtSc). Automatically called by keyboard scan when PrtSc key
  2690.            is pressed. Normally executes a routine to print the screen, but may
  2691.            call any routine that can safely be executed from inside the keyboard
  2692.            handler. Status and result byte are at address 0050:0000.
  2693.  
  2694. (internal) BOUND Check Failed (80286+)
  2695.            Generated by BOUND instruction when the value to be tested is less
  2696.            than the indicated lower bound or greater than the indicated upper
  2697.            bound.
  2698.  
  2699. entry   AH      05h
  2700. return  absolute address 50:0
  2701.         00h     print screen has not been called, or upon return from a call
  2702.                 there were no errors
  2703.         01h     print screen is already in progress
  2704.         0FFh    error encountered during printing
  2705. note 1) Uses BIOS services to read the screen.
  2706.      2) Output is directed to LPT1.
  2707.      3) Revectored into GRAPHICS.COM if GRAPHICS.COM is loaded.
  2708.      4) On the Tandy 1000TX this interrupt can be enabled or disabled across
  2709.         the expansion slots via a DIP switch.
  2710.  
  2711.  
  2712. ┌─────────────────────────────────────────────────────────────────────────────┐
  2713. │Interrupt  06h Reserved by IBM                                               │
  2714. └─────────────────────────────────────────────────────────────────────────────┘
  2715. (0:0018h)
  2716.         On the Tandy 1000TX this interrupt can be enabled or disabled across
  2717.         the expansion slots via a DIP switch.
  2718.  
  2719. (internal) Undefined Opcode (80286+)
  2720.  
  2721.  
  2722.  
  2723. ┌─────────────────────────────────────────────────────────────────────────────┐
  2724. │Interrupt  07h Reserved by IBM                                               │
  2725. └─────────────────────────────────────────────────────────────────────────────┘
  2726. (0:00C0h)
  2727.         On the Tandy 1000TX this interrupt can be enabled or disabled across
  2728.         the expansion slots via a DIP switch.
  2729.  
  2730. (internal) No Math Unit Available (80286+)
  2731.  
  2732. note    The 80286 and later can be programmed to generate an int 7 whenever
  2733.         an ESC instruction is encountered. This could be used to emulate an
  2734.         80x87 series coprocessor in software and be transparent to the
  2735.         application software. It could also be used to make a non-Intel
  2736.         floating point processor emulate an 80x87.
  2737.  
  2738.  
  2739.  
  2740. ┌─────────────────────────────────────────────────────────────────────────────┐
  2741. │Interrupt  08h Timer                                                         │
  2742. └─────────────────────────────────────────────────────────────────────────────┘
  2743. (0:0020h)  55ms timer "tick" issued 18.2 times per second.
  2744.  (IRQ0)    8259-1 Interrupt Controller
  2745.            Updates the system time at [0040:006C] (low word) and [0040:006E]
  2746.            (high word) and issues an int 1Ch (timer). (int 1Ch points to an
  2747.            IRET instruction unless changed by a resident program). The timer
  2748.            interrupt is given the highest maskable interrupt priority upon
  2749.            power up.
  2750.  
  2751. (internal) Double Fault (80286+ protected mode) Called when multiple exceptions
  2752.            occur on one instruction, or an exception occurs in an exception
  2753.            handler. If an exception occurs in the double fault handler, the CPU
  2754.            goes into SHUTDOWN mode (which circuitry in the PC/AT converts to a
  2755.            reset).
  2756.  
  2757. entry   AH      08h
  2758. return  absolute addresses:
  2759.         40:6C   number of interrupts since power on (4 bytes)
  2760.         40:70   number of days since power on       (1 byte)
  2761.         40:67   day counter on all products after AT
  2762.         40:40   motor control count - gets decremented and shuts off diskette
  2763.                 motor if zero
  2764.  
  2765.  
  2766.  
  2767. ┌─────────────────────────────────────────────────────────────────────────────┐
  2768. │Interrupt  09h Keyboard                                                      │
  2769. └─────────────────────────────────────────────────────────────────────────────┘
  2770. (0:0024h)  Taken whenever a key is pressed or released. This is normally a scan
  2771.  (IRQ1)    code, but may also be an ACK or NAK of a command on AT-type
  2772.            keyboards. The hardware provides the key pressed in a non-ASCII scan
  2773.            code format read at I/O port 60h. The servicer acknowledges receipt
  2774.            of the key by toggling bit 7 of port 61h. (Port 61h should be read
  2775.            first, then bit 7 ORed on, output to port 61h, then ANDed off, and
  2776.            resent to port 61h).
  2777.  
  2778.             The read key is decoded to yield an ASCII character, special
  2779.            function key (such as F1) or a control function like Left Shift Key.
  2780.            The converted ASCII character is placed into the next available
  2781.            position in the circular queue keyboard. It is put in the position
  2782.            indicated by queue tail when it will not cause the loss of earlier
  2783.            entered data. The queue head points to the oldest key pressed in the
  2784.            buffer which has not been removed from the queue (the normal process
  2785.            uses int 16h to remove keys from the queue and return the key value
  2786.            to the int 16h caller).
  2787.  
  2788.             The 16 word queue holds up to 16 keys. If the queue head equals the
  2789.             queue tail, the queue is empty. Valid keys in the queue comprise
  2790.             the upper byte scan code and the lower byte ASCII character. If the
  2791.             key pressed has no ASCII equivalent (i.e F1 to F12), the lower byte
  2792.             is zero.
  2793.  
  2794.              Toggle and shift keys are not placed in the buffer, but appear in
  2795.            the two status bytes at absolute addr. [0040:0017,18].
  2796.  
  2797.            Special key combinations will cause other events to occur:
  2798.            a) Ctrl-Alt_Del  -  Reset computer by jumping to power_on_reset
  2799.            b) Print screen  -  Call int_5_prn_scrn to print the current screen
  2800.            c) Ctrl-Break    -  Call int_1Bh control break key processor (DOS)
  2801.            d) Pause         -  Wait until an ASCII key is pressed, without
  2802.                                placing the key in the queue
  2803.  
  2804. (internal) Math Unit Protection Fault (80286+ protected mode)
  2805.  
  2806. entry   AH      09h
  2807. return  at absolute memory addresses:
  2808.         40:17   bit
  2809.                 0       right shift key depressed
  2810.                 1       left shift key depressed
  2811.                 2       control key depressed
  2812.                 3       alt key depressed
  2813.                 4       ScrollLock state has been toggled
  2814.                 5       NumLock state has been toggled
  2815.                 6       CapsLock state has been toggled
  2816.                 7       insert state is active
  2817.         40:18   bit
  2818.                 0       left control key depressed
  2819.                 1       left alt key depressed
  2820.                 2       SysReq key depressed
  2821.                 3       Pause key has been toggled
  2822.                 4       ScrollLock key is depressed
  2823.                 5       NumLock key is depressed
  2824.                 6       CapsLock key is depressed
  2825.                 7       Insert key is depressed
  2826.         40:96   bit
  2827.                 0       last code was the E1h hidden code
  2828.                 1       last code was the E0h hidden code
  2829.                 2       right control key down
  2830.                 3       right alt key down
  2831.                 4       101 key Enhanced keyboard installed
  2832.                 5       force NumLock if rd ID & kbx
  2833.                 6       last character was first ID character
  2834.                 7       doing a read ID (must be bit 0)
  2835.         40:97   bit
  2836.                 0       ScrollLock indicator
  2837.                 1       NumLock indicator
  2838.                 2       CapsLock indicator
  2839.                 3       circus system indicator
  2840.                 4       ACK received
  2841.                 5       resend received flag
  2842.                 6       mode indicator update
  2843.                 7       keyboard transmit error flag
  2844.         40:1E   keyboard buffer (20h bytes)
  2845.         40:1C   buffer tail pointer
  2846.         40:72   1234h if ctrl-alt-del pressed on keyboard
  2847.      AL   scan code
  2848. note 1) Int 05h invoked if PrtSc key pressed.
  2849.      2) Int 1Bh invoked if Ctrl-Break key sequence pressed.
  2850.      3) Int 15h, AH=85h invoked on AT and after if SysReq key is pressed.
  2851.      4) Int 15h, AH=4Fh invoked on machines after AT.
  2852.      5) Int 16h, BIOS keyboard functions, uses this interrupt.
  2853.  
  2854.  
  2855. ┌─────────────────────────────────────────────────────────────────────────────┐
  2856. │Interrupt  0Ah  EGA Vertical Retrace                                         │
  2857. └─────────────────────────────────────────────────────────────────────────────┘
  2858. (0:0028h)  used by EGA vertical retrace
  2859.  (IRQ2)    8259-1 Interrupt Controller
  2860. note 1) The TOPS and PCnet adapters use this IRQ line by default.
  2861.      2) On systems equipped with 2 interrupt controller chips (8259), IRQ 2
  2862.         is used to support the second interrupt controller. In this case,
  2863.         int 71h (IRQ 9) is used to replace IRQ 2. Hardware calls to int 71h
  2864.         are redirected to this interrupt to maintain compatibility.
  2865.      3) Many VGA boards to not use this interrupt.
  2866.  
  2867. (internal) Invalid Task State Segment (80286+ protected mode)
  2868.  
  2869.  
  2870.  
  2871. ┌─────────────────────────────────────────────────────────────────────────────┐
  2872. │Interrupt  0Bh  Communications Controller (serial port) hdw. entry           │
  2873. └─────────────────────────────────────────────────────────────────────────────┘
  2874. (0:002Ch)  Serial Port 2 (COM2) 8259-1
  2875.  (IRQ3)
  2876. note 1) IRQ 3 may be used by SDLC (synchronous data-link control) or
  2877.         bisynchronous communications cards instead of a serial port.
  2878.      2) The TOPS and PCnet adapters use this interrupt request line as an
  2879.         alternate.
  2880.      3) On PS/2s, COM2 through COM8 share this IRQ.
  2881.      4) For most serial boards, COM4 shares this IRQ.
  2882.      5) On the Commodore Amiga 2000 with the PC Bridge Board, this interrupt
  2883.         is used for communication between the Amiga system board and the
  2884.         Bridge Board. This was probably the lowest IRQ level they felt safe
  2885.         using, but limits the A2000's use of network cards, etc.
  2886.      6) This interrupt is used by part of the stack-switching code added
  2887.         to DOS 3.2 for use with Local Area Network adapters.
  2888.      7) The PS/2 puts COM3 through COM8 at port addresses above 3FFh (not
  2889.         properly decoded by older PCs) and has all of them sharing IRQ3.
  2890.  
  2891. (internal) Not Present (80286+ protected mode)
  2892.            Generated when loading a segment register if the segment descriptor
  2893.            indicates that the segment is not currently in memory. May be used
  2894.            to implement virtual memory.
  2895.  
  2896.  
  2897. ┌─────────────────────────────────────────────────────────────────────────────┐
  2898. │Interrupt  0Ch  Communications Controller (serial port) Hardware Entry       │
  2899. └─────────────────────────────────────────────────────────────────────────────┘
  2900. (0:0030h)  Serial Port 1 (COM1) or internal modem in PCjr or Convertible
  2901.  (IRQ4)    8259-1
  2902. note 1) IRQ 4 may be used by SDLC (synchronous data-link control) or
  2903.         bisynchronous communications cards instead of a serial port.
  2904.      2) On some PCs, this interrupt is shared by COM3.
  2905.      3) Tandy computers use IRQ4 instead of IRQ5 for the hard disk interrupt.
  2906.      4) Best performance of mice sometimes happens when they are configured
  2907.         for IRQ4 instead of IRQ3, since some mouse drivers may lock system
  2908.         interrupts for long periods.
  2909.  
  2910. (internal) Stack Fault (80286+ protected mode)
  2911.            Generated on stack overflow/underflow. Note that the 80286 will shut
  2912.            down in real mode if SP=1 before a push.
  2913.  
  2914.  
  2915. ┌─────────────────────────────────────────────────────────────────────────────┐
  2916. │Interrupt  0Dh  Hard Disk                                                    │
  2917. └─────────────────────────────────────────────────────────────────────────────┘
  2918. (0:0034h)  Miscelleneous uses
  2919.  (IRQ5)    8259-1
  2920. note 1) Various Tandy 1000 models may use this line for the 60Hhz RAM refresh
  2921.         or as "optional bus interrupt."
  2922.      2) Used by hard disk on IBM XT and most compatibles.
  2923.      3) LPT2 on AT, XT/286, and PS/2
  2924.      4) Dummy CRT vertical retrace on PCjr
  2925.  
  2926. (internal) General Protection Violation (80286+)
  2927.            Called in real mode when an instruction attempts to access a word
  2928.            operand located at offset 0FFFFh or a PUSH MEM or POP MEM
  2929.            instruction contains an invalid bit code in the second byte, or
  2930.            when an instruction exceeds the maximum length allowed (10 bytes
  2931.            for 80286, 15 bytes for 80386)
  2932.  
  2933.  
  2934. ┌─────────────────────────────────────────────────────────────────────────────┐
  2935. │Interrupt  0Eh  Diskette Interrupt                                           │
  2936. └─────────────────────────────────────────────────────────────────────────────┘
  2937. (0:0038h)  Generated by floppy controller on completion of an operation
  2938.  (IRQ6)    (sets bit 8 of 40:3E)
  2939.  
  2940. (internal) Page Fault (80386+ native mode)
  2941.  
  2942.  
  2943. ┌─────────────────────────────────────────────────────────────────────────────┐
  2944. │Interrupt  0Fh  Reserved by IBM                                              │
  2945. └─────────────────────────────────────────────────────────────────────────────┘
  2946. (0:003Ch)  IRQ7 used by 8259 PPI interrupt (LPT1, LPT2)
  2947.  (IRQ7)
  2948. note 1) Generated by the LPT1 printer adapter when printer becomes ready. Many
  2949.         printer adapters do not reliably generate this interrupt.
  2950.      2) This interrupt is normally avoided. If a bad interrupt occurs, it will
  2951.         vector to this spot (when caused by a misprogrammed 8259 PIC)
  2952.  
  2953.  
  2954.        **  Programmer's Technical Reference for MSDOS and the IBM PC **
  2955.                 USA copyright TXG 392-616  ALL RIGHTS RESERVED
  2956. ───────────────────────────────┤ DOSREF (tm) ├────────────────────────────────
  2957.                      ISBN 1-878830-02-3 (disk-based text)
  2958.                     Copyright (c) 1987, 1991 Dave Williams
  2959.                         ┌─────────────────────────────┐
  2960.                         │ Shareware Version, 12/20/91 │
  2961.                         │  Please Register Your Copy  │
  2962.                         └─────────────────────────────┘
  2963.  
  2964.  
  2965.                           C H A P T E R    T H R E E
  2966.  
  2967.  
  2968.                                 THE PC ROM BIOS
  2969.  
  2970.  
  2971.                                 C O N T E N T S
  2972.  
  2973. Calling the ROM BIOS .................................................. 3**1
  2974. Interrupt 10h  Video Services ......................................... 3**2
  2975. Interrupt 11h  Equipment Check ........................................ 3**3
  2976. Interrupt 12h  Memory Size ............................................ 3**4
  2977. Interrupt 13h  Disk Functions ......................................... 3**5
  2978. Interrupt 14h  Initialize and Access Serial Port ...................... 3**6
  2979.                FOSSIL Drivers ......................................... 3**7
  2980. Interrupt 15h  Cassette I/O ........................................... 3**8
  2981. Interrupt 16h  Keyboard I/O ........................................... 3**9
  2982. Interrupt 17h  Printer ................................................ 3**10
  2983. Interrupt 18h  ROM BASIC .............................................. 3**11
  2984. Interrupt 19h  Bootstrap Loader ....................................... 3**12
  2985. Interrupt 1Ah  Time of Day ............................................ 3**13
  2986. Interrupt 1Bh  Control-Break .......................................... 3**14
  2987. Interrupt 1Ch  Timer Tick ............................................. 3**15
  2988. Interrupt 1Dh  Vector of Video Initialization Parameters .............. 3**16
  2989. Interrupt 1Eh  Vector of Diskette Controller Parameters ............... 3**17
  2990. Interrupt 1Fh  Ptr to Graphics Character Extensions (Graphics Set 2) .. 3**18
  2991.  
  2992.  
  2993.  
  2994.  The ROM BIOS is the lowest level of software access. It contains the
  2995. following routines:
  2996.  
  2997.    (all)
  2998.         power-on self-test (POST)
  2999.         boostrap loader
  3000.         clock
  3001.         floppy disk I/O
  3002.         video I/O
  3003.         keyboard
  3004.         serial ports
  3005.         parallel ports
  3006.         print screen
  3007.         equipment check
  3008.         report memory size
  3009.  
  3010.  
  3011.     (AT)
  3012.         hard disk I/O
  3013.         report memory size (extended memory)
  3014.         extended memory block moves
  3015.         enhanced video and keyboard I/O
  3016.         high resolution timer
  3017.         alarm
  3018.  
  3019.   Machines such as the PC Convertible, PCjr, and non-IBM machines add
  3020. additional functions.
  3021.  
  3022.  
  3023. Calling the ROM BIOS .................................................. 3**1
  3024.  
  3025.  The BIOS services are invoked by placing the number of the desired function in
  3026. register AH, subfunction in AL, setting the other registers to any specific
  3027. requirements of the function, and invoking any of ints 10h through int 1Fh.
  3028.  
  3029.  The original IBM PC Technical Reference gave the absolute addresses of the
  3030. ROM routines. Some early software jumped directly to these addresses, with
  3031. mixed results on non-IBM BIOSes. This practice was common on machines
  3032. predating the PC, but there is no practical use for it now. The OS/2
  3033. Compatibility Box also does not support jumping directly into the ROM.
  3034.  
  3035.  When the interrupt is called, all register and flag values are pushed into the
  3036. stack. The interrupt address contains a pointer into an absolute address in the
  3037. ROM BIOS chip address space. This location may be further vectored into the
  3038. IBMBIO.COM (or equivalent) file or user file.
  3039.  
  3040.  The address vector points to a particular BIOS command handler. The handler
  3041. pops the register values, compares them to its list of functions, and executes
  3042. the function if valid. When the function is complete, it may pass values back
  3043. to the command handler. The handler will push the values into the stack and
  3044. then return control to the calling program.
  3045.  
  3046.  Most functions will return an error code; some return more information.
  3047. Details are contained in the listings for the individual functions.
  3048.  
  3049.  Register settings listed are the ones used by the BIOS. Some functions will
  3050. return with garbage values in unused registers. Do not test for values in
  3051. unspecified registers; your program may exhibit odd behavior.
  3052.  
  3053.  
  3054.  Three sets of BIOS routines are available: PC BIOS, AT BIOS (also called
  3055. CBIOS or "Old compatibility BIOS", and the PS/2 ABIOS "Advanced BIOS".
  3056.  
  3057.  The Advanced BIOS is contained in PS/2 ROMs. It is primarily intended for OS
  3058. use rather than application use. OS/2 can take advantage of ABIOS routines to
  3059. reduce RAM use on PS/2 systems. The ABIOS can be replaced by disk and RAM based
  3060. ABIOS code if desired. There is a new BIOS Data Area defined in high memory
  3061. that occupies one K of RAM. In OS/2 systems, parts of the ABIOS are replaced
  3062. by OS/2 drivers.
  3063.  
  3064.  While the CBIOS must be addressed via pointers, the routines in the ABIOS are
  3065. fixed in absolute locations so they can be referenced directly by OS/2.
  3066.  
  3067.  The ABIOS can run in protected mode, and is fully reentrant. It supports three
  3068. types of function requests - single staged, discrete multistaged, or continuous
  3069. multistaged. A single-staged request does its job immediately and returns
  3070. control to the caller. A discrete multistaged request may happen in two or more
  3071. stages with pauses between the stages. The caller may regain control during the
  3072. pauses. A continuous multistaged request starts a staged operation that never
  3073. ends. (sometimes called a daemon).
  3074.  
  3075.  Unlike the CBIOS which is called with software interrupts, ABIOS is accessed
  3076. with FAR calls. ABIOS calls are completely reentrant in both real and
  3077. protected modes. To call an ABIOS function, the calling program must pass
  3078. pointers to two data structures - a request block and a common data area. The
  3079. request block specifies the desired function number and the common data area is
  3080. a table that contains pointers to all the ABIOS' other tables and data areas.
  3081. The common data area's internal structure contains the function transfer
  3082. tables which have the addresses of the BIOS routines.
  3083.  
  3084. ABIOS stack frame and calling conventions:
  3085.        bytes        stack contents
  3086.         2       common data area pointer (segment/selector only) required
  3087.         4       request block pointer - required
  3088.         4       function transfer table pointer - furnished by ABIOS or caller
  3089.         4       device block pointer - furnished by ABIOS or caller
  3090.         4       return address
  3091.  
  3092.  In ABIOS Transfer Convention, only the first two items are required. ABIOS
  3093. assigns the second two. In Operating System Transfer Convention, the caller
  3094. provides the second two. Since the parameters are not removed from the stack
  3095. on return to the caller, the operating system may save the function transfer
  3096. table and device addresses after they have been furnished by the ABIOS by a
  3097. call.
  3098.  
  3099.  ABIOS does no interrupt arbitration. It assumes all interrupts are handled by
  3100. the caller or the OS and it is called only for service. If more than one
  3101. device is sharing a hardware interrupt, the OS must determine which interrupt
  3102. is valid for the ABIOS.
  3103.  
  3104.  OS/2 may use the ABIOS if found, but otherwise duplicates the BIOS calls for
  3105. the DOS Compatibility Box by vectoring BIOS calls into its own device drivers.
  3106. This makes it rather difficult for DOS drivers for mass storage, high
  3107. resolution video boards, multitasking APIs using int 15h, etc. If your
  3108. software needs to manipulate hardware directly you might want to check if your
  3109. code is running under OS/2. The simplest method is to check for DOS version 10
  3110. or higher.
  3111.  
  3112.  
  3113. note    Some references list an "XT/2" machine, which was reputedly an 8mHz
  3114.         8088 with 640k and a clock on the motherboard. IBM doesn't list such
  3115.         a machine, and I have a late '86 XT, one of the last made. It is
  3116.         pretty much like the older ones.
  3117.  
  3118.  
  3119. ┌─────────────────────────────────────────────────────────────────────────────┐
  3120. │Interrupt 10h  Video Services                                          3**2  │
  3121. └─────────────────────────────────────────────────────────────────────────────┘
  3122. (0:0040h)       The BIOS Video Services may be found in Chapter 16.
  3123.  
  3124. (internal) Coprocessor Error (80286+)
  3125.         Generated by the CPU when the -ERROR pin is asserted by the coprocessor
  3126.         (usually 80x87, but may be any multimaster CPU or alternate NDP such
  3127.         as Weitek, etc.). ATs and clones usually wire the coprocessor to use
  3128.         IRQ13, but not all get it right.
  3129.  
  3130.  
  3131.  
  3132. ┌─────────────────────────────────────────────────────────────────────────────┐
  3133. │Interrupt 11h  Equipment Check                                         3**3  │
  3134. └─────────────────────────────────────────────────────────────────────────────┘
  3135. (0:0044h)       Reads the BIOS Data Area and returns two bytes of setup info.
  3136. entry   no parameters are required
  3137. return  AX      Equipment listing word. Bits are:
  3138.                 0       number of floppy drives
  3139.                         0       no drives
  3140.                         1       bootable (IPL) diskette drive installed
  3141.                 1       math chip
  3142.                         0       no math coprocessor (80x87) present
  3143.                         1       math coprocessor (80x87) present
  3144.          (PS/2) 2       0       mouse not installed
  3145.                         1       mouse installed
  3146.           (PC)  2,3     system board RAM
  3147.                         0,0     16k    (PC-0, PC-1)
  3148.                         0,1     32k
  3149.                         1,0     48k
  3150.                         1,1     64k    (PC-2, XT)
  3151.                         note 1) not commonly used. Set both bits to 1
  3152.                              2) both bits always 1 in AT
  3153.                 4,5     initial video mode
  3154.                         0,0     no video installed (use with dumb terminal)
  3155.                         0,1     40x25 color      (CGA)
  3156.                         1,0     80x25 color      (CGA, EGA, PGA, MCGA, VGA)
  3157.                         1,1     80x25 monochrome (MDA or Hercules, most super-
  3158.                                                   hires mono systems)
  3159.                 6,7     number of diskette drives (only if bit 0 is 1)
  3160.                         0,0     1 drives
  3161.                         0,1     2 drives
  3162.                         1,0     3 drives
  3163.                         1,1     4 drives
  3164.                 8       0       DMA present
  3165.                         1       no DMA (PCjr, some Tandy 1000s, 1400LT)
  3166.                 9,A,B   number of RS232 serial ports (0-3)
  3167.                         0,0,0   none
  3168.                         0,0,1   1
  3169.                         0,1,0   2
  3170.                         0,1,1   3
  3171.                         1,0,0   4
  3172.                 C       0       no game I/O attached
  3173.                         1       game I/O attached (default for PCjr)
  3174.                 D       serial accessory installation
  3175.                         0       no serial accessories installed
  3176.                         1       Convertible - internal modem installed
  3177.                                 or PCjr - serial printer attached
  3178.                 E,F     number of parallel printers
  3179.                         0,0     none
  3180.                         0,1     one   (LPT1, PRN)
  3181.                         1,0     two   (LPT2)
  3182.                         1,1     three (LPT3)
  3183.                         note    Models before PS/2 would allow a fourth
  3184.                                 parallel printer. Remapping of the BIOS in the
  3185.                                 PS/2s does not allow the use of LPT4.
  3186.         (386 extended AX)
  3187.                 23d     0       Weitek ABACUS - virtual '86 EMS page tables
  3188.                                 not correctly initialized
  3189.                         1       Weitek ABACUS - virtual '86 EMS page tables OK
  3190.  
  3191.                 24d     0       Weitek ABACUS NDP not present
  3192.                         1       Weitek ABACUS NDP present
  3193.  
  3194.  
  3195.  
  3196.  
  3197. ┌─────────────────────────────────────────────────────────────────────────────┐
  3198. │Interrupt 12h  Memory Size                                             3**4  │
  3199. └─────────────────────────────────────────────────────────────────────────────┘
  3200. (0:0048h)       get system memory
  3201. entry   no parameters required
  3202. return  AX      number of contiguous 1K RAM blocks available for DOS
  3203. note 1) This is the same value stored in absolute address 04:13h.
  3204.      2) For some early PC models, the amount of memory returned by this call is
  3205.         determined by the settings of the dip switches on the motherboard and
  3206.         may not reflect all the memory that is physically present.
  3207.      3) For the PC/AT, the value returned is the amount of functional memory
  3208.         found during the power-on self-test, regardless of the memory size
  3209.         configuration information stored in CMOS RAM.
  3210.      4) The value returned does not reflect any extended memory (above the 1 Mb
  3211.         boundary) that may be present on 80286 or 80386 machines.
  3212.  
  3213.  
  3214.  
  3215.  
  3216. ┌─────────────────────────────────────────────────────────────────────────────┐
  3217. │Interrupt 13h  Disk Functions                                          3**5  │
  3218. └─────────────────────────────────────────────────────────────────────────────┘
  3219. (0:0049h)       The service calls for BIOS disk functions are located in
  3220.                 Chapter 8.
  3221.  
  3222.  
  3223.  
  3224.  
  3225. ┌─────────────────────────────────────────────────────────────────────────────┐
  3226. │Interrupt 14h  Initialize and Access Serial Port For Int 14            3**6  │
  3227. └─────────────────────────────────────────────────────────────────────────────┘
  3228.  Note:  Some IBM PS/2 Model 50Z machines were delivered with serial ports
  3229.         that did not meet specification.  Some cheap clone serial ports may
  3230.         also be troublesome.
  3231.  
  3232. (0:0050h)       the following status is defined:
  3233.  
  3234.         serial status byte:
  3235.         bits    0 delta clear to send
  3236.                 1 delta data set ready
  3237.                 2 trailing edge ring detector
  3238.                 3 delta receive line signal detect
  3239.                 4 clear to send
  3240.                 5 data set ready
  3241.                 6 ring indicator
  3242.                 7 receive line signal detect
  3243.  
  3244.         line status byte:
  3245.         bits    0 data ready
  3246.                 1 overrun error
  3247.                 2 parity error
  3248.                 3 framing error
  3249.                 4 break detect
  3250.                 5 transmit holding register empty
  3251.                 6 transmit shift register empty
  3252.                 7 time out  note: if bit 7 set then other bits are invalid
  3253.  
  3254.         Though present on the IBM PS/2s, COM3 and COM4 are not widely
  3255.         standardized across the industry. The most common definitions are:
  3256.  
  3257.         port    addr.   IRQ     interrupt
  3258.  
  3259.         COM1    3F8     IRQ4    int 0Ch
  3260.         COM2    2F8     IRQ3    int 0Bh
  3261.         COM3    3E8     IRQ4    int 0Ch
  3262.         COM4    2E8     IRQ3    int 0Bh
  3263.  
  3264.         As you can see, COM1/COM3 and COM2/COM4 are siamesed.  Since the ISA
  3265.         bus does not support shared interrupts, simultaneous access of two of
  3266.         a pair may cause conflict.  For example, a mouse and a modem would not
  3267.         coexist well on paired ports.
  3268.  
  3269.  
  3270.  All routines have AH=function number and DX=RS232 card number (0 based).
  3271. AL=character to send or received character on exit, unless otherwise noted.
  3272.  
  3273. entry   AH      00h     Initialize And Access Serial Communications Port
  3274.                         bit pattern: BBBPPSLL
  3275.                         BBB = baud rate:   110,150,300,600,1200,2400,4800,9600
  3276.                         PP  = parity:      01 = odd, 11 = even
  3277.                         S   = stop bits:   0 = 1, 1 = 2
  3278.                         LL  = word length: 10 = 7-bits, 11 = 8-bits
  3279.         AL      parms for initialization:
  3280.                 bit pattern:
  3281.                 0       word length
  3282.                 1       word length
  3283.                 2       stop bits
  3284.                 3       parity
  3285.                 4       parity
  3286.                 5       baud rate
  3287.                 6       baud rate
  3288.                 7       baud rate
  3289.                 word length     10      7 bits
  3290.                                 11      8 bits
  3291.                 stop bits       0       1 stop bit
  3292.                                 1       2 stop bits
  3293.                 parity          00      none
  3294.                                 01      odd
  3295.                                 11      even
  3296.                 baud rate       000     110 baud
  3297.                                 001     150 baud
  3298.                                 010     300 baud
  3299.                                 011     600 baud
  3300.                                 100     1200 baud
  3301.                                 101     2400 baud
  3302.                                 110     4800 baud
  3303.                                 111     9600 baud  (4800 on PCjr)
  3304.         DX      port number (0=COM1, 1=COM2, etc.)
  3305. return  AH      line status
  3306.         AL      modem status
  3307. note    To initialize the serial port to > 9600 baud on PS/2 machines, see
  3308.         fns 04h and 05h.
  3309.  
  3310.  
  3311. Function 01h    Send Character in AL to Comm Port
  3312. entry   AH      01h
  3313.         AL      character
  3314.         DX      port number (0 - 3)
  3315. return  AH      RS232 status code
  3316.                 bit     0       data ready
  3317.                         1       overrun error
  3318.                         2       parity error
  3319.                         3       framing error
  3320.                         4       break detected
  3321.                         5       transmission buffer register empty
  3322.                         6       transmission shift register empty
  3323.                         7       timeout
  3324.         AL      modem status
  3325.                 bit
  3326.                         0       delta clear-to-send
  3327.                         1       delta data-set-ready
  3328.                         2       trailing edge ring detected
  3329.                         3       change, receive line signal detected
  3330.                         4       clear-to-send
  3331.                         5       data-set-ready
  3332.                         6       ring received
  3333.                         7       receive line signal detected
  3334.  
  3335.  
  3336. Function 02h    Wait For A Character From Comm Port DX
  3337. entry   AH      02h
  3338.         DX      port number (0-3)
  3339. return  AL      character received
  3340.         AH      error code (see above)(00h for no error)
  3341.  
  3342.  
  3343. Function 03h    Fetch the Status of Comm Port DX (0 or 1)
  3344. entry   AH      03h
  3345.         DX      port (0-3)
  3346. return  AH      set bits (01h) indicate comm-line status
  3347.                 bit     7       timeout
  3348.                 bit     6       empty transmit shift register
  3349.                 bit     5       empty transmit holding register
  3350.                 bit     4       break detected ("long-space")
  3351.                 bit     3       framing error
  3352.                 bit     2       parity error
  3353.                 bit     1       overrun error
  3354.                 bit     0       data ready
  3355.         AL      set bits indicate modem status
  3356.                 bit     7       received line signal detect
  3357.                 bit     6       ring indicator
  3358.                 bit     5       data set ready
  3359.                 bit     4       clear to send
  3360.                 bit     3       delta receive line signal detect
  3361.                 bit     2       trailing edge ring detector
  3362.                 bit     1       delta data set ready
  3363.                 bit     0       delta clear to send
  3364.  
  3365.  
  3366. Function 04h    Extended Initialize                       (Convertible, PS/2)
  3367. entry   AH      04h
  3368.         AL      break status
  3369.                 01h     if break
  3370.                 00h     if no break
  3371.         BH      parity
  3372.                 00h     no parity
  3373.                 01h     odd parity
  3374.                 02h     even parity
  3375.                 03h     stick parity odd
  3376.                 04h     stick parity even
  3377.         BL      number of stop bits
  3378.                 00h     one stop bit
  3379.                 01h     2 stop bits (1½ if 5 bit word length)
  3380.         CH      word length
  3381.                 00h     5 bits
  3382.                 01h     6 bits
  3383.                 02h     7 bits
  3384.                 03h     8 bits
  3385.         CL      baud rate
  3386.                 00h     110
  3387.                 01h     150
  3388.                 02h     300
  3389.                 03h     600
  3390.                 04h     1200
  3391.                 05h     2400
  3392.                 06h     4800
  3393.                 07h     9600
  3394.                 08h     19200
  3395.         DX      comm port (0-3)
  3396. return  AH      line control status
  3397.         AL      modem status
  3398. note    Provides a superset of fn 00h capabilities for PS/2 machines.
  3399.  
  3400.  
  3401. Function 05h    Extended Communication Port Control       (Convertible, PS/2)
  3402. entry   AH      05h
  3403.         AL      00h     read modem control register
  3404.                 01h     write modem control register
  3405.         BL      modem control register
  3406.            bits 0       DTR data terminal ready
  3407.                 1       RTS request to send
  3408.                 2       out1
  3409.                 3       out2
  3410.                 4       loop
  3411.                 5,6,7   reserved
  3412.         DX      port number (0=COM1, 1=COM2, etc.)
  3413. return  AH      port status (see 00h above)
  3414.         AL      modem status (see 00h above)
  3415.         BL      modem control register (see 01h above)
  3416.  
  3417.  
  3418.  
  3419. FOSSIL Drivers ........................................................ 3**7
  3420.  
  3421. Interrupt  14h  FOSSIL (Fido/Opus/Seadog Standard Interface Level) drivers
  3422.                 A FOSSIL is a device driver for handling the IBM PC serial
  3423.                 communications ports in a standard fashion from an application
  3424.                 (communications) program. A FOSSIL chains into the int 14h BIOS
  3425.                 communications vector and replaces many functions with enhanced
  3426.                 routines that may be easily accessed by an application.
  3427.  
  3428.                 For all functions, all registers not specifically containing a
  3429.                 function return value must be preserved across the call.
  3430.  
  3431.  
  3432. entry   AH      00h     Set baud rate and parameters
  3433.         AL      byte
  3434.                 bits 7,6,5 baudrate
  3435.                 000     19200 baud
  3436.                 001     38400 baud
  3437.                 010     300 baud
  3438.                 011     600 baud
  3439.                 100     1200 baud
  3440.                 101     2400 baud
  3441.                 110     4800 baud
  3442.                 111     9600 baud
  3443.                 bits 4,3 parity
  3444.                 00      none
  3445.                 01      odd
  3446.                 10      none
  3447.                 11      even
  3448.                 bit 2 stop bits
  3449.                 0       1 stop bit
  3450.                 1       2 stop bits
  3451.                 bit 1 char length
  3452.                 0       5 bits plus value
  3453.                 other   optional
  3454.         DX      port number (NOP if DX=00FFh)
  3455. return  AX      status (see fn 03h)
  3456. note    Low-order 5 bits are undefined by FOSSIL 1.0 spec.
  3457.  
  3458.  
  3459. entry   AH      01h     Transmit character with wait
  3460.         AL      ASCII value of character to be sent
  3461.         DX      port number (NOP if DX=00FFh)
  3462. return  AX      status bits (see function 03h)
  3463. note 1) Character is queued for transmission. If there is room in the
  3464.         transmitter buffer when this call is made, the character will be stored
  3465.         and control returned to caller. If the buffer is full, the driver will
  3466.         wait for room. Use this function with caution when flow control is
  3467.         enabled.
  3468.  
  3469.  
  3470. entry   AH      02h     FOSSIL: Receive a character with wait
  3471.         DX      port number (0-3) (NOP if DX=00FFh)
  3472. return  AH      RS-232 status code (see AH=00h above)
  3473.         AL      ASCII value of character received from serial port
  3474. note    Will timeout if DSR is not asserted, even if function 03h returns
  3475.         data ready.
  3476.  
  3477.  
  3478. entry   AH      03h     FOSSIL: Request status
  3479.         DX      port number  (NOP if DX=00FFh)
  3480. return  AX      status bit mask
  3481.                 AH      bit 0 set  RDA     input data is available in buffer
  3482.                             1 set  OVRN    input buffer overrun
  3483.                             2 N/A
  3484.                             3 N/A
  3485.                             4 N/A
  3486.                             5 set  THRE    room is available in output buffer
  3487.                             6 set  TSRE    output buffer is empty
  3488.                             7 N/A
  3489.                 AL      bit 0 N/A
  3490.                             1 N/A
  3491.                             2 N/A
  3492.                             3 set          this bit is always set
  3493.                             4 N/A
  3494.                             5 N/A
  3495.                             6 N/A
  3496.                             7 set  DCD     carrier detect
  3497. note    Bit 3 of AL is always returned set to enable programs to use it as a
  3498.         carrier detect bit on hardwired (null modem) links.
  3499.  
  3500.  
  3501. entry   AH      04h     Initialize FOSSIL driver
  3502.         BX      4F50h                      (optional)
  3503.         DX      port number                (DX=00FFh special)
  3504.         ES:CX   pointer to ^C flag address (optional)
  3505. return  AX      1954h if successful
  3506.         BL      maximum function number supported (excluding 7Eh-0BFh)
  3507.         BH      revision of FOSSIL supported
  3508. note 1) DTR is raised when FOSSIL inits.
  3509.      2) Existing baudrate is preserved.
  3510.      3) If BX contains 4F50h, the address specified in ES:CX is that of a ^C
  3511.         flag byte in the application program, to be incremented when ^C is
  3512.         detected in the keyboard service routines. This is an optional service
  3513.         and only need be supported on machines where the keyboard service can't
  3514.         (or won't) perform an int 1Bh or int 23h when a control-C is entered.
  3515.  
  3516.  
  3517. entry   AH      05h     Deinitialize FOSSIL driver
  3518.         DX      port number  (DX=00FFh special)
  3519. return  none
  3520. note 1) DTR is not affected.
  3521.      2) Disengages driver from comm port. Should be done when operations on the
  3522.         port are complete.
  3523.      3) If DX=00FFh, the initialization that was performed when FOSSIL function
  3524.         04h with DX=00FFh should be undone.
  3525.  
  3526.  
  3527. entry   AH      06h     FOSSIL: Raise/lower DTR
  3528.         AL      DTR state to be set
  3529.                 00h     lower DTR
  3530.                 01h     raise DTR
  3531.         DX      comm port (NOP if DX=00FFh)
  3532. return  none
  3533.  
  3534.  
  3535. entry   AH      07h     FOSSIL: Return timer tick parameters
  3536. return  AH      ticks per second on interrupt number shown in AL
  3537.         AL      timer tick interrupt number (not vector!)
  3538.         DX      milliseconds per tick (approximate)
  3539.  
  3540.  
  3541. entry   AH      08h     FOSSIL: Flush output buffer
  3542.         DX      port number (NOP if DX=00FFh)
  3543. return  none
  3544. note    Waits until all output is done.
  3545.  
  3546.  
  3547. entry   AH      09h     FOSSIL: Purge output buffer
  3548.         DX      port number (NOP if DX=00FFh)
  3549. return  none
  3550. note    Returns to caller immediately.
  3551.  
  3552.  
  3553. entry   AH      0Ah     FOSSIL: Purge input buffer
  3554.         DX      port number (NOP if DX=00FFh)
  3555. return  none
  3556. note 1) If any flow control restraint has been employed (dropping RTS or
  3557.         transmitting XOFF) the port will be "released" by doing the reverse,
  3558.         raising RTS or sending XON.
  3559.      2) Returns to caller immediately.
  3560.  
  3561.  
  3562. entry   AH      0Bh     FOSSIL: Transmit no wait
  3563.         AL      ASCII character value to be sent
  3564.         DX      port number (NOP if DX=00FFh)
  3565. return  AX      0000h   character not accepted
  3566.                 0001h   character accepted
  3567. note    This is exactly the same as the "regular" transmit call except that if
  3568.         there is no space available in the output buffer a value of zero is
  3569.         returned in AX, if room is available a value 1 (one) is returned.
  3570.  
  3571.  
  3572. entry   AH      0Ch     FOSSIL: Nondestructive Read no Wait
  3573.         DX      port number (NOP if DX=00FFh)
  3574. return  AH      character
  3575.                 0FFFFh  character not available
  3576. note 1) Reads async buffer.
  3577.      2) Does not remove keycode from buffer.
  3578.  
  3579.  
  3580. entry   AH      0Dh     FOSSIL: Keyboard read no wait
  3581. return  AX      IBM keyboard scan code or
  3582.                 0FFFFh if no keyboard character available
  3583. note 1) Use IBM-style function key mapping in the high order byte.
  3584.      2) Scan codes for non function keys are not specifically required but may
  3585.         be included.
  3586.      3) Does not remove keycode from buffer.
  3587.  
  3588.  
  3589. entry   AH      0Eh     FOSSIL: Keyboard input with wait
  3590. return  AX      IBM keyboard scan code
  3591. note    Returns the next character from the keyboard or waits if no character
  3592.         is available.
  3593.  
  3594.  
  3595. entry   AH      0Fh     Enable or Disable flow control
  3596.         AL      bit mask describing requested flow control
  3597.            bits 0       XON/XOFF on transmit (watch for XOFF while sending)
  3598.                 1       CTS/RTS (CTS on transmit/RTS on receive)
  3599.                 2       reserved
  3600.                 3       XON/XOFF on receive (send XOFF when buffer near full)
  3601.                 4-7     not used, FOSSIL spec calls for setting to 1
  3602.         DX      port number (NOP if DX=00FFh)
  3603. return  none
  3604. note 1) Bit 2 is reserved for DSR/DTR,  but is not currently supported in any
  3605.         implementation.
  3606.      2) TRANSMIT flow control allows the other end to restrain the transmitter
  3607.         when you are overrunning it. RECEIVE flow control tells the FOSSIL to
  3608.         attempt to do just that if it is being overwhelmed.
  3609.      3) Enabling transmit Xon/Xoff will cause the FOSSIL to stop transmitting
  3610.         upon receiving an Xoff. The FOSSIL will resume transmitting when an Xon
  3611.         is received.
  3612.      4) Enabling CTS/RTS will cause the FOSSIL to cease transmitting when CTS
  3613.         is lowered. Transmission will resume when CTS is raised. The FOSSIL
  3614.         will drop RTS when the receive buffer reaches a predetermined
  3615.         percentage full. The FOSSIL will raise RTS when the receive buffer
  3616.         empties below the predetermined percentage full. The point(s) at which
  3617.         this occurs is left to the individual FOSSIL implementor.
  3618.      5) Enabling receive Xon/Xoff will cause the FOSSIL to send a Xoff when the
  3619.         receive buffer reaches a pre-determined percentage full. An Xon will be
  3620.         sent when the receive buffer empties below the predetermined percentage
  3621.         full. The point(s) at which this occurs is left to the individual
  3622.         FOSSIL implementor.
  3623.      6) Applications using this function should set all bits ON in the high
  3624.         nibble of AL as well. There is a compatible (but not identical) FOSSIL
  3625.         driver implementation that uses the high nibble as a control mask. If
  3626.         your application sets the high nibble to all ones, it will always work,
  3627.         regardless of the method used by any given driver.
  3628.  
  3629.  
  3630. entry   AH      10h     Extended Ctrl-C/Ctrl-K checking and transmit on/off
  3631.         AL      flags bit mask byte (bit set if activated)
  3632.            bits 0       enable/disable Ctrl-C/Ctrl-K checking
  3633.                 1       disable/enable the transmitter
  3634.                 2-7     not used
  3635.         DX      port number (NOP if DX=00FFh)
  3636. return  AX      status byte
  3637.                 0000h   control-C/K has not been received
  3638.                 0001h   control-C/K has been received
  3639. note    This is used primarily for programs that can't trust XON/XOFF at FOSSIL
  3640.         level (such as BBS software).
  3641.  
  3642.  
  3643. entry   AH      11h     FOSSIL: Set current cursor location.
  3644.         DH      row (line) 0-24
  3645.         DL      column     0-79
  3646. return  none
  3647. note 1) This function looks exactly like the int 10h, fn 02h on the IBM PC.
  3648.         The cursor location is passed in DX: row in DH and column in DL. This
  3649.         function treats the screen as a coordinate system whose origin (0,0) is
  3650.         the upper left hand corner of the screen.
  3651.      2) Row and column start at 0.
  3652.  
  3653.  
  3654. entry   AH      12h     FOSSIL: Read current cursor location.
  3655. return  DH      row (line)
  3656.         DL      column
  3657. note 1) Looks exactly like int 10h/fn 03h in the IBM PC BIOS. The current
  3658.         cursor location (same coordinate system as function 16h) is passed back
  3659.         in DX.
  3660.      2) Row and column start at 0.
  3661.  
  3662.  
  3663. entry   AH      13h     FOSSIL: Single character ANSI write to screen.
  3664.         AL      value of character to display
  3665. return  none
  3666. note    This call might not be reentrant since ANSI processing may be through
  3667.         DOS.
  3668.  
  3669.  
  3670. entry   AH      14h     FOSSIL: Enable or disable watchdog processing
  3671.         AL      00h     to disable watchdog
  3672.                 01h     to enable watchdog
  3673.         DX      port number (NOP if DX=00FFh)
  3674. return  none
  3675. note 1) This call will cause the FOSSIL to reboot the system if Carrier Detect
  3676.         for the specified port drops while watchdog is turned on.
  3677.      2) The port need not be active for this function to work.
  3678.  
  3679.  
  3680. entry   AH      15h     Write character to screen using BIOS support routines
  3681.         AL      ASCII code of character to display
  3682. return  none
  3683. note 1) This function is reentrant.
  3684.      2) ANSI processing may not be assumed.
  3685.  
  3686.  
  3687. entry   AH      16h     Insert or Delete a function from the timer tick chain
  3688.         AL      00h     to delete a function
  3689.                 01h     to add a function
  3690.         ES:DX   address of function
  3691. return  AX      0000h   successful
  3692.                 0FFFFh  unsuccessful
  3693.  
  3694.  
  3695. entry   AH      17h     FOSSIL: Reboot system
  3696.         AL      boot type
  3697.                 00h     cold boot
  3698.                 01h     warm boot
  3699. return  none
  3700.  
  3701.  
  3702. entry   AH      18h     FOSSIL: Read block
  3703.         CX      maximum number of characters to transfer
  3704.         DX      port number (NOP if DX=00FFh)
  3705.         ES:DI   pointer to user buffer
  3706. return  AX      number of characters transferred
  3707. note 1) This function does not wait for more characters to become available if
  3708.         the value in CX exceeds the number of characters currently stored.
  3709.      2) ES:DI are left unchanged by the call; the count of bytes actually
  3710.         transferred will be returned in AX.
  3711.  
  3712.  
  3713. entry   AH      19h     FOSSIL: Write block
  3714.         CX      maximum number of characters to transfer
  3715.         DX      port number  (NOP if DX=00FFh)
  3716.         ES:DI   pointer to user buffer
  3717. return  AX      number of characters transfered
  3718. note    ES and DI are not modified by this call.
  3719.  
  3720.  
  3721. entry   AH      1Ah     FOSSIL: Break signal begin or end
  3722.         AL      00h     stop sending 'break'
  3723.                 01h     start sending 'break'
  3724.         DX      port number  (NOP if DX=00FFh)
  3725. return  none
  3726. note 1) Resets all transmit flow control restraints such as an XOFF received
  3727.         from remote.
  3728.      2) Init (fn 04h) or UnInit (fn 05h) will stop an in-progress break.
  3729.      3) The application must determine the "length" of the break.
  3730.  
  3731.  
  3732. entry   AH      1Bh     FOSSIL: Return information about the driver
  3733.         CX      size of user buffer in bytes
  3734.         DX      port number  (if DX=00FFh, port data will not be valid)
  3735.         ES:DI   pointer to user buffer
  3736. return  AX      number of characters transferred
  3737.         ES:DI   user buffer structure:
  3738.                 00h     word    size of structure in bytes
  3739.                 02h     byte    FOSSIL driver version
  3740.                 03h     byte    revision level of this specific driver
  3741.                 04h     dword   FAR pointer to ASCII ID string
  3742.                 08h     word    size of the input buffer in bytes
  3743.                 0Ah     word    number of bytes in input buffer
  3744.                 0Ch     word    size of the output buffer in bytes
  3745.                 0Eh     word    number of bytes in output buffer
  3746.                 10h     byte    width of screen in characters
  3747.                 11h     byte    screen height in characters
  3748.                 12h     byte    actual baud rate, computer to modem
  3749.                                 (see mask in function 00h
  3750. note 1) The baud rate byte contains the bits that fn 00h would use to set the
  3751.         port to that speed.
  3752.      2) The fields related to a particular port (buffer size, space left in the
  3753.         buffer, baud rate) will be undefined if port=0FFh or an invalid port is
  3754.         contained in DX.
  3755.      3) Additional information will always be passed after these, so that the
  3756.         fields will never change with FOSSIL revision changes.
  3757.  
  3758.  
  3759. entry   AH      7Eh     FOSSIL: Install an external application function
  3760.         AL      code assigned to external application
  3761.         ES:DX   pointer to entry point
  3762. return  AX      1954h   FOSSIL driver present
  3763.             not 1954h   FOSSIL driver not present
  3764.         BH      00h     failed
  3765.                 01h     successful
  3766.         BL      code assigned to application (same as input AL)
  3767. note 1) Application codes 80h-0BFh are supported. Codes 80h-83h are reserved.
  3768.      2) An error code of BH=00h with AX=1954h should mean that another external
  3769.         application has already been installed with the code specified in AL.
  3770.      3) Applications are entered via a FAR call and should make a FAR return.
  3771.  
  3772.  
  3773. entry   AH      7Fh     FOSSIL: Remove an external application function
  3774.         AL      code assigned to external application
  3775.         ES:DX   pointer to entry point
  3776. return  AX      1954h
  3777.         BH      00h     failed
  3778.                 01h     successful
  3779.         BL      code assigned to application (same as input AL)
  3780.  
  3781.  
  3782.  
  3783. ┌─────────────────────────────────────────────────────────────────────────────┐
  3784. │Interrupt 15h  Cassette I/O                                            3**8  │
  3785. └─────────────────────────────────────────────────────────────────────────────┘
  3786. (0:0054h)    1) Renamed "System Services" on PS/2 line.
  3787.              2) Issuing int 15h on an XT may cause a system crash.
  3788.                 On AT and after, interrupts are disabled with CLI when the
  3789.                 interrupt service routine is called, but most ROM versions do
  3790.                 not restore interrupts with STI.
  3791.              3) For the original IBM PC, int 15h returns AH=80h and CF set for
  3792.                 all calls with AH not 0,1, or 2.
  3793.              4) For the PC/XT int 15h returns AH=86h, CF set if called at all.
  3794.                 (the PC/XT ROM BIOS does not support int 15h)
  3795.              5) For the AT/339, int 15h returns AH=86h, CF set if called with
  3796.                 an invalid function code.
  3797.  
  3798.  
  3799. Function 00h    Turn Cassette Motor On                          (PC, PCjr only)
  3800. entry   AH      00h
  3801. return  CF      set on error
  3802.                 AH      error code
  3803.                         00h     no errors
  3804.                         01h     CRC error
  3805.                         02h     bad tape signals
  3806.                                 no data transitions (PCjr)
  3807.                         03h     no data found on tape
  3808.                                 not used (PCjr)
  3809.                         04h     no data
  3810.                                 no leader (PCjr)
  3811.                         80h     invalid command
  3812.                         86h     no cassette present
  3813.                                 not valid in PCjr
  3814. note    NOP for systems where cassette not supported.
  3815.  
  3816.  
  3817. Function 01h    Turn Cassette Motor Off                         (PC, PCjr only)
  3818. entry   AH      01h
  3819. return  CF      set on error
  3820.         AH      error code (86h)
  3821. note    NOP for systems where cassette not supported.
  3822.  
  3823.  
  3824. Function 02h    Read Blocks From Cassette                       (PC, PCjr only)
  3825. entry   AH      02h
  3826.         CX      number of bytes to read
  3827.         ES:BX   segment:offset + 1 of last byte read
  3828. return  CF      set on error
  3829.                 AH      error code (01h, 02h, 04h, 80h, 86h)
  3830.         DX      count of bytes actually read
  3831.         ES:BX   pointer past last byte written
  3832. note 1) NOP for systems where cassette not supported.
  3833.      2) Cassette operations normally read 256 byte blocks.
  3834.  
  3835.  
  3836. Function 03h    Write Data Blocks to Cassette                   (PC, PCjr only)
  3837. entry   AH      03h
  3838.         CX      count of bytes to write
  3839.         ES:BX   pointer to data buffer
  3840. return  CF      set on error
  3841.                 AH      error code (80h, 86h)
  3842.         CX      00h
  3843.         ES:BX   pointer to last byte written+1
  3844. note 1) NOP for systems where cassette not supported.
  3845.      2) The last block is padded to 256 bytes with zeroes if needed.
  3846.      3) No errors are returned by this service.
  3847.  
  3848.  
  3849. Function 0Fh    ESDI Format Unit Periodic Interrupt          (PS/2 50+)
  3850. entry   AH      0Fh
  3851.         AL      phase code
  3852.                 00h     reserved
  3853.                 01h     surface analysis
  3854.                 02h     formatting
  3855. return  CF      clear   if formatting should continue
  3856.                 set     if it should terminate
  3857. note 1) Called the BIOS on the ESDI Fixed Disk Drive Adapter/A during a format
  3858.         or surface analysis operation after each cylinder is completed.
  3859.      2) This function call can be captured by a program so that it will be
  3860.         notified as each cylinder is formatted or analyzed. The program can
  3861.         count interrupts for each phase to determine the current cylinder
  3862.         number.
  3863.      3) The BIOS default handler for this function returns with CF set.
  3864.  
  3865.  
  3866. Function 10h    TopView API Function Calls                      (TopView)
  3867.                 see Chapter 17
  3868.  
  3869.  
  3870. Function 20h    PRINT.COM  (DOS 3.1+ internal)         (AT, XT/286, PS/2 50+)
  3871. entry   AH      20h
  3872.         AL      subfunction
  3873.                 00h     disable critical region flag
  3874.                 01h     set critical region flag
  3875.                         ES:BX   pointer to flag byte set while inside DOS calls
  3876.                 10h     set up SysReq routine
  3877.                 11h     completion of SysReq routine (software only)
  3878.  
  3879.  
  3880. Function 21h    Read Power-On Self Test (POST) Error Log           (PS/2 50+)
  3881. entry   AH      21h
  3882.         AL      00h     read POST log
  3883.                 01h     write POST log
  3884.                         BH      device ID
  3885.                         BL      device error code
  3886. return  CF      set on error
  3887.         AH      status
  3888.                 00h     successful read
  3889.                         BX      number of POST error codes stored
  3890.                         ES:DI   pointer to error log
  3891.                 01h     list full
  3892.                 80h     invalid command
  3893.                 86h     function unsupported
  3894. note    The log is a series of words, the first byte of which identifies the
  3895.         error code and the second is the device ID.
  3896.  
  3897.  
  3898. Function 40h    Read/Modify Profiles                            (Convertible)
  3899. entry   AH      40h
  3900.         AL      00h     read system profile in CX,BX
  3901.                 01h     write system profile from CX, BX
  3902.                 02h     read internal modem profile in BX
  3903.                 03h     write internal modem profile from BX
  3904.         BX      profile info
  3905. return  BX      internal modem profile (from 02h)
  3906.         CX,BX   system profile (from 00h)
  3907.  
  3908.  
  3909. Function 41h    Wait On External Event                          (Convertible)
  3910. entry   AH      41h
  3911.         AL      condition type
  3912.            bits 0-2     condition to wait for
  3913.                         0,0,0   any external event
  3914.                         0,0,1   compare and return if equal
  3915.                         0,1,0   compare and return if not equal
  3916.                         0,1,1   test and return if not zero
  3917.                         1,0,0   test and return if zero
  3918.                 3       reserved
  3919.                 4       0       user byte
  3920.                         1       port address
  3921.                 5-7     reserved
  3922.         BH      condition compare or mask value
  3923.                 condition codes:
  3924.                 00h     any external event
  3925.                 01h     compare and return if equal
  3926.                 02h     compare and return if not equal
  3927.                 03h     test and return if not zero
  3928.                 04h     test and return if zero
  3929.         BL      timeout value times 55 milliseconds
  3930.                 00h     if no time limit
  3931.         DX      I/O port address (if AL bit 4=1)
  3932.         ES:DI   pointer to user byte (if AL bit 4=0)
  3933.  
  3934.  
  3935. Function 42h    Request System Power Off                        (Convertible)
  3936. entry   AH      42h
  3937.         AL      00h     to use system profile
  3938.                 01h     to force suspend regardless of profile
  3939. return  unknown
  3940.  
  3941.  
  3942. Function 43h    Read System Status                              (Convertible)
  3943. entry   AH      43h
  3944. return  AL      status byte
  3945.             bit 0       LCD detached
  3946.                 1       reserved
  3947.                 2       RS232/parallel powered on
  3948.                 3       internal modem powered on
  3949.                 4       power activated by alarm
  3950.                 5       bad time
  3951.                 6       external power in use
  3952.                 7       battery low
  3953.  
  3954.  
  3955. Function 44h    (De)activate Internal Modem Power               (Convertible)
  3956. entry   AH      44h
  3957.         AL      00h      to power off
  3958.                 01h      to power on
  3959. return  unknown
  3960.  
  3961.  
  3962. Function 4Fh    OS Hook - Keyboard Intercept          (except PC, PCjr, and XT)
  3963. entry   AH      4Fh
  3964.         AL      scan code, CF set
  3965. return  AL      scan code
  3966.         CF      set     processing desired
  3967.                 clear   scan code should not be used
  3968. note 1) Called by int 9 handler for each keystroke to translate scan codes.
  3969.      2) An OS or a TSR can capture this function to filter the raw keyboard
  3970.         data stream. The new handler can substitute a new scan code, return the
  3971.         same scan code, or return the carry flag clear causing the keystroke to
  3972.         be discarded. The BIOS default routine simply returns the scan code
  3973.         unchanged.
  3974.      3) A program can call int 15h/fn0C0h to determine whether the host
  3975.         machine's BIOS supports keyboard intercept.
  3976.      4) Used internally by PC-MOS/386 v4.00+ for keyboard input.
  3977.      5) Some BIOSes do not properly support this call. However, some versions
  3978.         of KEYB.COM provide additional 4Fh support.
  3979.  
  3980.  
  3981. Function 52h    MicroSoft RAM-Resident Software Specification 1.0
  3982.                 This standard was proposed by MicroSoft in 1986 as a common
  3983.                 interface for TSR programs. It appears to have been largely
  3984.                 unknown or disregarded.
  3985.  
  3986. Function 0: Get Program Information by Name
  3987. entry   DS:BX   The Program ID of the memory-resident program to look for
  3988. return  AL      0FFh    if the program we are looking for is installed
  3989.                 00h     if it is not installed
  3990.         CX      The number of this program. The first program installed is
  3991.                 number 0, with the second program being number 1, etc. By using
  3992.                 a dynamic numbering system, we avoid conflicts between programs
  3993.                 that might otherwise choose the same ID. We also provide a good
  3994.                 way to scan all the resident programs using function 1.
  3995.         ES:DX   pointer to the Program ID Record (PIDR)
  3996. note    This function tests to see if a program is memory resident and returns
  3997.         a pointer to its program information if it is resident. To use this
  3998.         function, set DS:BX to point to the program ID. Each installed program
  3999.         will check to see if this program ID agrees with its own internal
  4000.         program ID.
  4001.  
  4002. Function 1: Get Program Information by Number
  4003. entry   CX      Number of the program we want the information for
  4004.  
  4005. return  AL      0FFh    if the program we are looking for is installed
  4006.                 00h     if it is not installed
  4007.         ES:DX   pointer to the Program ID Record (PIDR)
  4008. note    This function returns exactly the same information as function 0. The
  4009.         only difference is how we identify the program we want, which is
  4010.         determined by its position in the interrupt chain; program 0 is the
  4011.         last program in the chain, and the first program in the chain (usually
  4012.         the most recently installed) has the highest number.
  4013.  
  4014. Function 2: Activate Program
  4015. entry   CX      The number of the program we want to activate
  4016.         DS:BX   Activation Record. This record will give program information on
  4017.                 how and what it should activate within the program
  4018. return  none
  4019. note    This function activates one of the installed programs. It is useful
  4020.         if you want to control many desk accessories with a single control
  4021.         panel like the one used in SideKick. You can also use it with a
  4022.         program like ProKey to run a named macro under program control, or
  4023.         with SideKick to bring up one of the desk accessories from within a
  4024.         program or batch file.
  4025.  
  4026. Function 3: Deactivate Program
  4027. entry   CX      The number of the program we want to deactivate
  4028.         DS:BX   Deactivation Record. This record will give program information
  4029.                 on how and what it should deactivate within the program
  4030. return  none
  4031. note    This function is the opposite of function 2 (activate program).
  4032.  
  4033. Function 4: Enable Program
  4034. entry   CX      The number of the program we want to enable
  4035.         DS:BX   Enable mask record. This mask describes what features we want
  4036.                 to enable. A null record enables all the features.
  4037. return  none
  4038. note    This function is the opposite of function 5 (disable program).
  4039.  
  4040. Function 5: Disable Program
  4041. entry   CX      The number of the program we want to disable
  4042.         DS:BX   Disable mask record.  This mask describes what features we want
  4043.                 to disable. A null record disables all the features.
  4044. return  none
  4045. note    Sometimes it becomes necessary to disable a program to prevent it from
  4046.         conflicting with another program, this function is designed to do that.
  4047.         This function is the opposite of function 4 (Enable Program).
  4048.  
  4049.  
  4050. Function 70h    EEROM handler                                (Tandy 1000HX)
  4051. entry   AH      00h     read from EEROM
  4052.                 BL      00h
  4053.                 01h     write to EEROM
  4054.                 BL      word number to write (0-15)
  4055.                 DX      word value to write
  4056. return  DX      (AH=00h) word value
  4057.         CF      set on error (system is not a Tandy 1000 HX)
  4058.  
  4059.  
  4060. Function 80h    OS Hook - Device Open                        (AT, XT/286, PS/2)
  4061. entry   AH      80h
  4062.         BX      device ID
  4063.         CX      process ID
  4064. return  CF      set on error
  4065.         AH      status
  4066. note 1) Acquires ownership of a logical device for a process.
  4067.      2) This call, along with fns 81h and 82h, defines a simple protocol that
  4068.         can be used to arbitrate usage of devices by multiple processes. A
  4069.         multitasking program manager would be expected to capture int 15h and
  4070.         provide the appropriate service.
  4071.      3) The default BIOS routine for this function simply returns with CF clear
  4072.         and AH=00h.
  4073.  
  4074.  
  4075. Function 81h    Device Close                               (AT, XT/286, PS/2)
  4076. entry   AH      81h
  4077.         BX      device ID
  4078.         CX      process ID
  4079. return  CF      set on error
  4080.         AH      status
  4081. note 1) Releases ownership of a logical device for a process.
  4082.      2) A multitasking program manager would be expected to capture int 15h and
  4083.         provide the appropriate service.
  4084.      3) The BIOS default routine for this function simply returns with the CF
  4085.         clear and AH=00h.
  4086.  
  4087.  
  4088. Function 82h    Program Termination                          (AT, XT/286, PS/2)
  4089.         AH      82h
  4090.         BX      device ID
  4091. return  CF      set on error
  4092.         AH      status
  4093. note 1) Closes all logical devices opened with function 80h.
  4094.      2) A multitasking program manager would be expected to capture int 15h and
  4095.         provide the appropriate service.
  4096.      3) The BIOS default routine for this function simply returns with CF clear
  4097.         and AH=00h.
  4098.  
  4099.  
  4100. Function 83h    Event Wait                 (AT, XT/286, Convertible, PS/2 50+)
  4101. entry   AH      83h
  4102.         AL      00h     to set interval
  4103.                 01h     to cancel
  4104.         CX:DX   number of microseconds to wait (granularity is 976 microseconds)
  4105.         ES:BX   pointer to semaphore flag (bit 7 is set when interval expires)
  4106.                 (pointer is to caller's memory) (some sources list bit 15 set)
  4107. return  CF      clear   OK
  4108.                 set     function already busy
  4109. note 1) Requests setting of a semaphore after a specified interval or cancels a
  4110.         previous request.
  4111.      2) The calling program is responsible for clearing the semaphore before
  4112.         requesting this function.
  4113.      3) The actual duration of an event wait is always an integral multiple of
  4114.         976 microseconds. The CMOS date/clock chip interrupts are used to
  4115.         implement this function.
  4116.      4) Use of this function allows programmed, hardware-independent delays at
  4117.         a finer resolution than can be obtained through use of the MS-DOS Get
  4118.         Time function (int 21h/fn 2Ch) which returns time in hundredths of a
  4119.         second.
  4120.      5) CX:DX is a four-byte integer.
  4121.      7) This function is called by int 70h and is not the normal Int 08h/1Ch
  4122.         clock tick. It is generated by the MC146818A Real Time Clock chip.
  4123.         This is the battery backed up CMOS clock chip.
  4124.  
  4125.  
  4126. Function 84h    Read Joystick Input Settings                 (AT, XT/286, PS/2)
  4127. entry   AH      84h
  4128.         DX      00h     to read the current switch settings  (return in AL)
  4129.                 01h     to read the resistive inputs
  4130. return  CF      set on error
  4131.         (fn 00h)
  4132.         AL      switch settings (bits 7-4)
  4133.         (fn 01h)
  4134.         AX      stick A (X) value
  4135.         BX      stick A (Y) value
  4136.         CX      stick B (X) value
  4137.         DX      stick B (Y) value
  4138. note 1) An error is returned if DX does not contain a valid subfunction number.
  4139.      2) If no game adapter is installed, all returned values are 00h.
  4140.      3) Using a 250K Ohm joystick, the potentiometer values usually lie within
  4141.         the range 0-416 (0000h-01A0h).
  4142.  
  4143.  
  4144. Function 85h    System Request (SysReq) Key Pressed        (except PC, PCjr, XT)
  4145. entry   AH      85h
  4146.         AL      00h      key pressed
  4147.                 01h      key released
  4148. return  CF      set on error
  4149.         AH      error code
  4150. note 1) Called by BIOS keyboard decode routine when the SysReq key is detected.
  4151.      2) The BIOS handler for this call is a dummy routine that always returns a
  4152.         success status unless called with an invalid subfunction number in AL.
  4153.      3) A multitasking program manager would be expected to capture int 15h so
  4154.         that it can be notified when the user strikes the SysReq key.
  4155.  
  4156.  
  4157. Function 86h    Delay                                 (except PC, PCjr, XT)
  4158.         AH      86h
  4159.         CX:DX   4-byte integer, number of microseconds to wait
  4160.                 CX high word, DX low word
  4161. return  CF      clear   after wait elapses
  4162.         CF      set     immediately due to error
  4163. note 1) Suspends the calling program for a specified interval in microseconds.
  4164.      2) The actual duration of the wait is always an integral multiple of 976
  4165.         microseconds.
  4166.      3) Use of this function allows programmed, hardware-independent delays at
  4167.         a finer resolution than can be obtained through use of the MS-DOS Get
  4168.         Time function (int 21h fn 2Ch) which returns time in hundredths of a
  4169.         second).
  4170.      4) This function calls int 70h and is not the normal Int 08h/1Ch
  4171.         clock tick. It is generated by the MC146818A Real Time Clock chip.
  4172.         This is the battery backed up CMOS clock chip.
  4173.  
  4174.  
  4175. Function 87h    Memory Block Move                       (2-3-486 machines only)
  4176.         AH      87h
  4177.         CX      number of words to move
  4178.         ES:SI   pointer to Global Descriptor Table (GDT)
  4179.                 offset 00h-0Fh  reserved, set to zero
  4180.                            00h  null descriptor
  4181.                            08h  uninitialized, will be made into GDT descriptor
  4182.                        10h-11h  source segment length in bytes
  4183.                                 (2*CX-1 or greater)
  4184.                        12h-14h  24-bit linear source address
  4185.                        15h      access rights byte (always 93h)
  4186.                        16h-17h  reserved, set to zero
  4187.                        18h-19h  destination segment length in bytes
  4188.                                 (2*CX-1 or greater)
  4189.                        1Ah-1Ch  24-bit linear destination address
  4190.                        1Dh      access rights byte (always 93h)
  4191.                        1Eh-1Fh  reserved, set to zero
  4192.                            20h *uninitialized, used by BIOS
  4193.                            28h *uninitialized, will be made into SS descriptor
  4194.                               (*) some sources say initialized to zero
  4195. return  CF      set on error
  4196.         AH      status
  4197.                 00h     success - source copied into destination
  4198.                 01h     RAM parity error
  4199.                 02h     exception interrupt error
  4200.                 03h     address line 20 gating failed
  4201. note 1) The GDT table is composed of six 8-byte descriptors to be used by the
  4202.         CPU in protected mode. The four descriptors in offsets 00h-0Fh and
  4203.         20h-2Fh are filled in by the BIOS before the CPU mode switch.
  4204.      2) The addresses used in the descriptor table are linear (physical)
  4205.         24-bit addresses in the range 000000h-0FFFFFFh - not segments and
  4206.         offsets - with the least significant byte at the lowest address and the
  4207.         most significant byte at the highest address.
  4208.      3) Interrupts are disabled during this call; use may interfere with the
  4209.         operation of comm programs, network drivers, or other software that
  4210.         relies on prompt servicing of hardware interrupts.
  4211.      4) This call is not valid in the OS/2 Compatibility Box.
  4212.      5) This call will move a memory block from any real or protected mode
  4213.         address to any other real or protected mode address.
  4214.      6) DESQview does not intercept function 87, but QEXT and QEMM do, thereby
  4215.         allowing function 87 to work correctly inside DV.  VDISK, which uses
  4216.         function 87, works inside DV.  If VDISK is sitting at the 1 MB mark,
  4217.         then the int 19h vector will have a VDISK signature in it.  The normal
  4218.         way to check for VDISK presence is by checking for the string "VDISK"
  4219.         at offset 12h of the segment of the int 19h vector.  If the string
  4220.         matches, then you can determine how much extended memory is reserved
  4221.         for VDISK by looking at offset 2Ch is the 3-byte address of the lowest
  4222.         extended memory address NOT in use by VDISK (i.e. if you see at 2Ch
  4223.         "00 00 14" then that means that VDISK is using memory up to 1 MB +
  4224.         256K).
  4225.  
  4226.  
  4227. Function 88h    Get Extended Memory Size                   (AT, XT/286, PS/2)
  4228. entry   AH      88h
  4229. return  AX      number of contiguous 1K blocks of extended memory starting at
  4230.                 address 1024k
  4231. note 1) This call will not work in the OS/2 Compatibility Box.
  4232.      2) Some BIOSes and software manipulate the Carry Flag when this function
  4233.         is called. When tested on a vanilla 386 with AMI BIOS the machine
  4234.         returned with the carry flag set. When 386-to-the-Max was loaded, the
  4235.         flag was not set.
  4236.      3) Used by IBM VDISK 4.0.
  4237.  
  4238.  
  4239. Function 89h    Switch Processor to Protected Mode         (AT, XT/286, PS/2)
  4240. entry   AH      89h
  4241.         BH      interrupt number for IRQ0, written to ICW2 of 8259 PIC #1
  4242.                 (must be evenly divisible by 8, determines IRQ0-IRQ7)
  4243.         BL      interrupt number for IRQ8, written to ICW2 of 8259 PIC #2
  4244.                 (must be evenly divisible by 8, determines IRQ8-IRQ15)
  4245.         ES:SI   pointer to 8-entry Global Descriptor Table for protected mode:
  4246.                 offset  00h     null descriptor, initialized to zero
  4247.                         08h     GDT descriptor
  4248.                         10h     IDT (Interrupt Descriptor Table) descriptor
  4249.                         18h     DS, user's data segment
  4250.                         20h     ES, user's extra segment
  4251.                         28h     SS, user's stack segment
  4252.                         30h     CS, user's code segment
  4253.                         38h     uninitialized, used to build descriptor for
  4254.                                 BIOS code segment
  4255. return  CF      set on error
  4256.                 AH      0FFh  error enabling address line 20
  4257.         CF      clear   function successful (CPU is in protected mode)
  4258.                 AH      00h
  4259.                 CS      user-defined selector
  4260.                 DS      user-defined selector
  4261.                 ES      user-defined selector
  4262.                 SS      user-defined selector
  4263. note 1) The user must initialize the first seven descriptors; the eighth is
  4264.         filled in by the BIOS to provide addressability for its own execution.
  4265.         The calling program may modify and use the eighth descriptor for any
  4266.         purpose after return from this function call.
  4267.      2) Intercepted by Microsoft's HIMEM.SYS and Quarterdeck's QEMM.SYS.
  4268.  
  4269.  
  4270. Function 90h    Device Busy Loop                         (except PC, PCjr, XT)
  4271. entry   AH      90h
  4272.         AL      predefined device type code:
  4273.                 00h     disk                                     (may timeout)
  4274.                 01h     diskette                                 (may timeout)
  4275.                 02h     keyboard                                 (no timeout)
  4276.                 03h     PS/2 pointing device                     (may timeout)
  4277.                 80h     network
  4278.                                                                  (no timeout)
  4279.                 0FCh    hard disk reset (PS/2)                   (may timeout)
  4280.                 0FDh    diskette motor start                     (may timeout)
  4281.                 0FEh    printer                                  (may timeout)
  4282.         ES:BX   pointer to request block for type codes 80h through 0FFh
  4283.                 (for network adapters ES:BX is a pointer to network control
  4284.                 block)
  4285. return  CF      set     if wait time satisfied
  4286.                 clear   if driver must perform wait
  4287. note 1) Used by NETBIOS, TOPS Network, Tom Wagner's CTASK multitasker.
  4288.      2) Generic type codes are allocated as follows:
  4289.         00h-7Fh   non-reentrant devices; OS must arbitrate access
  4290.                   serially reusable devices
  4291.         80h-0BFh  reentrant devices; ES:BX points to a unique control block
  4292.         0C0h-0FFh wait-only calls, no complementary POST int 15/fn 91h call
  4293.      3) Invoked by the BIOS disk, printer, network, and keyboard handlers prior
  4294.         to performing a programmed wait for I/O completion.
  4295.      4) A multitasking program manager would be expected to capture int 15h/
  4296.         fn 90h so that it can dispatch other tasks while I/O is in progress.
  4297.      5) The default BIOS routine for this function simply returns with the CF
  4298.         clear and AH=00h.
  4299.  
  4300.  
  4301. Function 91h    Interrupt Completed                     (AT, XT/286, PS/2 50+)
  4302. entry   AH      91h
  4303.         AL      type code (see AH=90h above)
  4304.                 00h-7Fh  serially reusable devices
  4305.                 80h-0BFh reentrant devices
  4306.         ES:BX   pointer to request block for type codes 80h through 0BFh
  4307. return  AH       00h
  4308. note 1) Used by NETBIOS and TOPS network, Tom Wagner's CTASK multitasker.
  4309.      2) Invoked by the BIOS disk network, and keyboard handlers to signal that
  4310.         I/O is complete and/or the device is ready.
  4311.      3) Predefined device types that may use Device POST are:
  4312.         00H  disk                   (may timeout)
  4313.         01H  floppy disk            (may timeout)
  4314.         02H  keyboard               (no timeout)
  4315.         03H  PS/2 pointing device   (may timeout)
  4316.         80H  network                (no timeout)
  4317.      4) The BIOS printer routine does not invoke this function because printer
  4318.         output is not interrupt driven.
  4319.      5) A multitasking program manager would be expected to capture int 15h/
  4320.         fn 91h so that it can be notified when I/O is completed and awaken the
  4321.         requesting task.
  4322.      6) The default BIOS routine for this function simply returns with the CF
  4323.         flag clear and AH=00h.
  4324.  
  4325.  
  4326. Function 0C0h   Get System Configuration      (XT after 1/10/86, PC Convertible,
  4327.                                                XT/286, AT, PS/2)
  4328. entry   AH      0C0h
  4329. return  CF      set     if BIOS doesn't support call
  4330.         ES:BX   pointer to ROM system descriptor table
  4331.           bytes 00h-01h number of bytes in the following table (norm. 16 bytes)
  4332.                 02h     system ID byte; see Chapter 2 for interpretation
  4333.                 03h     secondary ID distingushes between AT and XT/286, etc.
  4334.                 04h     BIOS revision level, 0 for 1st release, 1 for 2nd, etc.
  4335.                 05h     feature information byte
  4336.                    bits 0       reserved
  4337.                         1       Micro Channel bus (instead of ISA or EISA)
  4338.                         2       extended BIOS area allocated at 640k
  4339.                         3       wait for external event supported (int 15fn41)
  4340.                                  used on Convertible; reserved on PS/2 systems
  4341.                         4       kbd intrcpt:int 15h, fn 04h called upon int 09h
  4342.                         5       realtime clock installed
  4343.                         6       second 8259 installed (cascaded IRQ2)
  4344.                         7       DMA channel 3 - used by hard disk BIOS
  4345.                 06h     unknown (set to 0) (reserved by IBM)
  4346.                 07h     unknown (set to 0) (reserved by IBM)
  4347.                 08h     unknown (set to 0)
  4348.                 09h     unknown (set to 0) (Award BIOS copyright here)
  4349. note 1) Int 15h is also used for the Multitask Hook on PS/2 machines. No
  4350.         register settings available yet.
  4351.      2) The 1/10/86 XT BIOS returns an incorrect value for the feature byte.
  4352.      3) Novell documents some versions of Netware prior to 2.2 as having
  4353.         problems on PS/2 machines due to a bug which did not return from the
  4354.         interrupt correctly.
  4355.      4) Some AMI BIOSes do not support this function. (early Dell machines)
  4356.  
  4357.  
  4358. Function 0C1h   Return Extended BIOS Data Area Segment Address         (PS/2)
  4359. entry   AH      0C1h
  4360. return  CF      set on error
  4361.         ES      segment of XBIOS data area
  4362. note 1) The XBIOS Data Area is allocated at the high end of conventional memory
  4363.         during the POST (Power-On-Self-Test) sequence.
  4364.      2) The word at 0040:0013h (memory size) is updated to reflect the reduced
  4365.         amount of memory available for DOS and application programs.
  4366.      3) The 1st byte in the XBIOS Data Area is initialized to its length in K.
  4367.      4) A program can determine whether the XBIOS Data Area exists by using
  4368.         int 15h/fn 0C0h.
  4369.  
  4370.  
  4371. Function 0C2h   Pointing Device BIOS Interface      (DesQview 2.x)    (PS/2)
  4372. entry   AH      0C2h
  4373.         AL      00h     Enable/Disable Pointing Device
  4374.                         BH      00h     disable
  4375.                                 01h     enable
  4376.                 01h     Reset Pointing Device
  4377.                          Resets the system's mouse or other pointing device,
  4378.                         sets the sample rate, resolution, and other
  4379.                         characteristics to their default values.
  4380.                         return  BH      device ID (0=first)
  4381.                         note 1) After a reset operation, the state of the
  4382.                                  pointing device is as follows:
  4383.                                  disabled;
  4384.                                  sample rate at 100 reports per second;
  4385.                                  resolution at 4 counts per millimeter;
  4386.                                  scaling at 1 to 1.
  4387.                              2) The data package size is unchanged by this fn.
  4388.                              3) Apps can use the fn 0C2h subfunctions to
  4389.                                 initialize the pointing device to other parms,
  4390.                                 then enable the device with fn 00h.
  4391.                              4) BL is altered on return.
  4392.                 02h     Set Sampling Rate
  4393.                         BH      00h     10/second
  4394.                                 01h     20/second
  4395.                                 02h     40/second
  4396.                                 03h     60/second
  4397.                                 04h     80/second
  4398.                                 05h     100/second  (default)
  4399.                                 06h     200/second
  4400.                 03h     Set Pointing Device Resolution
  4401.                         BH      00h     one count per mm
  4402.                                 01h     two counts per mm
  4403.                                 02h     four counts per mm  (default)
  4404.                                 03h     eight counts per mm
  4405.                 04h     Get Pointing Device Type
  4406.                         return  BH      ID code for the mouse or other pointing
  4407.                                         device
  4408.                 05h     Initialize Pointing Device Interface
  4409.                          Sets the data package size for the system's mouse or
  4410.                         other pointing device, and initializes the resolution,
  4411.                         sampling rate, and scaling to their default values.
  4412.                         BH      data package size (1 - 8 bytes)
  4413.                         note    After this operation, the state of the pointing
  4414.                                 device is as follows:
  4415.                                 a) disabled;
  4416.                                 b) sample rate at 100 reports per second;
  4417.                                 c) resolution at 4 counts per millimeter;
  4418.                                 d) scaling set at 1 to 1.
  4419.                 06h     Get Status or Set Scaling Factor
  4420.                          Returns the current status of the system's mouse or
  4421.                         other pointing device or sets the device's scaling
  4422.                         factor.
  4423.                         BH      00h     return device status
  4424.                                 return  BL      status byte
  4425.                                   bits  0       set if right button pressed
  4426.                                         1       reserved
  4427.                                         2       set if left button pressed
  4428.                                         3       reserved
  4429.                                         4       0       1:1 scaling
  4430.                                                 1       2:1 scaling
  4431.                                         5       0       device disabled
  4432.                                                 1       device enabled
  4433.                                         6       0       stream mode
  4434.                                                 1       remote mode
  4435.                                         7       reserved
  4436.                                         CL      resolution
  4437.                                                 00h     1 count per millimeter
  4438.                                                 01h     2 counts per millimeter
  4439.                                                 02h     4 counts per millimeter
  4440.                                                 03h     8 counts per millimeter
  4441.                                         DL      sample rate (hex count)
  4442.                                                 0Ah     10  reports per second
  4443.                                                 14h     20  reports per second
  4444.                                                 28h     40  reports per second
  4445.                                                 3Ch     60  reports per second
  4446.                                                 50h     80  reports per second
  4447.                                                 64h     100 reports per second
  4448.                                                 0C8h    200 reports per second
  4449.                                 01h     set scaling to 1:1
  4450.                                 02h     set scaling to 2:1
  4451.                 07h     Set Pointing Device Handler Address
  4452.                          Notifies BIOS pointing device driver of the address
  4453.                         for a routine to be called each time pointing device
  4454.                         data is available.
  4455.                         ES:BX   address of user device handler
  4456.                         return  AL      00h
  4457. return  CF      set on error
  4458.         AH      status
  4459.                 00h     successful
  4460.                 01h     invalid function
  4461.                 02h     invalid input
  4462.                 03h     interface error
  4463.                 04h     need to resend
  4464.                 05h     no device handler installed
  4465. note 1) The values in BH for those functions that take it as input are stored
  4466.         in different locations for each subfunction.
  4467.      2) The user's handler for pointing device data is entered via a far call
  4468.         with four parameters on the stack:
  4469.         SS:SP+0Ah    status
  4470.         SS:SP+08h    x coordinate
  4471.         SS:SP+06h    y coordinate
  4472.         SS:SP+04h    z coordinate (always 0)
  4473.          The handler must exit via a far return without removing the parameters
  4474.         from the stack.
  4475.      3) The status parameter word passed to the user's handler is interpreted
  4476.         as follows:
  4477.         bits    0       left button pressed
  4478.                 1       right button pressed
  4479.                 2-3     reserved
  4480.                 4       sign of x data is negative
  4481.                 5       sign of y data is negative
  4482.                 6       x data has overflowed
  4483.                 7       y data has overflowed
  4484.                 8-0Fh   reserved
  4485.  
  4486.  
  4487. Function 0C3h   Enable/Disable Watchdog Timeout                 (PS/2 50+)
  4488. entry   AH      0C3h
  4489.         AL      00h     disable watchdog
  4490.                 01h     enable watchdog
  4491.                         BX      timer counter
  4492. return  CF      set on error
  4493. note 1) The watchdog timer generates an NMI.
  4494.      2) This would be subject to protection with a real OS so temporary masters
  4495.         would not be able to seize the bus forever.
  4496.  
  4497.  
  4498. Function 0C4h   Programmable Option Select                      (PS/2 50+)
  4499. entry   AH      0C4h
  4500.         AL      00h     return base POS register address
  4501.                 01h     enable slot
  4502.                         BL      slot number
  4503.                 02h     enable adapter
  4504. return  CF      set on error
  4505.         DX      base POS register address (if function 00h)
  4506. note 1) Fn 00h returns the base Programmable Option Select register address,
  4507.         enables a slot for setup, or enables an adapter.
  4508.      2) Valid on machines with Micro Channel Architecture (MCA) bus only.
  4509.      3) After a slot is enabled with fn 01h, specific information can be
  4510.         obtained for the adapter in that slot by performing port input
  4511.         operations:
  4512.         Port    Function
  4513.         100h    MCA ID (low byte)
  4514.         101h    MCA ID (high byte)
  4515.         102h    Option Select Byte 1
  4516.             bit 0       0       if disabled
  4517.                         1       if enabled
  4518.         103h    Option Select Byte 2
  4519.         104h    Option Select Byte 3
  4520.         105h    Option Select Byte 4
  4521.                 bits 6-7 are channel check indicators
  4522.         106h    Subaddress Extension (low byte)
  4523.         107h    Subaddress Extension (high byte)
  4524.  
  4525.  
  4526. Function 0C5h   Used by PS/2 Model 50+ and Olivetti MCA machines
  4527.                 Used by Desqview 2.2
  4528.                 Used by Lotus 123 Release 2.2
  4529.                 Used by Microsoft Word 5.0
  4530. note    Functions unknown. Reported by InfoWorld Nov 13 1989's Micro Channel
  4531.         386 test as a conflict between the above software packages. InfoWorld
  4532.         said that Quarterdeck (Desqview) was working on a fix for their
  4533.         product. No other information.
  4534.  
  4535.  
  4536. Function 0DEh   DesQview Services                             (DesQview)
  4537.  
  4538.  
  4539. ┌─────────────────────────────────────────────────────────────────────────────┐
  4540. │Interrupt 16h  Keyboard I/O                                            3**9  │
  4541. └─────────────────────────────────────────────────────────────────────────────┘
  4542. (0:0058h)       Access the keyboard. Scancodes are found in Appendix 1. ASCII
  4543.                 codes are found in Appendix 2.
  4544.  
  4545.                 IBM's original keyboard layout is referred to as the 84-key
  4546.                 or "old style". It has the function keys on the left and an
  4547.                 embedded cursor/numeric keypad on the right. The 101-key "new
  4548.                 style" or "enhanced" keyboard (such as used on the PS/2s) adds
  4549.                 several keys. The early BIOS will not detect the new scancodes
  4550.                 and the new BIOS for some reason added new function calls for
  4551.                 this purpose instead of enhancing the old ones. This causes
  4552.                 some hassle when writing programs which need to support both
  4553.                 keyboards fully. Most programs limit themselves to the 84-key
  4554.                 functions in the interest of backward compatibility.
  4555.  
  4556.                 The SWITCHES CONFIG.SYS command forces DOS 4.0 to use the
  4557.                 standard int 16h requests for keyboard I/O rather than the
  4558.                 extended int 16h requests.
  4559.  
  4560.                 The DOS KEYB command does not hook into the BIOS. It is a total
  4561.                 replacement for the BIOS int9 driver. The only good thing about
  4562.                 this is that you can use 101-key keyboards on old ATs without
  4563.                 support for enhanced keyboards. KEYB is very peculiar in its
  4564.                 handling of the keyboard, causing some programs to break. It
  4565.                 also tends to disable interrupts for a long time while process-
  4566.                 ing each scan code.
  4567.  
  4568.                 There are machines such as the Toshiba 5200 which have 84-key
  4569.                 layouts but "simulate" being 101-key, at least as far as int 16
  4570.                 goes.  (always good for confusing your software...)
  4571.  
  4572.  
  4573. Function  00h   Get Keyboard Input - read the next character in keyboard buffer,
  4574.                 if no key ready, wait for one.
  4575. entry   AH      00h
  4576. return  AH      scan code
  4577.         AL      ASCII character
  4578. note 1) Removes keystroke from buffer (destructive read).
  4579.      2) Does not work with the extra keys on the 101-key "enhanced" keyboard.
  4580.  
  4581.  
  4582. Function  01h   Check Keystroke Buffer - Do Not Clear
  4583. entry   AH      01h
  4584. return  ZF      0 (clear) if character in buffer
  4585.                 1 (set)   if no character in buffer
  4586.         AH      scan code of character (if ZF=0)
  4587.         AL      ASCII character if applicable
  4588. note 1) Keystroke is not removed from buffer. The same character and scan code
  4589.         will be returned by the next call to Int 16h/fn 00h.
  4590.      2) This call flushes the 101-key codes from the buffer if they precede
  4591.         an 84-key code.
  4592.  
  4593.  
  4594. Function  02h   Shift Status - fetch bit flags indicating shift status
  4595. entry   AH      02h
  4596. return  AL      status byte (same as [0040:0017])
  4597.            bits 7       Insert on
  4598.                 6       CapsLock on
  4599.                 5       NumLock on
  4600.                 4       ScrollLock on
  4601.                 3       Alt key down
  4602.                 2       Control key down
  4603.                 1       Left shift (left caps-shift key) down
  4604.                 0       Right shift (right caps-shift key) down
  4605. note    The Keyboard Flags Byte is stored in the BIOS Data Area at 0000:0417h.
  4606.  
  4607.  
  4608. Function 03h    Keyboard - Set Repeat Rate            (PCjr, AT, XT/286, PS/2)
  4609. entry   AH      03h
  4610.         AL      00h     reset typematic defaults                     (PCjr)
  4611.                 01h     increase initial delay                       (PCjr)
  4612.                 02h     decrease repeat rate by 1/2                  (PCjr)
  4613.                 03h     increase both delays by 1/2                  (PCjr)
  4614.                 04h     turn off typematic                           (PCjr)
  4615.                 05h     set typematic rate                           (AT, PS/2)
  4616.         BH      00h-03h for delays of 250ms, 500ms, 750ms, or 1 second
  4617.                         0,0     250ms
  4618.                         0,1     500ms
  4619.                         1,0     750ms
  4620.                         1,1     1 second
  4621.         BL      00h-1Fh for typematic rates of 30cps down to 2cps
  4622.                         00000 30     01011 10.9   10101 4.5
  4623.                         00001 26.7   01100 10     10110 4.3
  4624.                         00010 24     01101 9.2    10111 4
  4625.                         00011 21.8   01110 8.6    11000 3.7
  4626.                         00100 20     01111 8      11001 3.3
  4627.                         00101 18.5   10000 7.5    11010 3
  4628.                         00110 17.1   10001 6.7    11011 2.7
  4629.                         00111 16     10010 6      11100 2.5
  4630.                         01000 15     10011 5.5    11101 2.3
  4631.                         01001 13.3   10011 5.5    11110 2.1
  4632.                         01010 12     10100 5      11111 2
  4633. return  nothing
  4634. note 1) Subfunction 05h is available on ATs with ROM BIOS dated 11/15/85 and
  4635.         later, the XT/286, and the PS/2.
  4636.      2) Subfunction 0 (Return to Default Keyboard State) restores the keyboard
  4637.         to its original state. The original state at power-on is typematic on,
  4638.         normal initial delay and normal typematic rate.
  4639.      3) Subfunction 1 (Increase Initial Delay) increases the delay between the
  4640.         first character typed and the burst of typematic characters.
  4641.      4) For Subfunctions 0 through 4, each time the typematic rate is changed,
  4642.         all previous states are removed.
  4643.      5) Some clone keyboards (Northgate Omnikey and Focus) have much higher
  4644.         repeat rates for the same bit values.
  4645.  
  4646.  
  4647. Function 04h    Keyboard Click Toggle                 (PCjr and Convertible)
  4648. entry   AH      04h
  4649.         AL      00h     for click off
  4650.                 01h     for click on
  4651. return  nothing
  4652.  
  4653.  
  4654. Function 05h    Load Keyboard Buffer            (AT or PS/2 with enhanced kbd)
  4655. entry   AH      05h
  4656.         CH      scan code
  4657.         CL      ASCII character
  4658. return  CF      set on error
  4659.         AL      00h     success
  4660.                 01h     if buffer full
  4661. note    Places a character and scan code at the end of the keyboard type-ahead
  4662.         buffer.
  4663.  
  4664.  
  4665. Function 06h    Keyboard Buffer Write                (Fansi-Console to 2.00)
  4666. entry   AH      06h
  4667.         BX      extended key value to place in typeahead buffer
  4668. return  unknown
  4669. note    This call may be dropped since it now duplicates function 05h.
  4670.  
  4671.  
  4672. Function 07h    Change Shift Key Status              (Fansi-Console to 2.00)
  4673. entry   AH      07h
  4674.         AL      shift key status value
  4675. return  unknown
  4676. note    Status byte is same as function 02h.
  4677.  
  4678.  
  4679. Function 10h    Get Enhanced Keystroke And Read      (F11, F12 Enhanced Keyb'd)
  4680.                 (XT/286, PS/2, AT with "Enhanced" keyboard)
  4681. entry   AH      10h
  4682. return  AH      scan code
  4683.         AL      ASCII character if applicable
  4684. note 1) Reads a character and scan code from the keyboard type-ahead buffer.
  4685.      2) Use this function for the enhanced keyboard instead of int 16h fn 00h.
  4686.         It allows applications to obtain the scan codes for the additional F11,
  4687.         F12, and cursor control keys.
  4688.      3) This is the enhanced version of function 00h.
  4689.  
  4690.  
  4691. Function 11h    Check Enhanced Keystroke         (F11-F12 on enhanced keyboard)
  4692.                 (XT/286, PS/2, AT with "Enhanced" keyboard)
  4693. entry   AH      11h
  4694. return  ZF      0       (clear) if key pressed
  4695.                         AH      scan code
  4696.                         AL      ASCII character if applicable
  4697.                 1       if buffer is empty
  4698. note 1) Keystroke is not removed from buffer. The same char and scan code will
  4699.         be returned by the next call to Int 16h/fn 10h.
  4700.      2) Use this function for the enhanced keyboard instead of int 16h/fn 00h.
  4701.         It allows applications to test for the additional F11, F12, and cursor
  4702.         control keys.
  4703.  
  4704.  
  4705. Function 12h    Extended Get Shift Status         (F11, F12 Enhanced keyboard)
  4706. entry   AH      12h
  4707. return  AX      status word
  4708.                 AL bit  0       right Shift key depressed
  4709.                         1       left Shift key depressed
  4710.                         2       Control key depressed
  4711.                         3       Alt key depressed
  4712.                         4       ScrollLock state active
  4713.                         5       NumLock state active
  4714.                         6       CapsLock state active
  4715.                         7       insert state is active
  4716.                 AH bit  0       left Control key pressed
  4717.                         1       left Alt key depressed
  4718.                         2       right Control key pressed
  4719.                         3       right Alt key depressed
  4720.                         4       Scroll Lock key depressed
  4721.                         5       NumLock key depressed
  4722.                         6       CapsLock key depressed
  4723.                         7       SysReq key depressed
  4724. note    Use this function for the enhanced keyboard instead of int 16h/fn 02h.
  4725.  
  4726.  
  4727. Function  70h, 71h, 72h  Internal Functions       (SEAware's FAKEY.COM)
  4728. note    FAKEY.COM is a TSR keyboard utility distributed to registered users
  4729.         of SEAware products.
  4730.  
  4731.  
  4732. Function  75h   Set Tick Count for Scanning       (pcAnywhere 2.00)
  4733. entry   AH      75h
  4734.         AL      tick count
  4735. return  none
  4736. note 1) Sets count of 55ms timer ticks between checks for new screen changes.
  4737.      2) pcAnywhere is a program that allows operation of a remote machine
  4738.         over a serial link.
  4739.  
  4740.  
  4741. Function  76h   Set Error Checking Mode           (pcAnywhere 2.00)
  4742. entry   AH      76h
  4743.         AL      error checking type
  4744.                 00h     none
  4745.                 01h     fast
  4746.                 02h     slow
  4747. return  none
  4748.  
  4749.  
  4750. Function  77h   reserved                          (pcAnywhere 2.00)
  4751. pcAnywhere API - reserved
  4752.  
  4753.  
  4754. Function  78h   Log Off                           (pcAnywhere 2.00)
  4755. entry   AL      00h     wait for another call
  4756.                 01h     exit but remain TSR
  4757.                 02h     automatic mode - watches DTR
  4758.                 0FFh    leave in current operating mode (pcAnywhere 2.1)
  4759. return  none
  4760.  
  4761.  
  4762. Function  79h   Installation Check                (pcAnywhere 2.00)
  4763. entry   AH      79h
  4764.         AL      00h     installation check
  4765. return  AX      0FFFFh  resident and active
  4766.                 0FFFEh  resident but not active
  4767.                 0FFFDh  resident TSR
  4768.                 0FFFCh  automatic mode
  4769.                 any other value - not resident
  4770.  
  4771.  
  4772. Function  7Ah   Cancel pcAnywhere Session         (pcAnywhere 2.00)
  4773. entry   AH      7Ah
  4774. return  none
  4775. note    Leaves pcAnywhere resident but unable to answer another call.
  4776.  
  4777.  
  4778. Function  7Bh   Enable/Disable Operation          (pcAnywhere 2.00)
  4779. entry   AH      7Bh
  4780.         AL      state
  4781.                 00h     disabled
  4782.                 01h     enabled
  4783. return  none
  4784. note    Remote screen is automatically refreshed when session is enabled.
  4785.  
  4786.  
  4787. Function  7Ch   Get Port Configuration            (pcAnywhere 2.00)
  4788. entry   AH      7Ch
  4789. return  AH      port number in binary (0-15)
  4790.         AL      baud rate
  4791.                 00h     50
  4792.                 01h     75
  4793.                 02h     110
  4794.                 03h     134.5
  4795.                 04h     150
  4796.                 05h     300
  4797.                 06h     600
  4798.                 07h     1200
  4799.                 08h     1800
  4800.                 09h     2000
  4801.                 0Ah     2400
  4802.                 0Bh     4800
  4803.                 0Ch     7200
  4804.                 0Dh     9600
  4805.                 0Fh     19,200
  4806.  
  4807.  
  4808. Function  7Dh   Get/Set Terminal Parameters       (pcAnywhere 2.00)
  4809. entry   AH      7Dh
  4810.         AL      00h     set parameters
  4811.                 01h     get parameters
  4812.                 02h     get configuration header and terminal parameters
  4813.         CX:DS   address of Terminal Parameter Block
  4814. return  AL      00h     nothing
  4815.                 01h     current Terminal Parameter Block in CX:DS
  4816.                 02h     configuration header and Terminal Parameter Block
  4817.                         in CX:DS
  4818. note    Terminal Parameter Block format:   (1152 bytes) (decimal)
  4819.         384 bytes  CRT Control Information
  4820.                 bytes   function
  4821.                 1-8     cursor up
  4822.                9-16     cursor down
  4823.               17-24     cursor left
  4824.               25-32     cursor right
  4825.               33-40     cursor home
  4826.               41-48     clear screen
  4827.               49-56     clear to end of line
  4828.               57-64     clear to end of page
  4829.               65-72     insert line
  4830.               73-80     delete line
  4831.               81-88     insert character
  4832.               89-96     delete character
  4833.              97-104     cursor position lead in
  4834.             105-112     between row and column
  4835.             113-120     after cursor position
  4836.             121-128     CRT initialization
  4837.         256 bytes  Character Translation Table
  4838.                 translates ASCII characters from host. Normally changes IBM
  4839.                 graphics characters to other displayable symbols
  4840.         512 bytes  keyboard sequences
  4841.             641-644     cursor up
  4842.             645-648     cursor down
  4843.             649-652     cursor left
  4844.             653-656     cursor right
  4845.             657-660     home
  4846.             661-664     end
  4847.             665-668     PgUp
  4848.             669-672     PgDn
  4849.             673-676     insert
  4850.             677-680     delete
  4851.             681-684     control-home
  4852.             685-688     control-end
  4853.             689-692     control-PgUp
  4854.             693-696     control-PgDn
  4855.             697-700     escape
  4856.             701-740     F1...F10
  4857.             741-780     sF1...sF10
  4858.             781-820     ^F1...^F10
  4859.             821-860     aF1...aF10
  4860.             861-964     alt A-Z
  4861.            965-1004     alt 0-9
  4862.           1005-1008     alt =
  4863.           1009-1012     alt -
  4864.           1013-1016     print screen
  4865.           1017-1020     ctrl-left arrow
  4866.           1021-1024     ctrl-right arrow
  4867.           1025-1120     reserved
  4868.           1121-1124     begin conv. mode
  4869.           1125-1128     remote printing off
  4870.           1129-1132     remote printing on
  4871.           1133-1136     backspace
  4872.           1137-1140     refresh screen
  4873.           1141-1144     send next code
  4874.           1145-1148     display top 24 lines
  4875.           1149-1152     display bottom 24 lines
  4876.  
  4877.  
  4878. Function  7Eh   Serial I/O Through pcAnywhere Port   (pcAnywhere 2.00)
  4879. entry   AH      7Eh
  4880.         AL      I/O function
  4881.                 01h     get port input status
  4882.                 02h     get port input character
  4883.                 03h     output character
  4884.                 04h     hang up phone
  4885.         CX      ASCII character to output (fn 03h)
  4886. return  (if AL=01h)
  4887.         AX      00h     no character ready
  4888.                 01h     character is available
  4889.         (if AL=02h)
  4890.         AL      ASCII code received
  4891.  
  4892.  
  4893. Function  7Fh   Set Keyboard/Screen Mode            (pcAnywhere 2.00)
  4894. entry   AH      7Fh
  4895.         AL      parameters
  4896.                 00h     enable remote keyboard only  |
  4897.                 01h     enable host keyboard only    |  keyboard group
  4898.                 02h     enable both keyboards        |
  4899.  
  4900.                 08h     display top 24 lines         |  screen group
  4901.                 09h     display bottom 24 lines      |
  4902.  
  4903.                 10h     Hayes modem                  |
  4904.                 11h     other modems                 |  modem group
  4905.                 12h     direct connect               |
  4906.  
  4907.  
  4908. Function 0EDh   Borland Turbo Lightning API  (partial)
  4909. entry   AH      0EDh
  4910.         BH      0EDh
  4911.         BL      function
  4912.                 00h     installation check
  4913.                 02h     pointer to Lightning internal data structure lobyte
  4914.                 03h     pointer to Lightning internal data structure hibyte
  4915.                 04h     load auxiliary dictionary
  4916.                 06h     autoproof mode
  4917.                 0Fh     get number of substitutions (segment)
  4918.         DS:DI   pointer to string to be processed
  4919. return  AX      error code (unknown)
  4920. note    I've made several attempts to get a copy of the Turbo Lightning API,
  4921.         which was originally supposed to be available for developers in 1985.
  4922.         In 1988 Borland sent me a letter saying they were still working on it.
  4923.         In late 1989 the Borland rep on BIX told me basically that there were
  4924.         no plans for releasing the API any more. The information here was
  4925.         dredged from Chris Dunford's LSPELL.PAS interface into Lighting.
  4926.  
  4927.  
  4928. Function 0F0h   Set CPU speed                                     (Compaq 386)
  4929. entry   AH      0F0h    set speed
  4930.         AL      speed
  4931.                 00h     equivalent to 6 mHz 80286 (COMMON)
  4932.                 01h     equivalent to 8 mHz 80286 (FAST)
  4933.                 02h     full 16 mHz (HIGH)
  4934.                 03h     toggles between 8 mHz-equivalent and speed set by
  4935.                         system board switch (AUTO or HIGH)
  4936.                 04h-07h unknown
  4937.                 08h     full 16 mHz except 8 mHz-equivalent during floppy disk
  4938.                         access
  4939.                 09h     specify speed directly
  4940.                         CX      speed value, 1 (slowest) to 50 (full), 3 ~=8088
  4941. return  none?
  4942. note 1) Used by Compaq DOS MODE command.
  4943.  
  4944.  
  4945. Function 0F1h   Read Current CPU Speed                            (Compaq 386)
  4946. entry   AH      0F1h
  4947. return  AL      speed code (see function 0F0h above)
  4948.                 if AL=09h, CX=speed code
  4949.  
  4950.  
  4951. Function 0F2h   Determine Attached Keyboard Type                  (Compaq 386)
  4952. entry   AH      0F2h
  4953. return  AL      type
  4954.                 00h     if 11-bit AT keyboard is in use
  4955.                 01h     if 9-bit PC keyboard is in use
  4956.  
  4957.  
  4958. Function 0FFh   PC-Tools API
  4959. entry   AH      0FFh
  4960. other parameters unknown
  4961. note    PC-Tools is a Swiss-army-knife software package with an editor, DOS
  4962.         shell, cache, disk optimizer, and several other functions from Central
  4963.         Point Software.
  4964.  
  4965.  
  4966. Function 0FFh   2-The-Max VGA-16 Board
  4967. entry   AH      0FFh    query zoom interrupt
  4968. return  AL      zoom interrupt number
  4969.         AL+1    old BIOS keyboard handler interrupt number
  4970.         BX      hot key
  4971.  
  4972.  
  4973.  
  4974. Function 0FFh   Programmer Interface to Carbon Copy Plus (5.0)
  4975. entry   AH      0FFh
  4976.         AL      00h     check connection between CC and CCHELP
  4977. return  BL      00h     Carbon Copy not connected to CCHELP
  4978.                 01h     Carbon Copy is connected to CCHELP
  4979.  
  4980. entry   AL      01h     disconnects and resets the line if the Host or CC
  4981.                         side is connected to CCHELP
  4982.  
  4983. entry   AL      02h     return a pointer to the last phone number dialed by CC
  4984. return  ES:DI           dword pointer to ASCIIZ phone number string
  4985.  
  4986.  
  4987.  
  4988. ┌─────────────────────────────────────────────────────────────────────────────┐
  4989. │Interrupt 17h  Printer                                                 3**10 │
  4990. └─────────────────────────────────────────────────────────────────────────────┘
  4991. (0:005Ch)       access the parallel printer(s)
  4992.                 AH is changed. All other registers left alone.
  4993.  
  4994.                 Printer ports vary widely in compatibility, since the original
  4995.                 IBM MDA's parallel port did not match its own spec.  Many
  4996.                 parallel ports do not use IRQ7 at all.
  4997.  
  4998.                 The parallel port on a monochrome adapter is at 3BCh.  The port
  4999.                 on a parallel printer adapter is at 378h or 278h.  At boot time,
  5000.                 the BIOS looks at them in the order 3BCh, 378h, 278h, and
  5001.                 assigns the first port it finds to LPT1, the second to LPT2,
  5002.                 etc.  If you have a monochrome adapter, LPT1 is probably 3BCh;
  5003.                 otherwise, it is probably 378h.
  5004.  
  5005.  
  5006. Function  00h   Print Character/send AL to printer DX (0, 1, or 2)
  5007. entry   AH      00h
  5008.         AL      ASCII character code
  5009.         DX      printer to be used
  5010.                 00h     PRN or LPT1
  5011.                 01h     LPT2
  5012.                 02h     LPT3
  5013. return  AH      status byte
  5014.            bits 0       time out
  5015.                 1       unused
  5016.                 2       unused
  5017.                 3       I/O error
  5018.                 4       printer selected
  5019.                 5       out of paper
  5020.                 6       acknowledge
  5021.                 7       not busy
  5022.  
  5023.  
  5024. Function 01h    Initialize Printer - set init line low, send 0Ch to printer DX
  5025. entry   AH      01h
  5026.         DX      printer port to be initialized (0,1,2)
  5027. return  status as below
  5028.  
  5029.  
  5030. Function  02h   Printer Status - read status of printer DX into AH
  5031. entry   AH      02h
  5032.         DX      printer port to be used (0,1,2)
  5033. return  AH      status byte
  5034.            bits 7       0       busy/paused: the printer cannot immediately
  5035.                                 take more data because it is in the middle of
  5036.                                 accepting a character, printing a line, is
  5037.                                 offline, or it is in error status.
  5038.                         1       ready
  5039.                 6   ACKnowledge line toggled: reflects the state of the ACK
  5040.                     line on the printer port at the moment the status was read.
  5041.                     ACK is a strobe: it goes low for a very short time (12
  5042.                     microseconds on an Epson) when the printer is ready for
  5043.                     another character. As far as printer status is concerned,
  5044.                     this is useless; it's only useful for something like an
  5045.                     interrupt-driven interface. Most of the time, you'll see
  5046.                     ACK high (bit 6 on), but occasionally, if you check status
  5047.                     just after sending a character, you might see it low.
  5048.                     ACK is low when the printer is powered off.
  5049.                 5   out-of-paper line toggled
  5050.                 4   printer selected: printer is selected/ready/online. There
  5051.                     is usually a button on the printer to control this.
  5052.                 3   I/O error: offline, out of paper or other error condition
  5053.                     such as out of ribbon.
  5054.                 2   unused
  5055.                 1   unused
  5056.                 0   timeout error: printer failed to send ACK and drop busy
  5057.                     after being sent a character.
  5058. note 1) You can expect to see these states in a properly functioning printer:
  5059.         Normal                Offline                Power off
  5060.         ======                =======                =========
  5061.         not busy/paused       busy/paused            busy/paused
  5062.         not out of paper      not out of paper       not out of paper
  5063.         selected/online       not selected/online    not selected/online
  5064.         not I/O error         I/O error (usually)    I/O error
  5065.         not timeout error     not timeout error      not timeout error
  5066.      2) Not all printers return the status codes properly. That's OK, not all
  5067.         clone BIOS do it right either. If your program depends on the return
  5068.         codes, you might want to make the code easily patched or configured
  5069.         for nonstandard hardware.
  5070.  
  5071.  
  5072. Function   03h  Versa-Spool print spooler
  5073. entry   AH      03h     Versa-Spool
  5074.         AL      00h     Return Signature
  5075.                 01h     Toggle Pause
  5076.                 02h     Clear Buffer
  5077.                 03h     Request Pause Condition
  5078.                 04h     Request Free Buffer Space
  5079.                 05h     Request Total Buffer Size
  5080.                 06h     Redirect Output to LPT1
  5081.                 07h     Redirect Output to LPT2
  5082.                 08h     Redirect Output to LPT3
  5083.                 09h     Request Output Device
  5084.                 0Ah     Request Output Speed
  5085.                 0Bh     Request Device Spooled Status
  5086.  
  5087. return  (AH=00h)        AX      1234h   if Versa-Spool is installed
  5088.                                         undefined if not installed
  5089.         (AH=01h)        AX      0001h   if paused
  5090.                                 0000h   if resumed
  5091.         (AH=02h)        AX      0302h   not cleared
  5092.                                 0000h   cleared
  5093.         (AH=03h)        AX      0001h   if paused
  5094.                                 0000h   if resumed
  5095.         (AH=04h)        AX      remaining buffer space (in Kbytes)
  5096.         (AH=05h)        AX      total buffer space (in Kbytes)
  5097.         (AH=06h)        AX      nothing
  5098.         (AH=07h)        AX      nothing
  5099.         (AH=08h)        AX      nothing
  5100.         (AH=09h)        AX      printer output (0..2)
  5101.         (AH=0Ah)        AX      output speed in CPS
  5102.         (AH=0Bh)        AX      0001h   is spooled
  5103.                                 0000h   otherwise
  5104.  
  5105. Function  0C0h  PC Magazine PCSPOOL - get printer status
  5106. entry   AH      0C0h
  5107.         DX      printer port to be used (0,1,2)
  5108. return  ES:BX   address of printer control block
  5109. note    PC Magazine, January 15, 1991. (Vol 10, Number 1)
  5110.  
  5111.  
  5112. Function  0C1h  PC Magazine PCSPOOL - add pause to spool queue
  5113. entry   AH      0C1h
  5114.         DX      printer port to be used (0,1,2)
  5115.         DS:SI   pointer to ASCIIZ string to display
  5116. return  AH      printer status
  5117.  
  5118.  
  5119. Function  0C2h  PC Magazine PCSPOOL - flush queue record
  5120. entry   AH      0C2h
  5121.         DX      printer port to be used (0,1,2)
  5122. return  AH      printer status
  5123.  
  5124.  
  5125. Function  0C3h  PC Magazine PCSPOOL - cancel printer queue
  5126. entry   AH      0C3h
  5127.         DX      printer port to be used (0,1,2)
  5128. return  AH      printer status
  5129.  
  5130.  
  5131. Function  0C4h  PC Magazine PCSPOOL - determine of spooler is active
  5132. entry   AH      0C4h
  5133. return  DI      0B0BFh  if PCSPOOL is loaded
  5134.         SI      segment of the PSP of the active PCSPOOL
  5135.  
  5136.  
  5137. ┌─────────────────────────────────────────────────────────────────────────────┐
  5138. │Interrupt 18h  ROM BASIC                                               3**11 │
  5139. └─────────────────────────────────────────────────────────────────────────────┘
  5140. (0:0060h)       Execute ROM BASIC at address 0F600h:0000h
  5141. entry   no parameters used
  5142. return  jumps into ROM BASIC on IBM systems
  5143. note 1) Often reboots a compatible.
  5144.      2) Used by Turbo C 1.5. 2.0 and later do not use it.
  5145.      3) On IBM systems, this interrupt is called if disk boot failure occurs.
  5146.      4) Video interrupt on DEC Rainbow.
  5147.      5) Digital Research's ROM-based implementation of DR-DOS uses int 18h as
  5148.         the initial entry vector into the operating system code. Note that
  5149.         some clone BIOSes may not properly implement int 18h in the ROM and
  5150.         use of DR-DOS ROMs may not always work.
  5151.      6) Maxon 286/HD laptop: called by BIOS power management routines to
  5152.         communicate with applications.
  5153.  
  5154.  
  5155.  
  5156. ┌─────────────────────────────────────────────────────────────────────────────┐
  5157. │Interrupt 19h  Bootstrap Loader / Extended Memory VDISK ID             3**12 │
  5158. └─────────────────────────────────────────────────────────────────────────────┘
  5159. (0:0064h)
  5160. entry   no parameters used
  5161. return  none
  5162. note 1) Reads track 0, sector 1 into address 0000h:7C00h, then transfers
  5163.         control to that address. If no diskette drive available, looks at
  5164.         absolute address C:800 for a valid hard disk or other ROM. If none,
  5165.         transfers to ROM-BASIC via int 18h or displays loader error message.
  5166.      2) Causes reboot of disk system if invoked while running. (no memory test
  5167.         performed).
  5168.      3) If location 0000:0472h does not contain the value 1234h, a memory test
  5169.         (POST) will be performed before reading the boot sector.
  5170.      4) VDISK from DOS 3.0+ traps this vector to determine when the CPU has
  5171.         shifted from protected mode to real mode. A detailed discussion can
  5172.         be found by Ray Duncan in PC Magazine, May 30, 1989.
  5173.      5) Reportedly, some versions of DOS 2.x and all versions of DOS 3.x+
  5174.         intercept int 19h in order to restore some interrupt vectors DOS takes
  5175.         over, in order to put the machine back to a cleaner state for the
  5176.         reboot, since the POST will not be run on the int 19h. These vectors
  5177.         are reported to be: 02h, 08h, 09h, 0Ah, 0Bh, 0Ch, 0Dh, 0Eh, 70h, 72h,
  5178.         73h, 74h, 75h, 76h, and 77h. After restoring these, it restores the
  5179.         original int 19h vector and calls int 19h.
  5180.      6) The system checks for installed ROMs by searching memory from 0C000h to
  5181.         the beginning of the BIOS, in 2k chunks. ROM memory is identified if it
  5182.         starts with the word 0AA55h. It is followed a one byte field length of
  5183.         the ROM (divided by 512). If ROM is found, the BIOS will call the ROM
  5184.         at an offset of 3 from the beginning. This feature was not supported in
  5185.         the earliest PC machines. The last task turns control over to the
  5186.         bootstrap loader (assuming the floppy controller is operational).
  5187.      7) 8255 port 60h bit 0 = 1 if booting from diskette.
  5188.  
  5189.  
  5190.  
  5191. ┌─────────────────────────────────────────────────────────────────────────────┐
  5192. │Interrupt 1Ah  Time of Day                                             3**13 │
  5193. └─────────────────────────────────────────────────────────────────────────────┘
  5194.  
  5195. (0:0068h)    1) Accesses the PC internal clock.
  5196.              2) This interrupt is not supported on some machines, such as
  5197.                 the HP150 PC.
  5198.              3) Some "turbo" BIOSes run the clock slower than normal in order
  5199.                 to throw off benchmark software, which usually uses int 1Ah
  5200.                 for timekeeping.
  5201.              4) Counts occur at the rate of 1193180/65536 counts/sec (about
  5202.                 18.2 per second).
  5203.  
  5204. Function 00h    Read System Timer Tick Counter                 (except PC)
  5205. entry   AH      00h
  5206. return  AL      00h     if clock was read or written (via AH=0,1) within the
  5207.                         current 24-hour period.
  5208.                 <>0     midnight was passed since last read
  5209.         CX:DX   32-bit tick count (high 16 bits in CX)
  5210. note 1) The returned value is the cumulative number of clock ticks since
  5211.         midnight. There are 18.2 clock ticks per second, or one every 54.92ms.
  5212.         When the counter reaches 1,573,040, it is cleared to zero, and the
  5213.         rollover flag is set.
  5214.      2) The rollover flag is cleared by this function call, so the flag will
  5215.         only be returned nonzero once per day.
  5216.      3) Int 1Ah/fn 01h can be used to set the counter to an arbitrary 32 bit
  5217.         value.
  5218.      4) This function does not return seconds/100 in DL. The best you can do
  5219.         is set it to zero (or any value <=99). This means that your DOS clock
  5220.         could be up to 1 second off from the BIOS clock, however the effect is
  5221.         not cumulative.
  5222.  
  5223.  
  5224. Function 01h    Set Clock Tick Counter Value                    (except PC)
  5225. entry   AH      01h
  5226.         CX:DX   32-bit high word/low word count of timer ticks
  5227. return  none
  5228. note 1) The clock ticks are incremented by timer interrupt at 18.2065 times
  5229.         per second or 54.9254 milliseconds/count. Therefore:
  5230.                 counts per second   18      (12h)
  5231.                 counts per minute   1092    (444h)
  5232.                 counts per hour     65543   (10011h)
  5233.                 counts per day      1573040 (1800B0h)
  5234.      2) The counter is zeroed when system is rebooted.
  5235.      3) Stores a 32-bit value in the clock tick counter.
  5236.      4) The rollover flag is cleared by this call.
  5237.  
  5238.  
  5239. Function 02h    Read Real Time Clock Time                       (AT and after)
  5240. entry   AH      02h
  5241. return  CH      hours in BCD
  5242.         CL      minutes in BCD
  5243.         DH      seconds in BCD
  5244.         DL      00h     standard time
  5245.                 01h     daylight savings time
  5246.         CF      0       if clock running
  5247.                 1       if clock not operating
  5248. note 1) Reads the current time from the CMOS time/date chip.
  5249.      2) Also for Leading Edge Model M.
  5250.      3) According to Phoenix this call will fail if the BIOS is "updating" its
  5251.         clock value. You should check the carry flag and retry if it is set
  5252.         following the call.
  5253.  
  5254.  
  5255. Function 03h    Set Real Time Clock Time                        (AT and after)
  5256. entry   AH      03h
  5257.         CH      hours in BCD
  5258.         CL      minutes in BCD
  5259.         DH      seconds in BCD
  5260.         DL      0 (clear) if standard time
  5261.                 1 (set)   if daylight savings time option
  5262. return  none
  5263. note 1) Sets the time in the CMOS time/date chip.
  5264.      2) Also for Leading Edge Model M.
  5265.  
  5266.  
  5267. Function 04h    Read Real Time Clock Date                       (AT and after)
  5268. entry   AH      04h
  5269. return  CH      century in BCD (19 or 20)
  5270.         CL      year in BCD
  5271.         DH      month in BCD
  5272.         DL      day in BCD
  5273.         CF      0 (clear) if clock is running
  5274.                 1 (set)   if clock is not operating
  5275. note 1) Reads the current date from the CMOS time/date chip.
  5276.      2) Also for Leading Edge Model M.
  5277.  
  5278.  
  5279. Function 05h    Set Real Time Clock Date                        (AT and after)
  5280. entry   AH      05h
  5281.         CH      century in BCD (19 or 20)
  5282.         CL      year in BCD
  5283.         DH      month in BCD
  5284.         DL      day in BCD
  5285. return  none
  5286. note 1) Sets the date in the CMOS time/date chip.
  5287.      2) Also for Leading Edge Model M.
  5288.  
  5289.  
  5290. Function 06h    Set Real Time Clock Alarm                       (AT and after)
  5291. entry   AH      06h
  5292.         CH      hours in BCD
  5293.         CL      minutes in BCD
  5294.         DH      seconds in BCD
  5295. return  CF      set if alarm already set or clock inoperable
  5296. note 1) Sets alarm in the CMOS date/time chip. Int 4Ah occurs at specified
  5297.         alarm time every 24hrs until reset with Int 1Ah/fn 07h.
  5298.      2) A side effect of this function is that the clock chip's interrupt
  5299.         level (IRQ8) is enabled.
  5300.      3) Only one alarm may be active at any given time.
  5301.      4) The program using this function must place the address of its interrupt
  5302.         handler for the alarm in the vector for Int 4Ah.
  5303.  
  5304.  
  5305. Function 07h    Reset Real Time Clock Alarm                     (AT and after)
  5306. entry   AH      07h
  5307. return  none
  5308. note 1) Cancels any pending alarm request on the CMOS date/time chip.
  5309.      2) This function does not disable the clock chip's interrupt level (IRQ8).
  5310.  
  5311.  
  5312. Function 08h    Set Real Time Clock Activated Power On Mode     (Convertible)
  5313. entry   AH      08h
  5314.         CH      hours in BCD
  5315.         CL      minutes in BCD
  5316.         DH      seconds in BCD
  5317.  
  5318.  
  5319. Function 09h    Read Real Time Clock Alarm Time and Status
  5320.                                                 (Convertible and PS/2 Model 30)
  5321. entry   AH      09h
  5322. return  CH      hours in BCD
  5323.         CL      minutes in BCD
  5324.         DH      seconds in BCD
  5325.         DL      alarm status:
  5326.                 00h     if alarm not enabled
  5327.                 01h     if alarm enabled but will not power up system
  5328.                 02h     if alarm will power up system
  5329.  
  5330.  
  5331. Function 0Ah    Read System-Timer Day Counter                          (PS/2)
  5332. entry   AH      0Ah
  5333. return  CF      set on error
  5334.         CX      count of days since Jan 1,1980
  5335. note    Returns the contents of the system's day counter.
  5336.  
  5337.  
  5338. Function 0Bh    Set System-Timer Day Counter                           (PS/2)
  5339. entry   AH      0Bh
  5340.         CX      count of days since Jan 1,1980
  5341. return  CF      set on error
  5342. note    Stores an arbitrary value in the system's day counter.
  5343.  
  5344.  
  5345. Function 80h    Set Up Sound Multiplexor                (PCjr) (Tandy 1000?)
  5346. entry   AH      80h
  5347.         AL      sound source
  5348.                 00h     source is 8253 timer chip, channel 2
  5349.                 01h     source is cassette input
  5350.                 02h     source is I/O channel "audio in" line
  5351.                 03h     source is TI sound generator chip
  5352. return  none
  5353. note    Sets up the source for tones that will appear on the PCjr's Audio Out
  5354.         bus line or RF modulator.
  5355.  
  5356.  
  5357. Function 1Ah    Read Time and Date                                 (AT&T 6300)
  5358. entry   AH      0FEh
  5359. return  BX      days count (1=Jan 1, 1984)
  5360.         CH      hours
  5361.         CL      minutes
  5362.         DH      seconds
  5363.         DL      hundredths
  5364. note    Day count in BX is unique to AT&T/Olivetti computers.
  5365.  
  5366.  
  5367.  
  5368. ┌─────────────────────────────────────────────────────────────────────────────┐
  5369. │Interrupt 1Bh  Control-Break                                           3**14 │
  5370. └─────────────────────────────────────────────────────────────────────────────┘
  5371. (0:006Ch)       This interrupt is called when the keyboard handler of the IBM
  5372.                 machines detects Ctrl and Break pressed at the same time. DOS
  5373.                 normally point this interrupt at its own Ctrl-Break handler.
  5374.  
  5375. note 1) If the break occurred while processing an interrupt, one or more
  5376.         end of interrupt commands must be send to the 8259 Programmable
  5377.         Interrupt Controller.
  5378.      2) All I/O devices should be reset in case an operation was underway at
  5379.         the time.
  5380.      3) It is normally pointed to an IRET during system initialization so that
  5381.         it does nothing, but some programs change it to return a Ctrl-C scan
  5382.         code and thus invoke int 23h.
  5383.  
  5384.  
  5385.  
  5386. ┌─────────────────────────────────────────────────────────────────────────────┐
  5387. │Interrupt 1Ch  Timer Tick                                              3**15 │
  5388. └─────────────────────────────────────────────────────────────────────────────┘
  5389. (0:0070h)
  5390. note 1) Taken 18.2065 times per second by the int 08h interrupt.
  5391.      2) Normally vectors to dummy IRET unless PRINT.COM has been installed.
  5392.      3) If an application moves the interrupt pointer, it is the responsibility
  5393.         of that application to save and restore all registers that may be
  5394.         modified.
  5395.      4) returns values at absolute address 40:6x (BIOS Data Area); number of
  5396.         ticks since midnight
  5397.         40:6C   word    timer counter high word
  5398.         40:6E   word    timer counter low word
  5399.      5) Ventura Publisher 2.0 grabs this interrupt and does not pass subsequent
  5400.         vector reassignments along. This causes problems with some TSRs and
  5401.         network software.
  5402.      6) When installing a user interrupt for int 1Ch, the external interrupts
  5403.         must be disabled before the vector is altered. If a timer interrupt
  5404.         occurs between the setting of the offset and segment, an incorrect
  5405.         address will result.
  5406.  
  5407.  
  5408. ┌─────────────────────────────────────────────────────────────────────────────┐
  5409. │Interrupt 1Dh  Vector of Video Initialization Parameters               3**16 │
  5410. └─────────────────────────────────────────────────────────────────────────────┘
  5411. (0:0074h)       This doubleword address points to 3 sets of 16-bytes containing
  5412.                 data to initialize for video modes for video modes 0 & 1 (40
  5413.                 column), 2 & 3 (80 column), and 4, 5 & 6 (graphics) on the
  5414.                 Motorola 6845 CRT controller chip.
  5415.  6845 registers:
  5416.         R0      horizontal total                (horizontal sync in characters)
  5417.         R1      horizontal displayed                      (characters per line)
  5418.         R2      horizontal sync position           (move display left or right)
  5419.         R3      sync width         (vertical and horizontal pulse: 4-bits each)
  5420.         R4      vertical total                          (total character lines)
  5421.         R5      vertical adjust                (adjust for 50 or 60 Hz refresh)
  5422.         R6      vertical displayed                   (lines of chars displayed)
  5423.         R7      vertical sync position               (lines shifted up or down)
  5424.         R8      interlace (bits 4 and 5) and skew (bits 6 and 7)
  5425.         R9      max scan line addr               (scan lines per character row)
  5426.         R10     cursor start                     (starting scan line of cursor)
  5427.         R11     cursor stop                        (ending scan line of cursor)
  5428.         R12     video memory start address high byte                   (6 bits)
  5429.         R13     video memory start address low byte                    (8 bits)
  5430.         R14     cursor address high byte                               (6 bits)
  5431.         R15     cursor address low byte                                (8 bits)
  5432.  
  5433.  6845 Video Init Tables:
  5434.         table for modes 0 and 1   \
  5435.         table for modes 2 and 3    \ each table is 16 bytes long and
  5436.         table for modes 4,5, and 6 / contains values for 6845 registers
  5437.         table for mode 7          /
  5438.       4 words   size of video RAM for modes 0/1, 2/3, 4/5, and 6/7
  5439.       8 bytes   number of columns in each mode
  5440.       8 bytes   video controller mode byte for each mode
  5441. note 1) There are 4 separate tables, and all 4 must be initialized if all
  5442.         video modes will be used.
  5443.      2) The power-on initialization code of the computer points this vector
  5444.         to the ROM BIOS video routines.
  5445.      3) IBM recommends that if this table needs to be modified, it should be
  5446.         copied into RAM and only the necessary changes made.
  5447.  
  5448.  
  5449.  
  5450.  
  5451. ┌─────────────────────────────────────────────────────────────────────────────┐
  5452. │Interrupt 1Eh  Vector of Diskette Controller Parameters                3**17 │
  5453. └─────────────────────────────────────────────────────────────────────────────┘
  5454. (0:0078h)       Dword address points to data base table that is used by BIOS.
  5455.                 Default location is at 0F000:0EFC7h. 11-byte table format:
  5456.           bytes:
  5457.                 00h     4-bit step rate, 4-bit head unload time
  5458.                 01h     7-bit head load time, 1-bit DMA flag
  5459.                 02h     54.9254 ms ticks - delay til motor off (36-38 typical)
  5460.                 03h     sector size:
  5461.                         00h     128 bytes
  5462.                         01h     256 bytes
  5463.                         02h     512 bytes
  5464.                         03h     1024 bytes
  5465.                 04h     last sector on track                  (8 or 9 typical)
  5466.                 05h     inter-sector gap on read/write            (42 typical)
  5467.                 06h     data length for DMA transfers           (0FFh typical)
  5468.                 07h     gap length between sectors for format     (80 typical)
  5469.                 08h     sector fill byte for format             (0F6h typical)
  5470.                 09h     head settle time (in milliseconds)  (15 to 25 typical)
  5471.                         DOS 1.0   0
  5472.                         DOS 1.10  0
  5473.                         DOS 2.10  15
  5474.                         DOS 3.1   1
  5475.                 0Ah     motor start time (in 1/8 sec intervals)  (2-4 typical)
  5476.                         DOS 2.10  2
  5477. note 1) This vector is pointed to the ROM BIOS diskette tables on system
  5478.         initialization
  5479.      2) IBM recommends that if this table needs to be modified, it should be
  5480.         copied into RAM and only the necessary changes made.
  5481.      3) Some versions of DOS 3.2 may contain a bug. DOS 3.2 assumes that the
  5482.         dword at 0070:0F37 contains the address of the diskette parameter
  5483.         block and changes values in that block. The location does contain a
  5484.         copy of the value at 0:78 (int 1Eh, DISK_POINTER) if DOS is booted from
  5485.         diskette, but when booted from the hard disk, the location contains
  5486.         0:0. This leads to strange things, especially when running under a
  5487.         debugger since DOS overwrites parts of the interrupt vectors for
  5488.         interrupts 1 to 3. The solution to the problem is to either upgrade
  5489.         to DOS 3.3 or to copy the disk parameter vector to 70:0F37 before
  5490.         running or at the start of your program.
  5491.  
  5492.  
  5493.  
  5494. ┌─────────────────────────────────────────────────────────────────────────────┐
  5495. │Interrupt 1Fh  Ptr to Graphics Character Extensions (Graphics Set 2)   3**18 │
  5496. └─────────────────────────────────────────────────────────────────────────────┘
  5497. (0:007Ch)       This is the pointer to data used by the ROM video routines to
  5498.                 display characters above ASCII 127 while in CGA medium and high
  5499.                 res graphics modes.
  5500.  
  5501. note 1) Doubleword address points to 1K table composed of 28 8-byte character
  5502.         definition bit-patterns. First byte of each entry is top row, last byte
  5503.         is bottom row.
  5504.      2) The first 128 character patterns are located in system ROM.
  5505.      3) This vector is set to 000:0 at system initialization.
  5506.      4) Used by DOS' external GRAFTABL command.
  5507.  
  5508.  
  5509.        **  Programmer's Technical Reference for MSDOS and the IBM PC **
  5510.                 USA copyright TXG 392-616  ALL RIGHTS RESERVED
  5511. ───────────────────────────────┤ DOSREF (tm) ├────────────────────────────────
  5512.                      ISBN 1-878830-02-3 (disk-based text)
  5513.                     Copyright (c) 1987, 1991 Dave Williams
  5514.                         ┌─────────────────────────────┐
  5515.                         │ Shareware Version, 12/20/91 │
  5516.                         │  Please Register Your Copy  │
  5517.                         └─────────────────────────────┘
  5518.  
  5519.  
  5520.                            C H A P T E R    F O U R
  5521.  
  5522.                        DOS INTERRUPTS AND FUNCTION CALLS
  5523.  
  5524.        note: The registered version of this chapter is twice this size.
  5525.  
  5526.  
  5527.  
  5528. DOS REGISTERS├─────────────────────────────────────────────────────────────────
  5529.  
  5530.  DOS uses the following registers, pointers, and flags when it executes
  5531. interrupts and function calls:
  5532. ┌───────────────────┬──────────┬───────────────────────────────────────────────┐
  5533. │GENERAL REGISTERS  │ register │                  definition                   │
  5534. │                   ├──────────┼───────────────────────────────────────────────┤
  5535. │                   │    AX    │  accumulator (16 bit)                         │
  5536. │                   │    AH    │  accumulator high-order byte (8 bit)          │
  5537. │                   │    AL    │  accumulator low order byte (8 bit)           │
  5538. │                   │    BX    │  base (16 bit)                                │
  5539. │                   │    BH    │  base high-order byte (8 bit)                 │
  5540. │                   │    BL    │  base low-order byte (8 bit)                  │
  5541. │                   │    CX    │  count (16 bit)                               │
  5542. │                   │    CH    │  count high order byte (8 bit)                │
  5543. │                   │    CL    │  count low order byte (8 bit)                 │
  5544. │                   │    DX    │  data (16 bit)                                │
  5545. │                   │    DH    │  date high order byte (8 bit)                 │
  5546. │                   │    DL    │  data low order byte (8 bit)                  │
  5547. ├───────────────────┼──────────┼───────────────────────────────────────────────┤
  5548. │SEGMENT REGISTERS  │ register │                  definition                   │
  5549. │                   ├──────────┼───────────────────────────────────────────────┤
  5550. │                   │    CS    │  code  segment (16 bit)                       │
  5551. │                   │    DS    │  data  segment (16 bit)                       │
  5552. │                   │    SS    │  stack segment (16 bit)                       │
  5553. │                   │    ES    │  extra segment (16 bit)                       │
  5554. ├───────────────────┼──────────┼───────────────────────────────────────────────┤
  5555. │INDEX REGISTERS    │ register │                  definition                   │
  5556. │                   ├──────────┼───────────────────────────────────────────────┤
  5557. │                   │    DI    │  destination index (16 bit)                   │
  5558. │                   │    SI    │  stack       index (16 bit)                   │
  5559. ├───────────────────┼──────────┼───────────────────────────────────────────────┤
  5560. │SEGMENT REGISTERS  │ register │                  definition                   │
  5561. │                   ├──────────┼───────────────────────────────────────────────┤
  5562. │                   │    CS    │  code  segment (16 bit)                       │
  5563. │                   │    DS    │  data  segment (16 bit)                       │
  5564. │                   │    SS    │  stack segment (16 bit)                       │
  5565. │                   │    ES    │  extra segment (16 bit)                       │
  5566. ├───────────────────┼──────────┼───────────────────────────────────────────────┤
  5567. │INDEX REGISTERS    │ register │                  definition                   │
  5568. │                   ├──────────┼───────────────────────────────────────────────┤
  5569. │                   │    DI    │  destination index (16 bit)                   │
  5570. │                   │    SI    │  stack       index (16 bit)                   │
  5571. ├───────────────────┼──────────┼───────────────────────────────────────────────┤
  5572. │POINTERS           │ register │                  definition                   │
  5573. │                   ├──────────┼───────────────────────────────────────────────┤
  5574. │                   │    SP    │  stack pointer (16 bit)                       │
  5575. │                   │    BP    │  base pointer (16 bit)                        │
  5576. │                   │    IP    │  instruction pointer (16 bit)                 │
  5577. ├───────────────────┴──────────┴───────────────────────────────────────────────┤
  5578. │FLAGS                   AF, CF, DF, IF, OF, PF, SF, TF, ZF                    │
  5579. └──────────────────────────────────────────────────────────────────────────────┘
  5580.  
  5581.  These registers, pointers, and flags are "lowest common denominator" 8088-8086
  5582. CPU oriented. DOS makes no attempt to use any of the special or enhanced
  5583. instructions availible on the later CPUs which will execute 8088 code, such as
  5584. the 80186, 80286, 80386, or NEV V20, V30, V40, or V50.
  5585.  
  5586.  When DOS takes control after a function call, it switches to an internal
  5587. stack. Registers which are not used to return information (other than AX) are
  5588. preserved. The calling program's stack must be large enough to accomodate the
  5589. interrupt system - at least 128 bytes in addition to other interrupts.
  5590.  DOS actually maintains three stacks -
  5591. stack 1: 384 bytes (in DOS 3.1)
  5592.          for functions 00h and for 0Dh and up, and for ints 25h and 26h.
  5593.  
  5594. stack 2: 384 bytes (in DOS 3.1)
  5595.          for function calls 01h through 0Ch.
  5596.  
  5597. stack 3: 48 bytes (in DOS 3.1)
  5598.          for functions 0Dh and above. This stack is the initial stack used by
  5599.          the int 21h handler before it decides which of the other two to use.
  5600.          It is also used by function 59h (get extended error), and 01h to 0Ch if
  5601.          they are called during an int 24h (critical error) handler. Functions
  5602.          33h (get/set break flag), 50h (set process ID), 51h (get process ID)
  5603.          and 62h (get PSP address) do not use any DOS stack under DOS 3.x
  5604.          (under 2.x, 50h and 51h use stack number 2).
  5605.  
  5606.  IBM and Microsoft made a change back in DOS 3.0 or 3.1 to reduce the size of
  5607. DOS. They reduced the space allocated for scratch areas when interrupts are
  5608. being processed. The default seems to vary with the DOS version and the
  5609. machine, but 8 stack frames seems to ring a bell. That means that if you get
  5610. more than 8 interrupts at the same time, clock, disk, printer spooler,
  5611. keyboard, com port, etc., the system will crash. It seems to happen usually on
  5612. a network. STACKS=16,256 means allow 16 interrupts to interrupt each other and
  5613. allow 256 bytes for each for scratch area. Eight is marginal.
  5614.  
  5615.  DOS 3.2 does some different stack switching than previous versions. The
  5616. interrupts which are switched are 02h, 08h, 09h, 0Ah, 0Bh, 0Ch, 0Dh, 0Eh, 70h,
  5617. 72h, 73h, 74h, 75h, 76h, and 77h. DOS 3.2 has a special check in the
  5618. initialization code for a PCjr and don't enable stack switching on that machine.
  5619.  
  5620.  
  5621.  
  5622. INTERRUPTS├────────────────────────────────────────────────────────────────────
  5623.  
  5624.  Microsoft recommends that a program wishing to examine or set the contents of
  5625. any interrupt vector use the DOS function calls 35h and 25h provided for those
  5626. purposes and avoid referencing the interrupt vector locations directly.
  5627.  DOS reserves interrupt numbers 20h to 3Fh for its own use. This means absolute
  5628. memory locations 80h to 0FFh are reserved by DOS. The defined interrupts are as
  5629. follows with all values in hexadecimal.
  5630.  
  5631.  
  5632. ┌─────────────────────────────────────────────────────────────────────────────┐
  5633. │Interrupt 21h  Function Call Request                                         │
  5634. └─────────────────────────────────────────────────────────────────────────────┘
  5635. (0:0084h)
  5636.  DOS provides a wide variety of function calls for character device I/O, file
  5637. management, memory management, date and time functions,execution of other
  5638. programs, and more. They are grouped as follows:
  5639.  
  5640.           call              description
  5641.         00h             program terminate
  5642.         01h-0Ch         character device I/O, CP/M compatibility format
  5643.         0Dh-24h         file management,      CP/M compatibility format
  5644.         25h-26h         nondevice functions,  CP/M compatibility format
  5645.         27h-29h         file management,      CP/M compatibility format
  5646.         2Ah-2Eh         nondevice functions,  CP/M compatibility format
  5647.         2Fh-38h         extended functions
  5648.         39h-3Bh         directory group
  5649.         3Ch-46h         extended file management
  5650.         47h             directory group
  5651.         48h-4Bh         extended memory management
  5652.         54h-57h         extended functions
  5653.         5Eh-5Fh         networking
  5654.         60h-62h         extended functions
  5655.         63h-66h         enhanced foreign language support
  5656.  
  5657.  
  5658. List of DOS services:   * = undocumented
  5659.         00h     terminate program
  5660.         01h     get keyboard input
  5661.         02h     display character to STDIO
  5662.         03h     get character from STDAUX
  5663.         04h     output character to STDAUX
  5664.         05h     output character to STDPRN
  5665.         06h     direct console I/O - keyboard to screen
  5666.         07h     get char from std I/O without echo
  5667.         08h     get char from std I/O without echo, checks for ^C
  5668.         09h     display a string to STDOUT
  5669.         0Ah     buffered keyboard input
  5670.         0Bh     check STDIN status
  5671.         0Ch     clear keyboard buffer and invoke keyboard function
  5672.         0Dh     flush all disk buffers
  5673.         0Eh     select disk
  5674.         0Fh     open file with File Control Block
  5675.         10h     close file opened with File Control Block
  5676.         11h     search for first matching file entry
  5677.         12h     search for next matching file entry
  5678.         13h     delete file specified by File Control Block
  5679.         14h     sequential read from file specified by File Control Block
  5680.         15h     sequential write to file specified by File Control Block
  5681.         16h     find or create firectory entry for file
  5682.         17h     rename file specified by file control block
  5683.         18h*    unknown
  5684.         19h     return current disk drive
  5685.         1Ah     set disk transfer area (DTA)
  5686.         1Bh     get current disk drive FAT
  5687.         1Ch     get disk FAT for any drive
  5688.         1Dh*    unknown
  5689.         1Eh*    unknown
  5690.         1Fh*    read DOS disk block, default drive
  5691.         20h*    unknown
  5692.         21h     random read from file specified by FCB
  5693.         22h     random write to file specified by FCB
  5694.         23h     return number of records in file specified by FCB
  5695.         24h     set relative file record size field for file specified by FCB
  5696.         25h     set interrupt vector
  5697.         26h     create new Program Segment Prefix (PSP)
  5698.         27h     random file block read from file specified by FCB
  5699.         28h     random file block write to file specified by FCB
  5700.         29h     parse the command line for file name
  5701.         2Ah     get the system date
  5702.         2Bh     set the system date
  5703.         2Ch     get the system time
  5704.         2Dh     set the system time
  5705.         2Eh     set/clear disk write VERIFY
  5706.         2Fh     get the Disk Transfer Address (DTA)
  5707.         30h     get DOS version number
  5708.         31h     TSR, files opened remain open
  5709.         32h*    read DOS Disk Block
  5710.         33h     get or set Ctrl-Break
  5711.         34h*    INDOS  Critical Section Flag
  5712.         35h     get segment and offset address for an interrupt
  5713.         36h     get free disk space
  5714.         37h*    get/set option marking character (SWITCHAR)
  5715.         38h     return country-dependent information
  5716.         39h     create subdirectory
  5717.         3Ah     remove subdirectory
  5718.         3Bh     change current directory
  5719.         3Ch     create and return file handle
  5720.         3Dh     open file and return file handle
  5721.         3Eh     close file referenced by file handle
  5722.         3Fh     read from file referenced by file handle
  5723.         40h     write to file referenced by file handle
  5724.         41h     delete file
  5725.         42h     move file pointer (move read-write pointer for file)
  5726.         43h     set/return file attributes
  5727.         44h     device IOCTL (I/O control) info
  5728.         45h     duplicate file handle
  5729.         46h     force a duplicate file handle
  5730.         47h     get current directory
  5731.         48h     allocate memory
  5732.         49h     release allocated memory
  5733.         4Ah     modify allocated memory
  5734.         4Bh     load or execute a program
  5735.         4Ch     terminate prog and return to DOS
  5736.         4Dh     get return code of subprocess created by 4Bh
  5737.         4Eh     find first matching file
  5738.         4Fh     find next matching file
  5739.         50h*    set new current Program Segment Prefix (PSP)
  5740.         51h*    puts current PSP into BX
  5741.         52h*    pointer to the DOS list of lists
  5742.         53h*    translates BPB (Bios Parameter Block, see below)
  5743.         54h     get disk verification status (VERIFY)
  5744.         55h*    create PSP: similar to function 26h
  5745.         56h     rename a file
  5746.         57h     get/set file date and time
  5747.         58h     get/set allocation strategy             (DOS 3.x)
  5748.         59h     get extended error information
  5749.         5Ah     create a unique filename
  5750.         5Bh     create a DOS file
  5751.         5Ch     lock/unlock file contents
  5752.         5Dh*    network
  5753.         5Eh*    network printer
  5754.         5Fh*    network redirection
  5755.         60h*    parse pathname
  5756.         61h*    unknown
  5757.         62h     get program segment prefix (PSP)
  5758.         63h*    get lead byte table                     (DOS 2.25)
  5759.         64h*    unknown
  5760.         65h     get extended country information        (DOS 3.3)
  5761.         66h     get/set global code page table          (DOS 3.3)
  5762.         67h     set handle count                        (DOS 3.3)
  5763.         68h     commit file                             (DOS 3.3)
  5764.         69h     disk serial number                      (DOS 4.0)
  5765.         6Ah     unknown
  5766.         6Bh     unknown
  5767.         6Ch     extended open/create                    (DOS 4.0)
  5768.  
  5769.  
  5770. CALLING THE DOS SERVICES├──────────────────────────────────────────────────────
  5771.  
  5772.  The DOS services are invoked by placing the number of the desired function in
  5773. register AH, subfunction in AL, setting the other registers to any specific
  5774. requirements of the function, and invoking int 21h.
  5775.  
  5776.  On return, the requested service will be performed if possible. Most codes
  5777. will return an error; some return more information. Details are contained in
  5778. the listings for the individual functions. Extended error return may be
  5779. obtained by calling function 59h (see 59h).
  5780.  
  5781.  Register settings listed are the ones used by DOS. Some functions will return
  5782. with garbage values in unused registers. Do not test for values in unspecified
  5783. registers; your program may exhibit odd behavior.
  5784.  
  5785.  DS:DX pointers are the data segment register (DS) indexed to the DH and DL
  5786. registers (DX). DX always contains the offset address, DS contains the segment
  5787. address.
  5788.  
  5789.  The File Control Block services (FCB services) were part of DOS 1.0. Since
  5790. the release of DOS 2.0, Microsoft has recommended that these services not be
  5791. used. A set of considerably more enhanced services (handle services) were
  5792. introduced with DOS 2.0. The handle services provide support for wildcards and
  5793. subdirectories, and enhanced error detection via function 59h.
  5794.  
  5795.  The data for the following calls was compiled from various Intel, Microsoft,
  5796. IBM, and other publications. There are many subtle differences between MSDOS
  5797. and PCDOS and between the individual versions. Differences between the
  5798. versions are noted as they occur.
  5799.  
  5800.  There are various ways of calling the DOS functions. For all methods, the
  5801. function number is loaded into register AH, subfunctions and/or parameters are
  5802. loaded into AL or other registers, and call int 21 by one of the following
  5803. methods:
  5804.  A) call interrupt 21h directly  (the recommended procedure)
  5805.  B) perform a long call to offset 50h in the program's PSP.
  5806.      1) This method will not work under DOS 1.x
  5807.      2) Though recommended by Microsoft for DOS 2.0, this method takes more
  5808.         time and is no longer recommended.
  5809.  C) place the function number in CL and perform an intrasegment call to
  5810.     location 05h in the current code segment. This location contains a long
  5811.     call to the DOS function dispatcher.
  5812.      1) IBM recommends this method be used only when using existing programs
  5813.         written for different calling conventions. (such as converting CP/M
  5814.         programs). This method should be avoided unless you have some specific
  5815.         use for it.
  5816.      2) AX is always destroyed by this method.
  5817.      3) This method is valid only for functions 00h-24h.
  5818.  
  5819.  There are also various ways of exiting from a program. (assuming it is not
  5820. intended to be a TSR). All methods except call 4Ch must ensure that the
  5821. segment register contains the segment address of the PSP.
  5822.  A) Interrupt 21h, function 4Ch (Terminate with Result Code). This is the
  5823.     "official" recommended method of returning to DOS.
  5824.  B) Interrupt 21h, function 00h (Exit Program). This is the early style
  5825.     int 21 function call. It simply calls int 20h.
  5826.  C) Interrupt 20h (Exit).
  5827.  D) A JMP instruction to offset 00h (int 20h vector) in the Program Segment
  5828.     Prefix. This is just a roundabout method to call int 20h. This method
  5829.     was set up in DOS 1.0 for ease of conversion for CP/M programs. It is no
  5830.     longer recommended for use.
  5831.  E) A JMP instruction to offset 05h (int 21 vector) in the Program Segment
  5832.     Prefix, with AH set to 00h or 4Ch. This is another CP/M type function.
  5833.  
  5834.  
  5835.  
  5836.  
  5837. INT 21H   DOS services
  5838.           Function (hex)
  5839.  
  5840. * Indicates Functions not documented in the IBM DOS Technical Reference.
  5841.  Note some functions have been documented in other Microsoft or licensed OEM
  5842. documentation.
  5843.  
  5844.  
  5845. Function  00h   Terminate Program
  5846.       Ends program, updates, FAT, flushes buffers, restores registers
  5847. entry   AH      00h
  5848.         CS      segment address of PSP
  5849. return  none
  5850. note 1) Program must place the segment address of the PSP control block in CS
  5851.         before calling this function.
  5852.      2) The terminate, ctrl-break,and critical error exit addresses (0Ah, 0Eh,
  5853.         12h) are restored to the values they had on entry to the terminating
  5854.         program, from the values saved in the program segment prefix at
  5855.         locations PSP:000Ah, PSP:000Eh, and PSP:0012h.
  5856.      3) All file buffers are flushed and the handles opened by the process are
  5857.         closed.
  5858.      4) Any files that have changed in length and are not closed are not
  5859.         recorded properly in the directory.
  5860.      5) Control transfers to the terminate address.
  5861.      6) This call performs exactly the same function as int 20h.
  5862.      7) All memory used by the program is returned to DOS.
  5863.  
  5864.  
  5865. Function  01h     Get Keyboard Input
  5866.         Waits for char at STDIN (if nescessary), echoes to STDOUT
  5867. entry   AH      01h
  5868. return  AL      ASCII character from STDIN (8 bits)
  5869. note 1) Checks char for Ctrl-C, if char is Ctrl-C, executes int 23h.
  5870.      2) For function call 06h, extended ASCII codes require two function calls.
  5871.         The first call returns 00h as an indicator that the next call will be an
  5872.         extended ASCII code.
  5873.      3) Input and output are redirectable. If redirected, there is no way to
  5874.         detect EOF.
  5875.  
  5876.  
  5877. Function  02h   Display Output
  5878.       Outputs char in DL to STDOUT
  5879. entry   AH      02h
  5880.         DL      8 bit data (usually ASCII character)
  5881. return  none
  5882. note 1) If char is 08 (backspace) the cursor is moved 1 char to the left
  5883.         (nondestructive backspace).
  5884.      2) If Ctrl-C is detected after input, int 23h is executed.
  5885.      3) Input and output are redirectable. If redirected, there is no way to
  5886.         detect disk full.
  5887.  
  5888.  
  5889. Function  03h   Auxiliary Input
  5890.       Get (or wait until) character from STDAUX
  5891. entry   AH      03h
  5892. return  AL      char from auxiliary device
  5893. note 1) AUX, COM1, COM2 is unbuffered and not interrupt driven
  5894.      2) This function call does not return status or error codes. For greater
  5895.         control it is recommended that you use ROM BIOS routine (int 14h) or
  5896.         write an AUX device driver and use IOCTL.
  5897.      3) At startup, PC-DOS initializes the first auxiliary port (COM1) to 2400
  5898.         baud, no parity, one stop bit, and an 8-bit word. MSDOS may differ.
  5899.      4) If Ctrl-C is has been entered from STDIN, int 23h is executed.
  5900.  
  5901.  
  5902. Function  04h   Auxiliary Output
  5903.       Write character to STDAUX
  5904. entry   AH      04h
  5905.         DL      char to send to AUX
  5906. return  none
  5907. note 1) This function call does not return status or error codes. For greater
  5908.         control it is recommended that you use ROM BIOS routine (int 14h) or
  5909.         write an AUX device driver and use IOCTL.
  5910.      2) If Ctrl-C is has been entered from STDIN, int 23h is executed.
  5911.      3) Default is COM1 unless redirected by DOS.
  5912.      4) If the device is busy, this function will wait until it is ready.
  5913.  
  5914.  
  5915. Function  05h   Printer Output
  5916.       Write character to STDPRN
  5917. entry   AL      05h
  5918.         DL      character to send
  5919. return  none
  5920. note 1) If Ctrl-C is has been entered from STDIN, int 23h is executed.
  5921.      2) Default is PRN or LPT1 unless redirected with the MODE command.
  5922.      3) If the printer is busy, this function will wait until it is ready.
  5923.  
  5924.  
  5925. Function  06h   Direct Console I/O
  5926.       Get character from STDIN; echo character to STDOUT
  5927. entry   AH      06h
  5928.         DL      0FFh for console input, or 00h-0FEh for console output
  5929. return  ZF      set   (1) = no character
  5930.                 clear (0) = character recieved
  5931.         AL      character
  5932. note 1) Extended ASCII codes require two function calls. The first call returns
  5933.         00h to indicate the next call will return an extended code.
  5934.      2) If DL is not 0FFh, DL is assumed to have a valid character that is
  5935.         output to STDOUT.
  5936.      3) This function does not check for Ctrl-C or Ctrl-PrtSc.
  5937.      4) Does not echo input to screen
  5938.      5) If I/O is redirected, EOF or disk full cannot be detected.
  5939.  
  5940.  
  5941. Function  07h   Direct Console Input Without Echo         (does not check BREAK)
  5942.       Get or wait for char at STDIN, returns char in AL
  5943. entry   AH      07h
  5944. return  AL      character from standard input device
  5945. note 1) Extended ASCII codes require two function calls. The first call returns
  5946.         00h to indicate the next call will return an extended code.
  5947.      2) No checking for Ctrl-C or Ctrl-PrtSc is done.
  5948.      3) Input is redirectable.
  5949.  
  5950.  
  5951. Function  08h   Console Input Without Echo                (checks BREAK)
  5952.       Get or Wait for char at STDIN, return char in AL
  5953. entry   AH      08h
  5954. return  AL      char from standard input device
  5955. note 1) Char is checked for ctrl-C. If ctrl-C is detected, executes int 23h.
  5956.      2) For function call 08h, extended ASCII characters require two function
  5957.         calls. The first call returns 00h to signify an extended ASCII code.
  5958.         The next call returns the actual code.
  5959.      3) Input is redirectable. If redirected, there is no way to check EOF.
  5960.  
  5961.  
  5962. Function  09h   Print String
  5963.       Outputs Characters in the Print String to the STDOUT
  5964. entry   AH      09h
  5965.         DS:DX   pointer to the Character String to be displayed
  5966. return  none
  5967. note 1) The character string in memory must be terminated by a $ (24h)
  5968.         The $ is not displayed.
  5969.      2) Output to STDOUT is the same as function call 02h.
  5970.  
  5971.  
  5972. Function  0Ah   Buffered Keyboard Input
  5973.       Reads characters from STDIN and places them in the buffer beginning
  5974.       at the third byte.
  5975. entry   AH      0Ah
  5976.         DS:DX   pointer to an input buffer
  5977. return  none
  5978. note 1) Min buffer size = 1, max = 255
  5979.      2) Char is checked for ctrl-C. If ctrl-C is detected, executes int 23h.
  5980.      3) Format of buffer DX:
  5981.         byte       contents
  5982.          1      Maximum number of chars the buffer will take, including CR.
  5983.                 Reading STDIN and filling the buffer continues until a carriage
  5984.                 return (<Enter> or 0Dh) is read. If the buffer fills to one less
  5985.                 than the maximum number the buffer can hold, each additional
  5986.                 number read is ignored and ASCII 7 (BEL) is output to the
  5987.                 display until a carriage return is read. (you must set this
  5988.                 value)
  5989.          2      Actual number of characters received, excluding the carriage
  5990.                 return, which is always the last character. (the function sets
  5991.                 this value)
  5992.          3-n    Characters received are placed into the buffer starting here.
  5993.                 Buffer must be at least as long as the number in byte 1.
  5994.      4) Input is redirectable. If redirected, there is no way to check EOF.
  5995.      5) The string may be edited with the standard DOS editing commands as it
  5996.         is being entered.
  5997.      6) Extended ASCII characters are stored as 2 bytes, the first byte being
  5998.         zero.
  5999.  
  6000.  
  6001. Function  0Bh   Check Standard Input (STDIN) status
  6002.       Checks for character availible at STDIN
  6003. entry   AH      0Bh
  6004. return  AL      0FFh    if a character is availible from STDIN
  6005.                 00h     if no character is availible from STDIN
  6006. note 1) Checks for Ctrl-C. If Ctrl-C is detected, int 23h is executed
  6007.      2) Input can be redirected.
  6008.      3) Checks for character only, it is not read into the application
  6009.      4) IBM reports that this call does not work properly under the DOSSHELL
  6010.         program in DOS 4.00 and 4.01. DOSSHELL will return all zeroes. This
  6011.         function works correctly from the command line or application.
  6012.  
  6013.  
  6014. Function  0Ch   Clear Keyboard Buffer & Invoke a Keyboard Function       (FCB)
  6015.       Dumps buffer, executes function in AL (01h,06h,07h,08h,0Ah only)
  6016. entry   AH      0Ch
  6017.         AL      function number (must be 01h, 06h, 07h, 08h, or 0Ah)
  6018. return  AL      00h     buffer was flushed, no other processing performed
  6019.                 other   any other value has no meaning
  6020. note 1) Forces system to wait until a character is typed.
  6021.      2) Flushes all typeahead input, then executes function specified by AL (by
  6022.         moving it to AH and repeating the int 21 call).
  6023.      3) If AL contains a value not in the list above, the keyboard buffer is
  6024.         flushed and no other action is taken.
  6025.  
  6026.  
  6027. Function  0Dh   Disk Reset
  6028.       Flushes all currently open file buffers to disk
  6029. entry   AH      0Dh
  6030. return          none
  6031. note 1) Does not close files. Does not update directory entries; files changed
  6032.         in size but not closed are not properly recorded in the directory
  6033.      2) Sets DTA address to DS:0080h
  6034.      3) Should be used before a disk change, Ctrl-C handlers, and to flush
  6035.         the buffers to disk.
  6036.  
  6037.  
  6038. Function  0Eh   Select Disk
  6039.       Sets the drive specified in DL (if valid) as the default drive
  6040. entry   AL      0Eh
  6041.         DL      new default drive number (0=A:,1=B:,2=C:,etc.)
  6042. return  AL      total number of logical drives (not nescessarily physical)
  6043. note 1) For DOS 1.x and 2.x, the minimum value for AL is 2.
  6044.      2) For DOS 3.x and 4.x, the minimum value for AL is 5.
  6045.      3) The drive number returned is not nescessarily a valid drive.
  6046.      4) For DOS 1.x: 16 logical drives are availible, A-P.
  6047.         For DOS 2.x: 63 logical drives are availible. (Letters are only used for
  6048.                      the first 26 drives. If more than 26 logical drives are
  6049.                      used, further drive letters will be other ASCII characters
  6050.                      ie {,], etc.
  6051.         For DOS 3.x: 26 logical drives are availible, A-Z.
  6052.         For DOS 4.x: 26 logical drives are availible, A-Z.
  6053.  
  6054.  
  6055. Function  0Fh   Open Disk File                                            (FCB)
  6056.       Searches current directory for specified filename and opens it
  6057. entry   AH      0Fh
  6058.         DS:DX   pointer to an unopened FCB
  6059. return  AL      00h     if file found
  6060.                 0FFh    if file not not found
  6061. note 1) If the drive code was 0 (default drive) it is changed to the actual
  6062.         drive used (1=A:,2=B:,3=C:, etc). This allows changing the default drive
  6063.         without interfering with subsequent operations on this file.
  6064.      2) The current block field (FCB bytes C-D, offset 0Ch) is set to zero.
  6065.      3) The size of the record to be worked with (FCB bytes E-F, offset 0Eh) is
  6066.         set to the system default of 80h. The size of the file (offset 10h) and
  6067.         the date (offset 14h) are set from information obtained in the root
  6068.         directory. You can change the default value for the record size (FCB
  6069.         bytes E-F) or set the random record size and/or current record field.
  6070.         Perform these actions after the open but before any disk operations.
  6071.      4) The file is opened in compatibility mode.
  6072.      5) Microsoft recommends handle function call 3Dh be used instead.
  6073.      6) This call is also used by the APPEND command in DOS 3.2+
  6074.      7) Before performing a sequential disk operation on the file, you must
  6075.         set the Current Record field (offset 20h). Before performing a random
  6076.         disk operation on the file, you must set the Relative Record field
  6077.         (offset 21h). If the default record size of 128 bytes is incorrect, set
  6078.         it to the correct value.
  6079.  
  6080.  
  6081. Function  10h  Close File                                              (FCB)
  6082.      Closes a File After a File Write
  6083. entry   AH      10h
  6084.         DS:DX   pointer to an opened FCB
  6085. return  AL      00h     if the file is found and closed
  6086.                 0FFh    if the file is not found in the current directory
  6087. note 1) This function call must be done on open files that are no longer needed,
  6088.         and after file writes to insure all directory information is updated.
  6089.      2) If the file is not found in its correct position in the current
  6090.         directory, it is assumed that the diskette was changed and AL returns
  6091.         0FFh. This error return is reportedly not completely reliable with DOS
  6092.         version 2.x.
  6093.      3) If found, the directory is updated to reflect the status in the FCB, the
  6094.         buffers to that file are flushed, and AL returns 00h.
  6095.  
  6096.  
  6097. Function  11h   Search For First Matching Entry                           (FCB)
  6098.       Searches current disk & directory for first matching filename
  6099. entry   AH      11h
  6100.         DS:DX   pointer to address of FCB
  6101. return  AL      00h     successful match
  6102.                 0FFh    no matching filename found
  6103. note 1) The FCB may contain the wildcard character ? under Dos 2.x, and ? or *
  6104.         under 3.x and 4.x.
  6105.      2) The original FCB at DS:DX contains information to continue the search
  6106.         with function 12h, and should not be modified.
  6107.      3) If a matching filename is found, AL returns 00h and the locations at the
  6108.         Disk Transfer Address are set as follows:
  6109.         a) If the FCB provided for searching was an extended FCB, then the first
  6110.            byte at the disk transfer address is set to 0FFh followed by 5 bytes
  6111.            of zeroes, then the attribute byte from the search FCB, then the
  6112.            drive number used (1=A, 2=B, etc) then the 32 bytes of the directory
  6113.            entry. Thus, the disk transfer address contains a valid unopened FCB
  6114.            with the same search attributes as the search FCB.
  6115.         b) If the FCB provided for searching was a standard FCB, then the first
  6116.            byte is set to the drive number used (1=A,2=b,etc), and the next 32
  6117.            bytes contain the matching directory entry. Thus, the disk transfer
  6118.            address contains a valid unopened normal FCB.
  6119.      4) If an extended FCB is used, the following search pattern is used:
  6120.         a) If the FCB attribute byte is zero, only normal file entries are
  6121.            found. Entries for volume label, subdirectories, hidden or system
  6122.            files, are not returned.
  6123.         b) If the attribute byte is set for hidden or system files, or
  6124.            subdirectory entries, it is to be considered as an inclusive search.
  6125.            All normal file entries plus all entries matching the specified
  6126.            attributes are returned. To look at all directory entries except the
  6127.            volume label, the attribute byte may be set to hidden + system +
  6128.            directory (all 3 bits on).
  6129.         c) If the attribute field is set for the volume label, it is considered
  6130.            an exclusive search, and ONLY the volume label entry is returned.
  6131.      5) This call is also used by the APPEND command in DOS 3.2+
  6132.  
  6133.  
  6134. Function  12h   Search For Next Entry Using FCB                          (FCB)
  6135.       Search for next matching filename
  6136. entry   AH      12h
  6137.         DS:DX   pointer to the unopened FCB specified from the previous Search
  6138.                 First (11h) or Search Next (12h)
  6139. return  AL      00h     if matching filename found
  6140.                 0FFh    if matching filename was not found
  6141. note 1) After a matching filename has been found using function call 11h,
  6142.         function 12h may be called to find the next match to an ambiguous
  6143.         request. For DOS 2.x, ?'s are allowed in the filename. For DOS 3.x
  6144.         and 4.x, global (*) filename characters are allowed.
  6145.      2) The DTA contains info from the previous Search First or Search Next.
  6146.      3) All of the FCB except for the name/extension field is used to keep
  6147.         information nescessary for continuing the search, so no disk operations
  6148.         may be performed with this FCB between a previous function 11h or 12h
  6149.         call and this one.
  6150.      4) If the file is found, an FCB is created at the DTA address and set up to
  6151.         open or delete it.
  6152.  
  6153.  
  6154. Function  13h   Delete File Via FCB                                       (FCB)
  6155.       Deletes file specified in FCB from current directory
  6156. entry   AH      13h
  6157.         DS:DX   pointer to address of FCB
  6158. return  AL      00h     file deleted
  6159.                 0FFh    if file not found or was read-only
  6160. note 1) All matching current directory entries are deleted. The global filename
  6161.         character "?" is allowed in the filename.
  6162.      2) Will not delete files with read-only attribute set
  6163.      3) Close open files before deleting them.
  6164.      4) Requires Network Access Rights
  6165.  
  6166.  
  6167. Function  14h   Sequential Disk File Read                                 (FCB)
  6168.       Reads record sequentially from disk via FCB
  6169. entry   AH  14h
  6170.         DS:DX   pointer to an opened FCB
  6171. return  AL      00h     successful read
  6172.                 01h     end of file (no data read)
  6173.                 02h     Data Transfer Area too small for record size specified
  6174.                         or segment overflow
  6175.                 03h     partial record read, EOF found
  6176. note 1) The record size is set to the value at offset 0Eh in the FCB.
  6177.      2) The record pointed to by the Current Block (offset 0Ch) and the Current
  6178.         Record (offset 20h) fields is loaded at the DTA, then the Current Block
  6179.         and Current Record fields are incremented.
  6180.      3) The record is read into memory at the current DTA address as specified
  6181.         by the most recent call to function 1Ah. If the size of the record and
  6182.         location of the DTA are such that a segment overflow or wraparound would
  6183.         occur, the error return is set to AL=02h
  6184.      4) If a partial record is read at the end of the file, it is passed to the
  6185.         requested size with zeroes and the error return is set to AL=03h.
  6186.  
  6187.  
  6188. Function  15h   Sequential Disk Write                                     (FCB)
  6189.       Writes record specified by FCB sequentially to disk
  6190. entry   AH      15h
  6191.         DS:DX   pointer to address of FCB
  6192. return  AL      00h     successful write
  6193.                 01h     diskette full, write canceled
  6194.                 02h     disk transfer area (DTA) too small or segment wrap
  6195. note 1) The data to write is obtained from the disk transfer area
  6196.      2) The record size is set to the value at offset 0Eh in the FCB.
  6197.      3) This service cannot write to files set as read-only
  6198.      4) The record pointed to by the Current Block (offset 0Ch) and the Current
  6199.         Record (offset 20h) fields is loaded at the DTA, then the Current Block
  6200.         and Current Record fields are incremented.
  6201.      5) If the record size is less than a sector, the data in the DTA is written
  6202.         to a buffer; the buffer is written to disk when it contains a full
  6203.         sector of data, the file is closed, or a Reset Disk (function 0Dh) is
  6204.         issued.
  6205.      6) The record is written to disk at the current DTA address as specified
  6206.         by the most recent call to function 1Ah. If the size of the record and
  6207.         location of the DTA are such that a segment overflow or wraparound would
  6208.         occur, the error return is set to AL=02h
  6209.  
  6210.  
  6211. Function  16h   Create A Disk File                                        (FCB)
  6212.       Search and open or create directory entry for file
  6213. entry   AH      16h
  6214.         DS:DX   pointer to an FCB
  6215. return  AL      00h     successful creation
  6216.                 0FFh    no room in directory
  6217. note 1) If a matching directory entry is found, the file is truncated to zero
  6218.         bytes.
  6219.      2) If there is no matching filename, a filename is created.
  6220.      3) This function calls function 0Fh (Open File) after creating or
  6221.         truncating a file.
  6222.      4) A hidden file can be created by using an extended FCB with the attribute
  6223.         byte (offset FCB-1) set to 2.
  6224.  
  6225.  
  6226. Function  17h   Rename File Specified by File Control Block              (FCB)
  6227.       Renames file in current directory
  6228. entry   AH      17h
  6229.         DS:DX   pointer to an FCB (see note 4)
  6230. return  AL      00h     successfully renamed
  6231.                 0FFh    file not found or filename already exists
  6232. note 1) This service cannot rename read-only files
  6233.      2) The "?" wildcard may be used.
  6234.      3) If the "?" wildcard is used in the second filename, the corresponding
  6235.         letters in the filename of the directory entry are not changed.
  6236.      4) The FCB must have a drive number, filename, and extension in the usual
  6237.         position, and a second filename starting 6 bytes after the first, at
  6238.         offset 11h.
  6239.      5) The two filenames cannot have the same name.
  6240.      6) FCB contains new name starting at byte 17h.
  6241.  
  6242.  
  6243. Function  18h  Internal to DOS
  6244.  *   Unknown
  6245. entry   AH      18h
  6246. return  AL      0
  6247.  
  6248.  
  6249. Function  19h   Get Current Disk Drive
  6250.       Return designation of current default disk drive
  6251. entry   AH      19h
  6252. return  AL      current default drive (0=A, 1=B,etc.)
  6253. note    Some other DOS functions use 0 for default, 1=A, 2=B, etc.
  6254.  
  6255.  
  6256. Function  1Ah   Set Disk Transfer Area Address (DTA)
  6257.       Sets DTA address to the address specified in DS:DX
  6258. entry   AH      1Ah
  6259.         DS:DX   pointer to buffer
  6260. return  none
  6261. note 1) The default DTA is 128 bytes at offset 80h in the PSP. DOS uses the
  6262.         DTA for all file I/O.
  6263.      2) Registers are unchanged.
  6264.      3) No error codes are returned.
  6265.      2) Disk transfers cannot wrap around from the end of the segment to the
  6266.         beginning or overflow into another segment.
  6267.  
  6268.  
  6269. Function  1Bh   Get Current Drive File Allocation Table Information
  6270.       Returns information from the FAT on the current drive
  6271. entry   AH      1Bh
  6272. exit    AL      number of sectors per allocation unit (cluster)
  6273.         DS:BX   address of the current drive's media descriptor byte
  6274.         CX      number of bytes per sector
  6275.         DX      number of allocation units (clusters) for default drive
  6276. note 1) Save DS before calling this function.
  6277.      2) This call returned a pointer to the FAT in DOS 1.x. Beginning with
  6278.         DOS 2.00, it returns a pointer only to the table's ID byte.
  6279.      3) IBM recommends programmers avoid this call and use int 25h instead.
  6280.  
  6281.  
  6282. Function  1Ch   Get File Allocation Table Information for Specific Device
  6283.       Returns information on specified drive
  6284. entry   AH      1Ch
  6285.         DL      drive number (1=A, 2=B, 3=C, etc)
  6286. return  AL      number of sectors per allocation unit (cluster)
  6287.         DS:BX   address of media descriptor byte for drive in DL
  6288.         CX      sector size in bytes
  6289.         DX      number of allocation units (clusters)
  6290. note 1) DL = 0 for default.
  6291.      2) Save DS before calling this function.
  6292.      3) Format of media-descriptor byte:
  6293.         bits:   0       0   (clear)   not double sided
  6294.                         1   (set)     double sided
  6295.                 1       0   (clear)   not 8 sector
  6296.                         1   (set)     8 sector
  6297.                 2       0   (clear)   nonremovable device
  6298.                         1   (set)     removable device
  6299.                 3-7     always set (1)
  6300.      4) This call returned a pointer to the FAT in DOS 1.x. Beginning with
  6301.         DOS 2.00, it returns a pointer only to the table's ID byte.
  6302.      5) IBM recommends programmers avoid this call and use int 25h instead.
  6303.  
  6304.  
  6305. Function  1Dh   Not Documented by Microsoft
  6306.  *    Unknown
  6307. entry   AH      1Dh
  6308. return  AL      0
  6309.  
  6310.  
  6311. Function  1Eh   Not Documented by Microsoft
  6312.  *    Unknown
  6313. entry   AH      1Eh
  6314. return  AL      0
  6315. note    Apparently does nothing
  6316.  
  6317.  
  6318. Function  1Fh Get Default Drive Parameter Block
  6319.  *  Same as function call 32h (below), except that the table is accessed from
  6320.     the default drive
  6321. entry   AH      1Fh
  6322.         other registers unknown
  6323. return  AL      00h     no error
  6324.                 0FFh    error
  6325.         DS:BX   points to DOS Disk Parameter Block for default drive.
  6326. note 1) Unknown vector returned in ES:BX.
  6327.      2) For DOS 2.x and 3.x, this just invokes function 32h (undocumented,
  6328.         Read DOS Disk Block) with DL=0
  6329.  
  6330.  
  6331. Function  20h  Unknown
  6332.  *   Internal - does nothing?
  6333. entry   AH      20h
  6334. return  AL      0
  6335.  
  6336.  
  6337. Function  21h  Random Read from File Specified by File Control Block     (FCB)
  6338.      Reads one record as specified in the FCB into the current DTA.
  6339. entry   AH      21h
  6340.         DS:DX   address of the opened FCB
  6341. return  AL      00h     successful read operation
  6342.                 01h     end of file (EOF), no data read
  6343.                 02h     DTA too small for the record size specified
  6344.                 03h     end of file (EOF), partial data read
  6345. note 1) The current block and current record fields are set to agree with the
  6346.         random record field. Then the record addressed by these fields is read
  6347.         into memory at the current Disk Transfer Address.
  6348.      2) The current file pointers are NOT incremented this function.
  6349.      3) If the DTA is larger than the file, the file is padded to the requested
  6350.         length with zeroes.
  6351.  
  6352.  
  6353. Function  22h  Random Write to File Specified by FCB                      (FCB)
  6354.      Writes one record as specified in the FCB to the current DTA
  6355. entry   AH      22h
  6356.         DS:DX   address of the opened FCB
  6357. return  AL      00h     successful write operation
  6358.                 01h     disk full; no data written (write was canceled)
  6359.                 02h     DTA too small for the record size specified (write was
  6360.                         canceled)
  6361. note 1) This service cannot write to read-only files.
  6362.      2) The record pointed to by the Current Block (offset 0Ch) and the Current
  6363.         Record (offset 20h) fields is loaded at the DTA, then the Current Block
  6364.         and Current Record fields are incremented.
  6365.      3) If the record size is less than a sector, the data in the DTA is written
  6366.         to a buffer; the buffer is written to disk when it contains a full
  6367.         sector of data, the file is closed, or a Reset Disk (function 0Dh) is
  6368.         issued.
  6369.      4) The current file pointers are NOT incremented this function.
  6370.      5) The record is written to disk at the current DTA address as specified
  6371.         by the most recent call to function 1Ah. If the size of the record and
  6372.         location of the DTA are such that a segment overflow or wraparound would
  6373.         occur, the error return is set to AL=02h
  6374.  
  6375.  
  6376. Function  23h  Get File Size                                             (FCB)
  6377.      Searches current subdirectory for matching file, returns size in FCB
  6378. entry   AH      23h
  6379.         DS:DX   address of an unopened FCB
  6380. return  AL      00h file found
  6381.                 0FFh file not found
  6382. note 1) Record size field (offset 0Eh) must be set before invoking this function
  6383.      2) The disk directory is searched for the matching entry. If a matching
  6384.         entry is found, the random record field is set to the number of records
  6385.         in the file. If the value of the Record Size field is not an even
  6386.         divisor of the file size, the value set in the relative record field is
  6387.         rounded up. This gives a returned value larger than the actual file size
  6388.      3) This call is used by the APPEND command in DOS 3.2+
  6389.  
  6390.  
  6391. Function  24h  Set Relative Record Field                                  (FCB)
  6392.      Set random record field specified by an FCB
  6393. entry   AH      24h
  6394.         DS:DX   address of an opened FCB
  6395. return  Random Record Field of FCB is set to be same as Current Block
  6396.         and Current Record.
  6397. note 1) You must invoke this function before performing random file access.
  6398.      2) The relative record field of FCB (offset 21h) is set to be same as the
  6399.         Current Block (offset 0Ch) and Current Record (offset 20h).
  6400.      3) No error codes are returned.
  6401.      4) The FCB must already be opened.
  6402.  
  6403.  
  6404. Function  25h  Set Interrupt Vector
  6405.      Sets the address of the code DOS is to perform each time the specified
  6406.      interrupt is invoked.
  6407. entry   AH      25h
  6408.         AL      int number to reassign the handler to
  6409.         DS:DX   address of new interrupt vector
  6410. return  none
  6411. note 1) Registers are unchanged.
  6412.      2) No error codes are returned.
  6413.      3) The interrupt vector table for the interrupt number specified in AL
  6414.         is set to the address contained in DS:DX. Use function 35h (Get Vector)
  6415.         to get the contents of the interrupt vector and save it for later use.
  6416.      4) When you use function 25 to set an interrupt vector, DOS 3.2 doesn't
  6417.         point the actual interrupt vector to what you requested. Instead, it
  6418.         sets the interrupt vector to point to a routine inside DOS, which does
  6419.         this:
  6420.                 1. Save old stack pointer
  6421.                 2. Switch to new stack pointer allocated from DOS's stack pool
  6422.                 3. Call your routine
  6423.                 4. Restore old stack pointer
  6424.         The purpose for this was to avoid possible stack overflows when there
  6425.         are a large number of active interrupts. IBM was concerned (this was an
  6426.         IBM change, not Microsoft) that on a Token Ring network there would be
  6427.         a lot of interrupts going on, and applications that hadn't allocated
  6428.         very much stack space would get clobbered.
  6429.  
  6430.  
  6431. Function  26h  Create New Program Segment Prefix (PSP)
  6432.      This service copies the current program-segment prefix to a new memory
  6433.      location for the creation of a new program or overlay. Once the new PSP is
  6434.      in place, a DOS program can read a DOS COM or overlay file into the memory
  6435.      location immediately following the new PSP and pass control to it.
  6436. entry   AH      26h
  6437.         DX      segment number for the new PSP
  6438. return  none
  6439. note 1) Microsoft recommends you use the newer DOS service 4Bh (EXEC) instead.
  6440.      2) The entire 100h area at location 0 in the current PSP is copied into
  6441.         location 0 of the new PSP. The memory size information at location 6
  6442.         in the new segment is updated and the current termination, ctrl-break,
  6443.         and critical error addresses from interrupt vector table entries for
  6444.         ints 22h, 23h, and 24 are saved in the new program segment starting at
  6445.         0Ah. They are restored from this area when the program terminates.
  6446.      3) Current PSP is copied to specified segment
  6447.  
  6448.  
  6449. Function  27h  Random Block Read From File Specified by FCB
  6450.      Similar to 21h (Random Read) except allows multiple files to be read.
  6451. entry   AH      27h
  6452.         CX      number of records to be read
  6453.         DS:DX   address of an opened FCB
  6454. return  AL      00h     successful read
  6455.                 01h     end of file, no data read
  6456.                 02h     DTA too small for record size specified (read canceled)
  6457.                 03h     end of file
  6458.         CX      actual number of records read (includes partial if AL=03h)
  6459. note 1) The record size is specified in the FCB. The service updates the Current
  6460.         Block (offset 0Ch) and Current Record (offset 20h) fields to the next
  6461.         record not read.
  6462.      2) If CX contained 0 on entry, this is a NOP.
  6463.      3) If the DTA is larger than the file, the file is padded to the requested
  6464.         length with zeroes.
  6465.      4) This function assumes that the FCB record size field (0Eh) is correctly
  6466.         set. If not set by the user, the default is 128 bytes.
  6467.      5) The record is written to disk at the current DTA address as specified
  6468.         by the most recent call to function 1Ah. If the size of the record and
  6469.         location of the DTA are such that a segment overflow or wraparound would
  6470.         occur, the error return is set to AL=02h
  6471.  
  6472.  
  6473. Function  28h  Random Block Write to File Specified in FCB
  6474.      Similar to 27h (Random Write) except allows multiple files to be read.
  6475. entry   AH      28h
  6476.         CX      number of records to write
  6477.         DS:DX   address of an opened FCB
  6478. return  AL      00h     successful write
  6479.                 01h     disk full, no data written
  6480.                 02h     DTA too small for record size specified (write canceled)
  6481.         CX      number of records written
  6482. note 1) The record size is specified in the FCB.
  6483.      2) This service allocates disk clusters as required.
  6484.      3) This function assumes that the FCB Record Size field (offset 0Eh) is
  6485.         correctly set. If not set by the user, the default is 128 bytes.
  6486.      4) The record size is specified in the FCB. The service updates the Current
  6487.         Block (offset 0Ch) and Current Record (offset 20h) fields to the next
  6488.         record not read.
  6489.      5) The record is written to disk at the current DTA address as specified
  6490.         by the most recent call to function 1Ah. If the size of the record and
  6491.         location of the DTA are such that a segment overflow or wraparound would
  6492.         occur, the error return is set to AL=02h
  6493.      6) If called with CX=0, no records are written, but the FCB's File Size
  6494.         entry (offset 1Ch) is set to the size specified by the FCB's Relative
  6495.         Record field (offset 21h).
  6496.  
  6497.  
  6498. Function  29h  Parse the Command Line for Filename
  6499.      Parses a text string into the fields of a File Control Block
  6500. entry   AH      29h
  6501.         DS:SI   pointer to string to parse
  6502.         ES:DI   pointer to memory buffer to fill with unopened FCB
  6503.         AL      bit mask to control parsing
  6504.                 bit 0 = 0: parsing stops if file seperator found
  6505.                         1: causes service to scan past leading chars such as
  6506.                            blanks. Otherwise assumes the filename begins in
  6507.                            the first byte
  6508.                     1 = 0: drive number in FCB set to default (0) if string
  6509.                            contains no drive number
  6510.                         1: drive number in FCB not changed
  6511.                     2 = 0: filename in FCB set to 8 blanks if no filename in
  6512.                            string
  6513.                         1: filename in FCB not changed if string does not
  6514.                            contain a filename
  6515.                     3 = 0: extension in FCB set to 3 blanks if no extension in
  6516.                            string
  6517.                         1: extension left unchanged
  6518.                     4-7    must be zero
  6519. return  AL      00h     no wildcards in name or extension
  6520.                 01h     wildcards appeared in name or extension
  6521.                 0FFh    invalid drive specifier
  6522.         DS:SI   pointer to the first byte after the parsed string
  6523.         ES:DI   pointer to a buffer filled with the unopened FCB
  6524. note 1) If the * wildcard characters are found in the command line, this service
  6525.         will replace all subsequent chars in the FCB with question marks.
  6526.      2) This service uses the characters as filename separators
  6527.         DOS 1       : ; . , + / [ ] = " TAB SPACE
  6528.         DOS 2,3     : ; . , + = TAB SPACE
  6529.      3) This service uses the characters
  6530.         : ; . , + < > | / \ [ ] = " TAB SPACE
  6531.         or any control characters as valid filename separators
  6532.      4) A filename cannot contain a filename terminator. If one is encountered,
  6533.         all processing stops. The handle functions will allow use of some of
  6534.         these characters.
  6535.      5) If no valid filename was found on the command line, ES:DI +1 points
  6536.         to a blank (ASCII 32).
  6537.      6) This function cannot be used with filespecs which include a path
  6538.      7) Parsing is in the form D:FILENAME.EXT. If one is found, a corresponding
  6539.         unopened FCB is built at ES:DI
  6540.  
  6541.  
  6542. Function  2Ah  Get Date
  6543.      Returns day of the week, year, month, and date
  6544. entry   AH      2Ah
  6545. return  CX      year    (1980-2099)
  6546.         DH      month   (1-12)
  6547.         DL      day     (1-31)
  6548.         AL      weekday 00h     Sunday
  6549.                         01h     Monday
  6550.                         02h     Tuesday
  6551.                         03h     Wednesday
  6552.                         04h     Thursday
  6553.                         05h     Friday
  6554.                         06h     Saturday
  6555. note 1) Date is adjusted automatically if clock rolls over to the next day,
  6556.         and takes leap years and number of days in each month into account.
  6557.      2) Although DOS cannot set an invalid date, it can read one, such as
  6558.         1/32/80, etc.
  6559.      3) DesQview also accepts CX = 4445h and DX = 5351h, i.e. 'DESQ' as valid
  6560.      4) DOS will accept CH=0 (midnight) as a valid time, but if a file's time
  6561.         is set to exactly midnight the time will not be displayed by the DIR
  6562.         command.
  6563.  
  6564.  
  6565. Function  2Bh  Set Date
  6566.      set current system date
  6567. entry   AH      2Bh
  6568.         CX      year    (1980-2099)
  6569.         DH      month   (1-12)
  6570.         DL      day     (1-31)
  6571. return  AL      00h     no error (valid date)
  6572.                 0FFh    invalid date specified
  6573. note 1) On entry, CX:DX must have a valid date in the same format as returned
  6574.         by function call 2Ah
  6575.      2) DOS 3.3 also sets CMOS clock
  6576.  
  6577.  
  6578. Function  2Ch  Get Time
  6579.      Get current system time from CLOCK$ driver
  6580. entry   AH      2Ch
  6581. return  CH      hours   (0-23)
  6582.         CL      minutes (0-59)
  6583.         DH      seconds (0-59)
  6584.         DL      hundredths of a second (0-99)
  6585. note 1) Time is updated every 5/100 second.
  6586.      2) The date and time are in binary format
  6587.  
  6588.  
  6589. Function  2Dh  Set Time
  6590.      Sets current system time
  6591. entry   AH      2Dh
  6592.         CH      hours   (0-23)
  6593.         CL      minutes (0-59)
  6594.         DH      seconds (0-59)
  6595.         DL      hundredths of seconds (0-99)
  6596. return  AL      00h     if no error
  6597.                 0FFh    if bad value sent to routine
  6598. note 1) DOS 3.3 also sets CMOS clock
  6599.      2) CX and DX must contain a valid time in binary
  6600.  
  6601.  
  6602. Function  2Eh  Set/Reset Verify Switch
  6603.      Set verify flag
  6604. entry   AH      2Eh
  6605.         AL      00      to turn verify off (default)
  6606.                 01      to turn verify on
  6607. return  none
  6608. note 1) This is the call invoked by the DOS VERIFY command
  6609.      2) Setting of the verify switch can be obtained by calling call 54h
  6610.      3) This call is not supported on network drives
  6611.      4) DOS checks this flag each time it accesses a disk
  6612.  
  6613.  
  6614. Function  2Fh  Get Disk Transfer Address (DTA)
  6615.      Returns current disk transfer address used by all DOS read/write operations
  6616. entry   AH      2Fh
  6617. return  ES:BX   address of DTA
  6618. note 1) The DTA is set by function call 1Ah
  6619.      2) Default DTA address is a 128 byte buffer at offset 80h in that program's
  6620.         Program Segment Prefix
  6621.  
  6622.  
  6623. Function  30h  Get DOS Version Number
  6624.      Return DOS version and/or user number
  6625. entry   AH      30h
  6626. return  AH      minor version number  (i.e., DOS 2.10 returns AX = 0A02h)
  6627.         AL      major version number
  6628.         BH      OEM ID number
  6629.                 00h     IBM
  6630.                 16h     DEC    (others not known)
  6631.         BL:CX   24-bit user serial number
  6632. note 1) If AL returns a major version number of zero, the DOS version is
  6633.         below 1.28 for MSDOS and below 2.00 for PCDOS.
  6634.      2) IBM PC-DOS always returns 0000h in BX and CX.
  6635.      3) OS/2 v1.0 Compatibility Box returns a value of 10 for major version.
  6636.      4) Due to the OS/2 return and the fact that some European versions of DOS
  6637.         carry higher version numbers than IBM's DOS, utilities which check
  6638.         for a DOS version should not abort if a higher version than required
  6639.         is found unless some specific problems are known.
  6640.  
  6641.  
  6642. Function  31h  Terminate Process and Stay Resident
  6643.      KEEP, or TSR
  6644. entry   AH      31h
  6645.  
  6646.         AL      exit code
  6647.         DX      program memory requirement in 16 byte paragraphs
  6648. return  AX      return code (retrieveable by function 4Dh)
  6649. note 1) Files opened by the application are not closed when this call is made
  6650.      2) Memory can be used more efficiently if the block containing the copy of
  6651.         the DOS environment is deallocated before terminating. This can be done
  6652.         by loading ES with the segment contained in 2Ch of the PSP and issuing
  6653.         function call 49h (Free Allocated Memory).
  6654.      3) Unlike int 27h, more than 64k may be made resident with this call
  6655.  
  6656.  
  6657. Function  32h  Read DOS Disk Block
  6658.  *   Retrieve the pointer to the drive parameter block for a drive
  6659. entry   AH      32h
  6660.         DL      drive (0=default, 1=A:, etc.).
  6661. return  AL      00h     if drive is valid
  6662.                 0FFh    if drive is not valid
  6663.         DS:BX   pointer to DOS Drive Parameter Table. Format of block:
  6664.                 Bytes   Type        Value
  6665.                 00h     byte    Drive: 0=A:, 1=B:, etc.
  6666.                 01h     byte    Unit within drive (0, 1, 2, etc.)
  6667.                 02h-03h word    Bytes per sector
  6668.                 04h     byte    Sectors per cluster - 1
  6669.                 05h     byte    Cluster to sector shift (i.e., how far to shift-
  6670.                                 left the bytes/sector to get bytes/cluster)
  6671.                 06h-07h word    Number of reserved (boot) sectors
  6672.                 08h     byte    Number of FATs
  6673.                 09h-0Ah word    Number of root directory entries
  6674.                 0Bh-0Ch word    Sector # of 1st data. Should be same as # of
  6675.                                 sectors/track.
  6676.                 0Dh-0Eh word    # of clusters + 1 (=last cluster #)
  6677.                 0Fh     byte    Sectors for FAT
  6678.                 10h-11h word    First sector of root directory
  6679.                 12h-15h dword   Address of device driver header for this drive
  6680.                 16h     byte    Media Descriptor Byte for this drive
  6681.                 17h     byte    0FFh indicates block must be rebuilt
  6682.                                 (DOS 3.x) 00h indicates block device has
  6683.                                 been accessed
  6684.                 18h-1Bh dword   address of next DOS Disk Block (0FFFFh means
  6685.                                 last in chain)
  6686.                 22h     byte    Current Working Directory (2.0 only) (64 bytes)
  6687. note 1) Use [BX+0D] to find no. of clusters (>1000H, 16-bit FAT; if not, 12-bit
  6688.         (exact dividing line is probably a little below 1000h to allow for
  6689.         bad sectors, EOF markers, etc.)
  6690.      2) Short article by C.Petzold, PC Magazine  Vol.5,no.8, and the article
  6691.         "Finding Disk Parameters" in the May 1986 issue of PC Tech Journal.
  6692.      3) This call is mostly supported in OS/2 1.0's DOS Compatibility Box. The
  6693.         dword at 12h will not return the address of the next device driver when
  6694.         in the Compatibility Box.
  6695.      4) used by CHKDSK
  6696.  
  6697.  
  6698. Function  33h  Control-Break Check
  6699.      Get or set control-break checking at CON
  6700. entry   AH      33h
  6701.         AL      00h     to test for break checking
  6702.                 01h     to set break checking
  6703.                         DL      00h     to disable break checking
  6704.                                 01h     to enable break checking
  6705.                 02h     internal, called by PRINT.COM (DOS 3.1)
  6706.                 03h     unknown
  6707.                 04h     unknown
  6708.                 05h     boot drive (DOS 4.0+)
  6709. return  DL      00h     if break=off
  6710.                 01h     if break=on
  6711.                 (if AL=05h) boot drive, A=1, B=2, etc)
  6712.         AL      0FFh    error
  6713.  
  6714.  
  6715. Function  34h  Return INDOS Flag
  6716.  *   Returns ES:BX pointing to Critical Section Flag, byte indicating whether
  6717.      it is safe to interrupt DOS.
  6718. entry   AH      34h
  6719. return  ES:BX   points to DOS "critical section flag"
  6720. note 1) If byte is 0, it is safe to interrupt DOS. This was mentioned in some
  6721.         documentation by Microsoft on a TSR standard, and PC Magazine reports
  6722.         it functions reliably under DOS versions 2.0 through 3.3. Chris
  6723.         Dunford (of CED fame) and a number of anonymous messages on the BBSs
  6724.         indicate it may not be totally reliable.
  6725.      2) The byte at ES:BX+1 is used by the Print program for this same purpose,
  6726.         so it's probably safer to check the WORD at ES:BX.
  6727.      3) Reportedly, examination of DOS 2.10 code in this area indicates that the
  6728.         byte immediately following this "critical section flag" must be 00h to
  6729.         permit the PRINT.COM interrupt to be called. For DOS 3.0 and 3.1 (except
  6730.         Compaq DOS 3.0), the byte before the "critical section flag" must be
  6731.         zero; for Compaq DOS 3.0, the byte 01AAh before it must be zero.
  6732.      4) In DOS 3.10 this reportedly changed to word value, with preceding byte.
  6733.      5) This call is supported in OS/2 1.0's DOS Compatibility Box
  6734.      6) Gordon Letwin of Microsoft discussed this call on ARPAnet in 1984. He
  6735.         stated:
  6736.         a) this is not supported under any version of the DOS
  6737.         b) it usually works under DOS 2, but there may be circumstances
  6738.            when it doesn't (general disclaimer, don't know of a specific
  6739.            circumstance)
  6740.         c) it will usually not work under DOS 3 and DOS 3.1; the DOS is
  6741.            considerably restructured and this flag takes on additional
  6742.            meanings and uses
  6743.         d) it will fail catastrophically under DOS 4.0 and forward.
  6744.            Obviously this information is incorrect since the call works fine
  6745.            through DOS 3.3. Microsoft glasnost?
  6746.  
  6747.  
  6748. Function  35h  Get Vector
  6749.      Get interrupt vector
  6750. entry   AH      35h
  6751.         AL      interrupt number (hexadecimal)
  6752. return  ES:BX   address of interrupt vector
  6753. note    Use function call 25h to set the interrupt vectors
  6754.  
  6755.  
  6756. Function  36h  Get Disk Free Space
  6757.      get information on specified drive
  6758. entry   AH      36h
  6759.         DL      drive number (0=default, 1=A:, 2=B:, etc)
  6760. return  AX      number of sectors per cluster
  6761.                 0FFFFh means drive specified in DL is invalid
  6762.         BX      number of availible clusters
  6763.         CX      bytes per sector
  6764.         DX      clusters per drive
  6765. note 1) Mult AX * CX * BX for free space on disk
  6766.      2) Mult AX * CX * DX for total disk space
  6767.      3) Function 36h returns an incorrect value after an ASSIGN command. Prior
  6768.         to ASSIGN, the DX register contains 0943h on return, which is the free
  6769.         space in clusters on the HC diskette. After ASSIGN, even with no
  6770.         parameters, 0901h is returned in the DX register; this is an incorrect
  6771.         value. Similar results occur with DD diskettes on a PC-XT or a PC-AT.
  6772.         This occurs only when the disk is not the default drive. Results are as
  6773.         expected when the drive is the default drive. Therefore, the
  6774.         circumvention is to make the desired drive the default drive prior to
  6775.         issuing this function call.
  6776.      4) Int 21h, function call 36h returns an incorrect value after an ASSIGN
  6777.         command. Prior to ASSIGN, the DX register contains 0943h on return,
  6778.         which is the free space in clusters on the HC diskette. After ASSIGN,
  6779.         even with no parameters, 0901h is returned in the DX register; this is
  6780.         an incorrect value. Similar results occur with DD diskettes on a PC-XT
  6781.         or a PC-AT. This occurs only when the disk is not the default drive.
  6782.         Results are as expected when the drive is the default drive. Therefore,
  6783.         the circumvention is to make the desired drive the default drive prior
  6784.         to issuing this function call.
  6785.      5) This function supercedes functions 1Bh and 1Ch.
  6786.  
  6787.  
  6788. Function  37h  SWITCHAR / AVAILDEV
  6789.  *   Get/set option marking character (is usually "/"), and device type
  6790. entry   AH      37h
  6791.         AL      00h     read switch character (returns current character in DL)
  6792.                 01h     set character in DL as new switch character
  6793.       (DOS 2.x) 02h     read device availability (as set by function AL=3) into
  6794.                         DL. A 0 means devices that devices must be accessed in
  6795.                         file I/O calls by /dev/device. A non-zero value means
  6796.                         that devices are accessible at every level of the
  6797.                         directory tree (e.g., PRN is the printer and not a file
  6798.                         PRN).
  6799.                         AL=2 to return flag in DL, AL=3 to set from DL (0 = set,
  6800.                         1 = not set).
  6801.       (DOS 2.x) 03h     get device availability, where:
  6802.         DL      00h     means /dev/ must precede device names
  6803.                 01h     means /dev/ need not precede device names
  6804. return  DL      switch character (if AL=0 or 1)
  6805.                 device availability flag (if AL=2 or 3)
  6806.         AL      0FFh    the value in AL was not in the range 0-3.
  6807. note 1) Functions 2 & 3 appear not to be implemented for DOS 3.x.
  6808.      2) It is documented on page 4.324 of the MS-DOS (version 2) Programmer's
  6809.         Utility Pack (Microsoft - published by Zenith).
  6810.      3) Works on all versions of IBM PC-DOS from 2.0 through 3.3.1.
  6811.      4) The SWITCHAR is the character used for "switches" in DOS command
  6812.         arguments (defaults to '/', as in "DIR/P"). '-' is popular to make a
  6813.         system look more like UNIX; if the SWITCHAR is anything other than '/',
  6814.         then '/' may be used instead of '\' for pathnames
  6815.      5) Ignored by XCOPY, PKARC, LIST
  6816.      6) SWITCHAR may not be set to any character used in a filename
  6817.      7) In DOS 3.x you can still read the "AVAILDEV" byte with subfunction 02h
  6818.         but it always returns 0FFh even if you try to change it to 0 with
  6819.         subfunction 03h.
  6820.      8) AVAILDEV=0 means that devices must be referenced in an imaginary
  6821.         subdirectory "\dev" (similar to UNIX's /dev/*); a filename "PRN.DAT"
  6822.         can be created on disk and manipulated like any other. If AVAILDEV != 0
  6823.         then device names are recognized anywhere (this is the default):
  6824.         "PRN.DAT" is synonymous with "PRN:".
  6825.      9) These functions reportedly are not supported in the same fashion in
  6826.         various implementations of DOS.
  6827.     10) used by DOS 3.3 CHKDSK, BASIC, DEBUG
  6828.  
  6829.  
  6830. Function  38h   Return Country Dependent Information
  6831.                 (PCDOS 2.0, 2.1, MSDOS 2.00 only)
  6832. entry   AH      38h
  6833.         AL      function code  (must be 0 in DOS 2.x)
  6834.         DS:DX   pointer to 32 byte memory buffer for returned information
  6835. return  CF      set on error
  6836.                 AX      error code (02h)
  6837.         BX      country code
  6838.         DS:DX   pointer to buffer filled with country information:
  6839.                 bytes 0,1       date/time format
  6840.                                 0       USA standard       H:M:S   M/D/Y
  6841.                                 1       European standard  H:M:S   D/M/Y
  6842.                                 2       Japanese standard  H:M:S   D:M:Y
  6843.                 byte2   ASCIIZ string currency symbol
  6844.                 byte3   zeroes
  6845.                 byte4   ASCIIZ string thousands separator
  6846.                 byte5   zeroes
  6847.                 byte6   ASCIIZ string decimal separator
  6848.                 byte7   zeroes
  6849.                 bytes 8,1Fh  24 bytes   reserved
  6850.  
  6851.  
  6852. Function  38h   Get Country Dependent Information
  6853.                 (PCDOS 3.x+, MSDOS 2.01+)
  6854. entry   AH      38h
  6855.         AL      function code
  6856.                 00h     to get current country information
  6857.                 01h-0FEh country code to get information for, for countries
  6858.                         with codes less than 255
  6859.                 0FFh    to get country information for countries with a code
  6860.                         greater than 255
  6861.                         BX      16 bit country code if AL=0FFh
  6862.         DS:DX   pointer to the memory buffer where the data will be returned
  6863.                 DX      0FFFFh if setting country code rather than getting info
  6864. return  CF      0 (clear) function completed
  6865.                 1 (set) error
  6866.                    AX   error code
  6867.                         02h     invalid country code (no table for it)
  6868.         (if DX <> 0FFFFh)
  6869.         BX      country code (usually international telephone code)
  6870.         DS:DX   pointer to country data buffer
  6871.           bytes 0,1     date/time format
  6872.                         0       USA standard       H:M:S   M/D/Y
  6873.                         1       European standard  H:M:S   D/M/Y
  6874.                         2       Japanese standard  H:M:S   D:M:Y
  6875.           bytes 2-6     currency symbol null terminated
  6876.           byte  07h     thousands separator null terminated
  6877.           byte  08h     zeroes
  6878.           byte  09h     decimal separator null terminated
  6879.           byte  0Ah     zeroes
  6880.           byte  0Bh     date separator null terminated
  6881.           byte  0Ch     zeroes
  6882.           byte  0Dh     time separator null terminated
  6883.           byte  0Eh     zeroes
  6884.           byte  0Fh     bit field currency format
  6885.                         bit 0 = 0  if currency symbol precedes the value
  6886.                                 1  if currency symbol is after the value
  6887.                         bit 1 = 0  no spaces between value and currency symbol
  6888.                                 1  one space between value and currency symbol
  6889.                         bit 2 = 1  set if currency symbol replaces decimal pt
  6890.                         bits 3-7   not defined by Microsoft
  6891.           byte  10h     number of significant decimal digits in currency
  6892.                         (number of places to right of decimal point)
  6893.           byte  11h     time format
  6894.                         bit 0 = 0       12 hour clock
  6895.                                 1       24 hour clock
  6896.                         bits 1-7 unknown, probably not used
  6897.           bytes 12h-15h address of case map routine (FAR CALL, AL = char)
  6898.                         entry   AL  ASCII code of character to be converted to
  6899.                                     uppercase
  6900.                         return  AL  ASCII code of the uppercase input character
  6901.           byte  16h     data-list separator character
  6902.           byte  17h     zeroes
  6903.           bytes 18h-21h 5 words reserved
  6904. note 1) When an alternate keyboard handler is invoked, the keyboard routine is
  6905.         loaded into user memory starting at the lowest portion of availible
  6906.         user memory. The BIOS interrupt vector that services the keyboard is
  6907.         redirected to the memory area where the new routine resides. Each new
  6908.         routine takes up about 1.6K of memory and has lookup tables that return
  6909.         values unique to each language. (KEYBxx in the DOS book)
  6910.          Once the keyboard interrupt vector is changed by the DOS keyboard
  6911.         routine, the new routine services all calls unless the system is
  6912.         returned to the US format by the ctrl-alt-F1 keystroke combination. This
  6913.         does not change the interrupt vector back to the BIOS location; it
  6914.         merely passes the table lookup to the ROM locations.
  6915.      2) Ctrl-Alt-F1 will only change systems with US ROMS to the US layout.
  6916.         Some systems are delivered with non-US keyboard handler routines in ROM
  6917.      3) Case mapping call: the segment/offset of a FAR procedure that performs
  6918.         country-specific lower-to-upper case mapping on ASCII characters 80h to
  6919.         0FFh. It is called with the character to be mapped in AL. If there is
  6920.         an uppercase code for the letter, it is returned in AL, if there is no
  6921.         code or the function was called with a value of less than 80h AL is
  6922.         returned unchanged.
  6923.      4) This call is fully implemented in MS-DOS version 2.01 and higher. It
  6924.         is in version 2.00 but not fully implemented (according to Microsoft)
  6925.  
  6926.  
  6927. Function  38h   Set Country Dependent Information
  6928. entry   AH      38h
  6929.         AL      code    country code to set information for, for countries
  6930.                         with codes less than 255
  6931.                 0FFh    to set country information for countries with a code
  6932.                         greater than 255
  6933.         BX      16 bit country code if AL=0FFh
  6934.         DX      0FFFFh
  6935. return  CF      clear   successful
  6936.                 set     if error
  6937.                         AX      error code (02h)
  6938.  
  6939.  
  6940. Function  39h   Create Subdirectory (MKDIR)
  6941.                 Makes a subdirectory along the indicated path
  6942. entry   AH      39h
  6943.         DS:DX   address of ASCIIZ pathname string
  6944. return  flag CF 0       successful
  6945.                 1       error
  6946.                         AX      error code if any  (3, 5)
  6947. note 1) The ASCIIZ string may contain drive and subdirectory.
  6948.      2) Drive may be any valid drive (not nescessarily current drive)
  6949.      3) The pathname cannot exceed 64 characters
  6950.  
  6951.  
  6952. Function  3Ah   Remove Subdirectory  (RMDIR)
  6953. entry   AH      3Ah
  6954.         DS:DX   address of ASCIIZ pathname string
  6955. return  CF      clear     successful
  6956.                 set       AX      error code if any  (3, 5, 16)
  6957. note 1) The ASCIIZ string may contain drive and subdirectory.
  6958.      2) Drive may be any valid drive (not nescessarily current drive)
  6959.      3) The pathname cannot exceed 64 characters
  6960.  
  6961.  
  6962. Function  3Bh   Change Current Directory  (CHDIR)
  6963. entry   AH      3Bh
  6964.         DS:DX   address of ASCIIZ string
  6965. return  flag CF 0       successful
  6966.                 1       error
  6967.         AX      error code if any (3)
  6968. note 1) The pathname cannot exceed 64 characters
  6969.      2) The ASCIIZ string may contain drive and subdirectory.
  6970.      3) Drive may be any valid drive (not nescessarily current drive)
  6971.  
  6972.  
  6973. Function  3Ch   Create A File (CREAT)
  6974.                 Create a file with handle
  6975. entry   AH      3Ch
  6976.         CX      attributes for file
  6977.                 00h     normal
  6978.                 01h     read only
  6979.                 02h     hidden
  6980.                 03h     system
  6981.         DS:DX   address of ASCIIZ filename string
  6982. return  flag CF 0       successful creation
  6983.                 1       error
  6984.         AX      16 bit file handle
  6985.                 or error code  (3, 4, 5)
  6986. note 1) The ASCIIZ string may contain drive and subdirectory.
  6987.      2) Drive may be any valid drive (not nescessarily current drive)
  6988.      3) If the volume label or subdirectory bits are set in CX, they are ignored
  6989.      4) The file is opened in read/write mode
  6990.      5) If the file does not exist, it is created. If one of the same name
  6991.         exists, it is truncated to a length of 0.
  6992.      6) Good practice is to attempt to open a file with fn 3Dh and jump to an
  6993.         error routine if successful, create file if 3Dh fails. That way an
  6994.         existing file will not be truncated and overwritten.
  6995.  
  6996.  
  6997. Function  3Dh   Open A File
  6998.                 Open disk file with handle
  6999. entry   AH      3Dh
  7000.         AL      access code byte
  7001. (DOS 2.x)       bits 0-2  file attribute
  7002.                 000     read only
  7003.                 001     write only
  7004.                 010     read/write
  7005.                 bits 3-7 should be set to zero
  7006. (DOS 3.x)       bits 0-2  file attribute
  7007.                 000     read only
  7008.                 001     write only
  7009.                 010     read/write
  7010.                 bit 3   reserved
  7011.                 0       should be set to zero
  7012.                 bits 4-6 sharing mode (network)
  7013.                 000     compatibility mode (the way FCBs open files)
  7014.                 001     read/write access denied (exclusive)
  7015.                 010     write access denied
  7016.                 011     read access denied
  7017.                 100     full access permitted
  7018.                 bit 7   inheritance flag
  7019.                 0       file inherited by child process
  7020.                 1       file private to child process
  7021.         DS:DX   address of ASCIIZ pathname string
  7022. return  flag CF set on error
  7023.                 AX      error code
  7024.                 1       error
  7025.         AX      16 bit file handle
  7026.                 or error code (1, 2, 4, 5, 0Ch)
  7027. note 1) Opens any normal, system, or hidden file
  7028.      2) Files that end in a colon are not opened
  7029.      3) The rear/write pointer is set at the first byte of the file and the
  7030.         record size of the file is 1 byte (the read/write pointer can be changed
  7031.         through function call 42h). The returned file handle must be used for
  7032.         all subsequent input and output to the file.
  7033.      4) If the file handle was inherited from a parent process or was
  7034.         duplicated by DUP or FORCEDUP, all sharing and access restrictions are
  7035.         also inherited.
  7036.      5) A file sharing error (error 1) causes an int 24h to execute with an
  7037.         error code of 2
  7038.  
  7039.  
  7040. Function  3Eh   Close A File Handle
  7041.                 Close a file and release handle for reuse
  7042. entry   AH      3Eh
  7043.         BX      file handle
  7044. return  flag CF 0       successful close
  7045.                 1       error
  7046.         AX      error code if error (6)
  7047. note 1) When executed, the file is closed, the directory is updated, and all
  7048.         buffers for that file are flushed. If the file was changed, the time
  7049.         and date stamps are changed to current
  7050.      2) If called with the handle 00000, it will close STDIN (normally the
  7051.         keyboard).
  7052.  
  7053.  
  7054. Function  3Fh   Read From A File Or Device
  7055.                 Read from file with handle
  7056. entry   AH      3Fh
  7057.         BX      file handle
  7058.         CX      number of bytes to read
  7059.         DS:DX   address of buffer
  7060. return  flag CF 0       successful read
  7061.                 1       error
  7062.         AX      0       pointer was already at end of file
  7063.                         or number of bytes read
  7064.                         or error code (5, 6)
  7065. note 1) This function attempts to transfer the number of bytes specified in CX
  7066.         to a buffer location. It is not guaranteed that all bytes will be read.
  7067.         If AX < CX a partial record was read.
  7068.      2) If performed from STDIN (file handle 0000), the input can be redirected
  7069.      3) If used to read the keyboard, it will only read to the first CR
  7070.      4) The file pointer is incremented to the last byte read.
  7071.  
  7072.  
  7073. Function  40h   Write To A File Or Device
  7074.                 Write to file with handle
  7075. entry   AH      40h
  7076.         BX      file handle
  7077.         CX      number of bytes to write
  7078.         DS:DX   address of buffer
  7079. return  flag CF 0       successful write
  7080.                 1       error
  7081.         AX      number of bytes written
  7082.                 or error code  (5, 6)
  7083. note 1) This call attempts to transfer the number of bytes indicated in CX
  7084.         from a buffer to a file. If CX and AX do not match after the write,
  7085.         an error has taken place; however no error code will be returned for
  7086.         this problem. This is usually caused by a full disk.
  7087.      2) If the write is performed to STDOUT (handle 0001), it may be redirected
  7088.      3) To truncate the file at the current position of the file pointer, set
  7089.         the number of bytes in CX to zero before calling int 21h. The pointer
  7090.         can be moved to any desired position with function 42h.
  7091.      4) This function will not write to a file or device marked read-only.
  7092.      5) May also be used to display strings to CON instead of fn 09h. This
  7093.         function will write CX bytes and stop; fn 09h will continue to write
  7094.         until a $ character is found.
  7095.      6) This is the call that DOS actually uses to write to the screen in DOS
  7096.         2.x and above.
  7097.  
  7098.  
  7099. Function  41h   Delete A File From A Specified Subdirectory  (UNLINK)
  7100. entry   AH      41h
  7101.         DS:DX   pointer to ASCIIZ filespec to delete
  7102. return  CF      0       successful
  7103.                 1       error
  7104.                 AX      error code if any  (2, 5)
  7105. note 1) This function will not work on a file marked read-only
  7106.      2) Wildcards are not accepted
  7107.  
  7108.  
  7109. Function  42h   Move a File Read/Write Pointer  (LSEEK)
  7110. entry   AH      42h
  7111.         AL      method code
  7112.                 00h     offset from beginning of file
  7113.                 01h     offset from present location
  7114.                 02h     offset from end of file
  7115.         BX      file handle
  7116.         CX      most significant half of offset
  7117.         DX      least significant half of offset
  7118. return  AX      low offset of new file pointer
  7119.         DX      high offset of new file pointer
  7120.         CF      0       successful move
  7121.                 1       error
  7122.                 AX      error code (1, 6)
  7123. note 1) If pointer is at end of file, reflects file size in bytes.
  7124.      2) The value in DX:AX is the absolute 32 bit byte offset from the beginning
  7125.         of the file
  7126.  
  7127.  
  7128. Function   43h  Get/Set file attributes  (CHMOD)
  7129. entry   AH      43h
  7130.         AL      00h     get file attributes
  7131.                 01h     set file attributes
  7132.                 CX      file attributes to set
  7133.                     bit 0       read only
  7134.                         1       hidden file
  7135.                         2       system file
  7136.                         3       volume label
  7137.                         4       subdirectory
  7138.                         5       written since backup
  7139.         DS:DX   pointer to full ASCIIZ file name
  7140. return  CF      set if error
  7141.         AX      error code  (1, 2, 3, 5)
  7142.         CX      file attributes on get
  7143.                 attributes:
  7144.                 01h     read only
  7145.                 02h     hidden
  7146.                 04h     system
  7147.                 0FFh    archive
  7148. note 1) This call will not change the volume label or directory bits
  7149.  
  7150.  
  7151. Function  44h   I/O Control for Devices (IOCTL)
  7152.                 Get or Set Device Information
  7153. entry   AH      44h
  7154.         AL      00h     Get Device Information (from DX)
  7155.                         BX      file or device handle
  7156.                         return  DX      device info
  7157.                                         If bit 7 set: (character device)
  7158.                                            bit 0: console input device
  7159.                                                1: console output device
  7160.                                                2: NUL device
  7161.                                                3: CLOCK$ device
  7162.                                                4: device is special
  7163.                                                5: binary (raw) mode
  7164.                                                6: not EOF
  7165.                                               12: network device (DOS 3.x)
  7166.                                               14: can process IOCTL control
  7167.                                                   strings (func 2-5)
  7168.                                         If bit 7 clear: (file)
  7169.                                            bits 0-5: block device number
  7170.                                                 6: file has not been written
  7171.                                                12: Network device (DOS 3.x)
  7172.                                                15: file is remote (DOS 3.x)
  7173.                 01h     Set Device Information (DH must be zero for this call)
  7174.                         DX bits:
  7175.                         0    1  console input device
  7176.                         1    1  console output device
  7177.                         2    1  null device
  7178.                         3    1  clock device
  7179.                         4    1  reserved
  7180.                         5    0  binary mode - don't check for control chars
  7181.                              1  cooked mode - check for control chars
  7182.                         6    0  EOF - End Of File on input
  7183.                         7       device is character device if set, if not, EOF
  7184.                                 is 0 if channel has been written, bits 0-5 are
  7185.                                 block device number
  7186.                         12      network device
  7187.                         14   1  can process control strings (AL 2-5, can only be
  7188.                                 read, cannot be set)
  7189.                         15   n  reserved
  7190.                 02h     Read CX bytes to device in DS:DX from BX control chan
  7191.                 03h     Write Device Control String
  7192.                         BX      device handle
  7193.                         CX      number of bytes to write
  7194.                         DS:DX   pointer to buffer
  7195.                         return  AX      number of bytes written
  7196.                 04h     Read From Block Device (drive number in BL)
  7197.                         BL      drive number (0=default)
  7198.                         CX      number of bytes to read
  7199.                         DS:DX   pointer to buffer
  7200.                         return  AX      number of bytes read
  7201.                 05h     Write to Block Device  (drive number in BL)
  7202.                         AX      number of bytes transfered
  7203.                 06h     Get Input Handle Status
  7204.                         BX      file or device handle
  7205.                         return  AL      0FFh    device ready
  7206.                                         00h     device not ready
  7207.                 07h     Get Output Handle Status
  7208.                         return  AL      00h     not ready
  7209.                                         0FFh    ready
  7210.                          note: for DOS 2.x, files are always ready for output
  7211.                 08h     Removable Media Bit (DOS 3.x+)
  7212.                         return  AX      00h     device is removable
  7213.                                         01h     device is nonremovable
  7214.                                         0Fh     invalid drive specification
  7215.                 09h     Test whether Local or Network Device in BL (DOS 3.x+)
  7216.                         BL      drive number (0=default)
  7217.                         return  DX      attribute word, bit 12 set if device is
  7218.                                         remote
  7219.                 0Ah     Is Handle in BX Local or Remote? (DOS 3.x+)
  7220.                         BX     file handle
  7221.                         return DX (attribute word) bit 15 set if file is remote
  7222.                 0Bh     Change Sharing Retry Count to DX (default=3), (DOS 3.x+)
  7223.                         CX     delay (default=1)
  7224.                         DX     retry count (default=3)
  7225.                 0Ch     General IOCTL (DOS 3.3 [3.2?]) allows a device driver to
  7226.                         prepare, select, refresh, and query Code Pages
  7227.                 0Dh     Block Device Request (DOS 3.3+)
  7228.                         BL      drive number (0=default)
  7229.                         CH      major subfunction
  7230.                         CL      minor subfunction
  7231.                                 40h set device parameters
  7232.                                 41h write logical device track
  7233.                                 42h format and verify logical device track
  7234.                                 60h get device parameters
  7235.                                 61h read logical device track
  7236.                                 62h verify logical device track
  7237.                         DS:DX   pointer to parameter block
  7238.                 0Eh     Get Logical Device (DOS 3.3+)
  7239.                         BL      drive number (0=default)
  7240.                         return  AL=0 block device has only one logical drive
  7241.                                 assigned 1..n the last letter used to reference
  7242.                                 the device (1=A:,etc)
  7243.                 0Fh     Set Logical Device (DOS 3.3+)
  7244.         BL      drive number:  0=default, 1=A:, 2=B:, etc.
  7245.         BX      file handle
  7246.         CX      number of bytes to read or write
  7247.         DS:DX   data or buffer
  7248.         DX      data
  7249. return  AX      number of bytes transferred
  7250.                 or error code (call function 59h for extended error codes)
  7251.                 or status  00h     not ready
  7252.                            0FFh    ready
  7253.         CF      set if error
  7254.  
  7255.  
  7256. Function  45h   Duplicate a File Handle (DUP)
  7257. entry   AH      45h
  7258.         BX      file handle to duplicate
  7259. return  CF      clear   AX      duplicate handle
  7260.                 set     AX      error code  (4, 6)
  7261. note 1) If you move the pointed of one handle, the pointer of the other will
  7262.         also be moved.
  7263.      2) The handle in BX must be open
  7264.  
  7265.  
  7266. Function  46h   Force Duplicate of a Handle (FORCEDUP or CDUP)
  7267.                 Forces handle in CX to refer to the same file at the same
  7268.                 position as BX
  7269. entry   AH      46h
  7270.         BX      existing file handle
  7271.         CX      new file handle
  7272. return  CF      clear   both handles now refer to existing file
  7273.                 set     error
  7274.                 AX      error code (4, 6)
  7275. note 1) If CX was an open file, it is closed first
  7276.      2) If you move the read/write pointer of either file, both will move
  7277.      3) The handle in BX must be open
  7278.  
  7279.  
  7280. Function  47h   Get Current Directory
  7281.                 Places full pathname of current directory/drive into a buffer
  7282. entry   AH      47h
  7283.         DL      drive (0=default, 1=A:, etc.)
  7284.         DS:SI   points to 64-byte buffer area
  7285. return  CF      clear   DS:DI   pointer to ASCIIZ pathname of current directory
  7286.                 set     AX      error code (0Fh)
  7287. note   String does not begin with a drive identifier or a backslash
  7288.  
  7289.  
  7290. Function  48h   Allocate Memory
  7291.                 Allocates requested number of 16-byte paragraphs of memory
  7292. entry   AH      48h
  7293.         BX      number of 16-byte paragraphs desired
  7294. return  CF      clear   AX      segment address of allocated space
  7295.                         BX      maximum number paragraphs available
  7296.                 set     AX      error code (7, 8)
  7297. note    BX indicates maximum memory availible only if allocation fails
  7298.  
  7299.  
  7300. Function  49h   Free Allocated Memory
  7301.                 Frees specified memory blocks
  7302. entry   AH      49h
  7303.         ES      segment address of area to be freed
  7304. return  CF      clear   successful
  7305.                 set     AX      error code (7, 9)
  7306. note 1) This call is only valid when freeing memory obtained by function 48h.
  7307.      2) A program should not try to release memory not belonging to it.
  7308.  
  7309.  
  7310. Function  4Ah   Modify Allocated Memory Blocks (SETBLOCK)
  7311.                 Expand or shrink memory for a program
  7312. entry   AH      4AH
  7313.         BX      new size in 16 byte paragraphs
  7314.         ES      segment address of block to change
  7315. return  CF      clear   nothing
  7316.                 set     AX      error code (7, 8, 9)
  7317.                     or  BX      max number paragraphs available
  7318. note 1) Max number paragraphs availible is returned only if the call fails
  7319.      2) Memory can be expanded only if there is memory availible
  7320.  
  7321.  
  7322. Function  4Bh   Load or Execute a Program  (EXEC)
  7323. entry   AH      4Bh
  7324.         AL      00h     load and execute program. A PSP is built for the program
  7325.                         the ctrl-break and terminate addresses are set to the
  7326.                         new PSP.
  7327.                *01h     load but don't execute  (note 1)
  7328.                *01h     load but don't execute (internal, DOS 3.x & DESQview)
  7329.                *02h     load but do not execute (internal, DOS 2.x only)
  7330.                 03h     load overlay (do not create PSP, do not begin execution)
  7331.         DS:DX   points to the ASCIIZ string with the drive, path, and filename
  7332.                 to be loaded
  7333.         ES:BX   points to a parameter block for the load
  7334.                (AL=00h) word    segment address of environment string to be
  7335.                                 passed
  7336.                        dword    pointer to the command line to be placed at
  7337.                                 PSP+80h
  7338.                        dword    pointer to default FCB to be passed at PSP+5Ch
  7339.                        dword    pointer to default FCB to be passed at PSP+6Ch
  7340.               (*AL=01h) word    segment of environment (0 = use current)
  7341.                        dword    pointer to command line
  7342.                        dword    pointer to FCB 1
  7343.                        dword    pointer to FCB 2
  7344.                        dword    will hold SS:SP on return
  7345.                        dword    will hold program entry point (CS:IP) on return
  7346.               (*AL=02h) word    segment of environment (0 = use current)
  7347.                        dword    pointer to command line
  7348.                        dword    pointer to FCB 1
  7349.                        dword    pointer to FCB 2
  7350.                (AL=03h) word    segment address where file will be loaded
  7351.                         word    relocation factor to be applied to the image
  7352. return  CF      set     error
  7353.                         AX      error code (1, 2, 8, 0Ah, 0Bh)
  7354. note 1) If you make this call with AL=1 the program will be loaded as if you
  7355.         made the call with AL=0 except that the program will not be executed.
  7356.         Additionally, with AL=1 the stack segment and pointer along with the
  7357.         program's CS:IP entry point are returned to the program which made the
  7358.         4B01h call. These values are put in the four words at ES:BX+0Eh. On
  7359.         entry to the call ES:BX points to the environment address, the command
  7360.         line and the two default FCBs. This form of EXEC is used by DEBUG.COM.
  7361.      2) Application programs may invoke a secondary copy of the command
  7362.         processor (normally COMMAND.COM) by using the EXEC function.  Your
  7363.         program may pass a DOS command as a parameter that the secondary
  7364.         command processor will execute as though it had been entered from the
  7365.         standard input device.
  7366.         The procedure is:
  7367.          A. Assure that adequate free memory (17k for 2.x and 3.0, 23k for 3.1
  7368.             up) exists to contain the second copy of the command processor and
  7369.             the command it is to execute. This is accomplished by executing
  7370.             function call 4Ah to shrink memory allocated to that of your current
  7371.             requirements. Next, execute function call 48h with BX=0FFFFh. This
  7372.             returns the amount of memory availible.
  7373.         B. Build a parameter string for the secondary command processor in the
  7374.            form:
  7375.                          1 byte   length of parameter string
  7376.                         xx bytes  parameter string
  7377.                          1 byte   0Dh (carriage return)
  7378.            For example, the assembly language statement below would build the
  7379.            string to cause execution of the command FOO.EXE:
  7380.                               DB 19,"/C C:FOO",13
  7381.         C. Use the EXEC function call (4Bh), function value 0 to cause execution
  7382.            of the secondary copy of the command processor. (The drive,
  7383.            directory, and name of the command processor can be gotten from the
  7384.            COMSPEC variable in the DOS environment passed to you at PSP+2Ch.)
  7385.         D. Remember to set offset 2 of the EXEC control block to point to the
  7386.            string built above.
  7387.      3) All open files of a process are duplicated in the newly created
  7388.         process after an EXEC, except for files originally opened with the
  7389.         inheritance bit set to 1.
  7390.      4) The environment is a copy of the original command processor's
  7391.         environment. Changes to the EXECed environment are not passed back to
  7392.         the original. The environment is followed by a copy of the DS:DX
  7393.         filename passed to the child process. A zero value will cause the
  7394.         child process to inherit the environment of the calling process. The
  7395.         segment address of the environment is placed at offset 2Ch of the
  7396.         PSP of the program being invoked.
  7397.      5) This function uses the same resident part of COMMAND.COM, but makes a
  7398.         duplicate of the transient part.
  7399.      6) How EXEC knows where to return to: Basically the vector for int 22h
  7400.         holds the terminate address for the current process. When a process
  7401.         gets started, the previous contents of int 22h get tucked away in the
  7402.         PSP for that process, then int 22h gets modified. So if Process A
  7403.         EXECs process B, while Process B is running, the vector for int 22h
  7404.         holds the address to return to in Process A, while the save location in
  7405.         Process B's PSP holds the address that process A will return to when
  7406.         *it* terminates. When Process B terminates by one of the usual legal
  7407.         means, the contents of int 22h are (surmising) shoved onto the stack,
  7408.         the old terminate vector contents are copied back to int 22h vector from
  7409.         Process B's PSP, then a RETF or equivalent is executed to return control
  7410.         to process A.
  7411.      7) To load an overlay file with 4B: first, don't de-allocate the memory
  7412.         that the overlay will load into. With the other 4Bh functions, the
  7413.         opposite is true--you have to free the memory first, with function 4Ah.
  7414.         Second, the "segment address where the file will be loaded" (first item
  7415.         in the parameter block for sub-function 03) should be a paragraph
  7416.         boundary within your currently-allocated memory. Third, if the
  7417.         procedures within the overlay are FAR procs (while they execute, CS will
  7418.         be equal to the segment address of the overlay area), the relocation
  7419.         factor should be set to zero. On the other hand, if the CS register
  7420.         will be different from the overlay area's segment address, the
  7421.         relocation factor should be set to represent the difference. You
  7422.         determine where in memory the overlay file will load by using the
  7423.         segment address mentioned above. Overlay files are .EXEs (containing
  7424.         header, relocation table, and memory image).
  7425.      8) When function 00h returns, all registers are changed, including the
  7426.         stack. You must resore SS, SP, and any other required registers.
  7427.  
  7428.  
  7429. Function  4Ch   Terminate a Process (EXIT)
  7430.                 Quit with ERRORLEVEL exit code
  7431. entry   AH      4Ch
  7432.         AL      exit code in AL when called, if any, is passed to next process
  7433. return  none
  7434. note 1) Control passes to DOS or calling program
  7435.      2) return code from AL can be retrieved by ERRORLEVEL or function 4Dh
  7436.      3) all files opened by this process are closed, buffers are flushed, and
  7437.         the disk directory is updated
  7438.      4) Restores Terminate vector from PSP:000Ah
  7439.                  Ctrl-C vector from PSP:000Eh
  7440.                  Critical Error vector from PSP:0012h
  7441.  
  7442.  
  7443. Function  4Dh   Get Return Code of a Subprocess (WAIT)
  7444.                 Gets return code from functions 31h and 4Dh  (ERRORLEVEL)
  7445. entry   AH      4Dh
  7446. return  AL      exit code of subprogram (functions 31h or 4Ch)
  7447.         AH      circumstance which caused termination
  7448.                 00h     normal termination
  7449.                 01h     control-break
  7450.                 02h     critical device error
  7451.                 03h     terminate and stay resident (function 31h)
  7452. note    The exit code is only returned once
  7453.  
  7454.  
  7455. Function  4Eh   Find First Matching File (FIND FIRST)
  7456. entry   AH      4Eh
  7457.         CX      search attributes
  7458.         DS:DX   pointer to ASCIIZ filename (with attributes)
  7459. return  CF      set     AX      error code (2, 12h)
  7460.                 clear   data block written at current DTA
  7461.                         format of block is:  (info from BIX)
  7462.   documented by Micro-  |00h   1 byte   attribute byte of search
  7463.   soft as "reserved for |01h   1 byte   drive letter for search
  7464.   DOS' use on subsquent |02h   11 bytes the search name used
  7465.   Find Next calls"      |0Ch   2 bytes  word value of last entry
  7466.   function 4Fh          |0Fh   4 bytes  dword pointer to this DTA
  7467.                         |13h   2 bytes  word directory start
  7468.                         | PC-DOS 3.10 (from INTERRUP.ARC)
  7469.                         |00h   1 byte   drive letter
  7470.                         |01h-0Bh    bytes  search template
  7471.                         |0Ch   1 byte   search attributes
  7472.                         | DOS 2.x (and DOS 3.x except 3.1?) (from INTERRUP.ARC)
  7473.                         |00h   1 byte   search attributes
  7474.                         |01h   1 byte   drive letter
  7475.                         |02h-0Ch bytes  search template
  7476.                         |0Dh-0Eh 2 bytes entry count within directory
  7477.                         |0Fh-12h   bytes reserved
  7478.                         |13h-14h 2 bytes cluster number of parent directory
  7479.  
  7480.                          15h   1 byte   file attribute
  7481.                          16h   2 bytes  file time
  7482.                          18h   2 bytes  file date
  7483.                          1Ah   2 bytes  low word of file size
  7484.                          1Ch   2 bytes  high word of file size
  7485.                          1Eh  13 bytes  name and extension of file found, plus
  7486.                                         1 byte of 0s. All blanks are removed
  7487.                                         from the name and extension, and if an
  7488.                                         extension is present it is preceded by a
  7489.                                         period.
  7490. note 1) Will not find volume label
  7491.      2) This function does not support network operations
  7492.      3) Wildcards are allowed in the filespec
  7493.      4) If the attribute is zero, only ordinary files are found. If the volume
  7494.         label bit is set, only volume labels will be found. Any other attribute
  7495.         will return that attribute and all normal files together.
  7496.      5) To look for everything except the volume label, set the hidden, system,
  7497.         and subdirectory bits all to 1
  7498.  
  7499.  
  7500. Function  4Fh   Find Next Matching File (FIND NEXT)
  7501.                 Find next ASCIIZ file
  7502. entry   AH      4Fh
  7503. return  CF      clear   data block written at current DTA
  7504.                 set     AX      error code (2, 12h)
  7505. note 1) If file found, DTA is formatted as in call 4Eh
  7506.      2) Volume label searches using 4Eh/4Fh reportedly aren't 100% reliable
  7507.         under DOS 2.x. The calls sometime report there's a volume label and
  7508.         point to a garbage DTA, and if the volume label is the only item they
  7509.         often won't find it
  7510.      3) This function does not support network operations
  7511.      4) Use of this call assumes that the original filespec contained wildcards
  7512.  
  7513.  
  7514. Function  50h   "Used Internally by DOS" - Set PSP
  7515.  *              Set new Program Segment Prefix (current Process ID)
  7516. entry   AH      50h
  7517.         BX      segment address of new PSP
  7518. return  none - swaps PSP's regarded as current by DOS
  7519. note 1) By putting the PSP segment value into BX and issuing call 50h DOS stores
  7520.         that value into a variable and uses that value whenever a file call is
  7521.         made.
  7522.      2) Note that in the PSP (or PDB) is a table of 20 (decimal) open file
  7523.         handles. The table starts at offset 18h into the PSP. If there is an
  7524.         0FFh in a byte then that handle is not in use. A number in one of the
  7525.         bytes is an index into an internal FB table for that handle. For
  7526.         instance the byte at offset 18h is for handle 0, at offset 19h handle
  7527.         1, etc. up to 13h. If the high bit is set then the file associated by
  7528.         the handle is not shared by child processes EXEC'd with call 4Bh.
  7529.      3) Function 50h is dangerous in background operations prior to DOS 3.x as
  7530.         it uses the wrong stack for saving registers.  (same as functions
  7531.         0..0Ch in DOS 2.x)
  7532.      4) Under DOS 2.x, this function cannot be invoked inside an int 28h handler
  7533.         without setting the Critical Error flag
  7534.      5) Open File information, etc. is stored in the PSP DOS views as current.
  7535.         If a program (eg. a resident program) creates a need for a second PSP,
  7536.         then the second PSP should be set as current to make sure DOS closes
  7537.         that as opposed to the first when the second application finishes.
  7538.      6) See PC Mag Vol.5, No 9, p.314 for discussion.
  7539.      7) Used by DOS 3.3 PRINT & DEBUG, DesQview 2.01, Windows 1.03, SYMDEB
  7540.         from MASM 4.0
  7541.  
  7542.  
  7543. Function  51h    "Used Internally by DOS" - Get Program Segment Prefix
  7544.  *               Returns the PSP address of currently executing program
  7545. entry   AH      51h
  7546. return  BX      address of currently executing program
  7547.                 offset
  7548.                 00h     program exit point
  7549.                 02h     memory size in paragraphs
  7550.                 04h     unused (0)
  7551.                 05h     CP/M style entry point (far call to DOS)
  7552.                 0Ah     terminate address (old int 22h)
  7553.                 0Ch     terminate segment
  7554.                 0Eh     break address (old int 23h)
  7555.                 10h     break segment
  7556.                 12h     error address (old int 24h)
  7557.                 14h     error segment
  7558.                 16h     parent PSP segment
  7559.                 18h     DOS 2.0+ open files, 0FFh = unused
  7560.                 2Ch     DOS 2.0+ environment segment
  7561.                 2Eh     far ptr to process's SS:SP
  7562.                 32h     DOS 3.x max open files
  7563.                 34h     DOS 3.x openfile table address
  7564.                 36h     DOS 3.x openfile table segment
  7565.                 38h     unused by DOS versions <= 3.3
  7566.                 50h     DOS function dispatcher (FAR routine)
  7567.                 53h     unused
  7568.                 55h     FCB #1 extension
  7569.                 5Ch     FCB #1
  7570.                 6Ch     FCB #2
  7571.                 80h     command tail / default DTA buffer
  7572. note 1) Used in DOS 2.x, 3.x uses 62h
  7573.      2) Function 51h is dangerous in background operations prior to DOS 3.x as
  7574.         it uses the wrong stack for saving registers.  (same as functions
  7575.         0..0Ch in DOS 2.x)
  7576.      3) 50h and 51h might be used if you have more than one process in a PC.
  7577.         For instance if you have a resident program that needs to open a file
  7578.         you could first call 51h to save the current id and then call 50h to set
  7579.         the ID to your PSP.
  7580.      4) Under DOS 2.x, this function cannot be invoked inside an int 28h handler
  7581.         without setting the Critical Error flag
  7582.      5) Used by DOS 3.3 PRINT, DEBUG
  7583.  
  7584.  
  7585. Function  52h   "Used Internally by DOS" - IN-VARS
  7586.  *              Returns a pointer to a set of DOS data variables MCB chain,
  7587.                 pointer to first device driver and a pointer to disk parameter
  7588.                 blocks (first one)
  7589. entry   AH      52h
  7590. return  ES:BX   pointer to the DOS list of lists, for disk information. Does not
  7591.                 access the disk, so information in tables might be incorrect if
  7592.                 disk has been changed. Returns a pointer to the following array
  7593.                 of longword pointers:
  7594.                 Bytes   Value
  7595.                 -2h,-1h segment of first memory control block
  7596.                 00h-03h pointer to first DOS disk block (see function 36h)
  7597.                 04h-07h Pointer to list of DOS file tables
  7598.                         dword   pointer to next file table
  7599.                         word    number of files in this table
  7600.                                 35h bytes per file
  7601.                                 00h-01h number of file handles referring to
  7602.                                         this file
  7603.                                 02h-06h unknown
  7604.                                 07h-0Ah pointer to device driver header if
  7605.                                         character device; pointer to DOS Device
  7606.                                         Control Block if block device (see
  7607.                                         fn 32h for format)
  7608.                                 0Bh-1Fh unknown
  7609.                                 20h-2Ah filename in FCB format (no path, no
  7610.                                         period, blank-padded)
  7611.                                 2Bh-2Ch PSP segment of file's owner
  7612.                                 2Dh-30h unknown -  0 always
  7613.                                 31h-32h unknown
  7614.                                 33h-34h unknown
  7615.                 8h-0Bh  pointer to CLOCK$ device driver, whether installable or
  7616.                         resident
  7617.                 0Ch-0Fh pointer to actual CON: device driver, whether
  7618.                         installable or resident
  7619.         (DOS 2.x)
  7620.                 10      number of logical drives in system
  7621.                 11-12   maximum bytes/block of any block device
  7622.                 13-16   unknown
  7623.                 17      beginning (not a pointer. The real beginning!) of NUL
  7624.                         device driver. This is the first device on DOS's linked
  7625.                         list of device drivers.
  7626.         (DOS 3.x)
  7627.                 10h-11h maximum bytes/block of any block device (0200h)
  7628.                 12h-15h pointer to first disk buffer
  7629.                 16h-19h partially undefined: Pointer to array of drive info:
  7630.                         51h bytes per drive, starting with A: ...
  7631.                         00h-3Fh current path as ASCIIZ, starting with 'x:\'
  7632.                         40h-43h unknown    zeros always
  7633.                         44h     unknown    flags? Usually 40h, except for
  7634.                                 entry after last valid entry = 00h
  7635.                         45h-48h pointer to DOS disk block for this drive
  7636.                         49h-4Ah unknown. Current track or block?
  7637.                                 -1 if never accessed
  7638.                         4Bh-4Eh unknown  -1 always
  7639.                         4Fh-52h unknown   2 always
  7640.                 1Ah-1Dh pointer to FCB table (if CONFIG.SYS contains FCBS=)
  7641.                 1Eh-1Fh size of FCB table
  7642.                 20h     number of block devices
  7643.                 21h     value of LASTDRIVE command in CONFIG.SYS (default 5)
  7644.                 22h     beginning (not a pointer. The real beginning!) of NUL
  7645.                         device driver. This is the first device on DOS's linked
  7646.                         list of device drivers.
  7647. note 1) This call is not supported in OS/2 1.0's DOS Compatibility Box
  7648.      2) Used by DOS 4.0 MEM.EXE, DOS 3.3 ASSIGN.COM, PRINT.COM, SUBST.EXE
  7649.      3) IMPORTANT:  The structure of this list changes with EVERY version of
  7650.         DOS.  It is only partially supported by DR-DOS, and isn't supported
  7651.         under PC-MOS, OS/2's DOS box, or Wendin-DOS.  Since the information
  7652.         changes so much, I feel it should be put in the "interesting, but
  7653.         not real useful" category.  If you depend on this stuff in production
  7654.         code, you're going to regret it.
  7655.  
  7656.  
  7657. Function  53h   "Used Internally by DOS" - Translate BPB
  7658.  *              Translates BPB (BIOS Parameter Block, see below) into a DOS Disk
  7659.                 Block (see function call 32h).
  7660. entry   AH      53h
  7661.         DS:SI   pointer to BPB
  7662.         ES:BP   pointer to area for DOS Disk Block.
  7663.                 Layout of Disk Block:
  7664.                 bytes   value
  7665.                 00h-01h bytes per sector, get from DDB bytes 02h-03h.
  7666.                 02h     sectors per cluster, get from (DDB byte 4) + 1
  7667.                 03h-04h reserved sectors, get from DDB bytes 06h-07h
  7668.                 05h     number of FATs, get from DDB byte 08h
  7669.                 06h-07h number of root dir entries, get from DDB bytes 09h-0Ah
  7670.                 08h-09h total number of sectors, get from:
  7671.                         ((DDB bytes 0Dh-0Eh) - 1) * (sectors per cluster (BPB
  7672.                         byte 2)) + (DDB bytes 0Bh-0Ch)
  7673.                 0Ah     media descriptor byte, get from DDB byte 16h
  7674.                 0Bh-0Ch number of sectors per FAT, get from DDB byte 0Fh
  7675. return  unknown
  7676.  
  7677.  
  7678. Function  54h   Get Verify Setting
  7679.                 Get verify flag status
  7680. entry   AH      54h
  7681. return  AL      00h if flag off
  7682.                 01h if flag on
  7683. note    Flag can be set with function 2Eh
  7684.  
  7685.  
  7686. Function  55h   "Used Internally by DOS" - Create "Child" PSP
  7687.  *              Create PSP: similar to function 26h (which creates a new Program
  7688.                 Segment Prefix at segment in DX) except creates a "child" PSP
  7689.                 rather than copying the existing one.
  7690. entry   AH      55h
  7691.         DX      segment number at which to create new PSP.
  7692. return  unknown
  7693. note 1) This call is similar to call 26h which creates a PSP except that unlike
  7694.         call 26h the segment address of the parent process is obtained from the
  7695.         current process ID rather than from the CS value on the stack (from the
  7696.         INT 21h call). DX has the new PSP value and SI contains the value to be
  7697.         placed into PSP:2 (top of memory).
  7698.      2) Function 55 is merely a substitute for function 26h. It will copy the
  7699.         current PSP to the segment address DX with the addition that SI is
  7700.         assumed to hold the new memory top segment. This means that function
  7701.         26h sets SI to the segment found in the current PSP and then calls
  7702.         function 55h.
  7703.  
  7704.  
  7705. Function  56h   Rename a File
  7706. entry   AH      56h
  7707.         DS:DX   pointer to ASCIIZ old pathname
  7708.         ES:DI   pointer to ASCIIZ new pathname
  7709. return  CF      clear   successful rename
  7710.                 set     AX      error code (2, 3, 5, 11h)
  7711. note 1) Works with files in same drive only
  7712.      2) Global characters not allowed in filename
  7713.      3) The name of a file is its full pathname. The file's full pathname can
  7714.         be changed, while leaving the actual FILENAME.EXT unchanged. Changing
  7715.         the pathname allows the file to be "moved" from subdirectory to
  7716.         subdirectory on a logical drive without actually copying the file.
  7717.      4) DOS 3.x allows renaming of directories
  7718.  
  7719.  
  7720.  
  7721.        **  Programmer's Technical Reference for MSDOS and the IBM PC **
  7722.                 USA copyright TXG 392-616  ALL RIGHTS RESERVED
  7723. ───────────────────────────────┤ DOSREF (tm) ├────────────────────────────────
  7724.                      ISBN 1-878830-02-3 (disk-based text)
  7725.                     Copyright (c) 1987, 1991 Dave Williams
  7726.                         ┌─────────────────────────────┐
  7727.                         │ Shareware Version, 12/20/91 │
  7728.                         │  Please Register Your Copy  │
  7729.                         └─────────────────────────────┘
  7730.  
  7731.  
  7732.                             C H A P T E R   F I V E
  7733.  
  7734.                           Interrupts 22h Through 86h
  7735.  
  7736. note: the registered version of this chapter is more than twice this size.
  7737.  
  7738.  
  7739. Interrupt 22h   Terminate Address
  7740. (0:0088h)
  7741.  This interrupt transfers control to the far (dword) address at this interrupt
  7742. location when an application program terminates. The default address for this
  7743. interrupt is 0:0088h through 0:008Bh. This address is copied into the program's
  7744. Program Segment Prefix at bytes 0Ah through 0Dh at the time the segment is
  7745. created and is restored from the PSP when the program terminates. The calling
  7746. program is normally COMMAND.COM or an application. Do not issue this interrupt
  7747. directly, as the EXEC function call does this for you. If an application
  7748. spawns a child process, it must set the Terminate Address prior to issuing the
  7749. EXEC function call, otherwise when the second program terminated it would
  7750. return to the calling program's Terminate Address rather than its own. This
  7751. address may be set with int 21, function 25h.
  7752.  
  7753.  
  7754. Interrupt 23h   Ctrl-Break Exit Address
  7755. (0:008Ch)
  7756.  If the user enters a Ctrl-Break during STDIN, STDOUT, STDPRN, or STDAUX, int
  7757. 23h is executed. If BREAK is on, int 23h is checked on MOST function calls
  7758. (notably 06h). If the user written Ctrl-Break routine saves all registers, it
  7759. may end with a return-from-interrupt instruction (IRET) to continue program
  7760. execution. If the user-written interrupt program returns with a long return, the
  7761. carry flag is used to determine whether the program will be aborted. If the
  7762. carry flag is set, the program is aborted, otherwise execution continues (as
  7763. with a return by IRET). If the user-written Ctrl-Break interrupt uses function
  7764. calls 09h or 0Ah, (Display String or Buffered Keyboard Input) then a three-byte
  7765. string of 03h-0Dh-0Ah (ETX/CR/LF) is sent to STDOUT. If execution is continued
  7766. with an IRET, I/O continues from the start of the line. When the interrupt
  7767. occurs, all registers are set to the value they had when the original function
  7768. call to DOS was made. There are no restrictions on what the Ctrl-Break handler
  7769. is allowed to do, including DOS function calls, as long as the registers are
  7770. unchanged if an IRET is used. If the program creates a new segment and loads a
  7771. second program which itself changes the Ctrl-Break address, the termination of
  7772. the second program and return to the first causes the Ctrl-Break address to
  7773. be restored from the PSP to the value it had before execution of the second
  7774. program.
  7775.  
  7776.  
  7777. Interrupt 24h   Critical Error Handler
  7778. (0:0090h)
  7779.  
  7780.  When a critical error occurs within DOS, control is transferred to an error
  7781. handler with an int 24h. This may be the standard DOS error handler (ABORT,
  7782. RETRY, IGNORE) or a user-written routine.
  7783.  On entry to the error handler, AH will have its bit 7=0 (high order bit)
  7784. if the error was a disk error (probably the most common error), bit 7=1 if
  7785. not.
  7786.  BP:SI contains the address of a Device Header Control Block from which
  7787. additional information can be retrieved (see below).
  7788.  The register is set up for a retry operation and an error code is in the
  7789. lower half of the DI register with the upper half undefined. These are the
  7790. error codes:
  7791.  
  7792.  The user stack is in effect and contains the following from top to bottom:
  7793.  
  7794.         IP      DOS registers from issuing int 24h
  7795.         CS      int 24h
  7796.         flags
  7797.         AX      user registers at time of signal
  7798.         BX      int 21h request
  7799.         CX
  7800.         DX
  7801.         SI
  7802.         DI
  7803.         BP
  7804.         DS
  7805.         ES
  7806.         IP      from original int 21h
  7807.         CS
  7808.         flags
  7809.  
  7810.  To reroute the critical error handler to a user-writen critical error handler,
  7811. the following should be done:
  7812.  
  7813. Before an int 24h occurs:
  7814. 1) The user application initialization code should save the int 24h vector and
  7815.    replace the vector with one pointing to the user error routine.
  7816.  
  7817. When the int 24h occurs:
  7818. 2) When the user error routine received control it should push the flag
  7819.    registers onto the stack and execute a far call to the original int 24h
  7820.    vector saved in step 1.
  7821. 3) DOS gives the appropriate prompt, and waits for user input (Abort, Retry,
  7822.    Ignore, Fail). After the user input, DOS returns control to the user error
  7823.    routine instruction following the far call.
  7824. 4) The user error routine can now do any tasks nescessary. To return to the
  7825.    original application at the point the error occurred, the error routine needs
  7826.    to execute an IRET instruction. Otherwise, the user error routine should
  7827.    remove the IP, CS, and flag registers from the stack. Control can then be
  7828.    passed to the desired point.
  7829.  
  7830.  Int 24h provides the following values in registers on entry to the interrupt
  7831. handler:
  7832.  
  7833. entry   AH      status byte (bits)
  7834.                 7       0       disk I/O hard error
  7835.                         1       other error - if block device, bad FAT
  7836.                                 - if char device, code in DI
  7837.                 6       unused
  7838.                 5       0       if IGNORE is not allowed
  7839.                         1       if IGNORE is allowed
  7840.                 4       0       if RETRY  is not allowed
  7841.                         1       if RETRY  is allowed
  7842.                 3       0       if FAIL   is not allowed
  7843.                         1       if FAIL   is allowed
  7844.                 2 \     disk area of error  00 = DOS area  01 = FAT
  7845.                 1 /                         10 = root dir  11 = data area
  7846.                 0       0       if read operation
  7847.                         1       if write operation
  7848.         AL      drive number if AH bit 7 = 1, otherwise undefined
  7849.                 If it is as hard error on disk (AH bit 7=0), register AL
  7850.                 contains the failing drive number (0=A:, 1=B:, etc.).
  7851.         BP:SI   address of a Device Header Control Block for which error
  7852.                 occurred block device if high bit of BP:SI+4 = 1
  7853.  low byte of DI: error code (note: high byte is undefined)
  7854.                error code      description
  7855.                 00h             attempt to write on write-protected diskette
  7856.                 01h             unknown unit
  7857.                 02h             drive not ready
  7858.                 03h             unknown command
  7859.                 04h             data error (bad CRC)
  7860.                 05h             bad request structure length
  7861.                 06h             seek error
  7862.                 07h             unknown media type
  7863.                 08h             sector not found
  7864.                 09h             printer out of paper
  7865.                 0Ah             write fault
  7866.                 0Bh             read fault
  7867.                 0Ch             general failure
  7868.                 0Fh             invalid disk change (DOS 3.x+)
  7869.                 10h     (DOS 3.x) FCB unavailable
  7870.                 11h     (DOS 3.x) sharing buffer overflow
  7871.  
  7872. The handler must return this information:
  7873.  
  7874.  The registers are set such that if an IRET is executed, DOS responds according
  7875. to (AL) as follows:
  7876.  AL     00h  ignore the error
  7877.         01h  retry the operation
  7878.         02h  terminate via int 22h
  7879.         03h  fail the system call that is in progress (DOS 3.x+)
  7880. note 1) Be careful when choosing to ignore a response because this causes DOS to
  7881.         beleive that an operation has completed successfully when it may not
  7882.         have.
  7883.      2) If the error was a character device, the contents of AL are invalid.
  7884.  
  7885.  
  7886.  
  7887. OTHER ERRORS
  7888.  
  7889.  If AH bit 7=1, the error occurred on a character device, or was the result of
  7890. a bad memory image of the FAT. The device header passed in BP:SI can be examined
  7891. to determine which case exists. If the attribute byte high-order bit indicates
  7892. a block device, then the error was a bad FAT. Otherwise, the error is on a
  7893. character device.
  7894.  If a character device is involved, the contents of AL are unpredictable, the
  7895. error code is in DI as above.
  7896.  
  7897. Notes:
  7898. 1.  Before giving this routine control for disk errors, DOS performs several
  7899.     retries. The number of retries varies according to the DOS version.
  7900. 2.  For disk errors, this exit is taken only for errors occurring during an
  7901.     int 21h function call. It is not used for errors during an int 25h or 26h.
  7902. 3.  This routine is entered in a disabled state.
  7903. 4.  All registers must be preserved.
  7904. 5.  This interrupt handler should refrain from using DOS function calls. If
  7905.     necessary, it may use calls 01h through 12h. Use of any other call destroys
  7906.     the DOS stack and leaves DOS in an unpredictable state.
  7907. 6.  The interrupt handler must not change the contents of the device header.
  7908. 7.  If the interrupt handler handles errors itself rather than returning to DOS,
  7909.     it should restore the application program's registers from the stack,
  7910.     remove all but the last three words on the stack, then issue an IRET. This
  7911.     will return to the program immediately after the int 21h that experienced
  7912.     the error. Note that if this is done DOS will be in an unstable state until
  7913.     a function call higher than 12h is issued, therefore not recommended.
  7914. 8.  For DOS 3.x, IGNORE requests (AL=0) are converted to FAIL for critical
  7915.     errors that occur on FAT or DIR sectors.
  7916. 9.  For DOS 3.10 up, IGNORE requests (AL=0) are converted to FAIL requests
  7917.     for network critical errors (50-79).
  7918.  
  7919. The device header pointed to by BP:SI is as follows:
  7920.  
  7921. DWORD Pointer to next device (0FFFFh if last device)
  7922.  
  7923. WORD Attributes:
  7924.  
  7925. Bit     15      1       if character device.
  7926.                         If bit 15 is 1:
  7927.                         Bit 0 = 1 if current standard input
  7928.                         Bit 1 = 1 if current standard output
  7929.                         Bit 2 = 1 if current NULL device
  7930.                         Bit 3 = 1 if current CLOCK device
  7931.                 0       if block device
  7932. Bit 14 is the IOCTL bit
  7933. WORD pointer to device driver strategy entry point
  7934. WORD pointer to device driver interrupt entry point
  7935. 8-BYTE character device named field for block devices. The first byte is the
  7936. number of units.
  7937.  To tell if the error occurred on a block or character device, look at bit 15
  7938. in the attribute field (WORD at BP:SI+4).
  7939.  If the name of the character device is desired, look at the eight bytes
  7940. starting at BP:SI+10.
  7941.  
  7942.  
  7943. HANDLING OF INVALID RESPONSES (DOS 3.x)
  7944.  
  7945.         A) If IGNORE (AL=0) is specified by the user and IGNORE is not allowed
  7946.            (bit 5=0), make the response FAIL (AL=3).
  7947.         B) If RETRY (AL=1) is specified by the user and RETRY is not allowed
  7948.            (bit 4=0), make the response FAIL (AL=3).
  7949.         C) If FAIL (AL=3) is specified by the user and FAIL is not allowed (bit
  7950.            3=0), make the response ABORT. (AL=2)
  7951.  
  7952.  
  7953.  
  7954.  
  7955.  
  7956. Interrupt 25h   Absolute Disk Read
  7957. Interrupt 26h   Absolute Disk Write
  7958. (0:0094h, 0:0098h)
  7959.   These transfer control directly to the device driver. On return, the original
  7960. flags are still on the stack (put there by the INT instruction). This is
  7961. necessary because return information is passed back in the current flags.
  7962.   The number of sectors specified is transferred between the given drive and the
  7963. transfer address. Logical sector numbers are obtained by numbering each sector
  7964. sequentially starting from track 0, head 0, sector 1 (logical sector 0) and
  7965. continuing along the same head, then to the next head until the last sector on
  7966. the last head of the track is counted.  Thus, logical sector 1 is track 0, head
  7967. 0, sector 2; logical sector 2 is track 0, head 0, sector 3; and so on. Numbering
  7968. then continues wih sector 1 on head 0 of the next track. Note that although the
  7969. sectors are sequentially numbered (for example, sectors 2 and 3 on track 0 in
  7970. the example above), they may not be physically adjacent on disk, due to
  7971. interleaving. Note that the mapping is different from that used by DOS 1.10 for
  7972. dual-sided diskettes.
  7973.  
  7974. The request is as follows:
  7975.  
  7976. int 25 for Absolute Disk Read,
  7977. int 26 for Absolute Disk Write
  7978. entry   AL      drive number (0=A:, 1=B:, etc)
  7979.         CX      number of sectors to read
  7980.         DS:BX   disk transfer address (buffer)
  7981.         DX      first relative sector to read - beginning logical sector number
  7982. return  CF      set if error
  7983.         AL      error code issued to int 24h in low half of DI
  7984.         AH      01h     bad command
  7985.                 02h     bad address mark
  7986.                 03h     write-protected disk
  7987.                 04h     requested sector not found
  7988.                 08h     DMA failure
  7989.                 10h     data error (bad CRC)
  7990.                 20h     controller failed
  7991.                 40h     seek operation failed
  7992.                 80h     attachment failed to respond
  7993. note 1) Original flags on stack! Be sure to pop the stack to prevent
  7994.         uncontrolled growth
  7995.      2) Ints 25 and 26 will try rereading a disk if they get an error the first
  7996.         time.
  7997.      3) All registers except the segment registers are destroyed by these calls
  7998.  
  7999.  
  8000. Interrupt 25h   ABSOLUTE DISK READ
  8001.                 (except DOS 4.0/Compaq DOS 3.31 >32M partition)
  8002. entry   AL      drive number (0=A, 1=B, etc)
  8003.         DS:BX   pointer to Disk Transfer Address (buffer)
  8004.         CX      number of sectors to read
  8005.         DX      first relative sector to read
  8006. return  CF      1 if error
  8007.                 AL      error code issued to int 24h in low half of DI
  8008.                 AH      80h     attachment failed to respond
  8009.                         40h     seek operation failed
  8010.                         20h     controller failed
  8011.                         10h     data error (bad CRC)
  8012.                         08h     DMA failure
  8013.                         04h     requested sector not found
  8014.                         03h     write-protected disk
  8015.                         02h     bad address mark
  8016.                         01h     bad command
  8017. note    Original flags on stack!
  8018.  
  8019. Interrupt 25h   DOS 4.0/Compaq DOS 3.31 - ABSOLUTE DISK READ
  8020.                 (>32M hard-disk partition)
  8021. entry   AL      drive number (0=A, 1=B, etc)
  8022.         CX      0FFFFh
  8023.         DS:BX   Packet address
  8024.                 DWORD  sector number
  8025.                 WORD   number of sectors to read
  8026.                 DWORD  transfer address
  8027. return  same as above?
  8028. note    Partition is potentially >32Mb (and requires this form of the call) if
  8029.         bit 1 of device attribute word in device driver is set
  8030.  
  8031. Interrupt 26h   ABSOLUTE DISK WRITE
  8032.                 (except DOS 4.0/Compaq DOS 3.31 >32M partition)
  8033. entry   AL      drive number (0=A, 1=B, etc)
  8034.         DS:BX   pointer to Disk Transfer Address (buffer)
  8035.         CX      number of sectors to write
  8036.         DX      first relative sector to write
  8037. return  CF      1 if error
  8038.                 AL      error code issued to int 24h in low half of DI
  8039.                 AH      same error codes as for int 25h
  8040. note    Original flags on stack!
  8041.  
  8042. Interrupt 26h   DOS 4.0/Compaq DOS 3.31 - ABSOLUTE DISK WRITE
  8043.                 (>32M hard disk partitions)
  8044. entry   AL      drive number (0=A, 1=B, etc)
  8045.         CX      0FFFFh
  8046.         DS:BX   Packet address
  8047.                 DWORD  sector number
  8048.                 WORD   number of sectors to write
  8049.                 DWORD  transfer address
  8050. return  same as above?
  8051. note    Partition is potentially >32M (and requires this form of the call) if
  8052.         bit 1 of device attribute word in device driver is set
  8053.  
  8054.  
  8055.  
  8056.  
  8057. Interrupt 27h   Terminate And Stay Resident
  8058. (0:009Ch)       (obsolete)
  8059.  This vector is used by programs that are to remain resident when COMMAND.COM
  8060. regains control.
  8061.  After initializing itself, the program must set DX to its last address plus
  8062. one relative to the program's initial DS or ES value (the offset at which other
  8063. programs can be loaded), then execute interrupt 27h. DOS then considers the
  8064. program as an extension of itself, so the program is not overlaid when other
  8065. programs are executed. This is useful for loading programs such as utilities
  8066. and interrupt handlers that must remain resident.
  8067.  
  8068. entry   CS      current program segment
  8069.         DX      last program byte + 1
  8070. return  none
  8071. note 1) This interrupt must not be used by .EXE programs that are loaded into
  8072.         the high end of memory.
  8073.      2) This interrupt restores the interrupt 22h, 23h, and 24h vectors in the
  8074.         same manner as interrupt 20h.  Therefore, it cannot be used to install
  8075.         permanently resident Ctrl-Break or critical error handler routines.
  8076.      3) The maximum size of memory that can be made resident by this method is
  8077.         64K.
  8078.      4) Memory can be more efficiently used if the block containing a copy of
  8079.         the environment is deallocated before terminating. This can be done by
  8080.         loading ES with the segment contained in 2Ch of the PSP, and issuing
  8081.         function call 49h (Free Allocated Memory).
  8082.      5) DOS function call 4Ch allows a program to pass a completion code to DOS,
  8083.         which can be interpreted with processing (see function call 31h).
  8084.      6) Terminate and stay resident programs do not close files.
  8085.      7) Int 21, function 31h is the preferred method to cause a program to
  8086.         remain resident because this allows return information to be passed and
  8087.         allows a program larger than 64K to remain resident.
  8088.  
  8089.  
  8090.  
  8091.  
  8092. Interrupt 28h   (not documented by Microsoft)
  8093.            *    DOS Idle Interrupt
  8094. Int 28h has been provided by DOS since release 2.0. The int 28h process is
  8095. similar to the "Timer Tick" process provided by BIOS via int 1Ch in that it is
  8096. an "outbound" (from DOS) call which an application can "hook onto" to get
  8097. service at a particular entry point. DOS normally only issues int 28h when it
  8098. recieves a function call (int 21h) from a foreground application with an
  8099. argument in the range of 0 thru 12 (0Ch) in the AH register, or when it is
  8100. idling waiting for keyboard input. In effect, when DOS issues int 28h, it is
  8101. saying to the background task "I'm not doing anything hot right now, if you can
  8102. use the time, go ahead." This means that a foreground application which doesn't
  8103. do many low-number DOS functions can preempt CPU time easily.
  8104.  
  8105.  It is possible, if you are careful, to enhance the background priority by
  8106. providing more int 28h calls than DOS normally would issue.
  8107.  
  8108.  When int 28h is being issued it is usually safe to do DOS calls. You won't get
  8109. int 28hs if a program is running that doesn't do its keyboard input through
  8110. DOS. You should rely on the timer interrupt for these.
  8111.  
  8112.  It is used primarily by the PRINT.COM routines, but any number of other
  8113. routines can be chained to it by saving the original vector and calling it with
  8114. a FAR call (or just JMPing to it) at the end of the new routine.
  8115.  
  8116.  Int 28h is not called at all when any non-trivial foreground task is running.
  8117. As soon as a foreground program has a file open, int 28h no longer gets called.
  8118. Could make a good driver for for a background program that works as long as
  8119. there is nothing else going on in the machine.
  8120.  
  8121.  DOS uses 3 separate internal stacks: one for calls 01h through 0Ch; another
  8122. for calls 0Dh and above; and a third for calls 01h through 0Ch when a Critical
  8123. Error is in progress. When int 28h is called, any calls above 0Ch can be
  8124. executed without destroying the internal stack used by DOS at the time.
  8125.  
  8126.  The byte which is pushed on the stack before an int 28h just indicates which
  8127. stack area is being used by the current int 21h call. In DOS 3.1, the code
  8128. sequence that calls int 28h looks like this:
  8129.  
  8130.         PUSH    SS:[0304]
  8131.         INT     28
  8132.         POP     SS:[0304]
  8133.  
  8134.  The low-order byte of the word pushed contains 1 if the int 21h call currently
  8135. in progress is for services 1 through 0Ch, and 0 for service 0 and for 0Dh and
  8136. up. Assuming that the last DOS call was not a reentrant one, this tells you
  8137. which set of DOS services should be safe to call.
  8138.  
  8139.  If the InDOS flag is zero on int 28h, then it was called by someone other than
  8140. DOS, and the word on the stack should NOT be examined.
  8141.  
  8142.  
  8143. entry   no parameters availible
  8144. return  none
  8145. note 1) The int 28h handler may invoke any int 21h function except functions
  8146.         00h through 0Ch (and 50h/51h under DOS 2.x unless DOS CritErr flag is
  8147.         set).
  8148.      2) Apparently int 28h is also called during screen writes
  8149.      3) Until some program installs its own routine, this interrupt vector
  8150.         simply points to an IRET opcode.
  8151.      4) Supported in OS/2 1.0's DOS Compatibility Box
  8152.  
  8153.  
  8154.  
  8155.  
  8156. Interrupt 29h   (not documented by Microsoft)
  8157.            *    Internal - Quick Screen Output
  8158.  
  8159.  This method is extremely fast (much faster than DOS 21h subfunctions 2 and 9,
  8160. for example), and it is portable, even to "non-compatible" MS-DOS computers.
  8161.  
  8162. entry   AL      character to output to screen
  8163. return  unknown
  8164. note 1) Documented by Digital Research's DOS Reference as provided with the
  8165.         DEC Rainbow
  8166.      2) If ANSI.SYS is installed, character output is filtered through it.
  8167.      3) Works on the IBM PC and compatibles, Wang PC, HP-150 and Vectra, DEC
  8168.         Rainbow, NEC APC, Texas Instruments PC and others
  8169.      4) This interrupt is called from the DOS's output routines if output is
  8170.         going to a device rather than a file, and the device driver's attribute
  8171.         word has bit 3 (04h) set to "1".
  8172.      5) This call has been tested with MSDOS 2.11, PCDOS 2.1, PCDOS 3.1, PCDOS
  8173.         3.2, and PCDOS 3.3.
  8174.      6) Used in IBMBIO.COM as a vector to int 10, function 0Eh (write TTY)
  8175.         followed by an IRET.
  8176.  
  8177.  
  8178.  
  8179.  
  8180. Interrupt 2Ah   Microsoft Networks - Session Layer Interrupt
  8181.            *    (not documented by Microsoft)
  8182.  
  8183. entry   AH      00h     check to see if network BIOS installed
  8184.                         return  AH      <> 0 if installed
  8185.                 01h     execute NETBIOS request
  8186.                 02h     set net printer mode
  8187.                 03h     get shared-device status (check direct I/O)
  8188.                         AL      00h
  8189.                         DS:SI   pointer to ASCIIZ disk device name
  8190.                         return  CF      0 if allowed
  8191.                 04h     execute NETBIOS
  8192.                         AL      0 for error retry
  8193.                                 1 for no retry
  8194.                         ES:BX   pointer to network control block
  8195.                         return  AX      0 for no error
  8196.                                 AH      1 if error
  8197.                                 AL      error code
  8198.                 05h     get network resource information
  8199.                         AL      00h
  8200.                         return  AX      reserved
  8201.                                 BX      number of network names
  8202.                                 CX      number of commands
  8203.                                 DX      number of sessions
  8204.                 06h     Network Print-stream Control
  8205.                         note    NETBIOS 1.10
  8206.                 20h     unknown
  8207.                         note    AL=01h intercepted by DESQview 2.0
  8208.                 80h     Begin DOS Critical Section
  8209.                         AL      1 to 6
  8210.                 81h     End DOS Critical Section
  8211.                         AL      1 to 6
  8212.                 82h     Server Hook
  8213.                         return  unknown
  8214.                         note    called by the int 21h function dispatcher
  8215.                                 in DOS 3.10+ for function 0 and functions
  8216.                                 greater than 0Ch except 59h
  8217.                 84h     keyboard busy loop
  8218.                         note    similar to DOS's int 28h
  8219.  
  8220.  
  8221. Interrupt 2Bh   (not documented by Microsoft)
  8222.            *    Unknown - Internal Routine for DOS (IRET)
  8223.  
  8224.  
  8225. Interrupt 2Ch   (not documented by Microsoft)
  8226.            *    Unknown - Internal Routine for DOS (IRET)
  8227.  
  8228.  
  8229. Interrupt 2Dh   (not documented by Microsoft)
  8230.            *    Unknown - Internal Routine for DOS (IRET)
  8231.  
  8232.  
  8233. Interrupt 2Eh   (undocumented by Microsoft)  (DOS 2.0+)
  8234.            *    Internal Routine for DOS  (Alternate EXEC)
  8235.  
  8236.   This interrupt passes a command line addressed by DS:SI to COMMAND.COM. The
  8237. command line must be formatted just like the unformatted parameter area of a
  8238. Program Segment Prefix. That is, the first byte must be a count of characters,
  8239. and the second and subsequent bytes must be a command line with parameters,
  8240. terminated by a carriage return character.
  8241.   When executed, int 2Eh will reload the transient part of the command
  8242. interpreter if it is not currently in memory. If called from a program that
  8243. was called from a batch file, it will abort the batch file. If executed from a
  8244. program which has been spawned by the EXEC function, it will abort the whole
  8245. chain and probably lock up the computer. Int 2Eh also destroys all registers
  8246. including the stack pointer.
  8247.   Int 2Eh is called from the transient portion of the program to reset the DOS
  8248. PSP pointers using the above Functions #81 & #80, and then reenters the
  8249. resident program.
  8250.   When called with a valid command line, the command will be carried out by
  8251. COMMAND.COM just as though you had typed it in at the DOS prompt. Note that the
  8252. count does not include the carriage return. This is an elegant way to perform a
  8253. SET from an application program against the master environment block for
  8254. example.
  8255.  
  8256. entry   DS:SI   pointer to an ASCIIZ command line in the form:
  8257.                         count byte
  8258.                         ASCII string
  8259.                         carriage return
  8260.                         null byte
  8261. note 1) Destroys all registers including stack pointer
  8262.      2) Seems to work OK in both DOS 2.x and 3.x
  8263.      3) It is reportedly not used by DOS.
  8264.      4) As far as known, int 2Eh is not used by DOS 3.1, although it was called
  8265.         by COMMAND.COM of PCDOS 3.0, so it appears to be in 3.1 only for the
  8266.         sake of compatibility.
  8267.  
  8268. Interrupt 2Fh   Multiplex Interrupt
  8269.  
  8270.  Interrupt 2Fh is the multiplex interrupt. A general interface is defined
  8271. between two processes. It is up to the specific application using interrupt
  8272. 2Fh to define specific functions and parameters.
  8273.  This interrupt is becoming more commonly used as the availible interrupt 21
  8274. functions are getting to be in short supply.  Int 2Fh doesn't require any
  8275. support from DOS itself for it to be used in application programs. It's not
  8276. handled by DOS, but by the programs themselves.
  8277.  Every multiplex interrupt handler is assigned a specific multiplex number.
  8278. The multiplex number is specified in the AH register; the AH value tells which
  8279. program your request is directed toward. The specific function that the handler
  8280. is to perform is placed in the AL register. Other parameters are places in the
  8281. other registers as needed. The handlers are chained into the 2Fh interrupt
  8282. vector and the multiplex number is checked to see if any other application is
  8283. using the same multiplex number. There is no predefined method for assigning a
  8284. multiplex number to a handler. You must just pick one. To avoid a conflict if
  8285. two applications choose the same multiplex number, the multiplex numbers used by
  8286. an application should be patchable. In order to check for a previous
  8287. installation of the current application, you can search memory for a unique
  8288. string included in your program. If the value you wanted in AH is taken but
  8289. you don't find the string, then another application has grabbed that location.
  8290.  Int 2Fh was not documented under DOS 2.x. There is no reason not to use int 2Fh
  8291. as the multiplex interrupt in DOS 2.x. The only problem is that DOS 2.x does not
  8292. initialize the int 2Fh vector, so when you try to chain to it like you are
  8293. supposed to, it will crash. If your program checks the vector for being zero
  8294. and initializes it itself or doesn't chain in that case, it will work for you
  8295. n 2.x just the same as 3.x.
  8296.  
  8297. Function   01h  PRINT.COM
  8298.            Register AH identifies which program is to handle the interrupt.
  8299.            Values 00h-7Fh are reserved for DOS, not that anyone cares much.
  8300.            Values 0C0h-0FFh are reserved for applications.
  8301.            Register AL contains the function code if used
  8302. entry   AH      01h
  8303.                 AL      00h     PRINT  Get Installed State
  8304.                         This call must be defined by all int 2Fh handlers. It
  8305.                         is used by the caller of the handler to determine if
  8306.                         the handler is present. On entry, AL=0. On return, AL
  8307.                         contains the installed state as follows:
  8308.                 return  AL      0FFh    installed
  8309.                                 01h     not installed, not OK to install
  8310.                                 00h     not installed, OK to install
  8311.  
  8312.                         01h     PRINT  Submit File
  8313.                         DS:DX   pointer to submit packet
  8314.                                 format  byte    level
  8315.                                         dword   pointer to ASCIIZ filename
  8316.                 return  CF      set if error
  8317.                                 AX      error code
  8318.                 note 1) A submit packet contains the level (BYTE) and a pointer
  8319.                         to the ASCIIZ string (DWORD in offset:segment form).
  8320.                         The ASCIIZ string must contain the drive, path, and
  8321.                         filename of the file you want to print. The filename
  8322.                         cannot contain global filename characters.
  8323.                 return  CF      set if error
  8324.                                 AX      error code
  8325.  
  8326.                         02h     PRINT Cancel File
  8327.                         On entry, AL=2 and DS:DX points to the ASCIIZ string for
  8328.                         the print file you want to cancel. Global filename
  8329.                         characters are allowed in the filename.
  8330.                 DS:DX   pointer to ASCIIZ file name to cancel (wildcards OK)
  8331.                 return  CF      set if error
  8332.                                 AX      error code
  8333.  
  8334.                         03h     PRINT remove all files
  8335.                 return  CF      set if error
  8336.                                 AX      error code
  8337.  
  8338.                         04h     PRINT hold queue/get status
  8339.                         This call holds the jobs in the print queue so that you
  8340.                         can scan the queue. Issuing any other code releases the
  8341.                         jobs. On entry, AL=4. On return, DX contains the error
  8342.                         count. DS:SI points to the print queue. The print queue
  8343.                         consists of a series of filename entries. Each entry is
  8344.                         64 bytes long. The first entry in the queue is the file
  8345.                         currently being printed. The end of the queue is marked
  8346.                         by the entry having a null as the first character.
  8347.                return   DX      error count
  8348.                         DS:SI   pointer to print queue (null-string terminated
  8349.                                 list of 64-byte ASCIIZ filenames)
  8350.                         CF      set if error
  8351.                                AX       error code
  8352.                                         01h     function invalid
  8353.                                         02h     file not found
  8354.                                         03h     path not found
  8355.                                         04h     too many open files
  8356.                                         05h     access denied
  8357.                                         08h     queue full
  8358.                                         09h     spooler busy
  8359.                                         0Ch     name too long
  8360.                                         0Fh     drive invalid
  8361.  
  8362.                         05h     PRINT restart queue
  8363.                 return  CF      set if error
  8364.                                 AX      error code
  8365.  
  8366.  
  8367. Function   05h  DOS 3.x critical error handler
  8368. entry   AH      05h
  8369.                 AL      00h     installation check
  8370.                         return  AL      00h not installed, OK to install
  8371.                                         01h not installed, can't install
  8372.                                         0FFh installed
  8373.                         note    This set of functions allows a user program to
  8374.                                 partially or completely override the default
  8375.                                 critical error handler in COMMAND.COM
  8376.                 AL      01h     handle error - nonzero error code in AL
  8377.                         return  CF      clear
  8378.                                         ES:DI   pointer to ASCIIZ error message
  8379.                                 CF      set     use default error handler
  8380.                                 AL      (?)
  8381.  
  8382.  
  8383. Function   06h  ASSIGN
  8384. entry   AH      06h
  8385.                         00h     installation check
  8386.                         return  AH <> 0 if installed
  8387.  
  8388.                         01h     get memory segment
  8389.                         return  ES      segment of ASSIGN work area
  8390.  
  8391.  
  8392. Function   10h  SHARE
  8393. entry   AH      10h
  8394.         AL      00h     installation check
  8395. return  AL      00h     not installed, OK to install
  8396.                 01h     not installed, not OK to install
  8397.                 0FFh    installed
  8398.  
  8399.  
  8400. Function   11h  Multiplex - network redirection
  8401. entry   AH      11h
  8402.         AL      00h     installation check
  8403.                         return  AL      00h    not installed, OK to install
  8404.                                         01h    not installed, not OK to install
  8405.                                         0FFh   installed
  8406.                 01h-05h unknown
  8407.                 06h     close remote file
  8408.                 07h-09h unknown
  8409.                 0Ah     unknown
  8410.                         stack   word    (?)
  8411.                         return  CF      set on error
  8412.                 0Bh     unknown
  8413.                         stack   word    (?)
  8414.                         return  CF      set on error(?)
  8415.                 0Ch     unknown
  8416.                 0Dh     unknown
  8417.                 0Eh     unknown
  8418.                         stack   word    (?)
  8419.                         return  (?)
  8420.                 0Fh-16h unknown
  8421.                 17h     unknown
  8422.                         stack   word    (?)
  8423.                         return  (?)
  8424.                 18h     unknown
  8425.                         stack   word    (?)
  8426.                         return  (?)
  8427.                 19h-1Dh unknown
  8428.                 1Eh     do redirection
  8429.                         stack   word    function to execute
  8430.                         return  CF      set on error
  8431.                 1Fh     printer setup
  8432.                         stack   word    function(?)
  8433.                         return  CF      set on error(?)
  8434.                 20h-25h unknown
  8435.                         stack   word    (?)
  8436.                 26h     unknown
  8437.  
  8438. Function   12h  multiplex, DOS 3.x internal services
  8439. entry   AH      12h
  8440.         AL      00h     installation check
  8441.                         return  AL      0FFh    for compatibility with other
  8442.                                                 int 2Fh functions
  8443.                 01h     close file (?)
  8444.                         stack   word value - unknown
  8445.                         return  BX      unknown
  8446.                                 CX      unknown
  8447.                                 ES:DI   pointer to unknown value
  8448.                         note    Can be called only from within DOS
  8449.                 02h     get interrupt address
  8450.                         stack   word    vector number
  8451.                         return  ES:BX pointer to interrupt vector
  8452.                                 stack   unchanged
  8453.                 03h     get DOS data segment
  8454.                         return  DS      segment of IBMDOS.COM file
  8455.                 04h     normalize path separator
  8456.                         stack   word    character to normalize
  8457.                         return  AL      normalized character (forward slash
  8458.                                         turned to backslash)
  8459.                                 stack   unchanged
  8460.                 05h     output character
  8461.                         stack   word    character to output
  8462.                         return  stack   unchanged
  8463.                         note    Can be called only from within DOS
  8464.                 06h     invoke critical error
  8465.                         return  AL      0-3 for Abort, Retry, Ignore, Fail
  8466.                         note    Can be called only from within DOS
  8467.                 07h     move disk buffer (?)
  8468.                         DS:DI   pointer to disk buffer
  8469.                         return  buffer moved to end of buffer list
  8470.                         note    Can be called only from within DOS
  8471.                 08h     decrement word
  8472.                         ES:DI   pointer to word to decrement
  8473.                         return  AX      new value of word
  8474.                         note    Word pointed to by ES:DI decremented,
  8475.                                 skipping zero
  8476.                 09h     unknown
  8477.                         DS:DI   pointer to disk buffer(?)
  8478.                         return  (?)
  8479.                         note    Can be called only from within DOS
  8480.                 0Ah     unknown
  8481.                         note    Can be called only from within DOS
  8482.                 0Bh     unknown
  8483.                         ES:DI   pointer to system file table entry(?)
  8484.                         return  AX      (?)
  8485.                         note    Can be called only from within DOS
  8486.                 0Ch     unknown
  8487.                         note    Can be called only from within DOS
  8488.                 0Dh     get date and time
  8489.                         return  AX      current date in packed format
  8490.                                 DX      current time in packed format
  8491.                         note    Can be called only from within DOS
  8492.                 0Eh     do something to all disk buffers (?)
  8493.                         return  DS:DI   pointer to first disk buffer
  8494.                         note    can be called only from within DOS
  8495.                 0Fh     unknown
  8496.                         DS:DI   pointer to (?)
  8497.                         return  DS:DI pointer to (?)
  8498.                         note 1) Can be called only from within DOS
  8499.                              2) Calls on function 1207h
  8500.                 10h     find dirty/clean(?) buffer
  8501.                         DS:DI   pointer to first disk buffer
  8502.                         return  DS:DI   pointer to first disk buffer which has
  8503.                                         (?) flag clear
  8504.                                 ZF      clear   if found
  8505.                                         set     if not found
  8506.                 11h     normalize ASCIIZ filename
  8507.                         DS:SI   pointer to ASCIIZ filename to normalize
  8508.                         ES:DI   pointer to buffer for normalized filename
  8509.                         return  destination buffer filled with uppercase
  8510.                                 filename, with slashes turned to backslashes
  8511.                 12h     get length of ASCIIZ string
  8512.                         ES:DI   pointer to ASCIIZ string
  8513.                         return  CX      length of string
  8514.                 13h     uppercase character
  8515.                         stack   word    character to convert to uppercase
  8516.                         return  AL      uppercase character
  8517.                                 stack   unchanged
  8518.                 14h     compare far pointers
  8519.                         DS:SI   first pointer
  8520.                         ES:DI   second pointer
  8521.                         return  ZF      set if pointers are equal
  8522.                                 ZF      clear if not equal
  8523.                 15h     unknown
  8524.                         DS:DI   pointer to disk buffer
  8525.                         stack   word    (?)
  8526.                         return  stack unchanged
  8527.                         note    Can be called only from within DOS
  8528.                 16h     get address of system FCB
  8529.                         BX      system file table entry number
  8530.                         return  ES:DI pointer to system file table entry
  8531.                 17h     set default drive (?)
  8532.                         stack   word    drive (0=A:, 1=B:, etc)
  8533.                         return  DS:SI   pointer to drive data block for
  8534.                                         specified drive
  8535.                                 stack   unchanged
  8536.                         note    Can be called only from within DOS
  8537.                 18h     get something (?)
  8538.                         return  DS:SI pointer to (?)
  8539.                 19h     unknown
  8540.                         stack   word    drive (0=default, 1=A:, etc)
  8541.                         return  (?)
  8542.                                 stack unchanged
  8543.                         note 1) Can be called only from within DOS
  8544.                              2) Calls function 1217h
  8545.                 1Ah     get file's drive
  8546.                         DS:SI   pointer to filename
  8547.                         return  AL      drive
  8548.                                         (0=default, 1=A:, etc, 0FFh=invalid)
  8549.                 1Bh     set something (?)
  8550.                         CL      unknown
  8551.                         return  AL      (?)
  8552.                         note    Can be called only from within DOS
  8553.                 1Ch     checksum memory
  8554.                         DS:SI   pointer to start of memory to checksum
  8555.                         CX      number of bytes
  8556.                         DX      initial checksum
  8557.                         return  DX      checksum
  8558.                         note    Can be called only from within DOS
  8559.                 1Dh     unknown
  8560.                         DS:SI   pointer to (?)
  8561.                         CX      (?)
  8562.                         DX      (?)
  8563.                         return  AX      (?)
  8564.                                 CX      (?)
  8565.                                 DX      (?)
  8566.  
  8567.                 1Eh     compare filenames
  8568.                         DS:SI   pointer to first ASCIIZ filename
  8569.                         ES:DI   pointer to second ASCIIZ filename
  8570.                         return  ZF      set     if filenames equivalent
  8571.                                         clear   if not
  8572.                 1Fh     build drive info block
  8573.                         stack   word    drive letter
  8574.                         return  ES:DI pointer to drive info block
  8575.                                       (will be overwritten by next call)
  8576.                                 stack unchanged
  8577.                         note    Can be called only from within DOS
  8578.                 20h     get system file table number
  8579.                         BX      file handle
  8580.                         return  CF      set on error, error code in AL
  8581.                                         AL      06h (invalid file handle)
  8582.                                 CF      clear if successful
  8583.                                         byte ES:[DI] = system file table entry
  8584.                                             number for file handle
  8585.                 21h     unknown
  8586.                         DS:SI   pointer to (?)
  8587.                         return  (?)
  8588.                         note    Can be called only from within DOS
  8589.                 22h     unknown
  8590.                         SS:SI   pointer to (?)
  8591.                         return  nothing(?)
  8592.                         note    Can be called only from within DOS
  8593.                 23h     check if character device (?)
  8594.                         return  DS:SI   pointer to device driver with
  8595.                                         same name as (?)
  8596.                         note    Can be called only from within DOS
  8597.                 24h     delay
  8598.                         return  after delay of (?) ms
  8599.                         note    Can be called only from within DOS
  8600.                 25h     get length of ASCIIZ string
  8601.                         DS:SI   pointer to ASCIIZ string
  8602.                         return  CX      length of string
  8603.  
  8604.  
  8605. Function   43h  Microsoft Extended Memory Specification (XMS)
  8606.  
  8607.  
  8608. Function 5453h TesSeRact Standard for Ram-Resident Program Communication
  8609.  
  8610.  
  8611. Function   64h  SCRNSAV2.COM
  8612. entry   AH      64h
  8613.         AL      00h     installation check
  8614. return  AL      00h     not installed
  8615.                 0FFh    installed
  8616. note    SCRNSAV2.COM is a screen saver for PS/2's with VGA by Alan Ballard
  8617.  
  8618.  
  8619. Function  7Ah   Novell NetWare
  8620. entry   AH      7Ah
  8621.         AL      00h     installation check
  8622. note 1) Returns address of entry point for IPX and SPX
  8623.      2) Parameters are listed under int 21
  8624.  
  8625.  
  8626. Function  087h  APPEND
  8627. entry   AH      087h
  8628.         AL      00h     APPEND installation check
  8629.                 return  AH <> 0 if installed
  8630.                 01h     APPEND - unknown
  8631.                 02h     APPEND - version check
  8632.  
  8633. Function  088h  Microsoft Networks
  8634. entry   AH      088h
  8635.         AL      00h     network program installation check
  8636.                 return  AH <> 0 if installed
  8637.                         BX      installed component flags (test in this order!)
  8638.                                 bit 6   server
  8639.                                 bit 2   messenger
  8640.                                 bit 7   receiver
  8641.                                 bit 3   redirector
  8642.                 01h     unknown
  8643.                 02h     unknown
  8644.                 03h     get current POST address
  8645.                         return  ES:BX   POST address
  8646.                 04h     set new POST address
  8647.                         ES:BX   new POST address
  8648.                 09h     network version check
  8649.  
  8650.  
  8651. Function  0AAh  VIDCLOCK.COM
  8652. entry   AH      0AAh
  8653.         AL      00h     installation check
  8654. return  AL      00h     not installed
  8655.                 0FFh    installed
  8656. note    VIDCLOCK.COM is a memory-resident clock by Thomas G. Hanlin III
  8657.  
  8658.  
  8659. Function  0BBh  Network Functions
  8660. entry   AH      0BBh
  8661.         AL      00h     net command installation check
  8662.                 01h, 02h unknown
  8663.                 03h     get server POST address
  8664.                 04h     get server POST address
  8665.  
  8666.  
  8667. Function  0F7h  AUTOPARK.COM  (PD TSR hard disk parking utility)
  8668. entry   AH      0F7h
  8669.         AL      00h     installation check
  8670.                 return  AL      00h     not installed
  8671.                                 0FFh    installed
  8672.                 note    AUTOPARK is a TSR HD parker by Alan D. Jones
  8673.         01h     set parking delay
  8674.                 BX:CX   32 bit count of 55ms timer ticks
  8675.  
  8676.  
  8677.  
  8678. MSDOS 2Fh functions 01h (PRINT), 02h (ASSIGN), 10h (SHARE):
  8679. return  AX      Error
  8680.                 Codes       Description
  8681.                 01h     invalid function number
  8682.                 02h     file not found
  8683.                 03h     path not found
  8684.                 04h     too many open files
  8685.                 05h     access denied
  8686.                 06h     invalid handle
  8687.                 08h     queue full
  8688.                 09h     busy
  8689.                 0Ch     name too long
  8690.                 0Fh     invalid drive was specified
  8691.         CF      clear (0) if OK
  8692.                 set (1) if error - error returned in AX
  8693. note 1) The multiplex numbers AH=0h through AH=7Fh are reserved for DOS.
  8694.         Applications should use multiplex numbers 80h through 0FFh.
  8695.      2) When in the chain for int 2Fh, if your code calls DOS or if you execute
  8696.         with interrupts enabled, your code must be reentrant/recursive.
  8697.      3) Important! In versions of DOS prior to 3.0, the int 2Fh vector was
  8698.         initialized to zero rather than being pointed into the DOS service area.
  8699.         You must initialize this vector manually under DOS 2.x.
  8700.  
  8701.  
  8702.  
  8703. ┌─────────────────────────────────────────────────────────────────────────────┐
  8704. │ Miscellaneous Interrupts - in numerical order                               │
  8705. └─────────────────────────────────────────────────────────────────────────────┘
  8706.  
  8707. Interrupt 30h   (not a vector!) far jump instruction for CP/M-style calls
  8708.  
  8709.  
  8710. Interrupt 31h   Unknown
  8711. note    The CALL 5 entry point does a FAR jump to here
  8712.  
  8713.  
  8714. Interrupt 32h   Unknown
  8715.  
  8716.  
  8717. Interrupt 33h   Used by Microsoft Mouse Driver
  8718.                 Function Calls
  8719.  
  8720. Function Requests
  8721.  
  8722.         00h     Reset Driver and Read Status
  8723.         entry   AH      00h
  8724.         return  AH      status
  8725.                         0  hardware/driver not installed
  8726.                        -1  hardware/driver installed
  8727.                 BX      number of buttons
  8728.                        -1       two buttons
  8729.                         0       other than two
  8730.                         3       Mouse Systems mouse
  8731.  
  8732.         01h     Show Mouse Cursor
  8733.         entry   AH      01h
  8734.         return  unknown
  8735.  
  8736.         02h     Hide Mouse Cursor
  8737.         entry   AH      02h
  8738.         return  unknown
  8739.         note    multiple calls to hide the cursor will require multiple calls
  8740.                 to function 01h to unhide it.
  8741.  
  8742.         03h     Return Position and Button Status
  8743.         entry   AH      03h
  8744.         return  BX      button status
  8745.                         bit 0   left button pressed if 1
  8746.                         bit 1   right button pressed if 1
  8747.                         bit 2   middle button pressed if 1 (Mouse Systems mouse)
  8748.                 CX      column
  8749.                 DX      row
  8750.  
  8751.         04h     Position Mouse Cursor
  8752.         entry   AH      04h
  8753.                 CX      column
  8754.                 DX      row
  8755.                 return  unknown
  8756.  
  8757.         05h     Return Button Press Data
  8758.         entry   AH      05h
  8759.                 BX      button
  8760.                         0 left
  8761.                         1 right
  8762.                         2 middle (Mouse Systems mouse)
  8763.         return  AH      button states
  8764.                         bit 0   left button pressed if 1
  8765.                         bit 1   right button pressed if 1
  8766.                         bit 2   middle button pressed if 1 (Mouse Systems mouse)
  8767.                 BX      no. of times specified button pressed since last call
  8768.                 CX      column at time specified button was last pressed
  8769.                 DX      row at time specified button was last pressed
  8770.  
  8771.         06h     Return Button Release Data
  8772.         entry   AH      06h
  8773.                 BX      button
  8774.                         0       left
  8775.                         1       right
  8776.                         2       middle (Mouse Systems mouse)
  8777.         return  AH      button states
  8778.                         bit 0   left button pressed if 1
  8779.                         bit 1   right button pressed if 1
  8780.                         bit 2   middle button pressed if 1 (Mouse Systems mouse)
  8781.                 BX      no. of times specified button released since last call
  8782.                 CX      column at time specified button was last released
  8783.                 DX      row at time specified button was last released
  8784.  
  8785.         07h     Define Horizontal Cursor Range
  8786.         entry   AH      0007h
  8787.                 CX      minimum column
  8788.                 DX      maximum column
  8789.         return  unknown
  8790.  
  8791.         08h     Define Vertical Cursor Range
  8792.         entry   AH      08h
  8793.                 CX      minimum row
  8794.                 DX      maximum row
  8795.                 return  unknown
  8796.  
  8797.         09h     Define Graphics Cursor
  8798.         entry   AH      09h
  8799.                 BX      column of cursor hot spot in bitmap (-16 to 16)
  8800.                 CX      row of cursor hot spot  (-16 to 16)
  8801.                 ES:DX   pointer to bitmap
  8802.                         16 words screen mask
  8803.                         16 words cursor mask
  8804.                 return  unknown
  8805.                 note    Each word defines the sixteen pixels of a row, low bit
  8806.                         rightmost
  8807.  
  8808.         0Ah     Define Text Cursor
  8809.         entry   AH      0Ah
  8810.                 BX      hardware/software text cursor
  8811.                         00h     software
  8812.                                 CX      screen mask
  8813.                                 DX      cursor mask
  8814.                         01h     hardware
  8815.                                 CX      start scan line
  8816.                                 DX      end scan line
  8817.         return  unknown
  8818.         note    When the software cursor is selected, the char/attribute data
  8819.                 at the current screen position is ANDed with the screen mask
  8820.                 and the with the cursor mask
  8821.  
  8822.         0Bh     Read Motion Counters
  8823.         entry   AH      0Bh
  8824.         return  CX      number of mickeys mouse moved horiz. since last call
  8825.                 DX      number of mickeys mouse moved vertically
  8826.         note 1) A mickey is the smallest increment the mouse can sense.
  8827.                 Positive values indicate up/right
  8828.  
  8829.         0Ch     Define Interrupt Subroutine Parameters
  8830.         entry   AH      0Ch
  8831.                 CX      call mask bit
  8832.                         bit 0   call if mouse moves
  8833.                         bit 1   call if left button pressed
  8834.                         bit 2   call if left button released
  8835.                         bit 3   call if right button pressed
  8836.                         bit 4   call if right button released
  8837.                         bit 5   call if middle button pressed (Mouse Systems)
  8838.                         bit 6   call if middle button released (Mouse Systems)
  8839.                 ES:DX  address of FAR routine
  8840.         return  unknown
  8841.         note    when the subroutine is called, it is passed these values:
  8842.                 AH      condition mask (same bit assignments as call mask)
  8843.                 BX      button state
  8844.                 CX      cursor column
  8845.                 DX      cursor row
  8846.                 DI      horizontal mickey count
  8847.                 SI      vertical mickey count
  8848.  
  8849.         0Dh     Light Pen Emulation On
  8850.         entry   AH      0Dh
  8851.         return  unknown
  8852.  
  8853.         0Eh     Light Pen Emulation Off
  8854.         entry   AH      0Eh
  8855.         return  unknown
  8856.  
  8857.         0Fh     Define Mickey/Pixel Ratio
  8858.         entry   AH      0Fh
  8859.                 CX      number of mickeys per 8 pixels horizontally
  8860.                 DX      number of mickeys per 8 pixels vertically
  8861.         return  unknown
  8862.  
  8863.         10h     Define Screen Region for Updating
  8864.         entry   AH      10h
  8865.                 CX,DX   X,Y coordinates of upper left corner
  8866.                 SI,DI   X,Y coordinates of lower right corner
  8867.         return  unknown
  8868.         note    Mouse cursor is hidden during updating, and needs to be
  8869.                 explicitly turned on again
  8870.  
  8871.         11h     not documented by Microsoft
  8872.  
  8873.         12h     Set Large Graphics Cursor Block
  8874.                 AH      12h
  8875.                 BH      cursor width in words
  8876.                 CH      rows in cursor
  8877.                 BL      horizontal hot spot (-16 to 16)
  8878.                 CL      vertical hot spot (-16 to 16)
  8879.                 ES:DX   pointer to bit map of screen and cursor maps
  8880.         return  AH     -1 if successful
  8881.         note    PC Mouse. Not documented by Microsoft
  8882.  
  8883.         13h     Define Double-Speed Threshold
  8884.         entry   AH      13h
  8885.                 DX      threshold speed in mickeys/second,
  8886.                         0 = default of 64/second
  8887.         return  unknown
  8888.         note    If speed exceeds threshold, the cursor's on-screen motion
  8889.                 is doubled
  8890.  
  8891.         14h     Exchange Interrupt Subroutines
  8892.         entry   AH      14h
  8893.         return  unknown
  8894.  
  8895.         15h     Return Drive Storage Requirements
  8896.         entry   AH      15h
  8897.         return  BX      size of buffer needed to store driver state
  8898.  
  8899.         16h     Save Driver State
  8900.         entry   AH      16h
  8901.                 ES:DX   pointer to buffer
  8902.         return  unknown
  8903.  
  8904.         17h     Restore Driver State
  8905.         entry   AH      17h
  8906.                 ES:DX   pointer to buffer containing saved state
  8907.         return  unknown
  8908.  
  8909.         18h-1Ch not documented by Microsoft; unknown
  8910.  
  8911.         1Dh     Define Display Page Number
  8912.         entry   AH      1Dh
  8913.  
  8914.         1Eh     Return Display Page Number
  8915.         entry   AH      1Eh
  8916.         return  unknown
  8917.  
  8918.         42h     PCMouse - Get MSmouse Storage Requirements
  8919.                 AH      42h
  8920.                 return  AX      0FFFFh successful
  8921.                 BX      buffer size in bytes for functions 50h and 52h
  8922.                         00h     MSmouse not installed
  8923.                         42h     functions 42h, 50h, and 52h not supported
  8924.  
  8925.         52h     PCMouse - Save MSmouse State
  8926.         entry   AH      50h
  8927.                 BX      buffer size
  8928.                 ES:DX   pointer to buffer
  8929.                 return  AX      0FFFFh if successful
  8930.  
  8931.         52h     PCMouse - restore MSmouse state
  8932.         entry   AH      52h
  8933.                 BX      buffer size
  8934.                 ES:DX   pointer to buffer
  8935.                 return  AX      0FFFFh if successful
  8936.  
  8937.  
  8938. Int 33: In addition, the following functions are appended to BIOS int 10h and
  8939.         implemented as the EGA Register Interface Library:
  8940.  
  8941.         0F0h    read one register
  8942.         0F1h    write one register
  8943.         0F2h    read consecutive register range
  8944.         0F3h    write consecutive register range
  8945.         0F4h    read non-consecutive register set
  8946.         0F5h    write non-consecutive register set
  8947.         0F6h    revert to default register values
  8948.         0F7h    define default register values
  8949.         0FAh    get driver status
  8950.  
  8951.  
  8952.  
  8953. Interrupt 34h   Turbo C/Microsoft languages - Floating Point emulation
  8954.                 This interrupt emulates opcode 0D8h
  8955.  
  8956.  
  8957. Interrupt 35h   Turbo C/Microsoft languages - Floating Point emulation
  8958.                 This interrupt emulates opcode 0D9h
  8959.  
  8960.  
  8961. Interrupt 36h   Turbo C/Microsoft languages - Floating Point emulation
  8962.                 This interrupt emulates opcode 0DAh
  8963.  
  8964.  
  8965. Interrupt 37h   Turbo C/Microsoft languages - Floating Point emulation
  8966.                 This interrupt emulates opcode 0DBh
  8967.  
  8968.  
  8969. Interrupt 38h   Turbo C/Microsoft languages - Floating Point emulation
  8970.                 This interrupt emulates opcode 0DCh
  8971.  
  8972.  
  8973. Interrupt 39h   Turbo C/Microsoft languages - Floating Point emulation
  8974.                 This interrupt emulates opcode 0DDh
  8975.  
  8976.  
  8977. Interrupt 3Ah   Turbo C/Microsoft languages - Floating Point emulation
  8978.                 This interrupt emulates opcode 0DEh
  8979.  
  8980.  
  8981. Interrupt 3Bh   Turbo C/Microsoft languages - Floating Point emulation
  8982.                 This interrupt emulates opcode 0DFh
  8983.  
  8984.  
  8985. Interrupt 3Ch   Turbo C/Microsoft languages - Floating Point emulation
  8986.                 This int emulates instructions with an ES segment override
  8987.  
  8988.  
  8989. Interrupt 3Dh   Turbo C/Microsoft languages - Floating Point emulation
  8990.                 This interrupt emulates a standalone FWAIT instruction
  8991.  
  8992.  
  8993. Interrupt 3Eh   Turbo C/Microsoft languages - Floating Point emulation
  8994.  
  8995.  
  8996. Interrupt 3Fh   Overlay manager interrupt (Microsoft LINK.EXE)
  8997.                 Default overlay interrupt; may be changed with LINK switch
  8998.  
  8999.  
  9000. Interrupt 40h   Hard Disk BIOS
  9001.                 Pointer to disk BIOS entry when a hard disk controller is
  9002.                 installed. The BIOS routines use int 30h to revector the
  9003.                 diskette handler (original int 13h) here so int 40 may be used
  9004.                 for hard disk control
  9005.  
  9006.  
  9007. Interrupt 41h   Hard Disk Parameters  (XT,AT,XT2,XT286,PS except ESDI disks)
  9008.                 Pointer to first Hard Disk Parameter Block, normally located
  9009.                 in the controller card's ROM. This table may be copied to RAM
  9010.                 and changed, and this pointer revectored to the new table.
  9011. note 1) format of parameter table is:
  9012.         dw      cylinders
  9013.         db      heads
  9014.         dw      starting reduced write current cylinder (XT only, 0 for others)
  9015.         db      maximum ECC burst length
  9016.         db      control byte
  9017.                   bits 0-2 drive option (XT only, 0 for others)
  9018.                   bit 3    set if more than 8 heads
  9019.                   bit 4    always 0
  9020.                   bit 5    set if manufacturer's defect map on max cylinder+1
  9021.                   bit 6    disable ECC retries
  9022.                   bit 7    disable access retries
  9023.         db      standard timeout (XT only, 0 for others)
  9024.         db      formatting timeout (XT only, 0 for others)
  9025.         db      timeout for checking drive (XT only, 0 for others)
  9026.         dw      landing zone    (AT, PS/2)
  9027.         db      sectors/track   (AT, PS/2)
  9028.         db      0
  9029.      2) normally vectored to ROM table when system is initialized.
  9030.  
  9031.  
  9032. Interrupt 42h   Pointer to screen BIOS entry  (EGA, VGA, PS/2)
  9033.                 Relocated (by EGA, etc.) video handler (original int 10h).
  9034.                 Revectors int 10 calls to EGA BIOS.
  9035.  
  9036.  
  9037. Interrupt 43h   Pointer to EGA graphics character table. The POST initializes
  9038.                 this vector pointing to the default table located in the EGA
  9039.                 ROM BIOS. (PC-2 and up). Not initialized if EGA not present.
  9040.                 This vector was referred to (mistakenly) as the Video
  9041.                 Parameters table in the original EGA BIOS listings.
  9042.  
  9043.  
  9044. Interrupt 44h   Pointer to graphics character table. This table contains the
  9045. (0:0110h)       dot patterns for the first 128 characters in video modes 4,5,
  9046.                 and 6, and all 256 characters in all additional graphics modes.
  9047.                 Not initialized if EGA not present.
  9048.              2) EGA/VGA/CONV/PS - EGA/PCjr fonts, characters 00h to 7Fh
  9049.              3) Novell NetWare - High-Level Language API
  9050.              4) This interrupt is not used by some EGA cards.
  9051.  
  9052.  
  9053. Interrupt 45h   Reserved by IBM  (not initialized)
  9054.  
  9055.  
  9056. Interrupt 46h   Pointer to second hard disk, parameter block (AT, XT/286, PS/2)
  9057.                 (see int 41h) (except ESDI hard disks) (not initialized unless
  9058.                 specific user software calls for it)
  9059.  
  9060.  
  9061. Interrupt 47h   Reserved by IBM  (not initialized)
  9062.  
  9063.  
  9064. Interrupt 48h   Cordless Keyboard Translation (PCjr, XT [never delivered])
  9065. (0:0120h)       This vector points to code to translate the cordless keyboard
  9066.                 scancodes into normal 83-key values. The translated scancodes
  9067.                 are then passed to int 9. (not initialized on PC or AT)
  9068.  
  9069.  
  9070. Interrupt 49h   Non-keyboard Scan Code Translation Table Address (PCjr)
  9071. (0:0124h)       This interrupt is used for operation of non-keyboard devices
  9072.                 on the PCjr, such as the Keystronic Numeric Keypad.
  9073.                 This interrupt has the address of a table used to translate
  9074.                 non-keyboard scancodes (greater than 85 excepting 255). This
  9075.                 interrupt can be revectored by a user application. IBM
  9076.                 recommends that the default table be stored at the beginning
  9077.                 of an application that required revectoring this interrupt,
  9078.                 and that the default table be restored when the application
  9079.                 terminates. (not initialized on PC or AT)
  9080.  
  9081.                 The PCjr BIOS can interpret scancodes other than those
  9082.                 generated by the keyboard to allow for expansion. The keyboard
  9083.                 generates scancodes from 01h to 055h, including 0FFh. Any
  9084.                 scancodes above 55h (56h through 7Eh for make codes and 0D6h
  9085.                 through 0FEh for break codes) are processed in the following
  9086.                 manner:
  9087.                 1) if the incoming make code falls within the range of the
  9088.                    translate table whose address is pointed to by int 49h, it
  9089.                    is translated into the corresponding scancode. Any incoming
  9090.                    break codes above 0D5h are ignored.
  9091.                 2) if the new translated scancode ius less and 56h, it is
  9092.                    processed by the BIOS as a keyboard scancode and the same
  9093.                    data is placed in the BIOS keyboard buffer.
  9094.                 3) if the translated scancode is higher than 55h or the
  9095.                    incoming scancode is outside the range of the translate
  9096.                    table, 40h is added creating a new extended scancode. The
  9097.                    extended scancode is placed in the BIOS keyboard buffer with
  9098.                    the character code of 00h (NUL). This utilitizes the range
  9099.                    of 96h through 0BEh for scancodes 56h through 7Eh.
  9100.  
  9101.                 The default translate-table maps scancodes 56h through 6Ah to
  9102.                 existing keyboard values. Codes 6Bh theough 0BEh are mapped (by
  9103.                 adding 40h) to extended codes 0ABh through 0FEh since they are
  9104.                 outside the range of the default translate table.
  9105.  
  9106.                 The format of the translate table is:
  9107.                 0       length - the number of nonkeyboard scancodes that are
  9108.                         mapped within the table (from 1 to n)
  9109.                 1 to n  word  high byte 00h (NUL) byte scancode with low order
  9110.                         byte representing the scancode mapped values relative
  9111.                         to their input values within the range of 56h through
  9112.                         7Eh
  9113.  
  9114.                 With this layout, all keyboard scancodes can be intercepted
  9115.                 through int 9h and and nonkeyboard scancodes can be intercepted
  9116.                 through int 48h.
  9117.  
  9118.  
  9119. Interrupt 4Ah   Real-Time Clock Alarm (Convertible, PS/2)
  9120.                 (not initialized on PC or AT)
  9121.                 Invoked by BIOS when real-time clock alarm occurs
  9122.  
  9123.  
  9124. Interrupt 4Bh   Reserved by IBM  (not initialized)
  9125.  
  9126.  
  9127. Interrupt 4Ch   Reserved by IBM  (not initialized)
  9128.  
  9129.  
  9130. Interrupt 4Dh   Reserved by IBM  (not initialized)
  9131.  
  9132.  
  9133. Interrupt 4Eh   Reserved by IBM  (not initialized)
  9134.                 Used instead of int 13h for disk I/O on TI Professional PC
  9135.  
  9136.  
  9137. Interrupt 4Fh   Reserved by IBM  (not initialized)
  9138.  
  9139.  
  9140. Interrupt 50-57 IRQ0-IRQ7 relocated by DesQview
  9141.                 (normally not initialized)
  9142.  
  9143.  
  9144. Interrupt 58h   Reserved by IBM  (not initialized)
  9145.  
  9146.  
  9147. Interrupt 59h   Reserved by IBM  (not initialized)
  9148.                 GSS Computer Graphics Interface (GSS*CGI)
  9149.                 DS:DX   Pointer to block of 5 array pointers
  9150.                 return  CF      0
  9151.                         AX      return code
  9152.                         CF      1
  9153.                         AX      error code
  9154.                 note 1) Int 59 is the means by which GSS*CGI language bindings
  9155.                         communicate with GSS*CGI device drivers and the GSS*CGI
  9156.                         device driver controller.
  9157.                      2) Also used by the IBM Graphic Development Toolkit
  9158.  
  9159.  
  9160. Interrupt 5Ah   Reserved by IBM  (not initialized)
  9161.  
  9162.  
  9163. Interrupt 5Bh   Reserved by IBM  (not initialized)
  9164.  
  9165.  
  9166. Interrupt 5Ah   Cluster Adapter BIOS entry address
  9167.                 (normally not initialized)
  9168.  
  9169.  
  9170. Interrupt 5Bh   Reserved by IBM  (not initialized) (cluster adapter?)
  9171.  
  9172.  
  9173. Interrupt 5Ch   NETBIOS interface entry port
  9174.                 ES:BX   pointer to network control block
  9175. return  AL      error code (0 if none)
  9176. note 1) When the NETBIOS is installed, interrupts 13 and 17 are interrupted by
  9177.         the NETBIOS; interrupt 18 is moved to int 86 and one of int 2 or 3 is
  9178.         used by NETBIOS. Also, NETBIOS extends the int 15 function 90 and 91h
  9179.         functions (scheduler functions)
  9180.      2) Normally not initialized.
  9181.      3) TOPS network card uses DMA 1, 3 or none.
  9182.  
  9183.  
  9184. Interrupt 5Dh   Reserved by IBM  (not initialized)
  9185.  
  9186.  
  9187. Interrupt 5Eh   Reserved by IBM  (not initialized)
  9188.  
  9189.  
  9190. Interrupt 5Fh   Reserved by IBM  (not initialized)
  9191.  
  9192.  
  9193. Interrupt 60h-67h  User Program Interrupts (availible for general use)
  9194.                    Various major programs make standardized use of this group
  9195.                    of interrupts. Details of common use follows
  9196.  
  9197.  
  9198. Interrupt 60h   10-Net Network
  9199.  
  9200. entry   AH      11h     Lock and Wait
  9201.         AL      drive number or 0
  9202.         DX      number of seconds to wait
  9203.         ES:SI   Ethernet address or 0
  9204.         DS:BX   pointer to 31-byte ASCIIZ semaphore name
  9205. return  AL      status
  9206.                 0       successful
  9207.                 1       timeout
  9208.                 2       server not responding
  9209.                 3       invalid semaphore name
  9210.                 4       semaphore list is full
  9211.                 5       invalid drive ID
  9212.                 6       invalid Ethernet address
  9213.                 7       not logged in
  9214.                 8       write to network failed
  9215.                 9       semaphore already logged for this CPU
  9216.  
  9217. entry   AH      12h     Lock
  9218.         AL      drive number or 0 for default
  9219.         ES:SI   Ethernet address or 0
  9220.         DS:BX   pointer to 31-byte ASCIIZ semaphore name
  9221. return  AL      status (see function 11h)
  9222.                 1       semaphore currently logged
  9223. note    Unlike function 11h, this function returns immediately
  9224.  
  9225. entry   AH      13h     Unlock
  9226.         AL      drive number or 0
  9227.         ES:SI   Ethernet address or 0
  9228.         DS:BX   pointer to 31-byte ASCIIZ semaphore name
  9229. return  AL      status (see function 11h)
  9230.                 1       semaphore not logged
  9231.  
  9232.  
  9233. Interrupt 67h   Used by Lotus-Intel-Microsoft Expanded Memory Specification
  9234.         user    and Ashton-Tate/Quadram/AST Enhanced Expanded Memory
  9235.                 specification (See Chapter 10)
  9236.  
  9237.  
  9238. Interrupt 68h   Not Used  (not initialized)
  9239.  
  9240.  
  9241. Interrupt 69h   Not Used  (not initialized)
  9242.  
  9243.  
  9244. Interrupt 6Ah   Not Used  (not initialized)
  9245.  
  9246.  
  9247. Interrupt 6Bh   Not Used  (not initialized)
  9248.  
  9249.  
  9250. Interrupt 6Ch   System Resume Vector (Convertible) (not initialized on PC)
  9251.                 DOS 3.2 Realtime Clock update
  9252.  
  9253.  
  9254. Interrupt 6Dh   Not Used  (not initialized)
  9255.  
  9256.  
  9257. Interrupt 6Eh   Not Used  (not initialized)
  9258.  
  9259.  
  9260. Interrupt 6Fh   Novell NetWare - PCOX API (3270 PC terminal interface)
  9261. Interrupt 6Fh   10-Net Network API
  9262. entry   AH      00h     Login
  9263.         DS:DX   login record
  9264.               8 bytes user name
  9265.               8 bytes password
  9266.              12 bytes name of super-station
  9267.                 return  CL      security level
  9268.                         AX      status
  9269.                                 0000h   good login
  9270.                                 0FF01h  no response from superstation
  9271.                                 0FF02h  network error
  9272.                                 0FF03h  invalid password
  9273.                                 0FF04h  no local buffer
  9274.                                 0FF05h  superstation not available
  9275.                                 0FF06h  node already logged in
  9276.                                 0FF07h  login not valid from this node
  9277.                                 0FF08h  node ID already in use
  9278.                 01h     Logoff
  9279.                 return  CX      number of files closed
  9280.                         AX      status
  9281.                                 0000h   successful
  9282.                                 0FF08h  superstation ID not already logged in
  9283.                 02h     Status of node
  9284.                 DS:DX   pointer to 512-byte record
  9285.                       8 bytes user name (0 if none)
  9286.                         byte  station type
  9287.                               0  workstation
  9288.                               1  superstation
  9289.                               4  logged into multiple superstations
  9290.                      24 bytes list of superstations logged into more than one
  9291.                         superstation
  9292.                      12 bytes node ID
  9293.                         word  message count for this station (send for user
  9294.                               node, receive for superstations)
  9295.                         for superstations only:
  9296.                         word  drives allocated (bit 0=A:, bit 1=B:,...)
  9297.                         byte  user service flag
  9298.                               bit 4: SUBMIT is on
  9299.                                   3: mail waiting for node
  9300.                                   2: calendar waiting for you
  9301.                                   1: news waiting for you
  9302.                                   0: mail waiting for you
  9303.                         byte    printers allocated (bit 0=LPT1,...)
  9304.                         byte    number of unprinted spool files
  9305.                         byte    number of opened files
  9306.                         byte    number of logged on files
  9307.                         byte    primary drive (1=A:)
  9308.                         byte    reserved
  9309.                       n bytes   list of logged on node IDs (each 12 bytes, max
  9310.                                 38 IDs)
  9311.                 return  CF      set on error
  9312.                                 AX      error code
  9313.                                         0FF01h  no response from node
  9314.                                         0FF02h  network error
  9315.                                         0FF04h  no local buffer
  9316.                                         0FF16h  invalid node ID
  9317.                 03h     Get Address of Configuration Table
  9318.                 return  ES:BX   pointer to record (actually starts at [BX-25])
  9319.                                 word    count of dropped Send6F
  9320.                                 word    buffer start address
  9321.                                 word    comm driver base address
  9322.                                 word    send/receive retry count
  9323.                                 byte    number of 550ms loops
  9324.                                 word    UFH address
  9325.                                 word    CDIR address
  9326.                                 word    LTAB address
  9327.                                 word    SFH address
  9328.                                 word    FTAB address
  9329.                                 word    RLTAB address
  9330.                                 word    SMI address
  9331.                                 word    NTAB address
  9332.                       ES:BX     pointer to word address of first CT_DRV
  9333.                                 byte  number of DRV entries
  9334.                               8 bytes login name
  9335.                              12 bytes node ID
  9336.                               6 bytes node address
  9337.                                 byte  flag
  9338.                                 byte    CT_CFLG
  9339.                                         bit 1: sound bell
  9340.                                         bit 0: CHAT permit
  9341.                                 byte    CT_PSFLG
  9342.                                         bit 5: PRINT permit
  9343.                                         bit 4: KB initiated
  9344.                                         bit 3: CHAT called FOXPTRM
  9345.                                         bit 2: SUBMIT active
  9346.                                         bit 1: SUBMIT received
  9347.                                         bit 0: SUBMIT permit
  9348.                                 byte    reserved
  9349.                                 word    receive message count
  9350.                                 word    send message count
  9351.                                 word    retry count
  9352.                                 word    failed count
  9353.                                 word    driver errors
  9354.                                 word    dropped responses/CHATs
  9355.                               9 bytes   list ID/NTAB address (3 entries-LPT1-3?)
  9356.                               6 bytes   AUX ID/NTAB address (2 entries-COM1-2?)
  9357.                                 byte    active CB channel
  9358.                                 byte    received 6F messages on queue
  9359.                               9 bytes   activity counters for channels 1-9
  9360.                 04h     Send
  9361.                         DS:BX   pointer to record
  9362.                              12 bytes   receiving node's ID
  9363.                                 word    length of data at DX
  9364.                         DS:DX   pointer to data (max 1024 bytes)
  9365.                 return  CF      set on error
  9366.                         AX      error code
  9367.                                 0FF01h  timeout
  9368.                                 0FF02h  network error
  9369.                                 0FF04h  no local buffer
  9370.                                 0FF16h  invalid parameter (bad length)
  9371.                 05h     Receive
  9372.                         CX      number of seconds before timeout
  9373.                         DS:DX   pointer to receive buffer
  9374.                              12 bytes   sending node's ID
  9375.                                 word    length of message
  9376.                               n bytes   message (maximum 1024 bytes)
  9377.                 return CF       set on error
  9378.                                 AX      error code
  9379.                                         0FF01h  timeout
  9380.                                         0FF18h  sent message has been dropped
  9381.                 06h     Unknown
  9382.                 07h     Lock Handle
  9383.                         BX      file handle
  9384.                         CX:DX   starting offset in file
  9385.                         SI      record length
  9386.                 return  CF      set on error
  9387.                                 AX      error code
  9388.                                         0FF01h  timeout
  9389.                                         02h     file not found
  9390.                                         0FF17h  record locked by another user
  9391.                 08h     Unlock Handle
  9392.                         BX      file handle
  9393.                         AL      mode
  9394.                                 0       unlock all
  9395.                                 1       unlock record at CX:DX
  9396.                 return  CF      set on error
  9397.                                 AX      error code
  9398.                                         02h     file not found
  9399.                 0Bh     Lock Semaphore, Return Immediately
  9400.                         AL      drive number or 0
  9401.                         ES:SI   Ethernet address or 0
  9402.                         DS:BX   pointer to 31-byte ASCIIZ semaphore name
  9403.                 return  AL      status
  9404.                                 0       successful
  9405.                                 1       semaphore currently locked
  9406.                                 2       server not responding
  9407.                                 3       invalid semaphore name
  9408.                                 4       semaphore list is full
  9409.                                 5       invalid drive ID
  9410.                                 6       invalid Ethernet address
  9411.                                 7       not logged in
  9412.                                 8       write to network failed
  9413.                                 9       semaphore already logged in this CPU
  9414.                 0Ch     unlock semaphore
  9415.                         AL      drive number or 0
  9416.                         ES:SI   Ethernet address or 0
  9417.                         DS:BX   pointer to 31-byte ASCIIZ semaphore name
  9418.                 return  AL      status (see AH=0Bh)
  9419.                                 1 semaphore not locked
  9420.                 0Dh     Who
  9421.                         CX      length of data
  9422.                         DS:DX   pointer to array of records to be filled
  9423.                              12 bytes   node ID
  9424.                                 byte    flag (1=workstation, 2=superstation)
  9425.                 return  CL      number of records returned (responding stations)
  9426.                 0Eh     spool/print
  9427.                 DS:DX   pointer to record
  9428.                         word    0       initiate spool
  9429.                                 1       abort print
  9430.                                 2       close spool
  9431.                                 3       delete spool
  9432.                                 4       print
  9433.                                 5       get report info
  9434.                      11 bytes file name
  9435.                         byte    notification
  9436.                                 bit 6:  do ID page
  9437.                                 bit 5:  no form feed
  9438.                                 bit 3:  notify at print completion
  9439.                                 bit 2:  notify at print start and reply?
  9440.                                 bit 1:  notify at print start
  9441.                                 bit 0:  no notification
  9442.                         byte    days to keep (0FFh=forever)
  9443.                         byte    device (1=LPT1)
  9444.                         word    length of following data area
  9445.                       n bytes   $SCNT records returned if code in first word
  9446.                                 is 05h
  9447.                 return  CF      set on error
  9448.                                 AX      error code
  9449.                                         0FF16h  invalid parameter
  9450.                                         0FF17h  device not mounted
  9451.                                         0FF18h  already spooling to named device
  9452.                 11h     Lock FCB
  9453.                         AL      mode
  9454.                                 0       sequential
  9455.                                 1       random
  9456.                                 2       random block
  9457.                         DS:DX   pointer to FCB
  9458.                 return  CF      set on error
  9459.                                 AX       02h    file not found
  9460.                                          0FF01h timeout
  9461.                                          0FF17h record locked by another user
  9462.                 12h     Unlock FCB
  9463.                         AL      mode
  9464.                                 0       sequential
  9465.                                 1       random
  9466.                                 2       random block
  9467.                         DS:DX   pointer to FCB
  9468.                 return  CF      set on error
  9469.                                 AX      02h     file not found
  9470.  
  9471.  
  9472. Interrupt 70h   IRQ 8, Real Time Clock Interrupt  (AT, XT/286, PS/2)
  9473.  
  9474.  
  9475. Interrupt 71h   IRQ 9, Redirected to IRQ 8 (AT, XT/286, PS/2)
  9476.                 LAN Adapter 1 (rerouted to int 0Ah [IRQ2] by BIOS)
  9477.  
  9478.  
  9479. Interrupt 72h   IRQ 10  (AT, XT/286, PS/2)  Reserved
  9480.  
  9481.  
  9482. Interrupt 73h   IRQ 11  (AT, XT/286, PS/2)  Reserved
  9483.  
  9484.  
  9485. Interrupt 74h   IRQ 12  Mouse Interrupt (PS/2)
  9486.  
  9487.  
  9488. Interrupt 75h   IRQ 13, Coprocessor Error, BIOS Redirect to int 2 (NMI) (AT)
  9489.  
  9490.  
  9491. Interrupt 76h   IRQ 14, Hard Disk Controller (AT, XT/286, PS/2)
  9492.  
  9493.  
  9494. Interrupt 77h   IRQ 15 (AT, XT/286, PS/2)  Reserved
  9495.  
  9496.  
  9497. Interrupt 78h   Not Used
  9498.  
  9499.  
  9500. Interrupt 79h   Not Used
  9501.  
  9502.  
  9503. Interrupt 7Ah   Novell NetWare - LOW-LEVEL API
  9504.  
  9505.  
  9506. Interrupt 7Bh-7Eh  Not Used
  9507.  
  9508.  
  9509. Interrupt 7Fh   unknown
  9510.                 Used by second copy of COMMAND set with SHELL=
  9511.                 Not used by COMMAND /C at DOS prompt
  9512.  
  9513.  
  9514. Interrupt 80h-85h  Reserved by BASIC
  9515. note    interrupts 80h through ECh are apparently unused and not initialized.
  9516.  
  9517.  
  9518. Interrupt 86h   Relocated by NETBIOS int 18
  9519.  
  9520.  
  9521. Interrupt 86h-0F0h  Used by BASIC when BASIC interpreter is running
  9522.  
  9523.  
  9524. Intrerrupt 0E0h CP/M-86 function calls
  9525.  
  9526.  
  9527. Interrupt 0E4h  Logitech Modula-2 v2.0   MONITOR
  9528. entry   AX      05h     monitor entry
  9529.                 06h     monitor exit
  9530.         BX      priority
  9531.  
  9532.  
  9533. Interrupt 0F0h  unknown
  9534.                 Used by secondary copy of COMMAND when SHELL= set
  9535.                 Not used by COMMAND /C at DOS prompt
  9536.  
  9537.  
  9538. Interrupts 0F1h-0FFh  (absolute addresses 3C4-3FF)
  9539.                       Location of Interprocess Communications Area
  9540.  
  9541.  
  9542. Interrupt 0F8h  Set Shell Interrupt (OEM)
  9543.                 Set OEM handler for int 21h calls from 0F9h through 0FFh
  9544. entry   AH      0F8h
  9545.         DS:DX   pointer to handler for Functions 0F9h thru 0FFh
  9546. note 1) To reset these calls, pass DS and DX with 0FFFFh. DOS is set up to
  9547.         allow ONE handler for all 7 of these calls. Any call to these handlers
  9548.         will result in the carry bit being set and AX will contain 1 if they are
  9549.         not initialized. The handling routine is passed all registers just as
  9550.         the user set them. The OEM handler routine should be exited through an
  9551.         IRET.
  9552.      2) 10 ms interval timer (Tandy?)
  9553.  
  9554.  
  9555. Interrupt 0F9h  First of 8 SHELL service codes, reserved for OEM shell (WINDOW);
  9556.                 use like HP Vectra user interface?
  9557.  
  9558.  
  9559. Interrupt 0FAh  USART ready (RS-232C)
  9560.  
  9561.  
  9562. Interrupt 0FBh  USART RS ready (keyboard)
  9563.  
  9564.  
  9565. Interrupt 0FCh  Unknown
  9566.  
  9567.  
  9568. Interrupt 0FDh  reserved for user interrupt
  9569.  
  9570.  
  9571. Interrupt 0FEh  AT/XT286/PS50+ - destroyed by return from protected mode
  9572.  
  9573.  
  9574. Interrupt 0FFh  AT/XT286/PS50+ - destroyed by return from protected mode
  9575.  
  9576.  
  9577.  
  9578.        **  Programmer's Technical Reference for MSDOS and the IBM PC **
  9579.                 USA copyright TXG 392-616  ALL RIGHTS RESERVED
  9580. ───────────────────────────────┤ DOSREF (tm) ├────────────────────────────────
  9581.                      ISBN 1-878830-02-3 (disk-based text)
  9582.                     Copyright (c) 1987, 1991 Dave Williams
  9583.                         ┌─────────────────────────────┐
  9584.                         │ Shareware Version, 12/20/91 │
  9585.                         │  Please Register Your Copy  │
  9586.                         └─────────────────────────────┘
  9587.  
  9588.  
  9589.                              C H A P T E R   S I X
  9590.  
  9591.                        DOS CONTROL BLOCKS AND WORK AREAS
  9592.  
  9593.  
  9594.  Contrary to popular belief, DOS is not limited to 640k of work space. This 
  9595. constraint is enforced by the mapping of ROM and video RAM into the default 1 
  9596. megabyte CPU address space. Some MSDOS compatible machines, such as the Sanyo 
  9597. 55x series, can have as much as 768k of contiguous DOS workspace with the 
  9598. appropriate option boards. Since DOS has no real memory management, it cannot 
  9599. deal with a fragmented workspace. Fragmented RAM (such as RAM mapped into the 
  9600. option ROM address space) can be dealt with as a RAMdisk or other storage area 
  9601. by using a device driver or other software.
  9602.  
  9603.  The 80386 CPU and appropriate control software can create a DOS workspace of 
  9604. more than one megabyte. Certain add-on boards can also add more than a 
  9605. megabyte of workspace, but only for specially written software. Since these 
  9606. are all proprietary schemes, little information is availible at present.
  9607.  
  9608.  When DOS loads a program, it first sets aside a section of memory for the 
  9609. program called the program segment, or code segment. Then it constructs a 
  9610. control block called the program segment prefix, or PSP, in the first 256 
  9611. (100h) bytes. Usually, the program is loaded directly after the PSP at 100h.
  9612.  The PSP contains various information used by DOS to help run the program.  
  9613. The PSP is always located at offset 0 within the code segment. When a program 
  9614. recieves control certain registers are set to point to the PSP. For a COM 
  9615. file, all registers are set to point to the beginning of the PSP and the 
  9616. program begins at 100h. For the more complex EXE file structures, only DS and 
  9617. ES registers are set to point to the PSP. The linker passes the settings for 
  9618. the DS, IP, SS, and SP registers and may set the starting location in CS:IP to 
  9619. a location other than 100h.
  9620.  
  9621.  IBMBIO provides an IRET instruction at absolute address 847h for use as a 
  9622. dummy routine for interrupts that are not used by DOS. This lets the interrupts
  9623. do nothing until their vectors are rerouted to their appropriate handlers.
  9624.  
  9625.  A storage block is used by DOS to record the amount and location of allocated 
  9626. memory within the machine's address space.
  9627.  A storage block, a Program Segment Prefix, and an environment area are built 
  9628. by DOS for each program currently resident in the address space. The storage 
  9629. block is used by DOS to record the address range of memory allocated to a 
  9630. program. It is used by DOS to find the next availible area to load a program 
  9631. and to determine if there is enough memory to run that porogram. When a 
  9632. memory area is in use, it is said to be allocated. Then the program ends, or 
  9633. releases memory, it is said to be deallocated. 
  9634.  A storage block contains a pointer to the Program Segment Prefix associated 
  9635. with each program. This control block is constructed by IBMDOS for the purpose 
  9636. of providing standardized areas for DOS/program communication. Within the 
  9637. PSP are areas which  are used to save interrupt vectors, pass parameters to 
  9638. the program, record disk directory information, and to buffer disk reads and 
  9639. writes. This control block is 100h bytes in length and is followed by the 
  9640. program module loaded by DOS. 
  9641.  The PSP contains a pointer to the environment area for that program. This 
  9642. area contains a copy of the current DOS SET, PROMPT, COMSPEC, and PATH values 
  9643. as well as any user-set variables. The program may examine and modify this 
  9644. information as desired. 
  9645.  Each storage block is 10h bytes long, although only 5 bytes are currently 
  9646. used by DOS. The first byte contains 4Dh (a capital M) to indicate that it 
  9647. contains a pointer to the next storage block. A 5Ah (a capital Z) in the 
  9648. first byte of a storage block indicatres there are no more storage blocks 
  9649. following this one (it is the end of the chain). The identifier byte is 
  9650. followed by a 2 byte segment number for the associated PSP for that program. 
  9651. The next 2 bytes contain the number of segments what are allocated to the 
  9652. program. If this is not the last storage block, then another storage block 
  9653. follows the allocated memory area.
  9654.  When the storage block contains zero for the number of allocated segments, 
  9655. then no storage is allocated to this block and the next storage block 
  9656. immediately follows this one. This can happen when memory is allocated and 
  9657. then deallocated repeatedly.
  9658.  IBMDOS constructs a storage block and PSP before loading the command 
  9659. interpreter (default is COMMAND.COM).
  9660.  
  9661.  If the copy of COMMAND.COM is a secondary copy, it will lack an environment 
  9662. address at PSP+2Ch.
  9663.  
  9664.  
  9665.  
  9666. THE DISK TRANSFER AREA (DTA)├──────────────────────────────────────────────────
  9667.  
  9668.  DOS uses an area in memory to contain the data for all file reads and writes 
  9669. that are performed with FCB function calls. This are is known as the disk 
  9670. transfer area. This disk transfer area (DTA) is sometimes called a buffer. 
  9671. It can be located anywhere in the data area of your application program and 
  9672. should be set by your program.
  9673.  
  9674.  Only one DTA can be in effect at a time, so your program must tell DOS what 
  9675. memory location to use before using any disk read or write functions. Use 
  9676. function call 1Ah (Set Disk Transfer Address) to set the disk transfer address.
  9677. Use function call 2Fh (Get Disk Transfer Address) to get the disk transfer 
  9678. address. Once set, DOS continues to use that area for all disk operations until
  9679. another function call 1Ah is issued to define a new DTA. When a program is given
  9680. control by COMMAND.COM, a default DTA large enough to hold 128 bytes is 
  9681. established at 80h into the program's Program Segment Prefix.
  9682.  
  9683.  For file reads and writes that are performed with the extended function calls,
  9684. there is no need to set a DTA address. Instead, specify a buffer address when 
  9685. you issue the read or write call.
  9686.  
  9687.  
  9688. DOS PROGRAM SEGMENT├───────────────────────────────────────────────────────────
  9689.  
  9690.  When you enter an external command or call a program through the EXEC function 
  9691. call, DOS determines the lowest availible address space to use as the start of 
  9692. available memory for the program being started. This area is called the Program
  9693. Segment.
  9694.  At offset 0 within the program segment, DOS builds the Program Segment Prefix 
  9695. control block. EXEC loads the program after the Program Segment Prefix (at
  9696. offset 100h) and gives it control.
  9697.  The program returns from EXEC by a jump to offset 0 in the Program Segment 
  9698. Prefix, by issuing an int 20h, or by issuing an int 21h with register AH=00h or 
  9699. 4Ch, or by calling location 50h in the PSP with AH=00h or 4Ch.
  9700.  It is the responsibility of all programs to ensure that the CS register 
  9701. contains the segment address of the Program Segment Prefix when terminating by
  9702. any of these methods except call 4Ch.
  9703.  
  9704.  All of these methods result in returning to the program that issued the EXEC. 
  9705. During this returning process, interrupt vectors 22h, 23h, and 24h (Terminate, 
  9706. Ctrl-Break, and Critical Error Exit addresses) are restored from the values 
  9707. saved in the PSP of the terminating program. Control is then given to the 
  9708. terminate address.
  9709.  
  9710.  
  9711. When a program receives control, the following conditions are in effect:
  9712.  
  9713. For all programs:
  9714.  
  9715. 1) The segment address of the passed environment is contained at offset 2Ch in 
  9716.    the Program Segment Prefix.
  9717.  
  9718. 2) The environment is a series of ASCII strings totalling less than 32k bytes
  9719.    in the form:       NAME=value      The default environment is 160 bytes.
  9720.     Each string is a maximum of 127 bytes terminated by a byte of zeroes for a 
  9721.    total of 128 bytes, and the entire set of strings is terminated by another
  9722.    byte of zeroes. Following the byte of zeroes that terminates the set of
  9723.    environment string is a set of initial arguments passed to a program that
  9724.    contains a word count followed by an ASCIIZ string. The ASCIIZ string
  9725.    contains the drive, path, and filename.ext of the executable program.
  9726.    Programs may use this area to determine where the program was loaded from.
  9727.    The environment built by the command processor (and passed to all programs
  9728.    it invokes) contains a COMSPEC=string at a minimum (the parameter on COMSPEC
  9729.    is the path used by DOS to locate COMMAND.COM on disk). The last PATH and
  9730.    PROMPT commands issued will also be in the environment, along with any 
  9731.    environment strings entered through the SET command. 
  9732.     The environment that you are passed is actually a copy of the invoking 
  9733.    process's environment. If your application terminates and stays resident 
  9734.    through int 27h, you should be aware that the copy of the environment passed 
  9735.    to you is static. That is, it will not change even if subsequent PATH,
  9736.    PROMPT, or SET commands are issued.
  9737.     The size of the environment may be changed from its default of 160 bytes
  9738.    by using the SHELL= command in the config.sys from in DOS version 3.1 up,
  9739.    or COMMAND.COM may be patched in earlier versions.
  9740.  
  9741.    The environment can be used to transfer information between processes or to
  9742.    store strings for later use by application programs. The environment is
  9743.    always located on a paragraph boundary. This is its format:
  9744.         byte    ASCIIZ string 1
  9745.         byte    ASCIIZ string 2
  9746.             ....
  9747.         byte    ASCIIZ string n
  9748.         byte    of zeros (0)
  9749.    Typically the environment strings have the form:
  9750.         NAME = VALUE
  9751.    The length of NAME or VALUE can be anything desired as long as it still fits
  9752.    into the 123 byte space (4 bytes are used by "SET ").
  9753.    Following the byte of zeros in the environment, a WORD indicates the number 
  9754.    of other strings following. 
  9755.  
  9756.    If the environment is part of an EXECed command interpreter, it is followed 
  9757.    by a copy of the DS:DX filename passed to the child process. A zero value 
  9758.    causes the newly created process to inherit the parent's environment.
  9759.  
  9760. 3) Offset 80h in the PSP contains code to invoke the DOS function dispatcher.
  9761.    Thus, by placing the desired function number in AH, a program can issue a
  9762.    long call to PSP+50h to invoke a DOS function rather than issuing an int 21h.
  9763.  
  9764. 4) The disk transfer address (DTA) is set to 80h (default DTA in PSP).
  9765.  
  9766. 5) File Control Blocks 5Ch and 6Ch are formatted from the first two parameters 
  9767.    entered when the command was invoked. Note that if either parameter contained
  9768.    a path name, then the corresponding FCB will contain only a valid drive
  9769.    number. The filename field will not be valid.
  9770.  
  9771. 6) An unformatted parameter area at 81h contains all the characters entered
  9772.    after the command name (including leading and imbedded delimiters), with 80h
  9773.    set to the number of characters. If the <, >, or | parameters were entered
  9774.    on the command line, they (and the filenames associated with them) will not
  9775.    appear in this area, because redirection of standard input and output is
  9776.    transparent to applications.
  9777.  
  9778. (For EXE files only)
  9779. 7) DS and ES registers are set to point to the PSP.
  9780.  
  9781. 8) CS, IP, SS, and SP registers are set to the values passed by the linker.
  9782.  
  9783. (For COM files only)
  9784. 9) For COM files, offset 6 (one word) contains the number of bytes availible in 
  9785.    the segment.
  9786.  
  9787. 10) Register AX reflects the validity of drive specifiers entered with the
  9788.     first two parameters as follows:
  9789.         AL=0FFh is the first parameter contained an invalid drive specifier,
  9790.                 otherwise AL=00h.
  9791.         AL=0FFh if the second parameter contained an invalid drive specifier, 
  9792.                 otherwise AL=00h.
  9793.  
  9794. 11) All four segment registers contain the segment address of the inital 
  9795.     allocation block, that starts within the PSP control block. All of user
  9796.     memory is allocated to the program. If the program needs to invoke another
  9797.     program through the EXEC function call (4Bh), it must first free some memory
  9798.     through the SETBLOCK function call to provide space for the program being
  9799.     invoked.
  9800.  
  9801. 12) The Instruction Pointer (IP) is set to 100h.
  9802.  
  9803. 13) The SP register is set to the end of the program's segment. The segment size
  9804.     at offset 6 is rounded down to the paragraph size.
  9805.  
  9806. 14) A word of zeroes is placed on top of the stack.
  9807.  
  9808.  
  9809.  The PSP (with offsets in hexadecimal) is formatted as follows:
  9810.  (* = undocumented)
  9811.  
  9812. ┌──────────────────────────────────────────────────────────────────────────────┐
  9813. │     P  R  O  G  R  A  M       S  E  G  M  E  N  T       P  R  E  F  I  X     │
  9814. ├───────┬──────────┬───────────────────────────────────────────────────────────┤
  9815. │ offset│   size   │                     C O N T E N T S                       │
  9816. ├───────┼──────────┼───────────────────────────────────────────────────────────┤
  9817. │ 0000h │ 2 bytes  │ int 20h                                                   │
  9818. ├───────┼──────────┼───────────────────────────────────────────────────────────┤
  9819. │ 0002h │ 2 bytes  │ segment address, end of allocation block                  │
  9820. ├───────┼──────────┼───────────────────────────────────────────────────────────┤
  9821. │ 0004h │ 1 byte   │ reserved, normally 0                                      │
  9822. ├───────┼──────────┼───────────────────────────────────────────────────────────┤
  9823. │ 0005h │ 5 bytes  │ FAR call to MSDOS function dispatcher (int 21h)           │
  9824. ├───────┼──────────┼───────────────────────────────────────────────────────────┤
  9825. │ 000Ah │ 4 bytes  │ previous termination handler interrupt vector (int 22h)   │
  9826. ├───────┼──────────┼───────────────────────────────────────────────────────────┤
  9827. │ 000Eh │ 4 bytes  │ previous contents of ctrl-C interrupt vector (int 23h)    │
  9828. ├───────┼──────────┼───────────────────────────────────────────────────────────┤
  9829. │ 0012h │ 4 bytes  │ prev. critical error handler interrupt vector (int 24h)   │
  9830. ├───────┼──────────┼───────────────────────────────────────────────────────────┤
  9831. │ 0016h │ 22 bytes │ reserved for DOS                                          │
  9832. └───────┼──────────┼───────────────────────────────────────────────────────────┤
  9833.       * │ 2 bytes  │ (16) parent process' PSP                                  │
  9834.       * │ 20 bytes │ (18) "handle table" used for redirection of files         │
  9835. ┌───────┼──────────┼───────────────────────────────────────────────────────────┤
  9836. │ 002Ch │ 2 bytes  │ segment address of the program's environment block        │
  9837. ├───────┼──────────┼───────────────────────────────────────────────────────────┤
  9838. │ 002Eh │ 34 bytes │ reserved, DOS work area                                   │
  9839. └───────┼──────────┼───────────────────────────────────────────────────────────┤
  9840.       * │  4 bytes │ (2E) stores the calling process's stack pointer when      │
  9841.         │          │      switching to DOS's internal stack.                   │
  9842.       * │          │ (32) DOS 3.x max open files                               │
  9843.       * │  2 bytes │ (3A) size of handle table   |these functions are in here  │
  9844.       * │  4 bytes │ (3C) handle table address   |but reported addresses vary  │
  9845. ┌───────┼──────────┼───────────────────────────────────────────────────────────┤
  9846. │ 0050h │  3 bytes │ int 21h, RETF instruction                                 │
  9847. ├───────┼──────────┼───────────────────────────────────────────────────────────┤
  9848. │ 0053h │  2 bytes │ reserved - unused?                                        │
  9849. ├───────┼──────────┼───────────────────────────────────────────────────────────┤
  9850. │ 0055h │  7 bytes │ reserved, or FCB#1 extension                              │
  9851. ├───────┼──────────┼───────────────────────────────────────────────────────────┤
  9852. │ 005Ch │ 16 bytes │ default unopened File Control Block #1                    │
  9853. ├───────┼──────────┼───────────────────────────────────────────────────────────┤
  9854. │ 006Ch │ 16 bytes │ default unopened FCB #2 (overlaid if FCB #1 opened)       │
  9855. ├───────┼──────────┼───────────────────────────────────────────────────────────┤
  9856. │ 0080h │  1 byte  │ parameter length (number of chars entered after filename) │
  9857. ├───────┼──────────┼───────────────────────────────────────────────────────────┤
  9858. │ 0081h │   ...    │ parameters                                                │
  9859. ├───────┼──────────┼───────────────────────────────────────────────────────────┤
  9860. │ 00FFh │ 128 bytes│ command tail and default Disk Transfer Area (DTA)         │
  9861. └───────┴──────────┴───────────────────────────────────────────────────────────┘
  9862.  
  9863.  
  9864. 1. The first segment of availible memory is in segment (paragraph) form. For 
  9865.    example, 1000h would respresent 64k.
  9866.  
  9867. 2. Offset 2Ch contains the segment address of the environment.
  9868.  
  9869. 3. Programs must not alter any part of the PSP below offset 5Ch.
  9870.  
  9871.  
  9872. PSP (comments):
  9873.  
  9874. offset 00h  contains hex bytes CD 20, the int 20h opcode. A program can end
  9875.             by making a jump to this location when the CS points to the PSP.
  9876.             For normal cases, int 21, function 4Ch should be used.
  9877.  
  9878. offset 02h  contains the segment-paragraph address of the end of memory as 
  9879.             reported by DOS. (which may not be the same as the real end of RAM).
  9880.             Multiply this number by 10h or 16 to get the amount of memory
  9881.             availible. ex. 1000h would be 64k.
  9882.  
  9883. offset 04h  "reserved or used by DOS" according to Microsoft
  9884.  
  9885. offset 05h  contains a long call to the DOS function dispatcher. Programs may 
  9886.             jump to this address instead of calling int 21 if they wish. 
  9887.             Used by Basic and other CPM object-code translated programs. It is
  9888.             slower than standard int 21h.
  9889.  
  9890. offset 0Ah, 0Eh, 12h
  9891.             vectors (IP, CS)
  9892.  
  9893. offset 16h  PSP:16h is the segment address of the invoking program's PSP, which
  9894.         *   will most often be COMMAND.COM but perhaps may be a secondary
  9895.             non-permanent COMMAND or a multitasking shell, etc. At any rate,
  9896.             the resident shell version of COMMAND.COM has PSP:16H = PSP, which
  9897.             indicates "don't look any lower in memory" for the command
  9898.             interpreter. To find the beginning of the allocation chain, look
  9899.             backwards through the PSP link addresses until the link address is
  9900.             equal to the PSP segment address that it resides in. This should
  9901.             be COMMAND.COM. To find COMMAND.COM's environment, look at the word
  9902.             stored at offset 0BD3h (PC-DOS 3.1 only). This is a segment
  9903.             address, so look there at offset 0.
  9904.  
  9905.        18h  handle alias table (networking). Also you can make PRN go to CON,
  9906.         *   CON go to PRN, ERR go to PRN, etc. 0FFh = availible.
  9907.  
  9908. offset 2Ch  is the segment:offset address of the environment for the program 
  9909.             using this particular PSP. This pointer does not point to
  9910.             COMMAND.COM's environment unless it is a second copy of COMMAND.
  9911.  
  9912. offset 2Eh  the DWORD at PSP+2Eh is used by DOS to store the calling process's
  9913.         *   stack pointer when switching to DOS's own private stack - at the end
  9914.             of a DOS function call, SS:SP is restored from this address.
  9915.  
  9916.        32h, 34h
  9917.         *   table of number of file handles (to 64k of handles!)
  9918.  
  9919. offset 40h  2 byte field points to the segment address of COMMAND.COM's PSP in
  9920.         *   "weird" EXE files produced by Digital Research RASMPC/LINKPC.
  9921.             EXE files created with these tools can cause all sorts of problems
  9922.             with standard MSDOS debugging tools.
  9923.  
  9924. offset 50h  contains a long call to the DOS int 21 function dispatcher.
  9925.  
  9926. offset 5Ch, 65h, 6Ch
  9927.             contain FCB information for use with FCB function calls. The first
  9928.             FCB may overlay the second if it is an extended call; your program
  9929.             should revector these areas to a safe place if you intend to use
  9930.             them.
  9931.  
  9932. offset 5Ch  16 bytes first command-line argument (formatted as uppercase 11
  9933.             character filename)
  9934.  
  9935. offset 6Ch  16 bytes second command-line argument (formatted as uppercase 11
  9936.             character filename)
  9937.  
  9938. offset 7Ch-7Fh
  9939.            "reserved or used by DOS"
  9940. offset 80h  1 byte number of bytes in command line argument
  9941.  
  9942. offset 80h, 81h
  9943.             contain the length and value of parameters passed on the command
  9944.             line. 
  9945.  
  9946. offset 81h  97 bytes unformatted command line and/or default DTA
  9947.  
  9948. offset 0FFh contains the DTA
  9949.           
  9950.  
  9951.  The PSP is created by DOS for all programs and contains most of the information
  9952. you need to know about a program running. You can change the environment for
  9953. the current process, however, but for the parent process, DOS in this case, you
  9954. need to literally backtrack to DOS or COMMAND.COM's PSP. In order to get there
  9955. you must look at the current PSP. At offset 16h of the current PSP segment,
  9956. there a 2 byte segment address to the parent or previous process PSP.
  9957.  From there you can manipulate the enviroment by looking at offset 2Ch. As you
  9958. know, at offset 2Ch, there is 2 byte segment address to the environment block.
  9959.  
  9960. Try this under debug and explore the addresses located at these offsets;
  9961.  
  9962.       offset  length                description
  9963.      ------------------------------------------------------------
  9964.         16h     2       segment address of parent process PSP
  9965.         2Ch     2       segment address of environment block.
  9966.  
  9967. Remember under debug you will have to backtrack two times.
  9968.  
  9969.         Programs        Parent
  9970.       --------------------------
  9971.         command.com     none
  9972.         debug.com       command.com
  9973.         program         debug.com
  9974.  
  9975.  
  9976.  
  9977.  
  9978. MEMORY CONTROL BLOCKS├─────────────────────────────────────────────────────────
  9979.  
  9980.  DOS keeps track of allocated and availible memory blocks, and provides four
  9981. function calls for application programs to communicate their memory needs to 
  9982. DOS. These calls are:
  9983.               48h --- allocate memory                 (MALLOC)
  9984.               49h --- free allocated memory
  9985.               4Ah --- modify allocated memory blocks  (SETBLOCK)
  9986.               4Bh --- load or execute program         (EXEC)
  9987.  
  9988. DOS manages memory as follows:
  9989.  
  9990.  DOS build a control block for each block of memory, whether free or allocated.
  9991. For example, if a program issues an "allocate" (48h), DOS locates a block of
  9992. free memory that satisfies the request, and then "carves" the requested memory 
  9993. out of that block. The requesting program is passed the location of the first 
  9994. byte of the block that was allocated for it - a memory management control block,
  9995. describing the allocated block, has been built for the allocated block and a 
  9996. second memory management control block describes the amount of space left in the
  9997. original free block of memory. When you do a SETBLOCK to shrink an allocated 
  9998. block, DOS builds a memory management control block for the area being freed and
  9999. adds it to the chain of control blocks. Thus, any program that changed memory 
  10000. that is not allocated to it stands a chance of destroying a DOS memory 
  10001. management control block. This causes unpredictable results that don't show up 
  10002. until an activity is performed where DOS uses its chain of control blocks. The 
  10003. normal result is a memory allocation error, which means a system reset will be 
  10004. required.
  10005.  
  10006.  When a program (command or application program) is to be loaded, DOS uses the 
  10007. EXEC function call 4Bh to perform the loading.
  10008.  
  10009.  This is the same function call that is availible to applications programs for 
  10010. loading other programs. This function call has two options:
  10011.  
  10012.       Function 00h, to load and execute a program (this is what the command
  10013.                     processor uses to load and execute external commands)
  10014.  
  10015.       Function 03h, to load an overlay (program) without executing it.
  10016.  
  10017.  Although both functions perform their loading in the same way (relocation is 
  10018. performed for EXE files) their handling of memory management is different.
  10019.  
  10020. FUNCTION 0: For function 0 to load and execute a program, EXEC first allocates 
  10021. the largest availible block of memory (the new program's PSP will be at offset 
  10022. 0 in that block). Then EXEC loads the program. Thus, in most cases, the new 
  10023. program owns all the memory from its PSP to the end of memory, including memory
  10024. occupied by the transient parent of COMMAND.COM. If the program were to issue 
  10025. its own EXEC function call to load and execute another program, the request 
  10026. would fail because no availible memory exists to load the new program into.
  10027.  
  10028. NOTE: For EXE programs, the amount of memory allocated is the size of the 
  10029.       program's memory image plus the value in the MAX_ALLOC field of the file's
  10030.       header (offset 0Ch, if that much memory is availible. If not, EXEC 
  10031.       allocates the size of the program's memory image plus the value in the 
  10032.       MIN_ALLOC field in the header (offset 0Ah). These fields are set by the 
  10033.       Linker).
  10034.  
  10035.  A well-behaved program uses the SETBLOCK function call when it receives 
  10036. control, to shrink its allocated memory block down to the size it really needs.
  10037. A COM program should remember to set up its own stack before doing the SETBLOCK,
  10038. since it is likely that the default stack supplied by DOS lies in the area of 
  10039. memory being used. This frees unneeded memory, which can be used for loading 
  10040. other programs.
  10041.  
  10042.  If the program requires additional memory during processing, it can obtain 
  10043. the memory using the allocate function call and later free it using the free 
  10044. memory function call.
  10045.  
  10046.  When a program is loaded using EXEC function call 00h exits, its initial 
  10047. allocation block (the block beginning with its PSP) is automatically freed 
  10048. before the calling program regains control. It is the responsibility of all 
  10049. programs to free any memory they allocate before exiting to the calling 
  10050. program.
  10051.  
  10052.  FUNCTION 3: For function 3, to load an overlay, no PSP is built and EXEC 
  10053. assumes the calling program has already allocated memory to load the new program
  10054. into - it will NOT allocate memory for it. Thus the calling program should 
  10055. either allow for the loading of overlays when it determines the amount of memory
  10056. to keep when issuing the SETBLOCK call, or should initially free as much memory 
  10057. as possible. The calling program should then allocate a block (based on the size
  10058. of the program to be loaded) to hold the program that will be loaded using the 
  10059. "load overlay" call. Note that "load overlay" does not check to see if the 
  10060. calling program actually owns the memory block it has been instructed to load 
  10061. into - it assumes the calling program has followed the rules. If the calling 
  10062. program does not own the memory into which the overlay is being loaded, there is
  10063. a chance the program being loaded will overlay one of the control blocks that 
  10064. DOS uses to keep track of memory blocks.
  10065.  
  10066.  Programs loaded using function 3 should not issue any SETBLOCK calls since
  10067. they don't own the memory they are operating in. (This memory is owned by the
  10068. calling program)
  10069.  
  10070.  Because programs loaded using function 3 are given control directly by (and 
  10071. return contrrol directly to) the calling program, no memory is automatically 
  10072. freed when the called program exits. It is up to the calling program to 
  10073. determine the disposition of the memory that had been occupied by the exiting 
  10074. program. Note that if the exiting program had itself allocated any memory, it 
  10075. is responsible for freeing that memory before exiting.
  10076.  
  10077.  Memory control blocks, sometimes called "arena headers" after their UNIX 
  10078. counterpart, are 16 bytes long. Only the first 5 bytes are used. 16 bytes are
  10079. used for the memory control block, which always starts at a paragraph boundary.
  10080. When DOS call 48h is made to allocate "x" many paragraphs of memory, the amount
  10081. used up is actually one more than the figure in the BX register to provide
  10082. space for the associated memory control block. The location of the memory
  10083. control block is at the paragraph immediately before the segment value returned
  10084. in AX by the DOS function 48h call i.e. ((AX-1):0).
  10085.  
  10086. ┌──────────────────────────────────────────────────────────────────────────────┐
  10087. │               M E M O R Y      C O N T R O L       B L O C K                 │
  10088. ├───────┬──────────────────────────────────────────────────────────────────────┤
  10089. │ Bytes │                           Function                                   │
  10090. ├───────┼──────────────────────────────────────────────────────────────────────┤
  10091. │   0   │ ASCII M or Z                                                         │
  10092. ├───────┼──────────────────────────────────────────────────────────────────────┤
  10093. │  1-2  │ PSP segment address of the program that owns this block of memory    │
  10094. ├───────┼──────────────────────────────────────────────────────────────────────┤
  10095. │  3-4  │ Size of next MCB in 16-byte paragraphs                               │
  10096. ├───────┼──────────────────────────────────────────────────────────────────────┤
  10097. │  5-F  │ unused                                                               │
  10098. └───────┴──────────────────────────────────────────────────────────────────────┘
  10099.  
  10100. byte 1    will always have the value of 4Dh or 5Ah. The value 5Ah (Z) indicates
  10101.           the block is the last in a chain, all memory above it is unused. 4Dh
  10102.           (M) means that the block is intermediate in a chain, the memory above
  10103.           it belongs to the next program or to DOS.
  10104.  
  10105. byte 2,3  hold the PSP segment address of the program that owns the
  10106.           corresponding block of memory. A value of 0 means the block is free
  10107.           to be claimed, any other value represents a segment address.
  10108.  
  10109. byte 3, 4 indicate the size in paragraphs of the memory block. If you know the
  10110.           address of the first block, you can find the next block by adding the
  10111.           length of the memory block plus 1 to the segment address of the
  10112.           control block. Finding the first block can be difficult, as this
  10113.           varies according to the DOS version and the configuration. 
  10114.  
  10115.  The remaining 11 bytes are not currently used by DOS, and may contain "trash" 
  10116. characters left in memory from previous applications.
  10117.  
  10118.  If DOS determines that the allocation chain of memory control blocks has been 
  10119. corrupted, it will halt the system and display the message "Memory Allocation 
  10120. Error", and the system will halt, requiring a reboot.
  10121.  
  10122.  Each memory block consists of a signature byte (4Dh or 5Ah) then a word which
  10123. is the PSP value of the owner of the block (which allocated it), followed by a 
  10124. word which is the size in paragraphs of the block. The last block has a 
  10125. signature of 5Ah. All others have 4Dh. If the owner is 0000 then the block is 
  10126. free.
  10127.  
  10128.  Once a memory control block has been created it should only be manipulated
  10129. with the appropriate DOS function calls. Accidentally writing over any of the
  10130. first 5 bytes of a memory control block can cause a memory allocation error 
  10131. and cause the system to lock up. If the first byte is overwritten with
  10132. something other than an 'M' or a 'Z' then DOS will complain with an error
  10133. return code of 7 signifying "Memory Control Blocks destroyed". However, should
  10134. you change the ownership or block size bytes, you've had it.
  10135.  
  10136.  When a .COM program is first loaded by DOS and given control, the memory
  10137. control block immediately preceding the Program Segment Prefix contains the
  10138. following data:
  10139.  
  10140.           ID    = 'Z'
  10141.           Owner = segment address of PSP (= CS register of .COM program)
  10142.           Size  = number of available paragraphs in DOS memory pool
  10143.  
  10144.   An .EXE file will have the following data in the memory control block for
  10145. the program (just prior to the PSP):
  10146.  
  10147.           ID    = 'M'
  10148.           Owner = segment address of PSP (= DS register of program)
  10149.           Size  = the number of paragraphs allocated to the program according
  10150.                   to the information in the .EXE program header
  10151.  
  10152.  In the case of an .EXE program file the amount of memory allocated depends
  10153. on the contents of the program header which informs the DOS loader how much to
  10154. allocate for each of the segments in the program. With an .EXE program file
  10155. there will always be a 'Z' memory control block created in memory immediately
  10156. after the end of the space allocated to the program itself.
  10157.  
  10158.  One important fact to remember about DOS memory allocation is that blocks of
  10159. RAM allocated by different calls to DOS function 48H will NOT be contiguous. At
  10160. the very best, they will be separated by the 16 bytes of the memory control
  10161. block, and at worst they could be anywhere in RAM that DOS manages to find a
  10162. existing memory control block of sufficient size to accomodate the memory
  10163. request.
  10164.  
  10165.  DOS treats the memory control blocks as a kind of linked list (term used
  10166. loosely). It uses the earlier MCBs to find the later ones by calculating the
  10167. location of the next one from the size of the prior one. As such, erasing any
  10168. of the MCB data in the chain of MCBs will upset DOS severely, as each call for
  10169. a new memory allocation causes DOS to scan the whole chain of MCBs looking for
  10170. a free one that is large enough to fulfill the request.
  10171.  
  10172.  A separate MCB is created for the DOS environment strings at each program
  10173. load, so there will be many copies of the environment strewn through memory
  10174. when you have a lot of memory resident programs loaded. The memory control
  10175. blocks for the DOS environment strings are not returned to the DOS memory pool
  10176. if the program goes resident, as DOS will need to copy this enviroment for the
  10177. next program loaded.
  10178.  
  10179.  
  10180.        **  Programmer's Technical Reference for MSDOS and the IBM PC **
  10181.                 USA copyright TXG 392-616  ALL RIGHTS RESERVED
  10182. ───────────────────────────────┤ DOSREF (tm) ├────────────────────────────────
  10183.                      ISBN 1-878830-02-3 (disk-based text)
  10184.                     Copyright (c) 1987, 1991 Dave Williams
  10185.                         ┌─────────────────────────────┐
  10186.                         │ Shareware Version, 12/20/91 │
  10187.                         │  Please Register Your Copy  │
  10188.                         └─────────────────────────────┘
  10189.  
  10190.  
  10191.                            C H A P T E R   S E V E N
  10192.  
  10193.                               DOS FILE STRUCTURE
  10194.  
  10195.  
  10196.  
  10197. FILE MANAGEMENT FUNCTIONS├─────────────────────────────────────────────────────
  10198.  
  10199.  Use DOS function calls to create, open, close, read, write, rename, find, and 
  10200. erase files. There are two sets of function calls that DOS provides for support
  10201. of file management. They are:
  10202.  
  10203.    * File Control Block function calls   (0Fh-24h)
  10204.    * Handle function calls               (39h-69h)
  10205.  
  10206.  Handle function calls are easier to use and are more powerful than FCB calls.
  10207. Microsoft recommends that the handle function calls be used when writing new
  10208. programs. DOS 3.0 up have been curtailing use of FCB function calls; it is
  10209. possible that future versions of DOS may not support FCB function calls.
  10210.  
  10211.  The following table compares the use of FCB calls to Handle function calls:
  10212.  
  10213.    ┌──────────────────────────────┬─────────────────────────────────────────┐
  10214.    │           FCB Calls          │               Handle Calls              │
  10215.    ├──────────────────────────────┼─────────────────────────────────────────┤
  10216.    │  Access files in current     │  Access files in ANY directory          │
  10217.    │  directory only.             │                                         │
  10218.    │                              │                                         │
  10219.    │  Requires the application    │  Does not require use of an FCB.        │
  10220.    │  program to maintain a file  │  Requires a string with the drive,      │
  10221.    │  control block to open,      │  path, and filename to open, create,    │
  10222.    │  create, rename or delete    │  rename, or delete a file. For file     │
  10223.    │  a file. For I/O requests,   │  I/O requests, the application program  │
  10224.    │  the application program     │  must maintain a 16 bit file handle     │
  10225.    │  also needs an FCB           │  that is supplied by DOS.               │
  10226.    └──────────────────────────────┴─────────────────────────────────────────┘
  10227.  
  10228.  The only reason an application should use FCB function calls is to maintain
  10229. the ability to run under DOS 1.x. To to this, the program may use only function
  10230. calls 00h-2Eh. Though the FCB function calls are frowned upon, many of the 
  10231. introductory assembly language programming texts use the FCB calls as examples.
  10232.  
  10233.  
  10234.  
  10235. FCB FUNCTION CALLS ├───────────────────────────────────────────────────────────
  10236.  
  10237.  FCB function calls require the use of one File Control Block per open file, 
  10238. which is maintained by the application program and DOS. The application program
  10239. supplies a pointer to the FCB and fills in ther appropriate fields required by 
  10240. the specific function call. An FCB function call can perform file management on
  10241. any valid drive, but only in the current logged directory. By using the current
  10242. block, current record, and record length fields of the FCB, you can perform 
  10243. sequential I/O by using the sequential read or write function calls. Random I/O
  10244. can be performed by filling in the random record and record length fields. 
  10245.  
  10246.  Several possible uses of FCB type calls are considered programming errors and 
  10247. should not be done under any circumstances to avoid problems with file sharing
  10248. and compatibility with later versions of DOS.
  10249.  Some errors are:
  10250. 1) If program uses the same FCB structure to access more than one open file. By
  10251.    opening a file using an FCB, doing I/O, and then replacing the filename field
  10252.    in the file control block with a new filename, a program can open a second
  10253.    file using the same FCB. This is invalid because DOS writes control info-
  10254.    rmation about the file into the reserved fields of the FCB. If the program
  10255.    then replaces the filename field with the original filename and then tries to
  10256.    perform I/O on this file, DOS may become confused because the control info-
  10257.    rmation has been changed. An FCB should never be used to open a second file
  10258.    without closing the one that is currently open. If more than one File Control
  10259.    Block is to be open concurrently, separate FCBs should be used.
  10260.  
  10261. 2) A program should never try to use the reserved fields in the FCB, as the
  10262.    function of the fields changes with different versions of DOS.
  10263.  
  10264. 3) A delete or a rename on a file that is currently open is considered an error
  10265.    and should not be attempted by an application program.
  10266.  
  10267.  It is also good programming practice to close all files when I/O is done. This
  10268. avoids potential file sharing problems that require a limit on the number of
  10269. files concurrently open using FCB function calls.
  10270.  
  10271.  
  10272.  
  10273. HANDLE FUNCTION CALLS├─────────────────────────────────────────────────────────
  10274.  
  10275.  The recommended method of file management is by using the extended "handle" 
  10276. set of function calls. These calls are not restricted to the current directory.
  10277. Also, the handle calls allow the application program to define the type of 
  10278. access that other processes can have concurrently with the same file if the file
  10279. is being shared.
  10280.  
  10281.  To create or open a file, the application supplies a pointer to an ASCIIZ 
  10282. string giving the name and location of the file. The ASCIIZ string contains an 
  10283. optional drive letter, optional path, mandatory file specification, and a 
  10284. terminal byte of 00h. The following is an example of an ASCIIZ string:
  10285.  
  10286.                   format [drive][path] filename.ext,0
  10287.  
  10288.                       DB "A:\path\filename.ext",0
  10289.  
  10290.  If the file is being created, the application program also supplies the 
  10291. attribute of the file. This is a set of values that defines the file read 
  10292. only, hidden, system, directory, or volume label.
  10293.  
  10294.  If the file is being opened, the program can define the sharing and access 
  10295. modes that the file is opened in. The access mode informs DOS what operations 
  10296. your program will perform on this file (read-only, write-only, or read/write) 
  10297. The sharing mode controls the type of operations other processes may perform 
  10298. concurrently on the file. A program can also control if a child process inherits
  10299. the open files of the parent. The sharing mode has meaning only if file sharing
  10300. is loaded when the file is opened.
  10301.  
  10302.  To rename or delete a file, the appplication program simply needs to provide 
  10303. a pointer to the ASCIIZ string containing the name and location of the file 
  10304. and another string with the new name if the file is being renamed.
  10305.  
  10306.  The open or create function calls return a 16-bit value referred to as the 
  10307. file handle. To do any I/O to a file, the program uses the handle to reference
  10308. the file. Once a file is opened, a program no longer needs to maintain the 
  10309. ASCIIZ string pointing to the file, nor is there any need to stay in the same 
  10310. directory. DOS keeps track of the location of the file regardless of what 
  10311. directory is current.
  10312.  
  10313.  Sequential I/O can be performed using the handle read (3Fh) or write (40h) 
  10314. function calls. The offset in the file that IO is performed to is automatically
  10315. moved to the end of what was just read or written. If random I/O is desired, the
  10316. LSEEK (42h) function call can be used to set the offset into the file where I/O 
  10317. is to be performed.
  10318.  
  10319.  
  10320. SPECIAL FILE HANDLES├──────────────────────────────────────────────────────────
  10321.  
  10322.  DOS reserves five special file handles for use by itself and applications 
  10323. programs. They are:
  10324. ┌───────┬────────┬─────────────────────────────────────────────────────────────┐
  10325. │ 0000h │ STDIN  │ standard input device        (input can be redirected)      │
  10326. │ 0001h │ STDOUT │ standard output device       (output can be redirected)     │
  10327. │ 0002h │ STDERR │ standard error output device (output cannot be redirected)  │
  10328. │ 0004h │ STDAUX │ standard auxiliary device                                   │
  10329. │ 0005h │ STDPRN │ standard printer device                                     │
  10330. └───────┴────────┴─────────────────────────────────────────────────────────────┘
  10331.  
  10332.  These handles are predefined by DOS and can be used by an application program.
  10333. They do not need to be opened by a program, although a program can close these 
  10334. handles. STDIN should be treated as a read-only file, and STDOUT and STDERR 
  10335. should be treated as write-only files. STDIN and STDOUT can be redirected. All 
  10336. handles inherited by a process can be redirected, but not at the command line.
  10337.  These handles are very useful for doing I/O to and from the console device. 
  10338. For example, you could read input from the keyboard using the read (3Fh) 
  10339. function call and file handle 0000h (STDIN), and write output to the console 
  10340. screen with the write function call (40h) and file handle 0001h (STDOUT). If 
  10341. you wanted an output that could not be redirected, you could output it using 
  10342. file handle 0002h (STDERR). This is very useful for error messages that must 
  10343. be seen by a user.
  10344.  
  10345.  File handles 0003h (STDAUX) and 0004h (STDPRN) can be both read from and 
  10346. written to. STDAUX is typically a serial device and STDPRN is usually a parallel
  10347. device.
  10348.  
  10349.  
  10350. ASCII and BINARY MODE├─────────────────────────────────────────────────────────
  10351.  
  10352.  I/O to files is done in binary mode. This means that the data is read or 
  10353. written without modification. However, DOS can also read or write to devices in
  10354. ASCII mode. In ASCII mode, DOS does some string processing and modification to 
  10355. the characters read and written. The predefined handles are in ASCII mode when 
  10356. initialized by DOS. All other file handles that don't refer to devices are in 
  10357. binary mode. A program, can use the IOCTL (44h) function call to set the mode 
  10358. that I/O is to a device. The predefined file handles are all devices, so the 
  10359. mode can be changed from ASCII to binary via IOCTL. Regular file handles that 
  10360. are not devices are always in binary mode and cannot be changed to ASCII mode.
  10361.  
  10362.  The ASCII/BINARY bit was called "raw" in DOS 2.x, but it is called ASCII/BINARY
  10363. in DOS 3.x.
  10364.  
  10365.  The predefined file handles STDIN (0000h) and STDOUT (0001h) and STDERR 
  10366. (0002h) are all duplicate handles. If the IOCTL function call is used to change
  10367. the mode of any of these three handles, the mode of all three handles is 
  10368. changed. For example, if IOCTL was used to change STDOUT to binary mode, then 
  10369. STDIN and STDERR would also be changed to binary mode.
  10370.  
  10371.  
  10372.  
  10373. FILE I/O IN BINARY (RAW) MODE├─────────────────────────────────────────────────
  10374.  
  10375. The following is true when a file is read in binary mode:
  10376.  
  10377. 1)  The characters ^S (scroll lock), ^P (print screen), ^C (control break) are 
  10378.     not checked for during the read. Therefore, no printer echo occurs if ^S or
  10379.     ^P are read.
  10380. 2)  There is no echo to STDOUT (0001h).
  10381. 3)  Read the number of specified bytes and returns immediately when the last 
  10382.     byte is received or the end of file reached.
  10383. 4)  Allows no editing of the ine input using the function keys if the input is 
  10384.     from STDIN (0000h).
  10385.  
  10386.  
  10387. The following is true when a file is written to in binary mode:
  10388.  
  10389. 1)  The characters ^S (scroll lock), ^P (print screen), ^C (control break) are 
  10390.     not checked for during the write. Therefore, no printer echo occurs.
  10391. 2)  There is no echo to STDOUT (0001h).
  10392. 3)  The exact number of bytes specified are written.
  10393. 4)  Does not caret (^) control characters. For example, ctrl-D is sent out as 
  10394.     byte 04h instead of the two bytes ^ and D.
  10395. 5)  Does not expand tabs into spaces. 
  10396.  
  10397.  
  10398. FILE I/O IN ASCII (COOKED) MODE├───────────────────────────────────────────────
  10399.  
  10400. The following is true when a file is read in ASCII mode:
  10401.  
  10402. 1)  Checks for the characters ^C,^S, and ^P.
  10403. 2)  Returns as many characters as there are in the device input buffer, or the 
  10404.     number of characters requested, whichever is less. If the number of 
  10405.     characters requested was less than the number of characters in the device 
  10406.     buffer, then the next read will address the remaining characters in the 
  10407.     buffer.
  10408. 3)  If there are no more bytes remaining in the device input buffer, read a 
  10409.     line (terminated by ^M) into the buffer. This line may be edited with the 
  10410.     function keys. The characters returned terminated with a sequence of 0Dh,
  10411.     0Ah (^M,^J) if the number of characters requested is sufficient to include
  10412.     them. For example, if 5 characters were requested, and only 3 were entered
  10413.     before the carriage return (0Dh or ^M) was presented to DOS from the console
  10414.     device, then the 3 characters entered and 0Dh and 0Ah would be returned. 
  10415.     However, if 5 characters were requested and 7 were entered before the 
  10416.     carriage return, only the first 5 characters would be returned. No 0Dh,0Ah 
  10417.     sequence would be returned in this case. If less than the number of 
  10418.     characters requested are entered when the carriage return is received, the
  10419.     characters received and 0Dh,0Ah would be returned. The reason the 0Ah 
  10420.     (linefeed or ^J) is added to the returned characters is to make the devices
  10421.     look like text files.
  10422. 4)  If a 1Ah (^Z) is found, the input is terminated at that point. No 0Dh,0Ah 
  10423.     (CR,LF) sequence is added to the string.
  10424. 5)  Echoing is performed.
  10425. 6)  Tabs are expanded.
  10426.  
  10427.  
  10428. The following is true when a file is written to in ASCII mode:
  10429.  
  10430. 1)  The characters ^S,^P,and ^C are checked for during the write operation.
  10431. 2)  Expands tabs to 8-character boundaries and fills with spaces (20h).
  10432. 3)  Carets control characters, for example, ^D is written as two bytes, ^ and D.
  10433. 4)  Bytes are output until the number specified is output or a ^Z is 
  10434.     encountered. The number actually output is returned to the user.
  10435.  
  10436.  
  10437. NUMBER OF OPEN FILES ALLOWED├──────────────────────────────────────────────────
  10438.  
  10439.  The number of files that can be open concurrently is restricted by DOS. This 
  10440. number is determined by how the file is opened or created (FCB or handle 
  10441. function call) and the number specified by the FCBS and FILES commands in the 
  10442. CONFIG.SYS file. The number of files allowed open by FCB function calls and the
  10443. number of files that can be opened by handle type calls are independent of one 
  10444. another.
  10445.  
  10446.  
  10447. RESTRICTIONS ON FCB USAGE├─────────────────────────────────────────────────────
  10448.  
  10449.  If file sharing is not loaded using the SHARE command, there are no 
  10450. restrictions on the nuumber of files concurrently open using FCB function calls.
  10451.  
  10452.  However, when file sharing is loaded, the maximum number of FCBs open is set
  10453. by the the FCBS command in the CONFIG.SYS file.
  10454.  
  10455.  The FCBS command has two values you can specify, 'm' and 'n'. The value for 
  10456. 'm' specifies the number of files that can be opened by FCBs, and the value 'n' 
  10457. specifies the number of FCBs that are protected from being closed.
  10458.  
  10459.  When the maximum number of FCB opens is exceeded, DOS automatically closes the
  10460. least recently used file. Any attempt to access this file results in an int 24h
  10461. critical error message "FCB not availible". If this occurs while an application
  10462. program is running, the value specified for 'm' in the FCBS command should be
  10463. increased.
  10464.  
  10465.  When DOS determines the least recently used file to close, it does not include
  10466. the first 'n' files opened, therefore the first 'n' files are protected from 
  10467. being closed.
  10468.  
  10469.  
  10470. RESTRICTIONS ON HANDLE USAGE├──────────────────────────────────────────────────
  10471.  
  10472.  The number of files that can be open simultaneously by all processes is 
  10473. determined by the FILES command in the CONFIG.SYS file. The number of files a 
  10474. single process can open depends on the value specified for the FILES command. If
  10475. FILES is greater than or equal to 20, a single process can open 20 files. If 
  10476. FILES is less than 20, the process can open less than 20 files. This value 
  10477. includes three predefined handles: STDIN, STDOUT, and STDERR. This means only
  10478. 17 additional handles can be added. DOS 3.3 includes a function to use more than
  10479. 20 files per application.
  10480.  
  10481.  
  10482. ALLOCATING SPACE TO A FILE├────────────────────────────────────────────────────
  10483.  
  10484.  Files are not nescessarily written sequentially on a disk. Space is allocated 
  10485. as needed and the next location availible on the disk is allocated as space for
  10486. the next file being written. Therefore, if considerable file generation has
  10487. taken place, newly created files will not be written in sequential sectors.
  10488. However, due to the mapping (chaining) of file space via the File Allocation
  10489. Table (FAT) and the function calls availible, any file may be used in either a
  10490. sequential or random manner.
  10491.  
  10492.  Space is allocated in increments called clusters. Cluster size varies 
  10493. according to the media type. An application program should not concern itself 
  10494. with the way that DOS allocates space to a file. The size of a cluster is only 
  10495. important in that it determines the smallest amount of space that can be 
  10496. allocated to a file. A disk is considered full when all clusters have been 
  10497. allocated to files.
  10498.  
  10499.  
  10500.  
  10501. MSDOS / PCDOS DIFFERENCES├─────────────────────────────────────────────────────
  10502.  
  10503.  There is a problem of compatibility between MS-DOS and IBM PC-DOS having to 
  10504. do with FCB Open and Create. The IBM 1.0, 1.1, and 2.0 documentation of OPEN
  10505. (call 0Fh) contains the following statement:
  10506.  
  10507.  "The current block field (FCB bytes C-D) is set to zero [when an FCB is 
  10508. opened]."
  10509.  
  10510.  This statement is NOT true of MS-DOS 1.25 or MS-DOS 2.00. The difference is
  10511. intentional, and the reason is CP/M 1.4 compatibility. Zeroing that field is 
  10512. not CP/M compatible. Some CP/M programs will not run when machine translated if
  10513. that field is zeroed. The reason it is zeroed in the IBM versions is that IBM 
  10514. specifically requested that it be zeroed. This is the reason for the complaints
  10515. from some vendors about the fact that IBM MultiPlan will not run under MS-DOS.
  10516. It is probably the reason that some other IBM programs don't run under MS-DOS.
  10517.  
  10518. NOTE: Do what all MS/PC-DOS systems programs do: Set every single FCB field you
  10519. want to use regardless of what the documentation says is initialized.
  10520.  
  10521.  
  10522. .COM FILE STRUCTURE├───────────────────────────────────────────────────────────
  10523.  
  10524.  The COM file structure was designed for DOS 1.0 and maximum compatibility 
  10525. with programs ported from the CP/M operating system. COM files normally 
  10526. comprise one segment only.
  10527.  
  10528.  
  10529. .EXE FILE STRUCTURE├───────────────────────────────────────────────────────────
  10530.  
  10531.  The EXE file is the native mode for DOS. EXE files may make use of multiple 
  10532. segments for code, stack, and data. The design of the EXE file reflects the 
  10533. segmented design of the Intel 80x86 CPU architecture. EXE files may be as 
  10534. large as availible memory and may make references to specific segment addresses.
  10535.  
  10536.  
  10537.  The EXE files produced by the Linker program consist of two parts, control and
  10538. relocation information and the load module itself.
  10539.  
  10540.  The control and relocation information, which is described below, is at the 
  10541. beginning of the file in an area known as the header. The load module 
  10542. immediately follows the header. The load module begins in the memory image of 
  10543. the module contructed by the Linker.
  10544.  
  10545.  When you are loading a file with the name *.EXE, DOS does NOT assume that it
  10546. is an EXE format file. It looks at the first two bytes for a signature telling
  10547. it that it is an EXE file. If it has the proper signature, then the load 
  10548. proceeds. Otherwise, it presumes the file to be a .COM format file.
  10549.  
  10550.  If the file has the EXE signature, then the internal consistency is checked.
  10551. Pre-2.0 versions of MSDOS did not check the signature byte for EXE files.
  10552.  
  10553.  The .EXE format can support programs larger than 64K. It does this by 
  10554. allowing separate segments to be defined for code, data, and the stack, each 
  10555. of which can be up to 64K long. Programs in EXE format may contain explicit 
  10556. references to segment addresses. A header in the EXE file has information for 
  10557. DOS to resolve these references.
  10558.  
  10559.  
  10560. The .EXE header is formatted as follows:
  10561. ┌─────────┬───────────────────────────────────────────────────────────────────┐
  10562. │ Offset  │                      C O N T E N T S                              │
  10563. ├─────────┼─────┬─────────────────────────────────────────────────────────────┤
  10564. │   00h   │ 4Dh │ This is the Linker's signature to mark the file as a valid  │ 
  10565. ├─────────┼─────┤ .EXE file  (The ASCII letters M and Z, for Mark Zbikowski,  │
  10566. │   01h   │ 5Ah │ one of the major designers of DOS at Microsoft)             │
  10567. ├─────────┼─────┴─────────────────────────────────────────────────────────────┤
  10568. │ 02h-03h │ Length of the image mod 512 (remainder after dividing the load    │
  10569. │         │ module image size by 512)                                         │
  10570. ├─────────┼───────────────────────────────────────────────────────────────────┤
  10571. │ 04h-05h │ Size of the file in 512 byte pages including the header.          │ 
  10572. ├─────────┼───────────────────────────────────────────────────────────────────┤
  10573. │ 06h-07h │ Number of relocation table items following the header.            │
  10574. ├─────────┼───────────────────────────────────────────────────────────────────┤
  10575. │ 08h-09h │ Size of the header in 16 byte increments (paragraphs). This is    │
  10576. │         │ used to locate the beginning of the load module in the file.      │
  10577. ├─────────┼───────────────────────────────────────────────────────────────────┤
  10578. │ 0Ah-0Bh │ Minimum number of 16 byte paragraphs required above the end of    │
  10579. │         │ the loaded program.                                               │
  10580. ├─────────┼───────────────────────────────────────────────────────────────────┤
  10581. │ 0Ch-0Dh │ Maximum number of 16 byte paragraphs required above the end of    │
  10582. │         │ the loaded program. If the minimum and maximum number of          │
  10583. │         │ paragraphs are both zero, the program will be loaded as high in   │
  10584. │         │ memory as possible.                                               │
  10585. ├─────────┼───────────────────────────────────────────────────────────────────┤
  10586. │ 0Eh-0Fh │ Displacement in paragraphs of stack segment within load module.   │
  10587. │         │ This size must be adjusted by relocation.                         │
  10588. ├─────────┼───────────────────────────────────────────────────────────────────┤
  10589. │ 10h-11h │ Offset to be in SP register when the module is given control.     │
  10590. ├─────────┼───────────────────────────────────────────────────────────────────┤
  10591. │ 12h-13h │ Word Checksum - negative sum of all the words in the file,        │
  10592. │         │ ignoring overflow.                                                │
  10593. ├─────────┼───────────────────────────────────────────────────────────────────┤
  10594. │ 14h-15h │ Offset to be in the IP register when the module is given control. │
  10595. ├─────────┼───────────────────────────────────────────────────────────────────┤
  10596. │ 16h-17h │ Displacement in paragraphs of code segment within load module.    │
  10597. │         │ This size must be adjusted by relocation.                         │
  10598. ├─────────┼───────────────────────────────────────────────────────────────────┤
  10599. │ 18h-19h │ Displacement in bytes of the first relocation item in the file.   │
  10600. ├─────────┼───────────────────────────────────────────────────────────────────┤
  10601. │ 1Ah-1Bh │ Overlay number (0 for the resident part of the program)           │
  10602. └─────────┴───────────────────────────────────────────────────────────────────┘
  10603.  
  10604.  
  10605.  
  10606. THE RELOCATION TABLE├──────────────────────────────────────────────────────────
  10607.  
  10608.  The word at 18h locates the first entry in the relocation table. The 
  10609. relocation table is made up of a variable number of relocation items. The number
  10610. of items is contained at offset 06-07. The relocation item contains two fields
  10611. - a 2 byte offset value, followed by a 2 byte segment value. These two fields 
  10612. represent the displacement into the load module before the module is given 
  10613. control. The process is called relocation and is accomplished as follows:
  10614.  
  10615. 1. The formatted part of the header is read into memory. Its size is 1Bh.
  10616.  
  10617. 2. A portion of memory is allocated depending on the size of the load module
  10618.    and the allocation numbers in offsets 0Ah-0Ch and 0Ch-0Dh. DOS always
  10619.    tries to allocate 0FFFFh paragraphs. Since this call will always fail,
  10620.    the function returns the amount of free memory. If this block is larger
  10621.    than the minimum specified at offset 0Ah and the loaded program size,
  10622.    DOS will allocate the size specified at offset 0Ch or the largest free
  10623.    memory space, whichever is less.
  10624.  
  10625. 3. A Program Segment Prefix is built following the resident portion of the 
  10626.    program that is performing the load operation.
  10627.  
  10628. 4. The formatted part of the header is read into memory (its size is at 
  10629.    offset 08h)
  10630.  
  10631. 5. The load module size is determined by subtracting the header size from the 
  10632.    file size. Offsets 04h and 08h can be used for this calculation. The 
  10633.    actual size is downward adjusted based on the contents of offsets 02-03. 
  10634.    Note that all files created by the Linker programs prior to version 1.10 
  10635.    always placed a value of 4 at this location, regardless of the actual 
  10636.    program size. Therefore, Microsoft recommends that this field be ignored if 
  10637.    it contains a value of 4. Based on the setting of the high/low loader switch,
  10638.    an appropriate segment is determined for loading the load module. This
  10639.    segment is called the start segment.
  10640.  
  10641. 6. The load module is read into memory beginning at the start segment. The
  10642.    relocation table is an ordered list of relocation items. The first relocation
  10643.    item is the one that has the lowest offset in the file. 
  10644.  
  10645. 7. The relocation table items are read into a work area one or more at a time.
  10646.  
  10647. 8. Each relocation table item segment value is added to the start segment value.
  10648.    The calculated segment, in conjunction with the relocation item offset value,
  10649.    points to a word in the load module to which is added the start segment 
  10650.    value. The result is placed back into the word in the load module.
  10651.  
  10652. 9. Once all the relocation items have been processed, the SS and SP registers 
  10653.    are set from the values in the header and the start segment value is added 
  10654.    to SS. The ES and DS registers are set to the segment address of the program 
  10655.    segment prefix. The start segment value is added to the header CS register 
  10656.    value. The result, along with the header IP value, is used to give the 
  10657.    module control.
  10658.  
  10659.  
  10660. "NEW" .EXE FORMAT (Microsoft Windows and OS/2)├────────────────────────────────
  10661.  
  10662.  The "old" EXE format is documented here. The "new" EXE format puts more 
  10663. information into the header section and is currently used in applications that 
  10664. run under Microsoft Windows. The linker that creates these files comes with the 
  10665. Microsoft Windows Software Development Kit and is called LINK4. If you try to 
  10666. run a Windows-linked program under DOS, you will get the error message "This 
  10667. program requires Microsoft Windows".
  10668.  
  10669. PIF Files
  10670.   PIF stands for "Program Information File". The PIF format was developed by 
  10671. IBM for use with TopView, its multitasking manager. Microsoft also uses PIF 
  10672. files to pass information regarding the amount of memory and type of I/O a 
  10673. program running under Microsoft Windows requires.
  10674.   The actual internal format of the PIF files is documented in the IBM TopView 
  10675. Programmers' ToolKit.
  10676.  
  10677. STANDRD FILE CONTROL BLOCK├────────────────────────────────────────────────────
  10678.  
  10679.  The standard file control block is defined as follows, with offsets in hex:
  10680.  
  10681. ┌──────────────────────────────────────────────────────────────────────────────┐
  10682. │                 F I L E      C O N T R O L      B L O C K                    │
  10683. ├───────┬──────────────────────────────────────────────────────────────────────┤
  10684. │ Bytes │                           Function                                   │
  10685. ├───────┼──────────────────────────────────────────────────────────────────────┤
  10686. │   0   │ 1 byte Drive number. For example:                                    │
  10687. │       │ Before open:    00h = default drive                                  │
  10688. │       │                 01h = drive A:                                       │
  10689. │       │                 02h = drive B: etc.                                  │
  10690. │       │ After open:     00h = drive C:                                       │
  10691. │       │                 01h = drive A:                                       │
  10692. │       │                 02h = drive B: etc.                                  │
  10693. │       │ An 0 is replaced by the actual drive number during open.             │
  10694. ├───────┼──────────────────────────────────────────────────────────────────────┤
  10695. │  1-8  │ 8 bytes Filename, left justified with blanks. If a reserved device   │
  10696. │       │ name is placed here (such as PRN) do not include the optional colon. │
  10697. ├───────┼──────────────────────────────────────────────────────────────────────┤
  10698. │  9-B  │ 3 bytes Filename extension, left justified with trailing blanks.     │
  10699. ├───────┼──────────────────────────────────────────────────────────────────────┤
  10700. │  C-D  │ 2 bytes Current block # relative to start of file, starting with 0   │
  10701. │       │ (set to 0 by the open function call). A block consists of 128        │
  10702. │       │ records, each of the size specified in the logical record size field.│
  10703. │       │ The current block number is used with the current record field       │
  10704. │       │ (below) for sequential reads and writes.                             │
  10705. ├───────┼──────────────────────────────────────────────────────────────────────┤
  10706. │  E-F  │ 2 bytes Logical record size in bytes. Set to 80h by OPEN function    │
  10707. │       │ If this is not correct, you must set the value because DOS uses it   │
  10708. │       │ to determine the proper locations in the file for all disk reads and │
  10709. │       │ writes.                                                              │
  10710. ├───────┼──────────────────────────────────────────────────────────────────────┤
  10711. │ 10-13 │ 4 bytes File size in bytes. In this field, the first word is the     │
  10712. │       │ low-order part of the size.                                          │
  10713. ├───────┼──────────────────────────────────────────────────────────────────────┤
  10714. │ 14-15 │ 2 bytes Date file was created or last updated. mm/dd/yy are mapped   │
  10715. │       │ as follows:                                                          │
  10716. │       │         15  14  13  12  11  10  9  8  7  6  5  4  3  2  1  0         │
  10717. │       │         y   y   y   y   y   y   y  m  m  m  m  d  d  d  d  d         │
  10718. │       │ where:            mm is 1-12                                         │
  10719. │       │                   dd is 1-31                                         │
  10720. │       │                   yy is 0-119 (1980-2099)                            │
  10721. ├───────┼──────────────────────────────────────────────────────────────────────┤
  10722. │ 16-17 │ 2 bytes time file was created or last updated.                       │
  10723. ├───────┼──────────────────────────────────────────────────────────────────────┤
  10724. │       │ These bytes contain the time when the file was created or last       │
  10725. │       │  updated. The time is mapped in the bits as follows:                 │
  10726. │       ├───────────────────────────────┬───────────────────────────────┐      │
  10727. │       │         B Y T E   16h         │         B Y T E   17h         │      │
  10728. │       ├───────────────────────────────┼───────────────────────────────┤      │
  10729. │       │ F   E   D   C   B   A   9   8 │ 7   6   5   4   3   2   1   0 │      │
  10730. │       ├───────────────────┬───────────┴───────────┬───────────────────┤      │
  10731. │       │ H   H   H   H   H │ M   M   M   M   M   M │ D   D   D   D   D │      │
  10732. │       ├───────────────────┼───────────────────────┼───────────────────┤      │
  10733. │       │ binary # hrs 0-23 │ binary # minutes 0-59 │ bin. # 2-sec incr │      │
  10734. │       ├───────────────────┴───────────────────────┴───────────────────┘      │
  10735. │       │ note: The time is stored with the least significant byte first.      │
  10736. ├───────┼──────────────────────────────────────────────────────────────────────┤
  10737. │ 18-19 │ 2 bytes Reserved for DOS.                                            │
  10738. ├───────┼──────────────────────────────────────────────────────────────────────┤
  10739. │  20   │1 byte  Current relative record number (0-127) within the current     │
  10740. │       │ block. This field and the Current Block field at offset 0Ch make up  │
  10741. │       │ the record pointer. This field is not initialized by the OPEN        │
  10742. │       │ function call. You must set this field before doing sequential read- │
  10743. │       │ write operations to the diskette.                                    │
  10744. ├───────┼──────────────────────────────────────────────────────────────────────┤
  10745. │ 21-25 │ 4 bytes Relative Record. Points to the currently selected record,    │
  10746. │       │ counting from the beginning of the file starting with 0. This field  │
  10747. │       │ is not initialized by the OPEN system call. You must set this field  │
  10748. │       │ before doing a random read or write to the file.                     │
  10749. │       │  If the record size is less than 64 bytes, both words are used.      │
  10750. │       │ Otherwise, only the first 3 bytes are used. Note that if you use the │
  10751. │       │ File Control Block at 5Ch in the program segment, the last byte of   │
  10752. │       │ the FCB overlaps the first byte of the unformatted parameter area.   │
  10753. └───────┴──────────────────────────────────────────────────────────────────────┘
  10754.  
  10755. note 1) An unopened FCB consists of the FCB prefix (if used), drive number, and 
  10756.         filename.ext properly filled in. An open FCB is one in which the 
  10757.         remaining fields have been filled in by the CREAT or OPEN function 
  10758.         calls.
  10759.      2) Bytes 0-5 and 32-36 must be set by the user program. Bytes 16-31 are set
  10760.         by DOS and must not be changed by user programs.
  10761.      3) All word fields are stored with the least significant byte first. For 
  10762.         example, a record length of 128 is stored as 80h at offset 14, and 00h 
  10763.         at offset 15.
  10764.  
  10765.  
  10766.  
  10767. EXTENDED FILE CONTROL BLOCK├───────────────────────────────────────────────────
  10768.  
  10769.  The extended file control block is used to create or search for files in the 
  10770. disk directory that have special attributes.
  10771.  
  10772. It adds a 7 byte prefix to the FCB, formatted as follows:
  10773.  
  10774. ┌──────────────────────────────────────────────────────────────────────────────┐
  10775. │       E X T E N D E D     F I L E      C O N T R O L      B L O C K          │
  10776. ├───────┬──────────────────────────────────────────────────────────────────────┤
  10777. │ Bytes │                           Function                                   │
  10778. ├───────┼──────────────────────────────────────────────────────────────────────┤
  10779. │   0   │ Flag byte containing 0FFh to indicate an extended FCB.               │
  10780. ├───────┼──────────────────────────────────────────────────────────────────────┤
  10781. │  1-6  │ Reserved                                                             │
  10782. ├───────┼──────────────────────────────────────────────────────────────────────┤
  10783. │  6-7  │ Attribute byte. Refer to function call 11h (search first) for        │
  10784. │       │ details on using the attribute bits during directory searches. This  │
  10785. │       │ function is present to allow applications to define their own files  │
  10786. │       │ as hidden (and thereby excluded from normal directory searches) and  │
  10787. │       │ to allow selective directory searches.                               │
  10788. └───────┴──────────────────────────────────────────────────────────────────────┘
  10789.                                      
  10790.  Any reference in the DOS function calls to an FCB, whether opened or unopened,
  10791. may use either a normal or extended FCB. If you are using an extended FCB, the 
  10792. appropriate register should be set to the first byte of the prefix, rather than
  10793. the drive-number field.
  10794.  
  10795.  Common practice is to refer to the extended FCB as a negative offset from the 
  10796. first byte of a standard File Control Block.
  10797.  
  10798.  
  10799.        **  Programmer's Technical Reference for MSDOS and the IBM PC **
  10800.                 USA copyright TXG 392-616  ALL RIGHTS RESERVED
  10801. ───────────────────────────────┤ DOSREF (tm) ├────────────────────────────────
  10802.                      ISBN 1-878830-02-3 (disk-based text)
  10803.                     Copyright (c) 1987, 1991 Dave Williams
  10804.                         ┌─────────────────────────────┐
  10805.                         │ Shareware Version, 12/20/91 │
  10806.                         │  Please Register Your Copy  │
  10807.                         └─────────────────────────────┘
  10808.  
  10809.  
  10810.                            C H A P T E R   E I G H T
  10811.  
  10812.  
  10813.                              DOS DISK INFORMATION
  10814.  
  10815.  
  10816.                                 C O N T E N T S
  10817.  
  10818. The DOS Area .......................................................... 8**1
  10819. The Boot Record ....................................................... 8**2
  10820. DOS File Allocation Table (FAT) ....................................... 8**3
  10821.         Media Descriptor Byte ......................................... 8**4
  10822.         12 Bit FATs ................................................... 8**5
  10823.         16 Bit FATs ................................................... 8**6
  10824. DOS Disk Directory .................................................... 8**8
  10825. The Data Area ......................................................... 8**9
  10826. Floppy Disk Types ..................................................... 8**10
  10827. Hard Disk Layout ...................................................... 8**11
  10828. System Initialization ................................................. 8**12
  10829. Boot Record/Partition Table ........................................... 8**13
  10830. Hard Disk Technical Information ....................................... 8**14
  10831. Determining Hard Disk File Allocation ................................. 8**15
  10832. BIOS Disk Functions ................................................... 8**16
  10833.         00h  Reset
  10834.         01h  Get Status
  10835.         02h  Read Sectors
  10836.         03h  Write Sectors
  10837.         04h  Verify
  10838.         05h  Format Track (floppy disk)
  10839.         06h  Hard Disk - format track
  10840.         07h  Hard Disk - format drive
  10841.         08h  Read Drive Parameters
  10842.         09h  Initialize Two Fixed Disk Base Tables
  10843.         0Ah  Read Long (Hard disk)
  10844.         0Bh  Write Long (Hard disk)
  10845.         0Ch  Seek To Cylinder
  10846.         0Dh  Alternate Hard Disk Reset
  10847.         0Eh  Read Sector Buffer
  10848.         0Fh  Write sector buffer
  10849.         10h  Test For Drive Ready
  10850.         11h  Recalibrate Drive
  10851.         12h  Controller RAM Diagnostic
  10852.         13h  Controller Drive Diagnostic
  10853.         14h  Controller Internal Diagnostic
  10854.         15h  Get Disk Type
  10855.         16h  Get Disk Change Status (diskette)
  10856.         17h  Set Disk Type for Format (diskette)
  10857.         18h  Set Media Type For Format (diskette)
  10858.         19h  Park Hard Disk Heads
  10859.         1Ah  ESDI Hard Disk - Low Level Format
  10860.         1Bh  ESDI Hard Disk - Get Manufacturing Header
  10861.         1Ch  ESDI Hard Disk - Get Configuration
  10862.  
  10863.  
  10864.  
  10865.  
  10866. THE DOS AREA├────────────────────────────────────────────────────────── 8**1
  10867.  
  10868.  All disks and diskettes formatted by DOS are created with a sector size of 512
  10869. bytes. The DOS area (entire area for a diskette, DOS partition for hard disks)
  10870. is formatted as follows:
  10871.  
  10872.         ┌────────────────────────────────────────────────────────────┐
  10873.         │                       D O S   A R E A                      │
  10874.         ├────────────────────────────────────────────────────────────┤
  10875.         │ partition table          - variable size (hard disk only)  │
  10876.         │ boot record              - 1 sector                        │
  10877.         │ first copy of the FAT    - variable size                   │
  10878.         │ second copy of the FAT   - same size as first copy         │
  10879.         │ root directory           - variable size                   │
  10880.         │ data area                - variable depending on disk size │
  10881.         └────────────────────────────────────────────────────────────┘
  10882.  
  10883. The following sections describe each of the allocated areas:
  10884.  
  10885.  
  10886.  
  10887. THE BOOT RECORD├─────────────────────────────────────────────────────── 8**2
  10888.  
  10889.  The boot record resides on track 0, sector 1, side 0 of every diskette
  10890. formatted by the DOS FORMAT program. For hard disks the boot record resides on
  10891. the first sector of the DOS partition. It is put on all disks to provide an
  10892. error message if you try to start up with a nonsystem disk in drive A:. If the
  10893. disk is a system disk, the boot record contains a JMP instruction pointing to
  10894. the first byte of the operating system.
  10895.  
  10896.  If the device is IBM compatible the first sector of the first FAT must be
  10897. located at the same sector for all disk types. This is because the FAT sector
  10898. is read before the disk type is actually determined.
  10899.  
  10900.  The information relating to the BPB for a particular media is kept in the 
  10901. disk's boot sector.  The format of the boot sector is:
  10902.  
  10903. ┌──────────────────────────────────────────────────────────────────────────────┐
  10904. │                        D O S   B O O T   R E C O R D                         │
  10905. ├───┬───────┬──────────────────────────────────────────────────────────────────┤
  10906. │00h│3 bytes│  JMP to executable code. For DOS 2.x, 3 byte near jump (0E9h).   │
  10907. │   │       │  For DOS 3.x, 2 byte near jump (0EBh) followed by a NOP (90h)    │
  10908. ├───┼───────┼──────────────────────────────────────────────────────────────────┤
  10909. │03h│8 bytes│  optional OEM name and version  (such as IBM 2.1)                │
  10910. ├───┼───────┼──────────────────────────────────────────────────────────────────┤
  10911. │0Bh│2 bytes│  bytes per sector                                                │
  10912. ├───┼───────┼─────┬────────────────────────────────────────────────────────────┤
  10913. │0Dh│ byte  │     │  sectors per allocation unit (must be a power of 2)        │
  10914. ├───┼───────┤     ├────────────────────────────────────────────────────────────┤
  10915. │0Eh│2 bytes│  B  │  reserved sectors (starting at logical sector 0)           │
  10916. │   │       │     │  01 for 1.x-3.31, 02 for 4.0+                              │
  10917. ├───┼───────┤     ├────────────────────────────────────────────────────────────┤
  10918. │10h│ byte  │     │  number of FATs                                            │
  10919. ├───┼───────┤     ├────────────────────────────────────────────────────────────┤
  10920. │11h│2 bytes│     │  maximum number of root directory entries                  │
  10921. ├───┼───────┤  P  ├────────────────────────────────────────────────────────────┤
  10922. │13h│2 bytes│     │  number of sectors in logical image (total number of       │
  10923. │   │       │     │  sectors in media, including boot sector directories, etc.)│
  10924. │   │       │     │  If logical disk size is geater than 32Mb, this value is 0 │
  10925. │   │       │     │  and the actual size is reported at offset 26h (DOS 4.0+)  │
  10926. ├───┼───────┤     ├────────────────────────────────────────────────────────────┤
  10927. │15h│ byte  │  B  │  media descriptor byte                                     │
  10928. ├───┼───────┤     ├────────────────────────────────────────────────────────────┤
  10929. │16h│2 bytes│     │  number of sectors occupied by a single FAT                │
  10930. ├───┼───────┼─────┴────────────────────────────────────────────────────────────┤
  10931. │18h│2 bytes│  sectors per track                                               │
  10932. ├───┼───────┼──────────────────────────────────────────────────────────────────┤
  10933. │1Ah│2 bytes│  number of heads                                                 │
  10934. ├───┼───────┼──────────────────────────────────────────────────────────────────┤
  10935. │1Ch│2 bytes│  # of hidden sectors  (sectors before this volume) (1st part)    │
  10936. └───┴───────┼──────────────────────────────────────────────────────────────────┤
  10937.             │                EXTENDED BOOT RECORD (DOS 4.0+)                   │
  10938. ┌───┬───────┼──────────────────────────────────────────────────────────────────┤
  10939. │1Eh│2 bytes│  # of hidden sectors  (sectors before this volume) (2nd part)    │
  10940. ├───┼───────┼──────────────────────────────────────────────────────────────────┤
  10941. │20h│4 bytes│  # sectors in this disk (see offset 13h, if 0)                   │
  10942. ├───┼───────┼──────────────────────────────────────────────────────────────────┤
  10943. │24h│2 bytes│  physical drive number (max 2 for DOS 4, max 8 for DOS 5)        │
  10944. ├───┼───────┼──────────────────────────────────────────────────────────────────┤
  10945. │26h│ byte  │  extended boot record signature  (29h)                           │
  10946. ├───┼───────┼──────────────────────────────────────────────────────────────────┤
  10947. │27h│4 bytes│  volume serial number (assigned with a random function)          │
  10948. ├───┼───────┼──────────────────────────────────────────────────────────────────┤
  10949. │2Bh│11 byte│  volume label                                                    │
  10950. ├───┼───────┼──────────────────────────────────────────────────────────────────┤
  10951. │36h│7 bytes│  file system ID   (FAT12   ), (FAT16   ) etc.     ("reserved")   │
  10952. └───┴───────┴──────────────────────────────────────────────────────────────────┘
  10953.  
  10954.  The three words at the end return information about the media. The number of
  10955. heads is useful for supporting different multihead drives that have the same
  10956. storage capacity but a different number of surfaces. The number of hidden
  10957. sectors is useful for drive partitioning schemes.
  10958.  
  10959.  DOS 3.2 uses a table called the BIOS Parameter Block (BPB) to determine if a
  10960. disk has a valid File Allocation Table. The BPB is located in the first sector
  10961. of a floppy disk. Although the BPB is supposed to be on every formatted floppy
  10962. disk, some earlier versions of DOS did not create a BPB and instead assumed that
  10963. the FAT begins at the second sector of the disk and that the first FAT byte
  10964. (Media Descriptor Byte) describes the disk format.
  10965.  DOS 3.2 reads in the whole of the BPB and tries to use it - although strangely
  10966. enough, it seems as if DOS is prepared to cope with a BPB that is more or less
  10967. totally blank (it seems to ignore the descriptor byte and treat it as a DSDD
  10968. 9-sector disk).
  10969.  DOS 3.2 determines if a disk has a valid boot sector by examining the first
  10970. byte of logical sector 0. If that byte it a jump instruction 0E9h, DOS 3.2
  10971. assumes the rest of the sector is a valid boot sector with a BPB. If the first
  10972. byte is not 0E9h DOS 3.2 behaves like previous versions, assumes the boot sector
  10973. is invalid and uses the first byte of the FAT to determine the media type.
  10974.  If the first byte on the disk happens to be 0E9h, but the disk does not have a
  10975. BPB, DOS 3.2 will return a disk error message.
  10976.  The real problems occur if some of the BPB data is valid and some isn't.
  10977. Apparently some OEMs have assumed that DOS would continue to ignore the
  10978. formatting data on the disk, and have failed to write much there during FORMAT
  10979. except the media descriptor byte (or, worse, have allowed random junk to be
  10980. written there). While this error is understandable, and perhaps even
  10981. forgiveable, it remains their problem, not IBM's, since the BPB area has always
  10982. been documented as containing the format information that IBM DOS 3.2 now
  10983. requires to be there.
  10984.  
  10985.  When the BPB problems first became evident with DOS 3.2 a number of reports
  10986. circulated claiming DOS looked for the letters "IBM" in the OEM ID field. This 
  10987. was incorrect. IBM DOS 4.0 *did* check for the letters "IBM" and would refuse
  10988. to recognize hard drives formatted under MSDOS 4.0. IBM corrected this with
  10989. their 4.01 revision.
  10990.  
  10991.  
  10992.  
  10993. THE DOS FILE ALLOCATION TABLE (FAT)├─────────────────────────────────── 8**3
  10994.  
  10995.  The File Allocation Table, or FAT, has three main purposes:
  10996.         1) to mark bad sectors on the media
  10997.         2) to determine which sectors are free for use
  10998.         3) to determine the physical location(s) of a file on the media.
  10999.  
  11000.  DOS uses one of two schemes for defining the File Allocation Table:
  11001.         1) a 12-bit FAT, for DOS 1.x, 2.x, all floppies, and small hard disks
  11002.         2) a 16-bit FAT, for DOS 3.x+ hard disks from 16.8 to 32Mb
  11003.  
  11004.  This section explains how DOS uses the FAT to convert the clusters of a file
  11005. into logical sector numbers. It is recommended that system utilities use the
  11006. DOS handle calls rather than interpreting the FAT, particularly since
  11007. aftermarket disk partitioning or formatting software may have been used.
  11008.  
  11009.  The FAT is used by DOS to allocate disk space for files, one cluster at a time.
  11010. In DOS 4.0, clusters are referred to as "allocation units." It means the same
  11011. things; the smallest logical portion of a drive.
  11012.  
  11013.  The FAT consists of a 12 bit entry (1.5 bytes) for each cluster on the disk or
  11014. a 16 bit (2 bytes) entry when a hard disk has more than 20740 sectors as is the
  11015. case with fixed disks larger than 10Mb.
  11016.  
  11017.  The first two FAT entries map a portion of the directory; these FAT entries
  11018. contain indicators of the size and format of the disk. The FAT can be in a 12
  11019. or 16 bit format. DOS determines whether a disk has a 12 or 16 bit FAT by
  11020. looking at the total number of allocation units on a disk. For all diskettes
  11021. and hard disks with DOS partitions less than 20,740 sectors, the FAT uses a 12
  11022. bit value to map a cluster. For larger partitions, DOS uses a 16 bit value.
  11023.  
  11024.  The second, third, and fourth bit applicable for 16 bit FAT bytes always
  11025. contains 0FFFFh. The first byte is used as follows:
  11026.  
  11027.  
  11028. Media Descriptor Byte ................................................. 8**4
  11029.  
  11030. ┌──────────────────────────────────────────────────────────────────────────────┐
  11031. │                 M E D I A    D E S C R I P T O R    B Y T E                  │
  11032. ├──────────┬──────────────────────────────────┬────────────────────────────────┤
  11033. │hex value │              meaning             │         normally used          │
  11034. ├──────────┼──────────────────────────────────┼────────────────────────────────┤
  11035. │    00    │ hard disk                        │ 3.3+ extended DOS partition    │
  11036. ├──────────┼──────────────────────────────────┼────────────────────────────────┤
  11037. │    ED    │ double sided  9 sector 80 track  │ Tandy 2000 720k         (5¼)   │
  11038. ├──────────┼──────────────────────────────────┼────────────────────────────────┤
  11039. │    F0    │ double sided  18 sector diskette │ PS/2 1.44 meg DSHD             │
  11040. ├──────────┼──────────────────────────────────┼────────────────────────────────┤
  11041. │    F8    │ hard disk                        │ bootable hard disk at C:800    │
  11042. ├──────────┼──────────────────────────────────┼────────────────────────────────┤
  11043. │    F8    │ 720k floppy, 9 sector 80 track   │ Sanyo 55x, DS-DOS 2.11  (5¼)   │
  11044. ├──────────┼──────────────────────────────────┼────────────────────────────────┤
  11045. │    F9    │ double sided  15 sector diskette │ AT 1.2 meg DSHD                │
  11046. │          │ double sided  9  sector diskette │ Convertible 720k DSQD          │
  11047. ├──────────┼──────────────────────────────────┼────────────────────────────────┤
  11048. │    FA    │ IBM Displaywriter System disk    │ 287k                           │
  11049. │          │ Kodak "4 meg"  (Pelican)         │ 4.4 meg                 (5¼)   │
  11050. ├──────────┼──────────────────────────────────┼────────────────────────────────┤
  11051. │    FB    │ IBM Displaywriter System disk    │ 1 meg                   (5¼)   │
  11052. │          │ Kodak "6 meg"  (Pelican)         │ 5.5 meg                 (5¼)   │
  11053. ├──────────┼──────────────────────────────────┼────────────────────────────────┤
  11054. │    FC    │ single sided  9  sector diskette │ DOS 2.0, 180k SSDD      (5¼)   │
  11055. ├──────────┼──────────────────────────────────┼────────────────────────────────┤
  11056. │    FD    │ double sided  9  sector diskette │ DOS 2.0, 360k DSDD      (5¼)   │
  11057. ├──────────┼──────────────────────────────────┼────────────────────────────────┤
  11058. │    FF    │ double sided 36  sector diskette │ Practidisk 2.88mb DSED  (3½)   │
  11059. │          │ single sided  8  sector diskette │ DOS 1.0, 160k SSDD      (5¼)   │
  11060. │          │ double sided  8  sector diskette │ DOS 1.1, 320k SSDD      (5¼)   │
  11061. │          │ hard disk                        │ Sanyo 55x with DS-DOS 2.11     │
  11062. ├──────────┴───────────┬──────────────────────┴────────────────────────────────┘
  11063. │for 8 inch diskettes: │
  11064. ├──────────┬───────────┴──────────────────────┬────────────────────────────────┐
  11065. │    FD    │ double sided  26 sector diskette │ IBM 3740 format DSSD           │
  11066. ├──────────┼──────────────────────────────────┼────────────────────────────────┤
  11067. │    FE    │ single sided  26 sector diskette │ IBM 3740 format SSSD           │
  11068. │          ├──────────────────────────────────┼────────────────────────────────┤
  11069. │          │ double sided  8  sector diskette │ IBM 3740 format DSDD           │
  11070. └──────────┴──────────────────────────────────┴────────────────────────────────┘
  11071.  
  11072.  
  11073.  
  11074. The third FAT entry begins mapping the data area (cluster 002).
  11075.  
  11076. NOTE: These values are provided as a reference. Therefore, programs should not
  11077.       make use of these values.
  11078.  
  11079.  Each entry contains three hexadecimal characters for 12-bit FATs or four for
  11080. 16-bit FATs.
  11081.  
  11082. The possible entries are:
  11083.  
  11084.    12-bit   |   16-bit
  11085.             |
  11086.       000h  |        0000h   if the cluster is unused and available
  11087.  
  11088.       0FF7h |        0FFF7h  bad cluster (if not part of the allocation chain)
  11089.             |
  11090. 0FF0h-0FF7h | 0FFF0h-0FFF7h  to indicate reserved clusters
  11091.             |
  11092. 0FF8h-0FFFh | 0FFF8h-0FFFFh  to indicate the last cluster of a file (EOF)
  11093.             |
  11094.        xxxH |         xxxxH  any other hexadecimal numbers are the cluster
  11095.             |                number of the next cluster in the file. The
  11096.             |                cluster number is the first cluster in the file
  11097.             |                that is kept in the file's directory entry.
  11098.  
  11099.  The file allocation table always occupies the sector or sectors immediately
  11100. following the boot record. If the FAT is larger than 1 sector, the sectors
  11101. occupy consecutive sector numbers. Two copies of the FAT are written, one
  11102. following the other, for integrity. The FAT is read into one of the DOS buffers
  11103. whenever needed (open, allocate more space, etc).
  11104.  
  11105.  
  11106.  
  11107. 12 Bit File Allocation Table .......................................... 8**5
  11108.  
  11109. Obtain the starting cluster of the file from the directory entry.
  11110.  
  11111. Now, to locate each subsequent sector of the file:
  11112.  
  11113. 1. Multiply the cluster number just used by 1.5 (each FAT entry is 1.5
  11114.    bytes long).
  11115. 2. The whole part of the product is offset into the FAT, pointing to the entry
  11116.    that maps the cluster just used. That entry contains the cluster number of
  11117.    the next cluster in the file.
  11118. 3. Use a MOV instruction to move the word at the calculated FAT into a register.
  11119. 4. If the last cluster used was an even number, keep the low order 12 bits of
  11120.    the register, otherwise, keep the high order 12 bits.
  11121. 5. If the resultant 12 bits are (0FF8h-0FFFh) no more clusters are in the file.
  11122.    Otherwise, the next 12 bits contain the cluster number of the next cluster in
  11123.    the file.
  11124.  
  11125.   To convert the cluster to a logical sector number (relative sector, such as
  11126. that used by int 25h and 26h and DEBUG):
  11127.  
  11128. 1. Subtract 2 from the cluster number
  11129. 2. Multiply the result by the number of sectors per cluster.
  11130. 3. Add the logical sector number of the beginning of the data area.
  11131.  
  11132. 12-bit FAT if DOS partition is smaller than 32,680 sectors (16.340 MB).
  11133.  
  11134.  
  11135.  
  11136. 16 Bit File Allocation Table .......................................... 8**6
  11137.  
  11138.  Obtain the starting cluster of the file from the directory entry. Now to
  11139. locate each subsequent cluster of the file:
  11140.  
  11141. 1.  Multiply the cluster number used by 2 (each FAT entry is 2 bytes long).
  11142. 2.  Use the MOV word instruction to move the word at the calculated FAT offset
  11143.     into a register.
  11144. 3.  If the resultant 16 bits are (0FF8h-0FFFFh) no more clusters are in the
  11145.     file. Otherwise, the 16 bits contain the cluster number of the next cluster
  11146.     in the file.
  11147.  
  11148.  
  11149.  
  11150.  
  11151. DOS Disk Directory .................................................... 8**8
  11152.  
  11153.  The FORMAT command initially builds the root directory for all disks. Its
  11154. location (logical sector number) and the maximum number of entries are
  11155. available through the device driver interfaces.
  11156.  
  11157.  Since directories other than the root directory are actually files, there is
  11158. no limit to the number of entries that they may contain.
  11159.  
  11160.  All directory entries are 32 bytes long, and are in the following format:
  11161. ┌───────┬─────────┬────────────────────────────────────────────────────────────
  11162. │offset │  size   │                  DISK DIRECTORY ENTRY
  11163. ├───────┼─────────┼────────────────────────────────────────────────────────────
  11164. │  00h  │ 8 bytes │ Filename
  11165. │       ├─────────┴────────────────────────────────────────────────────────────
  11166. │       │ The first byte of the filename indicates the file status.
  11167. │       │ The file status byte may contain the following values:
  11168. │       ├──────┬───────────────────────────────────────────────────────────────
  11169. │       │  00h │ Directory entry has never been used. This is used to limit
  11170. │       │      │ the length of directory searches, for performance reasons.
  11171. │       │  05h │ Indicates that the first character of the filename actually
  11172. │       │      │ has an 0EDh character.
  11173. │       │ 0E5h │ Filename has been used but the file has been erased.
  11174. │       │  2Eh │ This entry is for a directory. If the second byte is also
  11175. │       │      │ 2Eh, the cluster field contains the cluster number of this
  11176. │       │      │ directory's parent directory. (0000h if the parent directory
  11177. │       │      │ is the root directory). Otherwise, bytes 00h-0Ah are all
  11178. │       │      │ spaces and the cluster field contains the cluster number of
  11179. │       │      │ the directory.
  11180. │       ├──────┴───────────────────────────────────────────────────────────────
  11181. │       │ Any other character is the first character of a filename. Filenames
  11182. │       │ are left-aligned and if necessary padded with blanks.
  11183. ├───────┼─────────┬────────────────────────────────────────────────────────────
  11184. │  08h  │ 3 bytes │ Filename extension if any
  11185. │       ├─────────┴────────────────────────────────────────────────────────────
  11186. │       │ Three characters, left-aligned and padded with blanks if necessary.
  11187. │       │ If there is no file extension, this field contains all blanks
  11188. ├───────┼─────────┬────────────────────────────────────────────────────────────
  11189. │  0Bh  │ 1 byte  │ File attributes
  11190. │       ├─────────┴────────────────────────────────────────────────────────────
  11191. │       │          The attribute byte is mapped as follows:
  11192. │       ├─────┬───┬────────────────────────────────────────────────────────────
  11193. │       │ hex │bit│                    meaning
  11194. │       ├─────┼───┼────────────────────────────────────────────────────────────
  11195. │       │ 00h │   │ (no bits set) normal; can be read or written without
  11196. │       │     │   │ restriction
  11197. │       │ 01h │ 0 │ file is marked read-only. An attempt to open the file for
  11198. │       │     │   │ output using int 21h/fn 3Dh will fail and an error code
  11199. │       │     │   │ will be returned. This value can be used with other values
  11200. │       │     │   │ below.
  11201. │       │ 02h │ 1 │ indicates a hidden file. The file is excluded from normal
  11202. │       │     │   │ directory searches.
  11203. │       │ 04h │ 2 │ indicates a system file. The file is excluded from normal
  11204. │       │     │   │ directory searches.
  11205. │       │ 08h │ 3 │ indicates that the entry contains the volume label in the
  11206. │       │     │   │ first 11 bytes. The entry has no other usable information
  11207. │       │     │   │ and may exist only in the root directory.
  11208. │       │ 10h │ 4 │ indicates that the file is a subdirectory
  11209. │       │ 20h │ 5 │ indicates an archive bit. This bit is set to on whenever
  11210. │       │     │   │ the file is written to and closed. Used by BACKUP and
  11211. │       │     │   │ RESTORE.
  11212. │       │     │ 6 │ reserved, set to 0
  11213. │       │     │ 7 │ reserved, set to 0
  11214. │       ├─────┴───┴────────────────────────────────────────────────────────────
  11215. │       │ note 1) Bits 6 and 7 may be used in OS/2.
  11216. │       │ note 2) Attributes 08h and 10h cannot be changed using int21/43h.
  11217. │       │ note 3) The system files IBMBIO.COM and IBMDOS.COM (or customized
  11218. │       │         equivalent) are marked as read-only, hidden, and system
  11219. │       │         files. Files can be marked hidden when they are created.
  11220. │       │ note 4) Read-only, hidden, system and archive attributes may be
  11221. │       │         changed with int21h/fn43h.
  11222. ├───────┼─────────┬────────────────────────────────────────────────────────────
  11223. │  0Ch  │ 10 bytes│ Reserved by DOS; value unknown
  11224. ├───────┼─────────┼────────────────────────────────────────────────────────────
  11225. │  16h  │ 2 bytes │ File timestamp
  11226. │       ├─────────┴────────────────────────────────────────────────────────────
  11227. │       │ These bytes contain the time when the file was created or last
  11228. │       │  updated. The time is mapped in the bits as follows:
  11229. │       ├───────────────────────────────┬───────────────────────────────┐
  11230. │       │         B Y T E   16h         │         B Y T E   17h         │
  11231. │       ├───────────────────────────────┼───────────────────────────────┤
  11232. │       │ F   E   D   C   B   A   9   8 │ 7   6   5   4   3   2   1   0 │
  11233. │       ├───────────────────┬───────────┴───────────┬───────────────────┤
  11234. │       │ H   H   H   H   H │ M   M   M   M   M   M │ D   D   D   D   D │
  11235. │       ├───────────────────┼───────────────────────┼───────────────────┤
  11236. │       │ binary # hrs 0-23 │ binary # minutes 0-59 │ bin. # 2-sec incr │
  11237. │       ├───────────────────┴───────────────────────┴───────────────────┘
  11238. │       │ note: The time is stored with the least significant byte first.
  11239. ├───────┼─────────┬────────────────────────────────────────────────────────────
  11240. │  18h  │ 2 bytes │ File datestamp
  11241. │       ├─────────┴────────────────────────────────────────────────────────────
  11242. │       │ This area contains the date when the file was created or last
  11243. │       │ updated. The mm/dd/yy are mapped in the bits as follows:
  11244. │       ├───────────────────────────────┬───────────────────────────────┐
  11245. │       │         B Y T E   18h         │         B Y T E   19h         │
  11246. │       ├───────────────────────────────┼───────────────────────────────┤
  11247. │       │ F   E   D   C   B   A   9   8 │ 7   6   5   4   3   2   1   0 │
  11248. │       ├───────────────────────────┬───┴───────────┬───────────────────┤
  11249. │       │ Y   Y   Y   Y   Y   Y   Y │ M   M   M   M │ D   D   D   D   D │
  11250. │       ├───────────────────────────┼───────────────┼───────────────────┤
  11251. │       │     0-119 (1980-2099)     │     1-12      │       1-31        │
  11252. │       ├───────────────────────────┴───────────────┴───────────────────┘
  11253. │       │ note: The date is stored with the least significant byte first.
  11254. ├───────┼─────────┬────────────────────────────────────────────────────────────
  11255. │  1Ah  │ 2 bytes │ First file cluster number
  11256. │       ├─────────┴────────────────────────────────────────────────────────────
  11257. │       │ * (reserved in DOS 2, documented in DOS 3+)
  11258. │       │ This area contains the starting cluster number of the first cluster
  11259. │       │ in the file. The first cluster for data space on all fixed disks and
  11260. │       │ floppy disks is always cluster 002. The cluster number is stored
  11261. │       │ with the least significant byte first.
  11262. ├───────┼─────────┬────────────────────────────────────────────────────────────
  11263. │  1Ch  │ 4 bytes │ File size
  11264. │       ├─────────┴────────────────────────────────────────────────────────────
  11265. │       │ This area contains the file size in bytes. The first word contains
  11266. │       │ the low order part of the size. Both words are stored with the least
  11267. │       │ significant byte first.
  11268. └───────┴──────────────────────────────────────────────────────────────────────
  11269.  
  11270.  
  11271.  
  11272. The Data Area ......................................................... 8**9
  11273.  
  11274.  Allocation of space for a file (in the data area) is done only when needed
  11275. (it is not preallocated). The space is allocated one cluser (unit allocation)
  11276. at a time. A cluster is always one or more consecutive sector numbers, and all
  11277. of the clusters in a file are "chained" together in the FAT.
  11278.  
  11279.  The clusters are arranged on disk to minimize head movement for multisided
  11280. media. All of the space on a track (or cylinder) is allocated before moving
  11281. on to the next track. This is accomplished by using the sequential sector
  11282. numbers on the lowest-numbered head, then all the sector numbers on the next
  11283. head, and so on until all sectors of all heads of the track are used. Then the
  11284. next sector used will be sector 1 of head 0 on the next track.
  11285.  
  11286.  An interesting innovation that was introduced in MS-DOS 3.0: disk space that
  11287. is freed by erasing a file is not re-used immediately, unlike earlier versions
  11288. of DOS. Instead, free space is obtained from the area not yet used during the
  11289. current session, until all of it is used up. Only then will space that is freed
  11290. during the current session be re-used.
  11291.  
  11292.  This feature minimizes fragmentation of files, since never-before-used space
  11293. is always contiguous. However, once any space has been freed by deleting a file,
  11294. that advantage vanishes at the next system boot. The feature also greatly
  11295. simplifies un-erasing files, provided that the need to do an un-erase is found
  11296. during the same session and also provided that the file occupies contiguous
  11297. clusters.
  11298.  
  11299.  However, when one is using programs which make extensive use of temporary
  11300. files, each of which may be created and erased many times during a session,
  11301. the feature becomes a nuisance; it forces the permanent files to move farther
  11302. and farther into the inner tracks of the disk, thus increasing rather than
  11303. decreasing the amount of fragmentation which occurs.
  11304.  
  11305.  The feature is implemented in DOS by means of a single 16-bit "last cluster
  11306. used" (LCU) pointer for each physical disk drive; this pointer is a part of
  11307. the physical drive table maintained by DOS. At boot time, the LCU pointer is
  11308. zeroed. Each time another cluster is obtained from the free-space pool (the
  11309. FAT), its number is written into the LCU pointer. Each time a fresh cluster
  11310. is required, the FAT is searched to locate a free one; in older versions of
  11311. DOS this search always began at Cluster 0000, but in 3.x it begins at the
  11312. cluster pointed to by the LCU pointer.
  11313.  
  11314.  For hard disks, the size of the file allocation table and directory are
  11315. determined when FORMAT initializes it and are based on the size of the DOS
  11316. partition.
  11317.  
  11318.  
  11319.  
  11320. Floppy Disk Types ..................................................... 8**10
  11321.  
  11322. The following tables give the specifications for floppy disk formats:
  11323.  
  11324. IBM PC-DOS disk formats:
  11325.                  # of      FAT size   DIR     total
  11326.                  sides    (sectors)(entries) sectors
  11327.                    │  sectors  │  DIR  │ sectors│
  11328.                    │  /track   │sectors│/cluster│
  11329.                    │     │     │   │   │   │    │
  11330. ┌─────┬──┬───────┬─┴─┬───┴───┬─┴─┬─┴─┬─┴─┬─┴─┬──┴─┬────────────────────────────
  11331. │ 160k│5¼│DOS 1.0│ 1 │ 8 (40)│ 1 │ 4 │ 64│ 1 │ 320│Original PC-0, 16k mbd
  11332. │ 320k│5¼│DOS 1.1│ 2 │ 8 (40)│ 1 │ 7 │112│ 2 │ 360│PC-1, 64k mbd
  11333. │ 180k│5¼│DOS 2.0│ 1 │ 9 (40)│ 2 │ 4 │ 64│ 1 │ 640│PC-2, 256k mbd
  11334. │ 360k│5¼│DOS 2.0│ 2 │ 9 (40)│ 2 │ 7 │112│ 2 │ 720│PC/XT
  11335. │ 1.2M│5¼│DOS 3.0│ 2 │15 (80)│ 7 │14 │224│ 1 │2400│PC/AT, PC/RT, XT/286
  11336. │ 720k│3½│DOS 3.2│ 2 │ 9 (80)│ 3 │ 7 │112│ 2 │1440│Convertible, PS/2 25+
  11337. │1.44M│3½│DOS 3.3│ 2 │18 (80)│ 9 │14 │224│ 1 │2880│PS/2 50+
  11338. └─────┴──┴───────┴───┴───────┴───┴───┴───┴───┴────┴────────────────────────────
  11339. various MS-DOS disk formats:
  11340. ┌─────┬──┬───────┬─┴─┬───┴───┬─┴─┬─┴─┬─┴─┬─┴─┬──┴─┬────────────────────────────
  11341. │ 200k│5¼│  *    │ 1 │10 (40)│   │   │   │   │    │
  11342. │ 400k│5¼│  * ** │ 2 │10 (40)│   │   │   │   │    │
  11343. │ 800k│5¼│  *    │ 2 │10 (80)│   │   │   │   │    │
  11344. │ 720k│2 │       │   │       │   │   │   │   │    │Zenith SuperSport 2-inch
  11345. │ 720k│5¼│DOS2.11│ 2 │ 9 (80)│ 3 │ 7 │112│ 2 │1440│Tandy 2000 (discontinued)
  11346. │2.88M│3½│       │ 2 │36 (80)│   │   │   │   │5760│Practidisk 2.88mb floppy
  11347. │2720k│5¼│  ***  │ 2 │17(192)│ 8 │   │272│ 4 │5440│Pelican (Kodak 3.3Mb)(disc.)
  11348. │5570k│5¼│  ***  │ 2 │17(384)│ 8 │   │272│ 4 │10880Pelican (Kodak 6.6Mb)(disc.)
  11349. └─────┴──┴───────┴───┴───────┴───┴───┴───┴───┴────┴────────────────────────────
  11350. *   Michtron DS-DOS 2.11 Plus and one version of MS-DOS 3.11 (vendor unknown)
  11351. **  TallTree JFormat program
  11352. *** Pelican driver source calls for 2 sectors/cluster, Norton Utils reports 4.
  11353. ┌─────┬──┬───────┬─┴─┬───┴───┬─┴─┬─┴─┬─┴─┬─┴─┬──┴─┬────────────────────────────
  11354. │ 400k│5¼│DOS2.11│ 1 │10 (80)│   │   │   │   │ 800│DEC Rainbow  SS/HD   (disc.)
  11355. │ 720k│5¼│DOS2.11│ 2 │variable number of sectors  │Victor 9000 PC   (discont'd)
  11356. └─────┴──┴───────┴───┤per track, more sectors on  ├────────────────────────────
  11357.                      │outer tracks than inner     │
  11358.                      │tracks. Special DSDD drive. │
  11359.                      └────────────────────────────┘
  11360.  
  11361.  Some oddball DOS versions specify "zero" heads in their data area. HP's
  11362. single-sided disk format (16 256-byte sectors/track, model unknown) uses a
  11363. zero-based parameter for the number of heads. Without special device driver
  11364. software to "fix" this, these disks are basically unusable by normal DOS.
  11365.  
  11366.  A couple of people have reported that the IBM "Gearbox" industrial PC uses
  11367. an 800k 3.5 inch floppy with 10 sectors and 80 tracks. I've been unable to
  11368. confirm this.
  11369.  
  11370.  Files in the data area are not necessarily written sequentially. The data area
  11371. space is allocated one cluster at a time, skipping over clusters already
  11372. allocated. The first free cluster found is the next cluster allocated,
  11373. regardless of its physical location on the disk. This permits the most efficient
  11374. utilization of disk space because clusters freed by erasing files can be
  11375. allocated for new files. Refer back to the description of the DOS FAT in this
  11376. chapter for more information.
  11377.  
  11378.         SSDD    single sided, double density     (160-180k)     5¼
  11379.         DSDD    double sided, double density     (320-360k)     5¼
  11380.         DSQD    double sided, quad density       (720k)         5¼, 3½, 2
  11381.         DSHD    double sided, high density       (1.2-1.44M)    5¼, 3½
  11382.         DSED    double sided, extra high density (2.88M)        3½
  11383.  
  11384.  Much of the trouble with AT 1.2 meg drives has been through the inadverdent
  11385. use of quad density disks in the high density drives. The high density disks
  11386. use a higher-coercivity media than the quads, and quads are not completely
  11387. reliable as 1.2Mb. Make sure you have the correct disk for your application.
  11388.  
  11389.  
  11390. ROTATION SPEEDS:
  11391.  
  11392.         720k,   3½"    (unknown)  note: Zenith has discontinued 2" floppies
  11393.  
  11394.         720k,   3½"    300 RPM
  11395.         1.44Mb, 3½"    300 RPM
  11396.  
  11397.         360k,   5¼"    300 RPM
  11398.         720k,   5¼"    300 RPM
  11399.         1.2mb,  5¼"    360 RPM   (even when reading 360k diskettes)
  11400.  
  11401.         all      8"    360 RPM
  11402.  
  11403.  The Victor 9000's 5¼" floppies could vary their rotational speed as required. 
  11404. This allowed them to put 720k on a standard 360k floppy, using a constant 
  11405. density throughout.
  11406.  
  11407.  The Central Point CopyIIPC Option Board emulates the Macintosh GCR recording 
  11408. format by varying the data rate instead of the rotational speed.
  11409.  
  11410.  
  11411.  
  11412.  
  11413. HARD DISK LAYOUT ...................................................... 8**11
  11414.  
  11415.  The DOS hard disk routines perform the following services:
  11416.  
  11417. 1) Allow multiple operating systems to be installed on the hard disk at the
  11418.    same time.
  11419.  
  11420. 2) Allow a user-selected operating system to be started from the hard disk.
  11421.  
  11422.    I) In order to share the hard disk among operating systems, the disk may be
  11423.       logically divided into 1 to 4 partitions. The space within a given
  11424.       partition is contiguous, and can be dedicated to a specific operating
  11425.       system. Each operating system may "own" only one partition in DOS versions
  11426.       2.0 through 3.2. DOS 3.3 introduced the "Extended DOS Partition" which
  11427.       allows multiple DOS partitions on the same hard disk. FDISK (or a
  11428.       similar program from other DOS vendors) utility allows the user to select
  11429.       the number, type, and size of each partition. The partition information is
  11430.       kept in a partition table that is embedded in the master hard disk boot
  11431.       record on the first sector of the disk. The format of this table varies
  11432.       from version to version of DOS.
  11433.  
  11434.   II) An operating system must consider its partition to be the entire disk,
  11435.       and must ensure that its functions and utilities do not access other
  11436.       partitions on the disk.
  11437.  
  11438.  III) Each partition may contain a boot record on its first sector, and any
  11439.       other programs or data that you choose, including a different operating
  11440.       system. For example, the DOS FORMAT command may be used to format and
  11441.       place a copy of DOS in the DOS partition in the same manner that a
  11442.       diskette is formatted. You can use FDISK to designate a partition as
  11443.       "active" (bootable). The master hard disk boot record causes that
  11444.       partition's boot record to receive control when the system is
  11445.       initialized. Additional disk partitions could be FORTH, UNIX, Pick,
  11446.       CP/M-86, OS/2 HPFS, Concurrent DOS, Xenix, or the UCSD p-System.
  11447.  
  11448.  
  11449.  
  11450. SYSTEM INITIALIZATION ................................................. 8**12
  11451.  
  11452. The boot sequence is as follows:
  11453.  
  11454. 1. System initialization first attempts to load an operating system from
  11455.    diskette drive A. If the drive is not ready or a read error occurs, it then
  11456.    attempts to read a master hard disk boot record on the first sector of the
  11457.    first hard disk in the system. If unsuccessful, or if no hard disk is
  11458.    present, it invokes ROM BASIC in an IBM PC or displays a disk error
  11459.    message on most compatibles.
  11460.  
  11461. 2. If initialization is successful, the master hard disk boot record is given
  11462.    control and it examines the partition table embedded within it. If one of
  11463.    the entries indicates an active (bootable) partition, its boot record is
  11464.    read from the partition's first sector and given control.
  11465.  
  11466. 3. If none of the partitions is bootable, ROM BASIC is invoked on an IBM PC or
  11467.     a disk error on most compatibles.
  11468.  
  11469. 4. If any of the boot indicators are invalid, or if more than one indicator is
  11470.    marked as bootable, the message "INVALID PARTITION TABLE "is displayed and
  11471.    the system stops.
  11472.  
  11473. 5. If the partition's boot record cannot be successfully read within five
  11474.    retries due to read errors, the message "ERROR LOADING OPERATING SYSTEM"
  11475.    appears and the system stops.
  11476.  
  11477. 6. If the partition's boot record does not contain a valid "signature", the
  11478.    message "MISSING OPERATING SYSTEM" appears, and the system stops.
  11479.  
  11480. NOTE: When changing the size or location of any partition, you must ensure that
  11481.       all existing data on the disk has been backed up. The partitioning program
  11482.       will destroy the data on the disk.
  11483.  
  11484.  System programmers designing a utility to initialize/manage a hard disk must
  11485. provide the following functions at a minimum:
  11486.  
  11487. 1. Write the master disk boot record/partition table to the disk's first
  11488.    sector to initialize it.
  11489.  
  11490. 2. Perform partitioning of the disk - that is, create or update the partition
  11491.    table information (all fields for the partition) when the user wishes
  11492.    to create a partition. This may be limited to creating a partition for only
  11493.    one type of operating system, but must allow repartitoning the entire disk,
  11494.    or adding a partition without interfering with existing partitions (user's
  11495.    choice).
  11496.  
  11497. 3. Provide a means for marking a user-specified partition as bootable and
  11498.    resetting the bootable indicator bytes for all other partitions at the same
  11499.    time.
  11500.  
  11501. 4. Such utilities should not change or move any partition information that
  11502.    belongs to another operating system.
  11503.  
  11504.  
  11505.  
  11506.  
  11507. BOOT RECORD/PARTITION TABLE ........................................... 8**13
  11508.  
  11509.  A boot record must be written on the first sector of all hard disks, and
  11510. must contain the following:
  11511.  
  11512. 1. Code to load and give control to the boot record for one of four possible
  11513.    operating systems.
  11514.  
  11515. 2. A partition table at the end of the boot record. Each table entry is 16
  11516.    bytes long, and contains the starting and ending cylinder, sector, and head
  11517.    for each of four possible partitions, as well as the number of sectors
  11518.    preceding the partition and the number of sectors occupied by the partition.
  11519.    The "boot indicator" byte is used by the boot record to determine if one of
  11520.    the partitions contains a loadable operating system. FDISK initialization
  11521.    utilities mark a user-selected partition as "bootable" by placing a value
  11522.    of 80h in the corresponding partition's boot indicator (setting all other
  11523.    partitions' indicators to 0 at the same time). The presence of the 80h tells
  11524.    the standard boot routine to load the sector whose location is contained in
  11525.    the following three bytes. That sector is the actual boot record for the
  11526.    selected operating system, and it is responsible for the remainder of the
  11527.    system's loading process (as it is from the diskette). All boot records are
  11528.    loaded at absolute address 0:7C00.
  11529.  
  11530. The partition table with its offsets into the boot record is:
  11531. ┌──────────┬──────────┬──────────┬────────┬────────────────────────────────────
  11532. │  Offset  │  Offset  │  Offset  │        │
  11533. │from Start│from Start│from Start│  Size  │ Description
  11534. │ of Disk  │ of Entry │ of Disk  │        │                                   
  11535. ├──────────┼──────────┼──────────┼────────┼────────────────────────────────────
  11536. │          │    00h   │   0BEh   │ 1 byte │ boot indicator
  11537. │          │    01h   │   0BFh   │ 1 byte │ beginning head
  11538. │   1BEh   │    02h   │   0C0h   │ 1 byte │ beginning sector
  11539. │ (part 1) │    03h   │   0C1h   │ 1 byte │ beginning cylinder
  11540. │ 16 bytes │    04h   │   0C2h   │ 1 byte │ system indicator
  11541. │          │    05h   │   0C3h   │ 1 byte │ ending head
  11542. │          │    06h   │   0C4h   │ 1 byte │ ending sector
  11543. │          │    07h   │   0C5h   │ 1 byte │ ending cylinder
  11544. │          │    08h   │   0C6h   │ 4 bytes│ relative (starting) sector       
  11545. │          │    0Ch   │   0DAh   │ 4 bytes│ number of sectors       
  11546. ├──────────┼──────────┼──────────┼────────┼────────────────────────────────────
  11547. │          │    00h   │   0DEh   │ 1 byte │ boot indicator
  11548. │          │    01h   │   0DFh   │ 1 byte │ beginning head
  11549. │   1CEh   │    02h   │   0E0h   │ 1 byte │ beginning sector
  11550. │ (part 2) │    03h   │   0E1h   │ 1 byte │ beginning cylinder
  11551. │ 16 bytes │    04h   │   0E2h   │ 1 byte │ system indicator
  11552. │          │    05h   │   0E3h   │ 1 byte │ ending head
  11553. │          │    06h   │   0E4h   │ 1 byte │ ending sector
  11554. │          │    07h   │   0E5h   │ 1 byte │ ending cylinder
  11555. │          │    08h   │   0E6h   │ 4 bytes│ relative (starting) sector       
  11556. │          │    0Ch   │   0EAh   │ 4 bytes│ number of sectors       
  11557. ├──────────┼──────────┼──────────┼────────┼────────────────────────────────────
  11558. │          │    00h   │   0FEh   │ 1 byte │ boot indicator
  11559. │          │    01h   │   0FFh   │ 1 byte │ beginning head
  11560. │   1DEh   │    02h   │   0100h  │ 1 byte │ beginning sector
  11561. │ (part 3) │    03h   │   0101h  │ 1 byte │ beginning cylinder
  11562. │ 16 bytes │    04h   │   0102h  │ 1 byte │ system indicator
  11563. │          │    05h   │   0103h  │ 1 byte │ ending head
  11564. │          │    06h   │   0104h  │ 1 byte │ ending sector
  11565. │          │    07h   │   0105h  │ 1 byte │ ending cylinder
  11566. │          │    08h   │   0106h  │ 4 bytes│ relative (starting) sector       
  11567. │          │    0Ch   │   010Ah  │ 4 bytes│ number of sectors       
  11568. ├──────────┼──────────┼──────────┼────────┼────────────────────────────────────
  11569. │          │    00h   │   010Eh  │ 1 byte │ boot indicator
  11570. │          │    01h   │   011Fh  │ 1 byte │ beginning head
  11571. │   1EEh   │    02h   │   0110h  │ 1 byte │ beginning sector
  11572. │ (part 4) │    03h   │   0111h  │ 1 byte │ beginning cylinder
  11573. │ 16 bytes │    04h   │   0112h  │ 1 byte │ system indicator
  11574. │          │    05h   │   0113h  │ 1 byte │ ending head
  11575. │          │    06h   │   0114h  │ 1 byte │ ending sector
  11576. │          │    07h   │   0115h  │ 1 byte │ ending cylinder
  11577. │          │    08h   │   0116h  │ 4 bytes│ relative (starting) sector       
  11578. │          │    0Ch   │   011Ah  │ 4 bytes│ number of sectors       
  11579. ├──────────┼──────────┴──────────┼────────┼────────────────────────────────────
  11580. │   1FEh   │                     │ 2 bytes│ 055AAh signature
  11581. └──────────┴─────────────────────┴────────┴────────────────────────────────────
  11582.  
  11583.  Boot indicator (boot ind): The boot indicator byte must contain 0 for a non-
  11584. bootable partition or 80h for a bootable partition. Only one partition can be
  11585. marked as bootable at a time.
  11586.  
  11587.  System Indicator (sys ind): The sys ind field contains an indicator of the
  11588. operating system that "owns" the partition. IBM PC-DOS can only "own" one
  11589. partition, though some versions of MSDOS allow all four partitions to be used
  11590. by DOS.
  11591.  
  11592.  The system indicators are:
  11593.  
  11594.         ┌─────────────────────────────────────────────────────────────┐
  11595.         │                 System Indicator  (sys ind)                 │
  11596.         ├───────┬─────────────────────────────────────────────────────┤
  11597.         │  00h  │  unknown or no partition defined                    │
  11598.         ├───────┼─────────────────────────────────────────────────────┤
  11599.         │  01h  │  DOS 12 bit FAT  (DOS 2.x all and 3.x+ under 16 Mb) │
  11600.         │       │                  less than 4086 clusters            │
  11601.         ├───────┼─────────────────────────────────────────────────────┤
  11602.         │  02h  │  Xenix                                              │
  11603.         ├───────┼─────────────────────────────────────────────────────┤
  11604.         │  03h  │  Xenix                                              │
  11605.         ├───────┼─────────────────────────────────────────────────────┤
  11606.         │  04h  │  DOS 16 bit FAT  (DOS 3.0+. Not recognized by 2.x)  │
  11607.         │       │                  less than 65,536 sectors           │
  11608.         ├───────┼─────────────────────────────────────────────────────┤
  11609.         │  05h  │  extended DOS partition, some 3.2 and all 3.3+      │
  11610.         │       │  (pointer to further partition table)               │
  11611.         ├───────┼─────────────────────────────────────────────────────┤
  11612.         │  06h  │  Compaq DOS 3.31, DOS 4.0+ partitions over 32 megs  │
  11613.         │       │  Digital Research DRDOS 3.4, 3.41 over 32 megs      │
  11614.         ├───────┼─────────────────────────────────────────────────────┤
  11615.         │  06h  │  PC-MOS/386 partitions over 32 megs (NOT compatible │
  11616.         │       │  with the DR, Compaq, and MSDOS big partitions!     │
  11617.         ├───────┼─────────────────────────────────────────────────────┤
  11618.         │  07h  │  OS/2 High Performance File System                  │
  11619.         ├───────┼─────────────────────────────────────────────────────┤
  11620.         │  051h │  Ontrack Disk Manager "read/write" partitions       │
  11621.         ├───────┼─────────────────────────────────────────────────────┤
  11622.         │  0DBh │  DRI Concurrent DOS              (>32mb partitions?)│
  11623.         │       │  DRI Concurrent CP/M?                               │
  11624.         ├───────┼─────────────────────────────────────────────────────┤
  11625.         │  0E4h │  Speedstor, small partitions (?) (under 1024cyl?)   │
  11626.         ├───────┼─────────────────────────────────────────────────────┤
  11627.         │  0F2h │  2nd DOS partition, some OEM customized DOS 3.2     │
  11628.         ├───────┼─────────────────────────────────────────────────────┤
  11629.         │  0F4h │  Speedstor, large partitions (?)                    │
  11630.         ├───────┼─────────────────────────────────────────────────────┤
  11631.         │  0FEh │  Speedstor, partitions >1024 cylinders              │
  11632.         └───────┴─────────────────────────────────────────────────────┘
  11633.  
  11634.  There are ID bytes for proprietary formatting schemes. Some manufacturers
  11635. (such as Zenith, Wyse, and Tandon) diddle with these system bytes to implement
  11636. more than one DOS partition per disk.
  11637.  
  11638. note 1) Xenix doesn't like extended DOS partitions a'la DOS 3.3, limiting you
  11639.         to a DOS partition of 32Mb. Xenix doesn't recognize DOS 4.0x at all,
  11640.         so to use it you need to boot from a floppy. Early versions of OS/2
  11641.         also have this problem.
  11642.     2)  I have found one source listing Minix partitions as "40" and some
  11643.         Unix partitions as "63".  I don't know if these are decimal or
  11644.         hexadecimal figures.
  11645.  
  11646.  Cylinder (CYL) and Sector (S): The 1 byte fields labelled CYL contain the low
  11647. order 8 bits of the cylinder number - the high order 2 bits are in the high
  11648. order 2 bits of the sector (S) field. This corresponds with the ROM BIOS
  11649. interrupt 13h (disk I/O) requirements, to allow for a 10 bit cylinder number.
  11650.  
  11651.  The fields are ordered in such a manner that only two MOV instructions are
  11652. required to properly set up the DX and CX registers for a ROM BIOS call to
  11653. load the appropriate boot record (hard disk booting is only possible from the
  11654. first hard disk in the system, where a BIOS drive number of 80h corresponds
  11655. to the boot indicator byte).
  11656.  
  11657.  All partitions are allocated in cylinder multiples and begin on sector 1,
  11658. head 0, with the exception that the partition that is allocated at the beginning
  11659. of the disk starts at sector 2, to account for the hard disk's master boot
  11660. record.
  11661.  
  11662.  Relative (starting) Sector: The number of sectors preceding each partition
  11663. on the disk is kept in this 4 byte field. This value is determined by counting
  11664. the sectors beginning with cylinder 0, sector 1, head 0 of the disk, and
  11665. incrementing the sector, head, and then track values up to the beginning of
  11666. the partition. This, if the disk has 17 sectors per track and 4 heads, and the
  11667. second partition begins at cylinder 1, sector 1, head 0, then the partition's
  11668. starting relative sector is 68 (decimal) - there were 17 sectors on each of 4
  11669. heads on 1 track allocated ahead of it. The field is stored with the least
  11670. significant word first.
  11671.  
  11672.  Number of sectors (#sects): The number of sectors allocated to the partition
  11673. is kept in the "# of sects" field. This is a 4 byte field stored least
  11674. significant word first.
  11675.  
  11676.  Signature: The last 2 bytes of the boot record (55AAh) are used as a signature
  11677. to identify a valid boot record. Both this record and the partition boot record
  11678. are required to contain the signature at offset 1FEh.
  11679.  
  11680.  
  11681.  
  11682. HARD DISK TECHNICAL INFORMATION ....................................... 8**14
  11683.  
  11684.  Western Digital's hard disk installation manuals make the claim that MSDOS
  11685. can support only 2 hard drives. This is entirely false, and their purpose for
  11686. making the claim is unclear. DOS merely performs a function call pointed at
  11687. the hard disk driver, which is normally in one of three locations; a ROM at
  11688. absolute address C:800, the main BIOS ROM if the machine is an AT, or a device
  11689. driver installed through the CONFIG.SYS file. Two hard disk controller cards
  11690. can normally not reside in the same machine due to lack of interrupt
  11691. arbitration. Perstor's ARLL controller and some cards marketed by Novell can
  11692. coexist with other controllers. Perstor's technical department has had four
  11693. controllers and eight hard disks in the same IBM XT functioning concurrently.
  11694.  
  11695.  A valid hard disk has a boot record arranged in the following manner:
  11696.  
  11697.         db      drive           ; 0 or 80h  (80h marks a bootable, active
  11698.                                              partition)
  11699.         db      head1           ; starting head
  11700.         dw      trksec1         ; starting track/sector (CX value for INT 13)
  11701.         db      system          ; SYS IND ID from table above
  11702.         db      head2           ; ending head
  11703.         dw      trksec2         ; ending track/sector
  11704.         dd      sector1         ; absolute # of starting sector
  11705.         dd      sector2         ; absolute # of last sector
  11706.  
  11707.  The master disk boot record invokes ROM BASIC if no indicator byte reflects a
  11708. bootable system.
  11709.  
  11710.  When a partition's boot record is given control, it is passed its partition
  11711. table entry address in the DS:SI registers.
  11712.  
  11713.  
  11714.  
  11715. DETERMINING HARD DISK ALLOCATION ...................................... 8**15
  11716.  
  11717. DOS determines disk allocation using the following formula:
  11718.  
  11719.                                          D * BPD
  11720.                             TS - RS -  ───────────
  11721.                                            BPS
  11722.                       SPF = ──────────────────────────────
  11723.                                         BPS * SPC
  11724.                                  CF + ──────────────
  11725.                                            BPC
  11726. where:
  11727.  
  11728.      TS      Total number of sectors on the disk
  11729.      RS      The number of sectors at the beginning of the disk that are
  11730.              reserved for the boot record. DOS normally reserves 1 sector.
  11731.      D       The number of directory entries in the root directory.
  11732.      BPD     The number of bytes per directory entry. This is always 32.
  11733.      BPS     The number of bytes per logical sector. Typically 512, but you can
  11734.              specify a different number with VDISK.
  11735.      CF      The number of FATS per disk. Usually 2. VDISK is 1.
  11736.      SPF     The number of sectors per FAT. Maximum 64.
  11737.      SPC     The number of sectors per allocation unit (cluster).
  11738.      BPC     The number of bytes per FAT entry. BPC is 1.5 for 12 bit FATs.
  11739.              2 for 16 bit FATS.
  11740.  
  11741.  
  11742. To calculate the minimum partition size that will force a 16-bit FAT:
  11743.  
  11744.         CYL = (max clusters * 8)/(HEADS * SPT)
  11745.  
  11746. where:
  11747.      CYL           number of cylinders on the disk
  11748.      max clusters  4092 (maximum number of clusters for a 12 bit FAT)
  11749.      HEADS         number of heads on the hard disk
  11750.      SPT           sectors per track  (normally 17 on MFM)
  11751.  
  11752.  
  11753.  DOS 2.0 through 3.3 limit partition sizes to 32 megabytes. The limit arises
  11754. from the fact that DOS does things by sector number, and each sector is stored
  11755. as a word. So the largest sector number DOS can count to is 64k. As each
  11756. sector is 512 bytes long, 64k * .5k = 32Mb. The easiest way for an aftermarket
  11757. disk handler to break the 32Mb barrier is probably to increase the sector size
  11758. - with 2k sectors, maximum partiton size increases to 128Mb. However, the BIOS
  11759. boot routines and IBMBIO.COM are hardwired for 512 byte sectors, so you won't
  11760. be able to boot from a drive with oversize sectors. That's why Disk Manager
  11761. formats a small boot partition by default.
  11762.  
  11763.  DOS 2.x uses a "first fit" algorithm when allocating file space on the hard
  11764. disk. Each time an application requests disk space, it will scan from the
  11765. beginning of the FAT until it finds a contiguous peice of storage large enough
  11766. for the file.
  11767.  
  11768.  DOS 3.x+ keeps a pointer into the disk space, and begins its search from the
  11769. point it last left off. This pointer is lost when the system is rebooted.
  11770. This is called the "next fit" algorithm. It is faster than the first fit and
  11771. helps minimize fragmentation.
  11772.  
  11773.  In either case, if the FCB function calls are used instead of the handle
  11774. function calls, the file will be broken into pieces starting with the first
  11775. available space on the disk.
  11776.  
  11777.  
  11778.  
  11779.  
  11780. BIOS Disk Routines .................................................... 8**16
  11781.  
  11782. ┌─────────────────────────────────────────────────────────────────────────────┐
  11783. │Interrupt 13h  Disk I/O - access the disk drives (floppy and hard disk)      │
  11784. └─────────────────────────────────────────────────────────────────────────────┘
  11785. (0:004Ch)    1) These calls do not try rereading disk if an error is returned.
  11786.              2) In the IBM OS/2 Tech Ref Volume 1, page 7-33, under "DOS
  11787.                 Environment Software Interrupt Support", it lists:
  11788.                 13h  disk/diskette     for non-removable media only, these
  11789.                                        functions are supported:
  11790.                                        01h     read status
  11791.                                        02h     read sectors
  11792.                                        0Ah     read long
  11793.                                        15h     read DASD (disk) type
  11794.              3) On hard disk systems these calls may be vectored through the
  11795.                 int 40h hard disk BIOS.
  11796.  
  11797.  
  11798. Function 00h    Reset - reset the disk controller chip
  11799. entry   AH      00h
  11800.         DL      drive (if bit 7 is set both hard disks and floppy disks reset)
  11801.                 00h-7Fh  floppy disk
  11802.                 80h-0FFh hard disk
  11803. return  AH      status (see 01h below)
  11804. note 1) Forces controller chip to recalibrate read/write heads.
  11805.      2) Some systems (Sanyo 55x, Columbia MPC) this resets all drives.
  11806.      3) This function should be called after a failed floppy disk Read, Write,
  11807.         Verify, or Format request before retrying the operation.
  11808.      4) If called with DL >= 80h (i.e., selecting a hard drive), the floppy
  11809.         controller and then the hard disk controller are reset.
  11810.      5) Function 0Dh allows the hard disk controller to be reset without
  11811.         affecting the floppy controller.
  11812.  
  11813.  
  11814. Function 01h    Get Status of Disk System
  11815. entry   AH      01h
  11816.         DL      drive (hard disk if bit 7 set)
  11817.                 00h-7Fh  floppy disk
  11818.                 80h-0FFh hard disk
  11819. return  AH      00h
  11820.         AL      status of most recent disk operation
  11821.                 00h     successful completion, no errors
  11822.                 01h     bad command
  11823.                 02h     address mark not found
  11824.                 03h     tried to write on write-protected disk    (floppy only)
  11825.                 04h     sector not found
  11826.                 05h     reset failed                                (hard disk)
  11827.                 06h     diskette removed or changed               (floppy only)
  11828.                 07h     bad parameter table                         (hard disk)
  11829.                 08h     DMA overrun                               (floppy only)
  11830.                 09h     attempt to DMA across 64K boundary
  11831.                 0Ah     bad sector detected                         (hard disk)
  11832.                 0Bh     bad track detected                          (hard disk)
  11833.                 0Ch     unsupported track or media type not found (floppy disk)
  11834.                 0Dh     invalid number of sectors on format         (hard disk)
  11835.                 0Eh     control data address mark detected          (hard disk)
  11836.                 0Fh     DMA arbitration level out of range          (hard disk)
  11837.                 10h     uncorrectable CRC/EEC on read
  11838.                 11h     ECC corrected data error                    (hard disk)
  11839.                 20h     controller failure
  11840.                 40h     seek failed
  11841.                 80h     timeout
  11842.                 0AAh    drive not ready                             (hard disk)
  11843.                 0BBh    undefined error                             (hard disk)
  11844.                 0CCh    write fault                                 (hard disk)
  11845.                 0E0h    status error                                (hard disk)
  11846.                 0FFh    sense operation failed                      (hard disk)
  11847. note 1) For hard disks, error code 11h (ECC data error) indicates that a
  11848.         recoverable error was detected during a preceding int 13h fn 02h
  11849.         (Read Sector) call.
  11850.  
  11851.  
  11852. Function 02h    Read Sectors - read one or more sectors from diskette
  11853. entry   AH      02h
  11854.         AL      number of sectors to read
  11855.         BX      address of buffer (ES=segment)
  11856.         CH      track (cylinder) number (0-39 or 0-79 for floppies)
  11857.                 (for hard disk, bits 8,9 in high bits of CL)
  11858.         CL      sector number (1 to 18, not value checked)
  11859.         DH      head number (0 or 1)
  11860.         DL      drive (0=A, 1=B, etc.) (bit 7=0)  (drive 0-7)
  11861.                 00h-7Fh   floppy disk
  11862.                 80h-FF0h  hard disk
  11863.         ES:BX   address to store/fetch data  (buffer to fill)
  11864.        [0000:0078]  dword pointer to diskette parameters
  11865. return  CF      clear   successful
  11866.                         AL      number of sectors transferred
  11867.                 set     error
  11868.                         AH      status  (00h, 02h, 03h, 04h, 08h, 09h, 10h,
  11869.                                          0Ah, 20h, 40h, 80h)
  11870. note 1) Number of sectors begins with 1, not 0.
  11871.      2) Trying to read zero sectors is considered a programming error; results
  11872.         are not defined.
  11873.      3) For hard disks, the upper 2 bits of the 10-bit cylinder number are
  11874.         placed in the upper 2 bits of register CL.
  11875.      4) For hard disks, error code 11h indicates that a read error occurred
  11876.         that was corrected by the ECC algorithm; in this case, AL contains the
  11877.         burst length. The data read is good within the limits of the ECC code.
  11878.         If a multisector transfer was requested, the operation was terminated
  11879.         after the sector containing the read error.
  11880.      5) For floppy drives, an error may result from the drive motor being off
  11881.         at the time of the request. The BIOS does not automatically wait for
  11882.         the drive to come up to speed before attempting the read operation. The
  11883.         calling program should reset the floppy disk system with function 00h
  11884.         and retry the operation three times before assuming that the error
  11885.         results from some other cause.
  11886.  
  11887.  
  11888. Function 03h    Write Sectors - write from memory to disk
  11889. entry   AH      03h
  11890.         AL      number of sectors to write (1-8)
  11891.         CH      track number (for hard disk, bits 8,9 in high bits of CL)
  11892.         CL      beginning sector number
  11893.                 (if hard disk, high two bits are high bits of track #)
  11894.         DH      head number  (head 0=0)
  11895.         DL      drive number (0-7)
  11896.                 00h-7Fh   floppy disk
  11897.                 80h-FF0h  hard disk
  11898.         ES:BX   address of buffer for data
  11899. return  CF      clear   success
  11900.                         AL      number of sectors written
  11901.                 set     error
  11902.                         AH      status (see 01h above)
  11903. note 1) Number of sectors begins with 1, not 0.
  11904.      2) Trying to write zero sectors is considered a programming error; results
  11905.         are not defined.
  11906.      3) For hard disks, the upper 2 bits of the 10-bit cylinder number are
  11907.         placed in the upper 2 bits of register CL.
  11908.      4) For floppy drives, an error may result from the drive motor being off
  11909.         at the time of the request. The BIOS does not automatically wait for
  11910.         the drive to come up to speed before attempting the read operation. The
  11911.         calling program should reset the floppy disk system with function 00h
  11912.         and retry the operation three times before assuming that the error
  11913.         results from some other cause.
  11914.  
  11915.  
  11916. Function 04h    Verify - verify that a write operation was successful
  11917. entry   AH      04h
  11918.         AL      number of sectors to verify (1-8)
  11919.         CH      track number  (for hard disk, bits 8,9 in high bits of CL)
  11920.         CL      beginning sector number
  11921.         DH      head number
  11922.         DL      drive number (0-7)
  11923.         DL      drive number (0-7)
  11924.                 00h-7Fh   floppy disk
  11925.                 80h-FF0h  hard disk
  11926.         ES:BX   address of buffer for data
  11927. return  CF      set on error
  11928.                 AH      status (see 01h above)
  11929.         AL      number of sectors verified
  11930. note 1) With IBM PC, XT, and AT with ROM BIOS earlier than 11/15/85, ES:BX
  11931.         should point to a valid buffer.
  11932.      2) For hard disks, the upper 2 bits of the 10-bit cylinder number are
  11933.         placed in the upper 2 bits of register CL.
  11934.      3) This function can be used to test whether a readable media is in a
  11935.         floppy drive. An error may result from the drive motor being off at the
  11936.         time of the request since the BIOS does not automatically wait for the
  11937.         drive to come up to speed before attempting the verify operation. The
  11938.         requesting program should reset the floppy disk system with function
  11939.         00h and retry the operation three times before assuming that a readable
  11940.         disk is not present.
  11941.  
  11942.  
  11943. Function 05h    Format Track - write sector ID bytes for 1 track (floppy disk)
  11944. entry   AH      05h
  11945.         AL      number of sectors to create on this track
  11946.                 interleave (for XT hard disk only)
  11947.         CH      track (or cylinder) number (bits 8,9 in high bits of CL)
  11948.         CL      sector number
  11949.         DH      head number (0, 1)
  11950.         DL      drive number (0-3)
  11951.                 00h-7Fh   floppy disk
  11952.                 80h-0FFh  hard disk
  11953.         ES:BX   pointer to 4-byte address field (C-H-R-N) (except XT hard disk)
  11954.                 byte 1 = (C) cylinder or track
  11955.                 byte 2 = (H) head
  11956.                 byte 3 = (R) sector
  11957.                 byte 4 = (N) bytes/sector (0 = 128, 1 = 256, 2 = 512, 3 = 1024)
  11958. return  CF      set if error occurred
  11959.                 AH      status code (see 01h above)
  11960. note 1) Not valid for ESDI hard disks on PS/2.
  11961.      2) For floppy disks, the number of sectors per track is taken from the
  11962.         BIOS floppy disk parameter table whose address is stored in the vector
  11963.         for int 1Eh.
  11964.      3) When this function is used for floppies on ATs or the PS/2, it should
  11965.         be preceded by a call to int 13h/fn 17h to select the type of media to
  11966.         format.
  11967.      4) For hard disks, the upper 2 bits of the 10-bit cylinder number are
  11968.         placed in the upper 2 bits of CL.
  11969.      5) On the XT/286, AT, and PS/2 hard disks, ES:BX points to a 512-byte
  11970.         buffer containing byte pairs for each physical disk sector as follows:
  11971.         Byte  Contents
  11972.         0       00h     good sector
  11973.                 80h     bad sector
  11974.         1       sector number
  11975.         For example, to format a track with 17 sectors and an interleave of
  11976.         two, ES:BX would point to the following 34-byte array at the beginning
  11977.         of a 512-byte buffer:
  11978.         db      00h, 01h, 00h, 0Ah, 00h, 02h, 00h, 0Bh, 00h, 03h, 00h, 0Ch
  11979.         db      00h, 04h, 00h, 0Dh, 00h, 05h, 00h, 0Eh, 00h, 06h, 00h, 0Fh
  11980.         db      00h, 07h, 00h, 10h, 00h, 08h, 00h, 11h, 00h, 09h
  11981.  
  11982.  
  11983. Function 06h    Hard Disk - format track and set bad sector flags
  11984.                                                      (PC2, PC-XT, and Portable)
  11985. entry   AH      06h
  11986.         AL      interleave value (XT only)
  11987.         CH      cylinder number (bits 8,9 in high bits of CL)
  11988.         CL      sector number
  11989.         DH      head
  11990.         DL      drive (80h-0FFh for hard disk)
  11991.         ES:BX   512 byte format buffer
  11992.                 the first 2*(sectors/track) bytes contain f,n for each sector
  11993.                 f       00h     good sector
  11994.                         80h     bad sector
  11995.                 n       sector number
  11996. return  CF      error
  11997.                 AH      status code (see 01h above)
  11998.  
  11999.  
  12000. Function 07h    Hard Disk - format the drive starting at the desired track
  12001.                                                       (PC2, PC-XT and Portable)
  12002. entry   AH      07h
  12003.         AL      interleave value (XT only) (01h-10h)
  12004.         CH      cylinder number (bits 8,9 in high bits of CL) (00h-03FFh)
  12005.         CL      sector number
  12006.         DH      head number (0-7)
  12007.         DL      drive number (80h-0FFh, 80h=C, 81h=D,...)
  12008.         ES:BX   format buffer, size = 512 bytes
  12009.                 the first 2*(sectors/track) bytes contain f,n for each sector
  12010.                 f       00h     good sector
  12011.                         80h     bad sector
  12012.                 n       sector number
  12013. return  CF      set on error
  12014.         AH      status code (see 01h above)
  12015. note    Award AT BIOS routines are extended to handle more than 1024 cylinders.
  12016.         AL      number of sectors
  12017.         CH      cylinder numberm low 8 bits
  12018.         CL      sector number bits 0-5, bits 6-7 are high 2 cylinder bits
  12019.         DH      head number (bits 0-5) bits 6-7 are extended high cyls (>1024)
  12020.         DL      drive number (0-1 for diskette, 80h-81h for hard disk)
  12021.         ES:BX   transfer address
  12022.  
  12023.  
  12024. Function 08h    Read Drive Parameters                          (except PC, Jr)
  12025. entry   AH      08h
  12026.         DL      drive number
  12027.                 00h-7Fh   floppy disk
  12028.                 80h-0FFh  hard disk
  12029. return  CF      set on error
  12030.                 AH      status code (see above)
  12031.         BL      drive type  (AT/PS2 floppies only)
  12032.                 01h     if 360 Kb, 40 track, 5¼"
  12033.                 02h     if 1.2 Mb, 80 track, 5¼"
  12034.                 03h     if 720 Kb, 80 track, 3½"
  12035.                 04h     if 1.44 Mb, 80 track, 3½"
  12036.         CH      low 8 bits of maximum useable value for cylinder number
  12037.         CL bits 6-7     high-order 2 bits of maximum cylinder number
  12038.                 0-5     maximum sector number
  12039.         DH      maximum usable value for head number
  12040.         DL      number of consecutive acknowledging drives (0-2)
  12041.         ES:DI   pointer to drive parameter table
  12042. note 1) On the PC and PC/XT, this function is supported on hard disks only.
  12043.      2) The Columbia MPC supports functions 6-14 for its hard disk. It returns
  12044.         drive information, same as int 13 function 8, except that the BL and
  12045.         ES:DI values are omitted and AL <- burst length.
  12046.  
  12047.  
  12048. Function 09h    Initialize Two Fixed Disk Base Tables    (XT, AT, XT/286, PS/2)
  12049.                 (install nonstandard drive)
  12050. entry   AH      09h
  12051.         DL      80h-0FFh  hard disk number
  12052. return  CF      set on error
  12053.                 AH      status code (see 01h above)
  12054.                 For PC, XT hard disks, the disk parameter block format is:
  12055.                 00h-01h maximum number of cylinders
  12056.                 02h     maximum number of heads
  12057.                 03h-04h starting reduced write current cylinder
  12058.                 05h-06h starting write precompensation cylinder
  12059.                 07h     maximum ECC burst length
  12060.                 08h     drive options
  12061.                    bits 7       1       disable disk access retries
  12062.                         6       1       disable ECC retries
  12063.                         3-5     set to 0
  12064.                         0-2     drive option
  12065.                 09h     standard timeout value
  12066.                 0Ah     timeout value for format drive
  12067.                 0Bh     timeout value for check drive
  12068.                 0Ch-0Fh reserved
  12069.  
  12070.                 For AT and PS/2 hard disks:
  12071.                 00h-01h maximum number of cylinders
  12072.                 02h     maximum number of heads
  12073.                 03h-04h reserved
  12074.                 05h-06h starting write precompensation cylinder
  12075.                 07h     maximum ECC burst length
  12076.                 08h     drive options byte
  12077.                    bits 6-7     nonzero (10, 01, or 11) if retries disabled
  12078.                         5       1       if manufacturer's defect map present at
  12079.                                         maximum cylinder + 1
  12080.                         4       not used
  12081.                         3       1       if more than 8 heads
  12082.                         0-2     not used
  12083.                 09h-0Bh reserved
  12084.                 0Ch-0Dh landing zone cylinder
  12085.                 0Eh     sectors per track
  12086.                 0Fh     reserved
  12087. note 1) For the XT, int 41h must point to the Disk Parameter Block.
  12088.      2) For the AT and PS/2, int 41h points to table for drive 0 and int 46h
  12089.         points to table for drive 1.
  12090.      3) Initializes the hard disk controller for subsequent I/O operations
  12091.         using the values found in the BIOS disk parameter block(s).
  12092.      4) This function is supported on hard disks only.
  12093.  
  12094.  
  12095. Function 0Ah    Read Long   (Hard disk)                 (XT, AT, XT/286, PS/2)
  12096. entry   AH      0Ah
  12097.         CH      cylinder number (bits 8,9 in high bits of CL)
  12098.         CL      sector number (upper 2 bits of cyl # in upper 2 bits of CL)
  12099.         DH      head number
  12100.         DL      drive ID  (80h-0FFh hard disk)
  12101.         ES:BX   pointer to buffer to fill
  12102. return  CF      set on error
  12103.                 AH      status code (see 01h above)
  12104.         AL      number of sectors actually transferred
  12105. note 1) A "long" sector includes a 4 byte EEC (Extended Error Correction) code.
  12106.      2) Used for diagnostics only on PS/2 systems.
  12107.      3) This function is supported on fixed disks only.
  12108.      4) Unlike the normal Read Sector (02h) function, ECC errors are not
  12109.         automatically corrected. Multisector transfers are terminated after any
  12110.         sector with a read error.
  12111.  
  12112.  
  12113. Function 0Bh    Write Long                              (XT, AT, XT/286, PS/2)
  12114. entry   AH      0Bh
  12115.         AL      number of sectors
  12116.         CH      cylinder (bits 8,9 in high bits of CL)
  12117.         CL      sector number
  12118.         DH      head number
  12119.         DL      drive ID  (80h-0FFh hard disk)
  12120.         ES:BX   pointer to buffer containing data
  12121. return  CF      set on error
  12122.                 AH      status code (see 01h above)
  12123.         AL      number of sectors actually transferred
  12124. note 1) A "long" sector includes a 4 byte EEC (Extended Error Correction) code.
  12125.      2) Used for diagnostics only on PS/2 systems.
  12126.      3) Valid for hard disks only.
  12127.  
  12128.  
  12129. Function 0Ch    Seek To Cylinder                        (except PC, PCjr)
  12130. entry   AH      0Ch
  12131.         CH      lower 8 bits of cylinder
  12132.         CL      upper 2 bits of cylinder in bits 6-7
  12133.         DH      head number
  12134.         DL      drive number (0 or 1)  (80h-0FFh for hard disk)
  12135. return  CF      set on error
  12136.                 AH      status code (see 01h above)
  12137. note 1) Positions heads over a particular cylinder, but does not move any data.
  12138.      2) This function is supported on hard disks only.
  12139.      3) The upper 2 bits of the 10-bit cylinder number are placed in the upper
  12140.         2 bits of CL.
  12141.      4) The Read Sector, Read Sector Long, Write Sector, and Write Sector Long
  12142.         functions include an implied seek operation and need not be preceded by
  12143.         an explicit call to this function.
  12144.  
  12145.  
  12146. Function 0Dh    Alternate Hard Disk Reset                    (except PC, PCjr)
  12147. entry   AH      0Dh
  12148.         DL      hard drive number (80h-0FFh hard disk)
  12149. return  CF      set on error
  12150.                 AH      status code (see 01h above)
  12151. note 1) Not for PS/2 ESDI hard disks.
  12152.      2) Resets the hard disk controller, recalibrates attached drives (moves
  12153.         the read/write arm to cylinder 0), and prepares for subsequent disk I/O.
  12154.      3) This function is for hard disks only. It differs from fn 00h by not
  12155.         resetting the floppy disk controller.
  12156.  
  12157.  
  12158. Function 0Eh    Read Sector Buffer                         (XT, Portable, PS/2)
  12159. entry   AH      0Eh
  12160.         ES:BX   pointer to buffer
  12161. return  CF      set on error
  12162.                 AH      status code (see 01h above)
  12163.         AL      number of sectors actually transferred
  12164. note 1) Transfers controller's sector buffer. No data is read from the drive.
  12165.      2) Used for diagnostics only on PS/2 systems.
  12166.      3) This fn is supported by the XT's hard disk adapter only. It is "not
  12167.         defined" for hard disk adapters on the AT or PS/2.
  12168.  
  12169.  
  12170. Function 0Fh    Write sector buffer                          (XT, Portable)
  12171. entry   AH      0Fh
  12172.         ES:BX   pointer to buffer
  12173. return  CF      set if error
  12174.                 AH      status code (see 01h above)
  12175.         AL      number of sectors actually transferred
  12176. note 1) Should be called before formatting to initialize the controller's
  12177.         sector buffer.
  12178.      2) Used for diagnostics only on PS/2 systems.
  12179.      3) Transfers data from system RAM to the hard disk adapter's internal
  12180.         sector buffer.
  12181.      4) No data is written to the physical disk drive.
  12182.      5) This fn is for the XT hard disk controller only. It is "not defined"
  12183.         for AT or PS/2 controllers.
  12184.  
  12185.  
  12186. Function 10h    Test For Drive Ready                  (XT, AT, XT/286, PS/2)
  12187. entry   AH      10h
  12188.         DL      hard drive number 0 or 1 (80h-0FFh)
  12189. return  CF      set on error
  12190.                 AH      status code (see 01h above)
  12191. note 1) Tests whether the specified hard disk drive is operational and returns
  12192.         the drive's status.
  12193.      2) This function is supported on hard disks only.
  12194.      3) Perstor and Novell controllers allow more than one controller. Does
  12195.         not work for multiple Perstor controllers. (reports first two drives
  12196.         only).
  12197.      4) Does not work with network drives.
  12198.  
  12199.  
  12200. Function 11h    Recalibrate Drive                      (XT, AT, XT/286, PS/2)
  12201. entry   AH      11h
  12202.         DL      hard drive number (80h-0FFh hard disk)
  12203. return  CF      set on error
  12204.                 AH      status code (see 01h above)
  12205. note 1) Causes the HD controller to recalibrate itself for the specified drive,
  12206.         positioning the read/arm to cylinder 0, and returns the drive's status.
  12207.      2) This function is for hard disks only.
  12208.  
  12209.  
  12210. Function 12h    Controller RAM Diagnostics                (XT, Portable, PS/2)
  12211. entry   AH      12h
  12212. return  CF      set on error
  12213.                 AH      status code (see fn 01h above)
  12214. note 1) Used for diagnostics only on PS/2 systems.
  12215.      2) Makes the hard disk controller carry out a built-in diagnostic test on
  12216.         its internal sector buffer.
  12217.  
  12218.  
  12219. Function 13h    Controller Drive Diagnostic               (XT, Portable, PS/2)
  12220. entry   AH      13h
  12221. return  CF      set on error
  12222.                 AH      status code (see 01h above)
  12223. note 1) Used for diagnostics only on PS/2 systems.
  12224.      2) Causes HD controller to run internal diagnostic tests of the attached
  12225.         drive, indicating whether the test was passed by the returned status.
  12226.      3) This function is supported on XT HDs only.
  12227.  
  12228.  
  12229. Function 14h    Controller Internal Diagnostic               (AT, XT/286)
  12230. entry   AH      14h
  12231. return  CF      set on error
  12232.         AH      status code (see 01h above)
  12233. note 1) OEM is Western Digital 1003-WA2 hard/floppy combination controller
  12234.         in AT and XT/286.
  12235.      2) Used for diagnostics only in PS/2 systems.
  12236.      3) Causes HD controller to do a built-in diagnostic self-test, indicating
  12237.         whether the test was passed by the returned status.
  12238.      4) This function is supported on hard disks only.
  12239.  
  12240.  
  12241. Function 15h    Get Disk Type                                (except PC and XT)
  12242. entry   AH      15h
  12243.         DL      drive ID
  12244.                 00h-7Fh   floppy disk
  12245.                 80h-0FFh  fixed disk
  12246. return  CF      set on error
  12247.                 AH      error code (see 01h above)
  12248.         AH      disk type
  12249.                 00h     no drive is present
  12250.                 01h     diskette, no change detection present
  12251.                 02h     diskette, change detection present
  12252.                 03h     hard disk
  12253.                         CX:DX   number of 512-byte sectors
  12254. note 1) Returns a code indicating the type of disk referenced by the specified
  12255.         drive code.
  12256.      2) This function is not supported on the PC or XT.
  12257.  
  12258.  
  12259. Function 16h    Get Disk Change Status (diskette)      (except PC, XT, & Jr)
  12260. entry   AH      16h
  12261.         DL      drive to check
  12262. return  CF      set on error
  12263.         AH      disk change status
  12264.                 00h     no disk change
  12265.                 01h     disk changed
  12266.         DL      drive that had disk change (00h-07Fh floppy disk)
  12267. note    Returns the status of the change line, indicating whether the disk in
  12268.         the drive may have been replaced since the last disk access. If this
  12269.         function returns with CF set, the disk has not necessarily been
  12270.         changed; the change line can be activated by simply unlocking and
  12271.         relocking the disk drive door without removing the floppy disk.
  12272.  
  12273.  
  12274. Function 17h    Set Disk Type for Format (diskette)          (except PC and XT)
  12275. entry   AH      17h
  12276.         AL      00h     not used
  12277.                 01h     160, 180, 320, or 360Kb diskette in 360kb drive
  12278.                 02h     360Kb diskette in 1.2Mb drive
  12279.                 03h     1.2Mb diskette in 1.2Mb drive
  12280.                 04h     720Kb diskette in 720Kb drive
  12281.         DL      drive number (0-7)
  12282. return  CF      set on error
  12283.         AH      status of operation (see 01h above)
  12284. note 1) This function is probably enhanced for the PS/2 series to detect
  12285.         1.44 in 1.44 and 720k in 1.44.
  12286.      2) This function is not supported for floppy disks on the PC or XT.
  12287.      3) If the change line is active for the specified drive, it is reset.
  12288.      4) The BIOS sets the data rate for the specified drive and media type.
  12289.         The rate is 250k/sec for double-density media and 500k/sec for high
  12290.         density media. The proper hardware is required.
  12291.  
  12292.  
  12293. Function 18h    Set Media Type For Format  (diskette)   (AT, XT2, XT/286, PS/2)
  12294. entry   AH      18h
  12295.         CH      lower 8 bits of number of tracks
  12296.         CL      high 2 bits of number of tracks (6,7) sectors per track
  12297.                 (bits 0-5)
  12298.         DL      drive number (0-7)
  12299. return  CF      clear   no errors
  12300.         AH      00h      if requested combination supported
  12301.                 01h      if function not available
  12302.                 0Ch      if not suppported or drive type unknown
  12303.                 80h      if there is no media in the drive
  12304.         ES:DI   pointer to 11-byte disk parameter table for media type
  12305.         CF      set     error code (see 01h above)
  12306. note 1) A floppy disk must be present in the drive.
  12307.      2) This function should be called prior to formatting a disk with Int 13h
  12308.         Fn 05h so the BIOS can set the correct data rate for the media.
  12309.      3) If the change line is active for the specified drive, it is reset.
  12310.  
  12311.  
  12312. Function 19h    Park Hard Disk Heads                         (PS/2)
  12313. entry   AH      19h
  12314.         DL      drive number (80h-0FFh)
  12315. return  CF      set on error
  12316.                 AH      error code (see fn 01h)
  12317. note    This function is defined for PS/2 fixed disks only.
  12318.  
  12319.  
  12320. Function 1Ah    ESDI Hard Disk - Low Level Format                      (PS/2)
  12321. entry   AH      1Ah
  12322.         AL      Relative Block Address (RBA) defect table count
  12323.                 00h     no errors on disk
  12324.                 01h+    number of disk errors
  12325.         CL      format modifiers byte
  12326.            bits 0       ignore primary defect map
  12327.                 1       ignore secondary defect map
  12328.                 2       update secondary defect map
  12329.                 3       perform extended surface analysis
  12330.                 4       generate periodic interrupt after each cylinder format
  12331.                 5       reserved - must be 0
  12332.                 6       reserved - must be 0
  12333.                 7       reserved - must be 0
  12334.         DL      drive  (80h-0FFh)
  12335.         ES:BX   pointer to RBA defect table
  12336. return  CF      set on error
  12337.                 AH      error code (see fn 01h above)
  12338. note 1) Initializes disk sector and track address fields on a drive attached
  12339.         to the IBM "ESDI Fixed Disk Drive Adapter/A."
  12340.      2) If periodic interrupt selected, int 15h/fn 0Fh is called after each
  12341.         cylinder is formatted
  12342.      3) If bit 4 of CL is set, Int 15h, AH=0Fh, AL=phase code after each
  12343.         cylinder is formatted or analyzed. The phase code is defined as:
  12344.         0       reserved
  12345.         1       surface analysis
  12346.         2       formatting
  12347.      4) If bit 2 of CL is set, the drive's secondary defect map is updated to
  12348.         reflect errors found during surface analysis. If both bit 2 and bit 1
  12349.         are set, the secondary defect map is replaced.
  12350.      5) For an extended surface analysis, the disk should first be formatted by
  12351.         calling this function with bit 3 cleared and then analyzed by calling
  12352.         this function with bit 3 set.
  12353.  
  12354.  
  12355. Function 1Bh    ESDI Hard Disk - Get Manufacturing Header       (PS/2)
  12356. entry   AH      1Bh
  12357.         AL      number of record
  12358.         DL      drive
  12359.         ES:BX   pointer to buffer for manufacturing header (defect list)
  12360. return  CF      set on error
  12361.         AH      status
  12362. note    Manufacturing header format (Defect Map Record format) can be found
  12363.         in the "IBM 70Mb, 115Mb Fixed Disk Drives Technical Reference."
  12364.  
  12365.  
  12366. Function 1Ch    ESDI Hard Disk - Get Configuration                  (PS/2)
  12367. entry   AH      1Ch
  12368.         AL      0Ah     Get Device Configuration
  12369.                         DL      drive
  12370.                         ES:BX   pointer to buffer for device configuration
  12371.                                 (drive physical parameter)
  12372.                 0Bh     Get Adapter Configuration
  12373.                         ES:BX   pointer to buffer for adapter configuration
  12374.                 0Ch     Get POS Information
  12375.                         ES:BX   pointer to POS information
  12376.                 0Dh     unknown
  12377.                 0Eh     Translate RBA to ABA
  12378.                         CH      low 8 bits of cylinder number
  12379.                         CL      sector number, high two bits of cylinder number
  12380.                                 in bits 6 and 7
  12381.                         DH      head number
  12382.                         DL      drive number
  12383.                         ES:BX   pointer to ABA number
  12384.  
  12385. return  CF      set on error
  12386.                 AH      status (see 01h)
  12387. note 1) Device configuration format can be found in IBM ESDI Fixed Disk Drive
  12388.         Adapter/A Technical Reference.
  12389.      2) ABA (absolute block address) format can be found in IBM ESDI Adapter
  12390.         Technical Reference by using its Device Configuration Status Block.
  12391.  
  12392.  
  12393. Function 1Dh    IBMCACHE.SYS                                (PS/2 50+)
  12394. entry   AH      1Dh
  12395. other parameters unknown
  12396. note    IBMCACHE.SYS comes on the setup disk for MCA-bus PS/2 machines.
  12397.  
  12398.  
  12399. Function 20h    Western Digital HD SuperBIOS
  12400. entry   AH      20h
  12401. other parameters unknown
  12402. note    SuperBIOS may be purchased separately from Western Digital and added
  12403.         to standard HD controllers. SuperBIOS contains additional setup
  12404.         tables and parameters.
  12405.  
  12406.  
  12407.        **  Programmer's Technical Reference for MSDOS and the IBM PC **
  12408.                 USA copyright TXG 392-616  ALL RIGHTS RESERVED
  12409. ───────────────────────────────┤ DOSREF (tm) ├────────────────────────────────
  12410.                      ISBN 1-878830-02-3 (disk-based text)
  12411.                     Copyright (c) 1987, 1991 Dave Williams
  12412.                         ┌─────────────────────────────┐
  12413.                         │ Shareware Version, 12/20/91 │
  12414.                         │  Please Register Your Copy  │
  12415.                         └─────────────────────────────┘
  12416.  
  12417.  
  12418.                             C H A P T E R   N I N E
  12419.  
  12420.  
  12421.                           INSTALLABLE DEVICE DRIVERS
  12422.  
  12423.  
  12424.                                 C O N T E N T S
  12425.  
  12426. Device Driver Format .................................................... 9**
  12427. Types of Devices ........................................................ 9**
  12428.         Character Devices ............................................... 9**
  12429.         Block Devices ................................................... 9**
  12430. Device Header ........................................................... 9**
  12431.         Pointer to Next Device Header Field ............................. 9**
  12432.         Attribute Field ................................................. 9**
  12433.                 Bits 0 and 1 ............................................ 9**
  12434.                 Bit 2 ................................................... 9**
  12435.                 Bit 3 ................................................... 9**
  12436.                 Bit 13 .................................................. 9**
  12437.                 Bit 14 .................................................. 9**
  12438.                 Bit 15 .................................................. 9**
  12439.         Pointer to Strategy and Interrupt Routines ...................... 9**
  12440.         Name/Unit Field ................................................. 9**
  12441. Creating a Device Driver ................................................ 9**
  12442. Installing Device Drivers ............................................... 9**
  12443.         Installing Character Devices .................................... 9**
  12444.         Installing Block Devices ........................................ 9**
  12445. Request Header .......................................................... 9**
  12446.         Unit Code Field ................................................. 9**
  12447.         Command Code Field .............................................. 9**
  12448.         Status Field .................................................... 9**
  12449. Device Driver Functions ................................................. 9**
  12450.         INIT ............................................................ 9**
  12451.         MEDIA CHECK ..................................................... 9**
  12452.         Media Descriptor Byte ........................................... 9**
  12453.         BUILD BPB (BIOS Parameter Block) ................................ 9**
  12454.         INPUT OR OUTPUT ................................................. 9**
  12455.         NONDESTRUCTIVE INPUT NO WAIT .................................... 9**
  12456.         STATUS .......................................................... 9**
  12457.         FLUSH ........................................................... 9**
  12458.         OPEN or CLOSE (DOS 3.0+) ........................................ 9**
  12459.         REMOVEABLE MEDIA (DOS 3.0+) ..................................... 9**
  12460. The CLOCK$ Device ....................................................... 9**
  12461.  
  12462.  
  12463.  
  12464.  
  12465. DEVICE DRIVER FORMAT├──────────────────────────────────────────────────────────
  12466.  
  12467.  A device driver is a handler for communication between the system software
  12468. and hardware devices. The motherboard ROM and IBMBIO.COM or IO.SYS files
  12469. contain the basic drivers for allowing DOS to talk to the console, disk drives,
  12470. serial and parallel ports, clock, and other resources.
  12471.  
  12472.  DOS has five builtin drivers, STDIN, STDOUT, STERR, STDPRN, or STDAUX. An
  12473. "installable" driver may be loaded in the CONFIG.SYS file, and either replace
  12474. one of the builtin drivers or define a new resource, such as a mouse or
  12475. expanded memory driver.
  12476.  
  12477.  The device driver is a COM (memory image) file that contains all of the code
  12478. needed to control an add-in device. An EXE file should not be used since the
  12479. EXE loader in some DOS 2.x versions is part of COMMAND.COM, which is not
  12480. present when the device driver is being loaded by IBMBIO.COM or IO.SYS. EXE
  12481. format drivers could be used in DOS 3.x+, but there is generally no reason to
  12482. do so. The COM file must not load at the usual ORG 100h. Since the driver does
  12483. not use the Program Segment Prefix, it is simply loaded without offset,
  12484. therefore the driver file must have an origin of 0. Most references advise
  12485. "ORG 0 or no ORG statement", however with the advent of many new assemblers on
  12486. the market, some of which default to .COM files, specifically stating "ORG 0"
  12487. may eliminate problems. Driver files should not have a declared stack segment.
  12488.  
  12489.  DOS can install the device driver anywhere in memory, so care must be taken
  12490. in any FAR memory references. You should not expect that your driver will be
  12491. loaded in the same place every time.
  12492.  
  12493.  
  12494.  
  12495.  
  12496. TYPES OF DEVICES├──────────────────────────────────────────────────────────────
  12497.  
  12498.  There are two types of devices: Character devices and Block devices. Their
  12499. attributes are as follows:
  12500.  
  12501.  Character devices are designed to do serial I/O in a byte-by-byte manner.
  12502. These devices have names like CON, AUX, or PRN, and you can open channels
  12503. (handles or FCBs) to do I/O much like a disk file. I/O may be in either cooked
  12504. or raw mode. (see Chapter 7 for discussion of cooked and raw modes). Because
  12505. character devices have only one name, they can only support one device.
  12506.  
  12507.  Block devices are normally implemented as disk drives. They can do random I/O
  12508. in pieces called blocks, which are usually the physical sector size of the disk.
  12509. These devices are not named as character devices are, and cannot be opened
  12510. directly. Instead they are accessed by using drive letters such as A, B, C,
  12511. etc. Block devices can have units within them. In this way, a single block
  12512. driver can be responsible for one or more disk drives. For example, the first
  12513. block device driver can be responsible for drives A, B, C, and D. This means it
  12514. has four units defined and therefore takes up four drive letters. The position
  12515. of the driver in the chain of all drives determines the way in which the drive
  12516. letters correspond, i.e, if a second block device driver defines three units,
  12517. then those units are E, F, and G.
  12518.  
  12519.  DOS 1.x allows 16 block devices. DOS 2.x allows 63, and DOS 3.x allows 26. It
  12520. is recommended that drivers limit themselves to 26 devices for compatibility
  12521. with DOS 3.x and 4.x. When DOS 2.x passes the Z: drivespec, the drivespecs get
  12522. a little wierd, such as ^, [, or #. DOS 3.x+ will return an error message.
  12523.  
  12524.  
  12525.  
  12526.  
  12527. CREATING A DEVICE DRIVER├──────────────────────────────────────────────────────
  12528.  
  12529.  To create a device driver that DOS can install, you must do the following:
  12530.  
  12531. 1) Create a memory image (COM) file with a device header at the start of the
  12532.    file.
  12533. 2) Originate the code (including the device header) at 0, instead of 100h.
  12534. 3) Set the next device header field. Refer to "Pointer to Next Device Header
  12535.    Attribute Field" for more information.
  12536. 4) Set the attribute field of the device header. Refer to "Attribute Field" for
  12537.    more information.
  12538. 5) Set the entry points for the interrupt and strategy routines.
  12539. 6) Fill in the name/unit field with the name of the character device or the
  12540.    unit number of the block device.
  12541.  
  12542.  DOS always processes installable character device drivers before handling the
  12543. default devices. So to install a new CON device, simply name the device CON.
  12544. Be sure to set the standard input device and standard output device bits in
  12545. the attribute field of a new CON device. The scan of the device list stops on
  12546. the first match so the installable device driver takes precedence. For
  12547. instance, installing ANSI.SYS replaces the builtin CON driver.
  12548.  
  12549.  DOS doesn't care about the position of installed character devices versus
  12550. block devices.
  12551.  
  12552.  
  12553.  
  12554.  
  12555. STRUCTURE OF A DEVICE DRIVER├──────────────────────────────────────────────────
  12556.  
  12557.  A device driver consists of three major parts:
  12558.         a device header
  12559.         a strategy routine
  12560.         an interrupt routine
  12561.  
  12562.  
  12563. DEVICE HEADER
  12564.  
  12565.  The driver has a special header to identify it as a device and to define the
  12566. strategy and interrupt entry points and its various attributes. This header is
  12567. located at the beginning of the file. It contains a pointer to the next driver
  12568. in the chain, the attributes of the device, offsets into the strategy and
  12569. interrupt routines, and the device ID.
  12570.  
  12571.  This is the format of the device header:
  12572.  
  12573. ┌──────────────────────────────────────────────────────────────────────────────┐
  12574. │                         D E V I C E    H E A D E R                           │
  12575. ├───────┬────────┬─────────────────────────────────────────────────────────────┤
  12576. │Offset │ Length │                       Description                           │
  12577. ├───────┼────────┼─────────────────────────────────────────────────────────────┤
  12578. │  00h  │  word  │  Pointer to next device header field, offset value          │
  12579. ├───────┼────────┼─────────────────────────────────────────────────────────────┤
  12580. │  02h  │  word  │  Pointer to next device header field, segment value         │
  12581. ├───────┼────────┼─────────────────────────────────────────────────────────────┤
  12582. │  04h  │  word  │  Attribute                                                  │
  12583. ├───────┼────────┼─────────────────────────────────────────────────────────────┤
  12584. │  06h  │  word  │  Pointer to device strategy routine (offset only)           │
  12585. ├───────┼────────┼─────────────────────────────────────────────────────────────┤
  12586. │  08h  │  word  │  Pointer to device interrupt routine (offset only)          │
  12587. ├───────┼────────┼─────────────────────────────────────────────────────────────┤
  12588. │  0Ah  │8 bytes │  Name/Unit field                                            │
  12589. └───────┴────────┴─────────────────────────────────────────────────────────────┘
  12590.  
  12591.  
  12592. POINTER TO NEXT DEVICE HEADER FIELD
  12593.  
  12594.  The device header field is a pointer to the device header of the next device
  12595. driver. It is a doubleword field that is set by DOS at the time the device
  12596. driver is loaded. The first word is the offset and the second word is the
  12597. segment.
  12598.  
  12599.  If you are loading only one device driver, set the device header field to -1
  12600. before loading the device. If you are loading more than one device driver, set
  12601. the first word of the device driver header to the offset of the next device
  12602. driver's header. Set the device driver header field of the last device driver
  12603. to -1.
  12604.  
  12605.  
  12606. ATTRIBUTE FIELD
  12607.  
  12608.  The attribute field is a word field used to identify the type of device this
  12609. driver is responsible for. This field distinguishes between block and
  12610. character devices and determines is selected devices are given special
  12611. treatment. The attributes are:
  12612.  
  12613. ┌──────────────────────────────────────────────────────────────────────────────┐
  12614. │                        A T T R I B U T E   F I E L D                         │
  12615. ├──────────┬───────┬───────────────────────────────────────────────────────────┤
  12616. │   word   │ attr. │                                                           │
  12617. ├──────────┼───────┤                     description                           │
  12618. │   bits   │  set  │                                                           │
  12619. ├──────────┼───────┼───────────────────────────────────────────────────────────┤
  12620. │     0    │   0   │   not current standard input device                       │
  12621. │          │   1   │   current standard input device                           │
  12622. ├──────────┼───────┼───────────────────────────────────────────────────────────┤
  12623. │     1    │   0   │   not current standard output device                      │
  12624. │          │   1   │   current standard output device                          │
  12625. ├──────────┼───────┼───────────────────────────────────────────────────────────┤
  12626. │     2    │   0   │   not current NUL device                                  │
  12627. │          │   1   │   current NUL device                                      │
  12628. ├──────────┼───────┼───────────────────────────────────────────────────────────┤
  12629. │     3    │   0   │   not current CLOCK device                                │
  12630. │          │   1   │   current CLOCK device                                    │
  12631. ├──────────┼───────┼───────────────────────────────────────────────────────────┤
  12632. │     4    │   0   │   standard CON I/O routines should be used                │
  12633. │          │   1   │   fast screen I/O (int 29h) should be used                │
  12634. ├──────────┼───────┴───────────────────────────────────────────────────────────┤
  12635. │  5 - 10  │         "reserved for DOS" - unknown - should be set to 0         │
  12636. ├──────────┼───────┬───────────────────────────────────────────────────────────┤
  12637. │    11    │   0   │   doesn't support removeable media  (default for DOS 2.x) │
  12638. │          │   1   │   supports removeable media         (DOS 3.0+ only)       │
  12639. ├──────────┼───────┴───────────────────────────────────────────────────────────┤
  12640. │    12    │         "reserved for DOS" - unknown - should be set to 0         │
  12641. ├──────────┼───────┬───────────────────────────────────────────────────────────┤
  12642. │    13    │   0   │   IBM format       (block devices)                        │
  12643. │          │   1   │   non-IBM format   (block devices)                        │
  12644. │          │   1   │   output till busy (character devices)                    │
  12645. ├──────────┼───────┼───────────────────────────────────────────────────────────┤
  12646. │    14    │   0   │   doesn't support IOCTL                                   │
  12647. │          │   1   │   supports IOCTL                                          │
  12648. ├──────────┼───────┼───────────────────────────────────────────────────────────┤
  12649. │    15    │   0   │   block device                                            │
  12650. │          │   1   │   character device                                        │
  12651. └──────────┴───────┴───────────────────────────────────────────────────────────┘
  12652.  
  12653. note 1) If a bit in the attribute word is defined only for one type of device,
  12654.         a driver for the other type of device must set that bit to 0.
  12655.      2) For DOS 2.0 bits 4-12 must be off.
  12656.  
  12657.  
  12658. BIT 1   is the standard input and output bit. It is used for character devices
  12659.         only. Use this bit to tell DOS if your character device driver is the
  12660.         new standard input device or standard output device.
  12661.  
  12662. BIT 2   is the NUL attribute bit. It is used for character devices only. Use it
  12663.         to tell DOS if your character device driver is a NUL device. Although
  12664.         there is a NUL device attribute bit, you cannot reassign the NUL
  12665.         device or replace it with your own routine. This attribute exists for
  12666.         DOS so that DOS can tell if the NUL device is being used.
  12667.  
  12668. BIT 3   is the clock device bit. It is used for character devices only. Default
  12669.         is 0. You can use it to tell DOS if your character device driver is the
  12670.         new CLOCK device.
  12671.  
  12672. BIT 4   is the "fast video output" bit. The default is 0, which uses the BIOS
  12673.         for writing to the screen. When set, this bit uses int 29h for much
  12674.         faster screen updates.
  12675.  
  12676. BITS 5-10  reserved for DOS, unknown. Should be set to 0.
  12677.  
  12678. BIT 11  is the open/close removeable media bit. Use it to tell DOS if the
  12679.         device driver can handle removeable media. This bit is valid for DOS
  12680.         3.0+ only. This bit was reserved in DOS 2.x. Since DOS 2.x does not
  12681.         look at this bit, its use is backward compatible.
  12682.  
  12683. BIT 12  reserved for DOS, unknown. Should be set to 0.
  12684.  
  12685. BIT 13  is the non-IBM format bit. When used for block devices it affects the
  12686.         operation of the BUILD BPB (BIOS parameter block) device call. For
  12687.         character devices it indicates that the devices implements the OUTPUT
  12688.         UNTIL BUSY device call.
  12689.  
  12690. BIT 14  is the IOCTL bit. It is used for both character and block devices. Use
  12691.         it to tell DOS whether the device driver can handle control strings
  12692.         through the IOCTL function call 44h.
  12693.          If a device driver cannot process control strings, it should set bit
  12694.         14 to 0. This way DOS can return an error if an attempt is made through
  12695.         the IOCTL function call to send or receive control strings to the
  12696.         device. If a device can process control strings, it should set bit 14
  12697.         to 1. This way, DOS makes calls to the IOCTL input and output device
  12698.         function to send and receive IOCTL strings.
  12699.          The IOCTL functions allow data to be sent to and from the device
  12700.         without actually doing a normal read or write. In this way, the device
  12701.         driver can use the data for its own use, (for example, setting a baud
  12702.         rate or stop bits, changing form lengths, etc.) It is up to the device
  12703.         to interpret the information that is passed to it, but the information
  12704.         must not be treated as a normal I/O request.
  12705.  
  12706. BIT 15  is the device type bit. Use it to tell the system the that driver is a
  12707.         block or character device.
  12708.  
  12709.  
  12710. POINTER TO STRATEGY ROUTINE
  12711.  
  12712.  This field contains a pointer to "device strategy" function in the driver.
  12713. This function is called whenever a request is made to the driver, and must
  12714. store the location of the request header from DOS. This pointer is a word
  12715. value, and so must be in the same segment as the device header.
  12716.  
  12717.  
  12718. POINTER TO INTERRUPT ROUTINE
  12719.  
  12720.  This field contains a pointer to the function which activates driver routines
  12721. to perform the command in the current request header. This is called by DOS
  12722. after the call to the strategy function, and should reset to the request header
  12723. address stored by "strategy", to allow for the possibility of interrupts
  12724. between the two calls. This pointer is a word value, and so must be in the same
  12725. segment as the device header.
  12726.  
  12727.  
  12728. NAME/UNIT FIELD
  12729.  
  12730.  This is an 8-byte field that contains the name of a character device or the
  12731. number of units in a block device. For the character names, the name is
  12732. left-justified and the space is filled to 8 bytes. For block devices, the
  12733. number of units can be placed in the first byte. This is optional because DOS
  12734. fills in this location with the value returned by the driver's INIT code. The
  12735. other 7 bytes of the block device ID are reserved and should not be used.
  12736.  
  12737.  
  12738.  
  12739. INSTALLING DEVICE DRIVERS├─────────────────────────────────────────────────────
  12740.  
  12741.  DOS installs new device drivers dynamically at boot time by reading and
  12742. processing the DEVICE command in the CONFIG.SYS file. For example, if you have
  12743. written a device driver called RAMDISK, to install it put this command in the
  12744. CONFIG.SYS file:
  12745.                    DEVICE=[drive][path] RAMDISK [parameters]
  12746.  
  12747.  DOS makes a FAR call to the device driver at its strategy entry point first,
  12748. using the request header to pass information describing what DOS wants the
  12749. device driver to do.
  12750.  
  12751.  This strategy routine does not perform the request but rather queues the
  12752. request or saves a pointer to the request header. The second entry point is
  12753. the interrupt routine and is called by DOS immediately after the strategy
  12754. routine returns. The interrupt routine is called with no parameters. Its
  12755. function is to perform the operation based on the queued request and set up
  12756. any return infromation.
  12757.  
  12758.  DOS passes the pointer to the request header in ES:BX. This structure consists
  12759. of a fixed length header (Request Header) followed by data pertinent to the
  12760. operation to be performed.
  12761.  
  12762. NOTE: It is the responsibility of the device driver to preserve the machine
  12763.       state. For example, save all registers on entry and restore them on exit.
  12764.  
  12765.  The stack used by DOS has enough room on it to save all the registers. If more
  12766. stack space is needed, it is the device driver's responsibility to allocate and
  12767. maintain another stack.
  12768.  
  12769.  All calls to execute device drivers are FAR calls. FAR returns should be
  12770. executed to return to DOS.
  12771.  
  12772.  
  12773.  
  12774. INSTALLING CHARACTER DEVICES
  12775.  
  12776.   One of the functions defined for each device is INIT. This routine is called
  12777. only once when the device is installed and never again. The INIT routine returns
  12778. the following:
  12779.  
  12780. A) A location to the first free byte of memory after the device driver, like a
  12781.    TSR that is stored in the terminating address field. This way, the
  12782.    initialization code can be used once and then thrown away to save space.
  12783. B) After setting the address field, a character device driver can set the status
  12784.    word and return.
  12785.  
  12786.  
  12787.  
  12788. INSTALLING BLOCK DEVICES
  12789.  
  12790.  Block devices are installed in the same way as character devices. The
  12791. difference is that block devices return additional information. Block devices
  12792. must also return:
  12793.  
  12794. A) The number of units in the block device. This number determines the logical
  12795.    names the devices will have. For example, if the current logical device
  12796.    letter is F at the time of the install call, and the block device driver INIT
  12797.    routine returns three logical units, the letters G, H, and I are assigned to
  12798.    the units. The mapping is determined by the position of the driver in the
  12799.    device list and the number of units in the device. The number of units
  12800.    returned by INIT overrides the value in the name/unit field of the device
  12801.    header.
  12802.  
  12803. B) A pointer to a BPB (BIOS Parameter Block) pointer array. This is a pointer
  12804.    to an array of "N" word pointers there "N" is the number of units defined.
  12805.    These word pointers point to BPBs. This way, if all of the units are the
  12806.    same, the entire array can point to the same BPB to save space.
  12807.     The BPB contains information pertinent to the devices such as the sector
  12808.    size, number of sectors per allocation unit, and so forth. The sector size of
  12809.    the BPB cannot be greater than the maximum allotted size set at DOS
  12810.    initialization time. This array must be protected below the free pointer set
  12811.     by the return.
  12812.  
  12813. C) The media descriptor byte. This byte is passed to devices so that they know
  12814.    what parameters DOS is currently using for a particular drive unit.
  12815.  
  12816.  Block devices can take several approaches. They can be "dumb" or "smart". A
  12817. dumb device would define a unit (and therefore a BPB) for each possible media
  12818. drive combination. Unit 0=drive 0;single side, unit 1=drive 0;double side, etc.
  12819. For this approach, the media descriptor bytes would mean nothing. A smart
  12820. device would allow multiple media per unit. In this case, the BPB table
  12821. returned at INIT must define space large enough to acommodate the largest
  12822. possible medias supported (sector size in BPB must be as large as maximum
  12823. sector size DOS is currently using). Smart drivers will use the media
  12824. descriptor byte to pass information about what media is currently in a unit.
  12825.  
  12826.  
  12827.  
  12828. REQUEST HEADER├────────────────────────────────────────────────────────────────
  12829.  
  12830.  The request header passes the information describing what DOS wants the
  12831. device driver to do.
  12832.  When a valid device driver command code or function is called by your
  12833. application program, DOS develops a data structure called the "Request Header"
  12834. in ES:BX and passes it to the strategy entry point. This structure consists of
  12835. a 13-byte defined header which may be followed by other data bytes depending on
  12836. the function requested.
  12837.  It is the device driver's responsibility to preserve the machine state, for
  12838. example, saving all registers including flags on entry and restoring them on
  12839. exit. There is enough room on the stack when strategy or interrupt is called
  12840. to do about 20 pushes. If more stack is needed, the driver should set aside
  12841. its own stack space.
  12842.  The fixed ("static") part of the request header is as follows:
  12843.  
  12844. ┌────────────────────────────────────────────────────────────────────────────┐
  12845. │                        R E Q U E S T    H E A D E R                        │
  12846. ├───────┬───────┬────────────────────────────────────────────────────────────┤
  12847. │Offset │Length │                      F i e l d                             │
  12848. ├───────┼───────┼────────────────────────────────────────────────────────────┤
  12849. │  00h  │  byte │ Length in bytes of the request header plus any data at end │
  12850. ├───────┼───────┼────────────────────────────────────────────────────────────┤
  12851. │  01h  │  byte │ Unit code. Determines subunit to use in block devices      │
  12852. │       │       │ (minor device)  Has no meaning for character devices       │
  12853. ├───────┼───────┼────────────────────────────────────────────────────────────┤
  12854. │  02h  │  byte │ Command code                                               │
  12855. ├───────┼───────┼────────────────────────────────────────────────────────────┤
  12856. │  03h  │  word │ Status                                                     │
  12857. ├───────┼───────┼────────────────────────────────────────────────────────────┤
  12858. │  05h  │8 bytes│ Reserved for DOS                                           │
  12859. ├───────┼───────┼────────────────────────────────────────────────────────────┤
  12860. │  0Ch  │varies │ Data appropriate for the operation                         │
  12861. └───────┴───────┴────────────────────────────────────────────────────────────┘
  12862.  
  12863. REQUEST HEADER LENGTH FIELD
  12864.  
  12865.  The length in bytes of the total request header (0-255) plus any data at the
  12866. end of the header.
  12867.  
  12868.  
  12869. UNIT CODE FIELD
  12870.  
  12871.  The unit code field identifies which unit in a block device driver the request
  12872. is for. For example, if a block device driver has three units defined, then the
  12873. possible values of the unit code field would be 0, 1, and 2. This field is not
  12874. valid for character devices.
  12875.  
  12876.  
  12877. COMMAND CODE FIELD
  12878.  
  12879.  The command code invokes a specific device driver function. Functions 0
  12880. through 12 are supported in all device drivers. Functions 13-15 are available
  12881. only in DOS 3.0 or higher. Some functions are relevant for either character or
  12882. block devices but not both; nonetheless all functions must have an executable
  12883. routine present even if it does nothing but set the done flag in the return
  12884. status word in the request header.
  12885.  
  12886.  The command code field in the request header can have the following values:
  12887. ┌──────┬──────────────────┬────────────────────────────────────────────────────┐
  12888. │ code │       name       │                     function                       │
  12889. ├──────┼──────────────────┼────────────────────────────────────────────────────┤
  12890. │   0  │ INIT             │ initialize driver for later use (used once only)   │
  12891. │   1  │ MEDIA CHECK      │ block devices only, NOP for character devices      │
  12892. │   2  │ BUILD BPB        │ block devices only, NOP for character devices      │
  12893. │   3  │ IOCTL input      │ called only if device has IOCTL bit set            │
  12894. │   4  │ INPUT            │ read data                                          │
  12895. │   5  │ NONDESTRUCTIVE INPUT NO WAIT  character devices only                  │
  12896. │   6  │ INPUT STATUS     │ character devices only                             │
  12897. │   7  │ INPUT FLUSH      │ character devices only                             │
  12898. │   8  │ OUTPUT           │ write data                                         │
  12899. │   9  │ OUTPUT           │ write data with verify                             │
  12900. │  10  │ OUTPUT STATUS    │ character devices only                             │
  12901. │  11  │ OUTPUT FLUSH     │ character devices only                             │
  12902. │  12  │ IOCTL OUTPUT     │ called only if device has IOCTL bit is set         │
  12903. │  13  │ DEVICE OPEN      │ called only if OPEN/CLOSE/RM bit is set            │
  12904. │  14  │ DEVICE CLOSE     │ called only if OPEN/CLOSE/RM bit is set            │
  12905. │  15  │ REMOVEABLE MEDIA │ only if OPEN/CLOSE/RM bit set & device is block    │
  12906. │  16  │ OUTPUT UNTIL BUSY│ only called if bit 13 is set & device is character │
  12907. └──────┴──────────────────┴────────────────────────────────────────────────────┘
  12908.  
  12909.  The individual command codes are described later in this chapter.
  12910.  
  12911.  
  12912.  
  12913. STATUS FIELD
  12914.  
  12915.  The status word field is zero on entry and is set by the driver interrupt
  12916. routine on return.
  12917.  
  12918. The status field in the request header contains:
  12919.  
  12920. ┌─────────────────────────────────────────────────────────────────────────────┐
  12921. │            D E V I C E    D R I V E R    S T A T U S    F I E L D           │
  12922. ├───────┬───┬─────────────────────────────────────────────────────────────────┤
  12923. │ size  │bit│                        definition                               │
  12924. ├───────┼───┼─────────────────────────────────────────────────────────────────┤
  12925. │ byte  │ 0 │                                                                 │
  12926. │       │ 1 │                                                                 │
  12927. │       │ 2 │                                                                 │
  12928. │       │ 3 │  Error message return code                                      │
  12929. │       │ 4 │  (with bit 15=1)                                                │
  12930. │       │ 5 │                                                                 │
  12931. │       │ 6 │                                                                 │
  12932. │       │ 7 │                                                                 │
  12933. ├───────┼───┼─────────────────────────────────────────────────────────────────┤
  12934. │ byte  │ 8 │  DONE                                                           │
  12935. │       ├───┼─────────────────────────────────────────────────────────────────┤
  12936. │       │ 9 │  BUSY                                                           │
  12937. │       ├───┼─────────────────────────────────────────────────────────────────┤
  12938. │       │ A │  Reserved by DOS, unknown                                       │
  12939. │       │ B │                                                                 │
  12940. │       │ C │                                                                 │
  12941. │       │ D │                                                                 │
  12942. │       │ E │                                                                 │
  12943. │       ├───┼─────────────────────────────────────────────────────────────────┤
  12944. │       │ F │  Error                                                          │
  12945. └───────┴───┴─────────────────────────────────────────────────────────────────┘
  12946.  
  12947.  
  12948.  The low 8 bits of the status word define an error message if bit 15 is set.
  12949. These errors are:
  12950.  
  12951.         00h  write protect violation   01h  unknown unit
  12952.         02h  device not ready          03h  unknown command
  12953.         04h  CRC error                 05h  bad drive request structure length
  12954.         06h  seek error                07h  unknown media
  12955.         08h  sector not found          09h  printer out of paper
  12956.         0Ah  write fault               0Bh  read fault
  12957.         0Ch  general failure           0Dh  reserved
  12958.         0Eh  reserved                  0Fh  invalid disk change
  12959.  
  12960. BIT 8   is the done bit. If it is set, it means the operation is complete. The
  12961.         driver sets the bit to 1 when it exits.
  12962.  
  12963. BIT 9   is the busy bit. It is only set by status calls and the removable media
  12964.         call.
  12965.  
  12966. BITS 10-14 are reserved.
  12967.  
  12968. BIT 15  is the error bit. If this bit is set, the low 8 bits of the status word
  12969.         (7-0) indicate the error code.
  12970.  
  12971.  
  12972. RESERVED FOR DOS
  12973.  Official sources label this area as "reserved for DOS". Another source
  12974. indicates that this consists of two double-word (4-byte) pointers to be used
  12975. to maintain a linked list of request headers for this device and a list of all
  12976. current device requests being processed by DOS. This was apparently to be used
  12977. for the undelivered multitasking version of DOS.
  12978.  
  12979.  
  12980.  
  12981. DEVICE DRIVER FUNCTIONS├───────────────────────────────────────────────────────
  12982.  
  12983.  All strategy routines are called with ES:BX pointing to the request header.
  12984. The interrupt routines get the pointers to the request header from the queue
  12985. the strategy routines stores them in. The command code in the request header
  12986. tells the driver which function to perform.
  12987.  
  12988. NOTE: All DWORD pointers are stored offset first, then segment.
  12989.  
  12990.                          ############################
  12991.  
  12992. INIT
  12993. Command code = 0        (all devices)
  12994.         Performs all initialization required at DOS boot time to install the
  12995.         driver and set local driver variables. This function is called only
  12996.         once, when the driver is loaded.
  12997.  
  12998.         ES:BX   pointer to 26-byte request header and data structure
  12999.  Format of structure:
  13000.        offset     length          field
  13001.          00h    13 bytes   request header
  13002.          0Dh       byte    number of units (not set by character devices)
  13003.          11h       dword   ending address of the driver's resident code
  13004.          15h       dword   pointer to BPB array (not set by character devices)
  13005.                            /pointer to remainder of arguments
  13006.          19h       byte    drive number (DOS 3.0+ only)
  13007.  
  13008.  
  13009.  When INIT is called, the driver must do the following:
  13010.  
  13011.         A) set the number of units (block devices only)
  13012.         B) set up the pointer to the BPB array (block devices only)
  13013.         C) perform any initialization code (to modems, printers, etc)
  13014.         D) set the ending address of the resident program code
  13015.         E) set the status word in the request header
  13016.  
  13017.  To obtain information obtained from CONFIG.SYS to a device driver at INIT
  13018. time, the BPB pointer field points to a buffer containing the information
  13019. passed from CONFIG.SYS following the =. The buffer that DOS passes to the
  13020. driver at INIT after the file specification contains an ASCII string for the
  13021. file OPEN. The ASCII string (ending in 0h) is terminated by a carriage return
  13022. (0Dh) and linefeed (0Ah). If there is no parameter information after the file
  13023. specification, the file specification is immediately followed by a linefeed
  13024. (0Ah).
  13025.  
  13026.  NOTE: This information is read-only and only system calls 01h-0Ch and 30h can
  13027.        be issued by the INIT code of the driver.
  13028.  
  13029.  The last byte parameter contains the drive letter for the first unit of a
  13030. block driver. For example, 0=A, 1=B etc.
  13031.  
  13032.  If an INIT routine determines that it cannot set up the device and wants to
  13033. abort without using any memory, follow this procedure:
  13034.  
  13035.         A) set the number of units to 0
  13036.         B) set the ending offset address at 0
  13037.         C) set the ending offsret segment address to the code segment (CS)
  13038.  
  13039. NOTE: If there are multiple device drivers in a single memory image file, the
  13040.       ending address returned by the last INIT called is the one DOS uses. It is
  13041.       recommended that all device drivers in a single memory image file return
  13042.       the same ending address.
  13043.  
  13044.                          ############################
  13045.  
  13046. MEDIA CHECK
  13047. command code = 1        (block devices only)
  13048.         Checks to see if disk had been changed since last access.
  13049.  
  13050.         ES:BX   pointer to 19-byte request header and data structure
  13051.  Format of structure:
  13052.         offset  length          field
  13053.         00h     13 bytes   request header
  13054.         0Dh        byte    media descriptor from BPB
  13055.         0Eh        byte    returned
  13056.         0Fh       dword    returns a pointer to the previous volume ID (if bit
  13057.                            11=1 and disk change is returned) (DOS 3.0+)
  13058.  
  13059.  When the command code field is 1, DOS calls MEDIA CHECK for a drive unit and
  13060. passes its current media descriptor byte. See "Media Descriptor Byte" later in
  13061. this chapter for more information about the byte. MEDIA CHECK returns one of
  13062. the following:
  13063.  
  13064.         A) media not changed             C) not sure
  13065.         B) media changed                 D) error code
  13066.  
  13067. The driver must perform the following:
  13068.         A) set the status word in the request header
  13069.         B) set the return byte
  13070.                 00h   don't know if media has been changed
  13071.                 01h   media has not been changed
  13072.                 -1    media has been changed
  13073.  
  13074.  DOS 3.0+: If the driver has set the removable media bit 11 of the device header
  13075. attribute word to 1 and the driver returns -1 (media changed), the driver must
  13076. set the DWORD pointer to the previous volume identification field. If DOS
  13077. determines that the media changed is an error, DOS generates an error 0Fh
  13078. (invalid disk change) on behalf of the device. If the driver does not implement
  13079. volume identification support, but has bit 11 set to 1, the driver should set a
  13080. pointer to the string "NO NAME",0.
  13081.  
  13082.  
  13083. MEDIA DESCRIPTOR
  13084.  Currently the media descriptor byte has been defined for a few media types.
  13085. This byte should be identical to the media byte if the device has the non-IBM
  13086. format bit off. These predetermined values are:
  13087.  
  13088. media descriptor byte =>    1  1  1  1  1  0  0  0
  13089.  (numeric order)            7  6  5  4  3  2  1  0
  13090.  
  13091.        BIT                MEANING
  13092.  
  13093.         0       0       not double sided
  13094.                 1       double sided
  13095.         1       0       not 8 sector
  13096.                 1       8 sector
  13097.         2       0       nonremoveable
  13098.                 1       removeable
  13099.        3-7      must be set to 1
  13100.  
  13101.                          ############################
  13102.  
  13103. BUILD BPB (BIOS Parameter Block)
  13104. command code = 2        (block devices only)
  13105.  
  13106.         ES:BX   pointer to 22-byte request header and data structure
  13107.  Format of structure:
  13108.         offset   length          field
  13109.         00h     13 bytes   request header
  13110.         0Dh        byte    media descriptor from DOS
  13111.         0Eh       dword    transfer address (buffer address)
  13112.         12h       dword    pointer to BPB table
  13113.  
  13114. DOS calls BUILD BPB under the following two conditions:
  13115.  
  13116. A) If "media changed" is returned.
  13117. B) If "not sure" is returned. If so, there are no used buffers. Used buffers
  13118.    are buffers with changed data that have not yet been written to the disk.
  13119.  
  13120. The driver must do the following:
  13121.  
  13122. A) set the pointer to the BPB.
  13123. B) set the status word in the request header.
  13124.  
  13125.  The driver must determine the correct media type currently in the unit to
  13126. return the pointer to the BPB table. The way the buffer is used (pointer
  13127. passed by DOS) is determined by the non-IBM format bit in the attribute field
  13128. of the device header. If bit 13=0 (device is IBM compatible), the buffer
  13129. contains the first sector of the FAT (most importantly the FAT ID byte). The
  13130. driver must not alter this buffer in this case. If bit 13=1 the buffer is a
  13131. one sector scratch area which can be used for anything.
  13132.  
  13133.  For drivers that support volume identification and disk change, the call
  13134. should cause a new volume identification to be read off the disk. This call
  13135. indicates that the disk has been legally changed.
  13136.  
  13137.  If the device is IBM compatible, it must be true that the first sector of the
  13138. first FAT is located at the same sector for all possible media. This is
  13139. because the FAT sector is read before the media is actually determined.
  13140.  
  13141.  The information relating to the BPB for a particular media is kept in the boot
  13142. sector for the media. In particular, the format of the boot sector is:
  13143.  
  13144. ┌──────────────────────────────────────────────────────────────────────────────┐
  13145. │ For DOS 2.x, 3 byte near jump (0E9h) For DOS 3.x+, 2 byte near jump (0EBh)   │
  13146. │ followed by a NOP (90h)                                                      │
  13147. ├──────────┬───────────────────────────────────────────────────────────────────┤
  13148. │ 8 bytes  │  OEM name and version                                             │
  13149. ├──────────┼─────┬─────────────────────────────────────────────────────────────┤
  13150. │   BYTE   │     │  sectors per allocation unit (must be a power of 2)         │
  13151. ├──────────┤     ├─────────────────────────────────────────────────────────────┤
  13152. │   WORD   │  B  │  reserved sectors (strarting at logical sector 0)           │
  13153. ├──────────┤     ├─────────────────────────────────────────────────────────────┤
  13154. │   BYTE   │     │  number of FATs                                             │
  13155. ├──────────┤     ├─────────────────────────────────────────────────────────────┤
  13156. │   WORD   │  P  │  max number of root directory entries                       │
  13157. ├──────────┤     ├─────────────────────────────────────────────────────────────┤
  13158. │   WORD   │     │  number of sectors in logical image (total number of        │
  13159. │          │     │  sectors in media, including boot sector directories, etc.) │
  13160. ├──────────┤  B  ├─────────────────────────────────────────────────────────────┤
  13161. │   BYTE   │     │  media descriptor                                           │
  13162. ├──────────┤     ├─────────────────────────────────────────────────────────────┤
  13163. │   WORD   │     │  number of sectors occupied by a single FAT                 │
  13164. ├──────────┼─────┴─────────────────────────────────────────────────────────────┤
  13165. │   WORD   │  sectors per track                                                │
  13166. ├──────────┼───────────────────────────────────────────────────────────────────┤
  13167. │   WORD   │  number of heads                                                  │
  13168. ├──────────┼───────────────────────────────────────────────────────────────────┤
  13169. │   WORD   │  number of hidden sectors                                         │
  13170. └──────────┴───────────────────────────────────────────────────────────────────┘
  13171.  
  13172.  The three words at the end return information about the media. The number of
  13173. heads is useful for supporting different multihead drives that have the same
  13174. storage capacity but a different number of surfaces. The number of hidden
  13175. sectors is useful for drive partitioning schemes.
  13176.  
  13177.                          ############################
  13178.  
  13179. INPUT / OUTPUT  (IOCTL)
  13180. command code = 3   IOCTL Read
  13181.                4   Read              (block or character devices)
  13182.                8   Write             (block or character devices)
  13183.                9   Write With Verify
  13184.               12   IOCTL Write
  13185.               16   Output Until Busy (character devices only)
  13186.  
  13187.         ES:BX   pointer to 24-byte request header and data structure
  13188.  
  13189.   Format of structure:
  13190.         offset    length          field
  13191.         00h     13 bytes     request header
  13192.         0Dh        byte      media descriptor byte from BPB
  13193.         0Eh       dword      transfer address (buffer address)
  13194.         12h        word      byte/sector count
  13195.         14h        word      starting sector number (block devices)
  13196.                              [no meaning on character devices]
  13197.         16h       dword      (DOS 3.0+) pointer to the volume ID if error code
  13198.                              0Fh is returned
  13199.  
  13200. The driver must perform the following:
  13201.         A) set the status word in the request header
  13202.         B) perform the requested function
  13203.         C) set the actual number of sectors or bytes tranferred
  13204.  
  13205.  No error checking is performed on an IOCTL I/O call. However, the driver must
  13206. set the return sector or byte count to the actual number of bytes transferred.
  13207.  
  13208.  Under certain circumstances a block device driver may be asked to do a write
  13209. operation of 64k bytes that seems to be a "wrap around" of the transfer address
  13210. in the BIOS I/O packet. This arises due to an optimization added to write code
  13211. in DOS. It will only happen in writes that are within a sector size of 64k on
  13212. files that are being extended past the current end of file. It is allowable for
  13213. the device driver to ignore the balance of the write that wraps around, if it
  13214. so chooses. For example, a write of 10000h bytes worth of sectors with a
  13215. transfer address of XXX:1 ignores the last two bytes. A user program can never
  13216. request an I/O of more than 0FFFFh bytes and cannot wrap around (even to 0) in
  13217. the transfer segment, so in that case the last two bytes can be ignored.
  13218.  
  13219.  A program that uses DOS function calls can never request an input or output
  13220. function of more than 0FFFFh bytes, therefore, a wrap around in the transfer
  13221. (buffer) segment can never occur. It is for this reason you can ignore bytes
  13222. that would have wrapped around in the tranfer segment.
  13223.  
  13224.  If the driver returns an error code of 0Fh (invalid disk change) it must put
  13225. a DWORD pointer to an ASCIIZ string which is the correct volume ID to ask the
  13226. user to reinsert the disk.
  13227.  
  13228. DOS 3.0+:
  13229.  The reference count of open files on the field (maintained by the OPEN and
  13230. CLOSE calls) allows the driver to determine when to return error 0Fh. If there
  13231. are no open files (reference count=0) and the disk has been changed, the I/O
  13232. is all right, and error 0Fh is not returned. If there are open files
  13233. (reference count > 0) and the disk has been changed, an error 0Fh condition
  13234. may exist.
  13235.  
  13236.                          ############################
  13237.  
  13238. NONDESTRUCTIVE INPUT NO WAIT
  13239. command code = 5        (character devices only)
  13240.         Reads a character from input stream but does not remove it from the
  13241.         buffer
  13242.  
  13243.         ES:BX   pointer to 14-byte request header and data structure
  13244.  Format of structure:
  13245.         offset    length          field
  13246.         00h     13 bytes   request header
  13247.         0Dh        byte    read from device
  13248.  
  13249. The driver must do the following:
  13250.         A) return a byte from the device
  13251.         B) set the status word in the request header.
  13252.  
  13253.  If the character device returns busy bit=0 (characters in the buffer), then
  13254. the next character that would be read is returned. This character is not removed
  13255. form the buffer (hence the term nondestructive input). This call allows DOS to
  13256. look ahead one character.
  13257.  
  13258.                          ############################
  13259.  
  13260. STATUS
  13261. command codes =  6   Input Status      (character devices only)
  13262.                 10   Output Status     (character devices only)
  13263.         Check for characters waiting in input buffer
  13264.  
  13265.         ES:BX   pointer to 13-byte request header
  13266.  
  13267. This driver must perform the following:
  13268.         A) perform the requested function
  13269.         B) set the busy bit
  13270.         C) set the status word in the request header.
  13271.  
  13272. The busy bit is set as follows:
  13273.  
  13274.  For input on unbuffered character devices: if the busy bit (bit 9) is 1 on
  13275. return, a write request would wait for completion of a current request. If the
  13276. busy bit is 0, there is no current request. Therefore, a write request would
  13277. start immediately.
  13278.  
  13279.  For input on buffered character devices: if the busy bit is 1 on return, a
  13280. read request does to the physical device. If the busy bit is 0, there are
  13281. characters in the device buffer and a read returns quickly. It also indicates
  13282. that a user has typed something. DOS assumes all character devices have a type-
  13283. ahead input buffer. Devices that do not have this buffer should always return
  13284. busy=0 so that DOS does not hang waiting for information to be put in a buffer
  13285. that does not exist.
  13286.  
  13287.                          ############################
  13288.  
  13289. FLUSH INPUT BUFFERS
  13290. command code = 7        (character devices only)
  13291.         Forces all data in buffers to specified device.
  13292.  
  13293.         ES:BX   pointer to 13-byte request header
  13294.  
  13295.  This call tells the driver to flush (terminate) all pending requests that it
  13296. has knowledge of. Its primary use is to flush the input queue on character
  13297. devices.
  13298.  
  13299.  The driver must set the status word in the request header upon return.
  13300.  
  13301.                          ############################
  13302.  
  13303. FLUSH OUTPUT BUFFERS
  13304. command code 11         (character devices only)
  13305.         Forces all data in buffers to specified device.
  13306.  
  13307.         ES:BX   pointer to 13-byte request header
  13308.  
  13309.  
  13310.  This call tells the driver to flush all output buffers and discards any
  13311. pending requests. Its primary use is to flush the output queue on character
  13312. devices.
  13313.  
  13314.  The driver must set the status word in the request header upon return.
  13315.  
  13316.                          ############################
  13317.  
  13318. OPEN or CLOSE  (DOS 3.0+)
  13319. command code = 13   Open      (block or character devices)
  13320.                14   Close     (block or character devices)
  13321.  
  13322.         ES:BX   pointer to 13-byte static request header
  13323.  
  13324.  These calls are designed to give the device information about the current file
  13325. activity on the device if bit 11 of the attribute word is set. On block
  13326. devices, these calls can be used to manage local buffering. The device can keep
  13327. a reference count. Every OPEN causes the device to increment the reference
  13328. count. Every CLOSE causes the device to decrement the reference count. When the
  13329. reference count is 0, if means there are no open files in the device. Therefore,
  13330. the device should flush buffers inside the device it has written to because now
  13331. the user can change the media on a removeable media drive. If the media had been
  13332. changed, it is advisable to reset the reference count to 0 without flushing the
  13333. buffers. This can be thought of as "last close causes flush". These calls are
  13334. more useful on character devices. The OPEN call can be used to send a device
  13335. initialization string. On a printer, this could cause a string to be sent to set
  13336. the font, page size, etc. so that the printer would always be in a known state
  13337. in the I/O stream. Similarly, a CLOSE call can be used to send a post string
  13338. (like a form feed) at the end of an I/O stream. Using IOCTL to set these pre and
  13339. post strings provides a flexible mechanism of serial I/O device stream control.
  13340.  
  13341.  Since all processes have access to STDIN, STDOUT, STDERR, STDAUX, and STDPRN
  13342. (handles 0, 1, 2, 3, and 4) the CON, AUX, and PRN devices are always open.
  13343.  
  13344.                          ############################
  13345.  
  13346. REMOVABLE MEDIA  (DOS 3.0+)
  13347. command code = 15       (block devices only)
  13348.         This call identifies the media type as removable or nonremovable.
  13349.  
  13350.         ES:BX   pointer to 13-byte static request header
  13351.  
  13352.  To use this call, set bit 11 (removable media) of the attribute field to 1.
  13353. Block devices can only use this call through a subfunction of the IOCTL
  13354. function call (int 21h fn44h).
  13355.  This call is useful because it allows a utility to know whether it is dealing
  13356. with a nonremovable media drive or with a removable media drive. For example,
  13357. the FORMAT utility needs to know whether a drive is removable or nonremovable
  13358. because it prints different versions of some prompts.
  13359.  
  13360. note    No error checking is performed. It is assumed that this call always
  13361.         succeeds.
  13362.  
  13363.  
  13364. THE CLOCK$ DEVICE├─────────────────────────────────────────────────────────────
  13365.  
  13366.  To allow a clock board to be integrated into the system for TIME and DATE,
  13367. the CLOCK$ device is used. This device defines and performs functions like any
  13368. other character device (most functions will be reset done bit, reset error bit,
  13369. and return). When a read or write to this device occurs, 6 bytes are
  13370. transferred. The first 2 bytes are a word, which is the count of days since
  13371. 01-01-80. The third byte is minutes, the fourth is hours, the fifth is
  13372. hundredths of a second, and the sixth is seconds.
  13373.  
  13374.  Reading the CLOCK$ device gets the date and time, writing to it sets the date
  13375. and time. CLOCK$ is normally called only when the system is initializing or if
  13376. the system time and date are set (DOS 3.3+). DOS carries the system time and
  13377. date internally after receiving it from the CLOCK$ driver.
  13378.  
  13379.  
  13380.  
  13381.  
  13382.  
  13383.        **  Programmer's Technical Reference for MSDOS and the IBM PC **
  13384.                 USA copyright TXG 392-616  ALL RIGHTS RESERVED
  13385. ───────────────────────────────┤ DOSREF (tm) ├────────────────────────────────
  13386.                      ISBN 1-878830-02-3 (disk-based text)
  13387.                     Copyright (c) 1987, 1991 Dave Williams
  13388.                         ┌─────────────────────────────┐
  13389.                         │ Shareware Version, 12/25/91 │
  13390.                         │  Please Register Your Copy  │
  13391.                         └─────────────────────────────┘
  13392.  
  13393.  
  13394.                                  C R E D I T S
  13395.  
  13396.  The information presented here was gathered from megabytes of files found on
  13397. BBS systems, conversations on a dozen different BBS systems, correspondence,
  13398. and every reference book I could get my hands on. On occasion, a number of
  13399. prestigious references didn't agree with each other. Where this has happened, I
  13400. have used the latest references. There is too much information here for me to
  13401. verify every fact personally. I have used my own judgement as to the
  13402. reliability of the sources.
  13403.  
  13404.  I've been selling copies of the Reference since October 1987.  The original
  13405. basis for the Reference came from Peter Norton's "Programmer's Guide to the
  13406. IBM PC" and the original Janet Jack interrupt list circa sometime 1986, as
  13407. updated by Ross Greenberg. Anyway, I've prepared a list of the sources I've
  13408. used for the Reference to clear up any ambiguities.
  13409.  
  13410.  
  13411.  
  13412. Tools used in preparing this book:
  13413.  
  13414.  
  13415. Microsoft SymDeb, the final gasp of venerable DEBUG.COM and a fine program.
  13416.  
  13417. Microsoft CodeView, huge and awkward though it may be.
  13418.  
  13419. V Communications Sourcer, the only effective disassembler I've found.
  13420.  
  13421.  
  13422.  
  13423. References used in preparing this book:
  13424.  
  13425.  
  13426. AST EEMS Technical Reference Manual v3.2
  13427.         documents 020022-001B and 000408-001B
  13428.         provided by AST Corporation, 1987
  13429.  
  13430. AT&T 6300 Plus Hardware Reference Manual
  13431.         p/n 999-300-194IS
  13432.         from AT&T Corp, 1985 (before the Death Star logo, yet...)
  13433.  
  13434. Creative Labs Sound Blaster User Reference Manual
  13435.         copr. 1989
  13436.  
  13437. Data General Programmer's Reference for MS-DOS, Rev.3
  13438.         Data General Corporation             (covers through DOS 3.0)
  13439.         p/n 069-100157 rev 00 May 1986
  13440.  
  13441. Digital Research DR-DOS System and Programmer's Guide v3.32
  13442.         Digital Research Corporation 1988
  13443.         comment: This manual does not cover the extended disk partition access,
  13444.                  file password protection, or any of the other goodies
  13445.                  provided in DR-DOS. In fact, it not only doesn't cover the
  13446.                  extended features, it doesn't completely cover DOS calls
  13447.                  documented by IBM. It does have an extensive section on
  13448.                  customizing DR-DOS for use from ROM.
  13449.  
  13450. Digital Research DR-DOS User's Guide v3.32
  13451.         Digital Research Corporation 1988
  13452.  
  13453. Digital Research DR-DOS Reference Guide v3.32
  13454.         Digital Research Corporation 1988
  13455.  
  13456. Digital Research DR-DOS Users and Reference Guide v3.40
  13457.         Digital Research Corporation, January 1989
  13458.  
  13459. Digital Research DR Multiuser DOS Users and Reference Guide v5.0
  13460.         Digital Research Corporation, 1991
  13461.  
  13462. Digital Research DR-DOS Users and Reference Guide v5.0
  13463.         Digital Research Corporation, 1991
  13464.  
  13465. DPMI 0.9 Specification
  13466.         Intel Corp, 1990
  13467.  
  13468. DPMI 1.0 Specification
  13469.         Intel Corp, 1991
  13470.  
  13471. An Introduction to the DOS Protected Mode Interface
  13472.         Software Focus Group
  13473.         Intel Corp, March 1991   order # 240787-002
  13474.  
  13475. IBM DOS Operations Manual Version 2.00
  13476.         IBM Corp, 1983
  13477.  
  13478. IBM DOS Operations Manual Version 2.10
  13479.         IBM Corp, 1983
  13480.  
  13481. IBM DOS Operations Manual Version 3.1
  13482.         IBM Corp, November 1984
  13483.  
  13484. IBM DOS Operations Manual Version 3.3
  13485.         IBM Corp, April 1987
  13486.  
  13487. IBM DOS Technical Reference, Version 4.0
  13488.         IBM Corp, 1988
  13489.  
  13490. IBM DOS Command Reference, Version 4.0
  13491.         p/n 6280254
  13492.         IBM Corp, 1988
  13493.  
  13494. IBM PC Local Area Network Program Version 1.20
  13495.         IBM Corp, April 1987
  13496.  
  13497. IBM Technical Reference
  13498.         Options and Adapters - Enhanced Graphics Adapter
  13499.         p/n 6280131  IBM Publications Aug 1984
  13500.  
  13501. IBM Technical Reference
  13502.         Personal Computer
  13503.         p/n 6322507 IBM Publications
  13504.  
  13505. IBM Technical Reference
  13506.         Personal Computer - PCjr
  13507.         p/n 1502293 IBM Publications
  13508.  
  13509. LANtastic Programmer's Information Package, 2/21/89
  13510.  
  13511. Logitech Mouse Programmer's Toolkit
  13512.         Logitech Corp. 1986
  13513.  
  13514. Lotus-Intel-Microsoft Expanded Memory Specification Version 3.20
  13515.         part number 300275-003
  13516.         provided by Intel Corp.  September, 1985
  13517.  
  13518. Lotus-Intel-Microsoft Expanded Memory Specification 4.0
  13519.         document 300275-005
  13520.         provided by Intel Corp.  October 1987
  13521.  
  13522. Lotus-Intel-Microsoft Expanded Memory Specification 4.0
  13523. EMS Toolkit for C Developers
  13524.         document 302243-001
  13525.         provided by Intel Corp, February 1990
  13526.  
  13527. Microsoft - various documents provided to MS 5.0 beta testers
  13528.  
  13529. Microsoft Extended Memory Specification v2.00
  13530.         provided by Microsoft Corporation,  1988
  13531.  
  13532. Microsoft Mouse Technical Reference
  13533.         Microsoft Press, 1989
  13534.  
  13535. Mouse Systems Programmer's Toolkit
  13536.         p/n 302449-001 Rev A, 1989
  13537.         p/n 302375-100, 1989
  13538.         p/n 302446-100, 1989
  13539.  
  13540. MS-DOS Programmer's Reference                (covers through DOS 2.00)
  13541.         by Microsoft
  13542.         p/n 135555-001 Intel Corp. 1984
  13543.  
  13544. MS-DOS 5.0 Programmer's Reference            (covers DOS 5.0 only)
  13545.         by Microsoft
  13546.         Microsoft Press 1991, ISBN 1-55615-329-5
  13547.  
  13548. Phar Lap Virtual Control Program Interface (VCPI) Specification v1.0
  13549.         Phar Lap Software 1989
  13550.  
  13551. Tandy 1000 TX Technical Reference Manual
  13552.         Tandy Corp.
  13553.         p/n 25-1514  Tandy Corp 1987
  13554.  
  13555. The Software Link
  13556.         PC-MOS 4.1 Programmer's Reference
  13557.  
  13558. Toshiba 1000 Technical Reference Manual
  13559.         Toshiba Corp. of America 1987
  13560.  
  13561. Tseng Labs EVA Chipset Programming Guide
  13562.         Tseng Labs, 1986
  13563.  
  13564. X3.4-1977: American National Standard Code for Information Interchange
  13565.         by American National Standards Institute (ANSI)
  13566.         New York, NY  1977
  13567.  
  13568. Weitek ABACUS Software Designer's Guide, Doc 8967
  13569.         September 1989
  13570.  
  13571. Wendin, Inc
  13572.         Wendin-DOS Programmer's Reference
  13573.  
  13574. **********************
  13575.  
  13576. ATI EGA Wonder Operation Manual
  13577.         ATI Technologies, 1987
  13578.  
  13579. Everex EV-650 EGA Reference Guide, Version 1.00
  13580.         Everex Computer, 1986
  13581.  
  13582. FastCard IV User Manual
  13583.         Peripheral Marketing Inc.
  13584.         p/n 0527        Jan 1987
  13585.  
  13586. Hercules Graphics Card User's Manual
  13587.         Hercules Computer Technology
  13588.         1983
  13589.  
  13590. Hercules Graphics Card Plus Owner's Manual
  13591.         Hercules Computer Technology
  13592.         Model GB112  1987
  13593.  
  13594. JDR B-3101 FLoppy Disk Drive Card User's Guide
  13595.         470.03002 version 1.00    1988
  13596.  
  13597. LANtastic 2.46 Installation Guide
  13598.         Artisoft, 1988
  13599.  
  13600. LANtastic 3.01 Installation Guide
  13601.         Artisoft, 1990
  13602.  
  13603. LANtastic 4.0 beta Installation Guide
  13604.         Artisoft, 1991
  13605.  
  13606. LapLink Release 2 User's Manual
  13607.         Traveling Software, 1987
  13608.  
  13609. LapLink Release 3 User's Manual
  13610.         Traveling Software, 1989
  13611.  
  13612. Logitech EGA Reference Manual, EGA+Mouse Board
  13613.  
  13614. Mirage Super VGA TVGA-8900 User's Manual
  13615.  
  13616. MPC Operations Guide,  Manual #1023
  13617.         Columbia Data Products, Inc.
  13618.         CDP  1983
  13619.  
  13620. Microcomputer Products - 1987 Data Book
  13621.         NEC Electronics, Inc.
  13622.         p/n 500105      Aug 1987
  13623.  
  13624. NEC uPD70108/70116 Microprocessor User's Manual
  13625.         p/n 500350      October 1986
  13626.         provided by NEC Electronics, Inc.
  13627.  
  13628. Novell Advanced Netware System Manager's Reference
  13629.  
  13630. pcAnywhere User's Guide v2.00
  13631.         Dynamic Microprocessor Associates, Inc  1986
  13632.  
  13633. S-286 User Manual, version 2
  13634.         Link Computer, 1988
  13635.  
  13636. STB VGA Extra/EM
  13637.         EM-16 BIOS Features
  13638.         STB Corp.
  13639.  
  13640. TesSeRact v1.0 documentation
  13641.  
  13642. TCXL 5.1 documentation
  13643.  
  13644. Toshiba ND352/356 3.5" Diskette Drive Installation Notes
  13645.         document number 87019   March 1988
  13646.         Toshiba America Corporation
  13647.  
  13648. Tseng Labs
  13649.         EVA, EVA/480 BIOS Guide
  13650.         November 10, 1988
  13651.  
  13652. VESA Toolkit v2.0
  13653.         summer 1991
  13654.  
  13655. VideoTrax Installation Guide
  13656.         Alpha Micro, 1987
  13657.  
  13658. ******************
  13659.  
  13660. Advanced MSDOS
  13661.         Ray Duncan
  13662.         Microsoft Press  1986
  13663.  
  13664. Assembly Language Programming for the IBM Personal Computer
  13665.         David J. Bradley
  13666.         Prentice-Hall   1984
  13667.  
  13668. Assembly Language Subroutines for MSDOS Computers
  13669.         Leo J. Scanlon
  13670.         TAB Books   1986
  13671.  
  13672. Atari ST Internals
  13673.         Gerits, English, & Bruckmann
  13674.         Abacus Software  1985
  13675.  
  13676. Compute!'s Guide to Assembly Language Programming on the IBM PC
  13677.         COMPUTE! Publications
  13678.  
  13679. Compute!'s Mapping the IBM PC and PCjr
  13680.         Russ Davis
  13681.         COMPUTE! Publications
  13682.  
  13683. DOS Power Tools
  13684.         Paul Somerson
  13685.         Bantam Books  1988
  13686.  
  13687. DOS: The Complete Reference
  13688.         Kris Jamsa
  13689.         Osborne/McGraw-Hill  1987
  13690.  
  13691. Exploring the IBM PCjr
  13692.         Peter Norton
  13693.         Microsoft Press  1984
  13694.  
  13695. Discovering the IBM PCjr
  13696.         Peter Norton
  13697.         Microsoft Press  1984
  13698.  
  13699. IBM Video Subsystems
  13700.         Richard Wilton
  13701.         Microsoft Press  1988
  13702.  
  13703. Inside the IBM PC
  13704.         Peter Norton
  13705.  
  13706. Mapping the IBM PC
  13707.         Russ Davies/Compute! Magazine
  13708.         Compute! Books   1986
  13709.  
  13710. Memory Resident Utilities, Interrupts, and Disk Management With MS & PC DOS
  13711.         Michael Hyman
  13712.         MIS Press  1987
  13713.  
  13714. Microcomputer Interfacing
  13715.         Bruce A. Artwick
  13716.         Prentice Hall   1980
  13717.  
  13718. Microsoft Systems Journal - March 1987
  13719.         "Expanded Memory: Writing Programs that Break the 640k Barrier"
  13720.         Marion Hansen, Bill Krueger, Nick Stuecklen
  13721.  
  13722. MS-DOS Encyclopedia
  13723.         Ray Duncan
  13724.         Microsoft Press 1988  (first edition)
  13725.  
  13726. Network Programming in C
  13727.         Barry Nance  (barryn on BIX)
  13728.         Que, 1990
  13729.  
  13730. Operating Systems Design and Implementation
  13731.         Arthur S. Tanenbaum
  13732.         Prentice Hall 1987
  13733.  
  13734. Programmer's Guide to the IBM PC
  13735.         Peter Norton
  13736.         Microsoft Press  1985
  13737.  
  13738. Programmer's Problem Solver for the IBM PC, XT, & AT
  13739.         Robert Jourdain
  13740.         Prentice Hall  1986
  13741.  
  13742. Running MS-DOS
  13743.         Van Wolverton
  13744.         Microsoft Press
  13745.  
  13746. Supercharging MS-DOS
  13747.         Van Volverton
  13748.         Microsoft Press  1986
  13749.  
  13750. The 8080a Bugbook
  13751.         Tony-Larsen-Titus
  13752.         Howard W. Sams   1977
  13753.  
  13754. The 8086 Book
  13755.         Russell Rector and George Alexy
  13756.         Osborne/McGraw-Hill  1980
  13757.  
  13758. The IBM Personal Computer from the Inside Out
  13759.         Murray Sargent III and Richard L. Shoemaker
  13760.         Addison-Wesley  1984
  13761.  
  13762. The IBM ROM BIOS
  13763.         Ray Duncan
  13764.         Microsoft Press  1988
  13765.  
  13766. The Serious Assembler
  13767.         Charles A. Crayne and Dian Gerard
  13768.         Baen Books   1985
  13769.  
  13770. Tricks of the MS-DOS Masters
  13771.         Waite Group
  13772.         Howard W. Sams  1987
  13773.  
  13774. Turbo Pascal Express
  13775.         Robert Jourdain
  13776.         Brady Books, 1987
  13777.  
  13778. Writing DOS Device Drivers in C
  13779.         Adams/Tondo
  13780.         Prentice Hall, 1990
  13781.  
  13782. ***********************
  13783.  
  13784. Microsoft Macro Assembler 4.0, 5.1 documentation
  13785.  
  13786. Microsoft C 4.0 documentation
  13787.  
  13788. Borland Turbo Pascal 3.02a and 5.0 documentation, Turbo C 2.0 documentation
  13789.  
  13790. Novell SFT System Administrator's Reference
  13791.  
  13792. ***************************
  13793.  
  13794.  Western Digital, Rodime, Miniscribe, Microscience, Adaptec, Storage
  13795. Technologies, and Connor Peripherals were kind enough to send spec sheets on
  13796. most of their products which helped to expand and verify the hard drive
  13797. information in Appendix 6.
  13798.  
  13799. ***************************
  13800.  
  13801.  A large amount of miscellaneous information came from various computer
  13802. magazines. Documenting what came from where would be an experience all its
  13803. own. A great deal of information came from articles by Michael Mefford and
  13804. Charles Petzold of PC Magazine, and Neil Rubenking, Jeff Duntemann, and
  13805. Ray Duncan, who get around a lot.
  13806.  
  13807.    Byte
  13808.         ( Byte's kinda weird. They have some really neat, well-researched
  13809.           stuff interspersed with mindless drivel.  Still, they print some
  13810.           stuff you absolutely, positively won't find anywhere else. )
  13811.  
  13812.    C'T (Computer Technik)
  13813.         ( If you read German, this one is sorta like PC Magazine was in its
  13814.           heyday. )
  13815.  
  13816.    Computer Language
  13817.         ( I never decided if I liked CL or not.  Maybe I'm not the sort of
  13818.           programmer they're writing for... )
  13819.  
  13820.    Computer Shopper
  13821.         ( Though primarily advertising, some information sneaks in from time
  13822.           to time. )
  13823.  
  13824.    Dr. Dobb's Journal
  13825.         ( I always thought the old title, "Doctor Dobbs' Journal of Computer
  13826.           Calisthenics and Orthodontia - Running Light Without Overbyte" was
  13827.           a killer name, but nobody asked me. )
  13828.  
  13829.    InfoWorld
  13830.         ( I never really figured out how a weekly magazine could so often be
  13831.           both late *and* wrong with their stories, but IW tries hard. Still,
  13832.           you often hear about rumblings you'd never find out about in the
  13833.           slicks. The National Enquirer of the computer world? )
  13834.  
  13835.    Micro Cornucopia
  13836.         ( R.I.P - it was great while it lasted. )
  13837.  
  13838.    Microsoft Systems Journal
  13839.         ( Hideously expensive and mostly oriented to Windows and OS/2, the
  13840.           early issues had some really good stuff )
  13841.  
  13842.    Midnight Engineering
  13843.         ( This one's hard to classify.  It's hardcore computer with a dash
  13844.           of entrepreneurship, bizarre as the combination may sound.  I like
  13845.           it when I can find it. )
  13846.  
  13847.    PC Magazine
  13848.         ( Despite their new "management format" in mid '89, PC Mag still has
  13849.           some good techie stuff from time to time. I guess the bean counters
  13850.           thought managers were more important than programmers. )
  13851.  
  13852.    PC Resource
  13853.         ( There was rarely anything of interest in PC Resource, but every
  13854.           now and then I found something. Now defunct. )
  13855.  
  13856.    PC Tech Journal
  13857.         ( "Tell 'em what you're going to say, tell 'em what you're saying, tell
  13858.           'em what you just said." - and don't send us no steenking submissions
  13859.           unless they're in WordPerfect format! Despite their fascist policies,
  13860.           every now and then they printed something useful. The Little Rock
  13861.           Wild Bunch refered to it as "PC Tech Urinal," an apt monicker. Now
  13862.           defunct. )
  13863.  
  13864.    PC Techniques
  13865.         ( This is the magazine PC Tech Journal tried to advertise itself as.
  13866.           Pure programming, written by programmers for programmers, without
  13867.           too many "journalists" pissing in the text. Try it! )
  13868.  
  13869.    Programmer's Journal
  13870.         ( This is a nice magazine, though expensive. )
  13871.  
  13872.    Tech Specialist
  13873.         ( One of the few really good magazines for bit-twiddlers.  Haven't
  13874.           seen a GUI phone-dialer shootout yet! )
  13875.  
  13876. ****************************
  13877.  
  13878. various computer bulletin board systems, including
  13879.  
  13880. Byte Information Exchange (BIX)
  13881.  (check out ibm.dos/old.secrets.2 and ibm.dos/secrets.3)
  13882.  
  13883.  Effusive thanks to the gang in the ibm.exchange - these guys are *sharp*.
  13884.  In alphabetic order:
  13885.  
  13886.  barryn, billn, daiken, dgh, dmick, dnanian, dondumitru, drifkind, geary,
  13887.  glass, gmussar, greenber, hfishman, j_vanderbilt, jdunlap, jlussmeyer, johnf,
  13888.  jsloman, jsprowl, jswitzer, jrichards, mike123, rbabcock, rbrukardt, rduncan,
  13889.  roedy, sjgrant, skluger, terjem, twagner, wardc, wcowley, and all the guys
  13890.  whose names forgot... <grin>
  13891.  
  13892. Compuserve IBM SIG
  13893.  
  13894. FIDOnet international network       (various technical echos)
  13895.  
  13896. GEnie IBM RT and Borland RT
  13897.  
  13898. PCanada BBS system                  (Toronto, Canada)
  13899.  
  13900. RIME PCRelay international network  (IBM, Technical, Programming echos)
  13901.  
  13902. TelePath
  13903.  
  13904. *********************************
  13905.  
  13906. The following text files were of use. Bear in mind that some of them may be
  13907. seen under several different names. The author's name is given as it appears
  13908. in the documentation (if any).
  13909.  
  13910. 10H-BUG  ASM     4680  29/01/87 bug in 2.x int 21h/fn10h             Ray Duncan
  13911.  
  13912. 1PT4MB   INF     5120   3/10/87 1.44Mb drives         Clyde Washburn 70305,1211
  13913.  
  13914. 2EH      ASM     2969   3/03/87 info on undoc'd int 2Eh           David Gwillim
  13915.  
  13916. 386BUG   ARC     9216  15/10/87 bug in early 80386 chips           Compaq Corp.
  13917.  
  13918. 8086     3      10572   5/12/88 dump of Fidonet?? 8086 conf??         <no name>
  13919.  
  13920. 8259     ARC     2826  15/03/88 info on 8259 chip                     <no name>
  13921.  
  13922. APICALLS ARC    11481   8/01/88 OS/2 API function call list          Bill Earle
  13923.  
  13924. ASM-ADRS ARC     6144  20/12/87 low memory vectors         Malcolm McCorquodale
  13925.  
  13926. ATCMDS   ARC     3072  20/03/88 Hayes 1200 baud command set           <no name>
  13927.  
  13928. BACKDOOR UPL    26115  11/12/89 "back door" through PSP            John Switzer
  13929.  
  13930. BIOSDOC  ARC    34816   3/11/87 very good function list         David E. Powell
  13931.  
  13932. BIXDOS1  ARC   155648  14/12/87 BIX "MSDOS Secrets" #1                <no name>
  13933.  
  13934. BUG40DOS ARC     3200  18/08/88 bugs in DOS 4.0                          "Doug"
  13935.  
  13936. CAS      ARC    33792  27/10/88 Communicating Applications Standard 1.0A
  13937.                                                                 DCA, Intel Corp
  13938.  
  13939. CCPM86   ARC    68238  14/10/89 list of Concurrent CP/M calls         <no name>
  13940.  
  13941. CDOS     ARC    35584  18/07/89 list of Concurrent DOS calls         Guy Scharf
  13942.  
  13943. CDOS2_   ARC   227200  18/07/89 list of Concurrent DOS calls      J. F. Jankura
  13944.  
  13945. CDOSCALL ARC    19968  18/07/89 list of Concurrent DOS calls      J. F. Jankura
  13946.  
  13947. CUFEXT   ARC    13228  13/03/90 common file extensions               J.W. Rider
  13948.  
  13949. DEBUGTUT ARC    15655  23/04/88 DEBUG tutorial                        <no name>
  13950.                                                         possibly David Whitman?
  13951.  
  13952. DIAGNOSE ARC    14336   1/01/86 memory errcodes  Jerry Schneider, Arnold Kischi
  13953.  
  13954. DISK144  ARC    23086  16/10/88 info on 1.44Mb diskettes              <no name>
  13955.  
  13956. DISKTYPE ARC     5073  14/04/88 IBM floppy formats                    <no name>
  13957.  
  13958. DOOM     ARC     9216  29/09/88 hard drive information                <no name>
  13959.  
  13960. DOS-SIZE ARC      787  27/03/88 size of DOS files 1.1-3.1             <no name>
  13961.  
  13962. DOS3TXT  ARX     9168  31/07/85 list of DOS/BIOS ints, data areas   Dan Rollins
  13963.  
  13964. DOS32    ARC    17408  31/05/88 command list for DOS 3.2              <no name>
  13965.  
  13966. DOS3BUGS ARC     5639  15/10/87 acknowledged bugs in DOS 3.0-3.2      IBM Corp.
  13967.  
  13968. DOS40    ARC    15625  22/07/88 IBM announcement of DOS 4.0           IBM Corp.
  13969.  
  13970. DOS401   ARC    18178  19/10/88 errors in DOS 4.0                     IBM Corp.
  13971.  
  13972. DOS40B   ARC    27008  26/08/88 Compuserve thread on DOS 4.0          <no name>
  13973.  
  13974. DOS40FAT ARC     1510  11/09/88 DOS 4.0 File Allocation Table       Mike Austin
  13975.  
  13976. DOS40FUN ZOO     3410  31/12/99 DOS 4.0 int 24, 25, etc               Pat Myrto
  13977.  
  13978. DOS40HLP ARC    53376  28/08/88 DOS 4.0 command set                   <no name>
  13979.  
  13980. DOS40TXT ARC    46169  16/10/88 DOS 4.0 problems & info               <no name>
  13981.  
  13982. DOS4TIPS ARC     1735  19/09/88 problems with DOS 4.0                 IBM Corp.
  13983.  
  13984. DOSBUG   TXT     1024  15/10/87 info on 2.0 volume label              <no name>
  13985.  
  13986. DOSGUIDE ARC    21344  21/02/88 DOS tutorial                Carrington B. Dixon
  13987.  
  13988. DOSINT   ARC     4201  15/03/88 list of DOS 2.0 function calls     John Chapman
  13989.  
  13990. DOSNOTES ARC     5052  15/03/88 info on DOS undoc fns.                <no name>
  13991.  
  13992. DOSREF   ARC     9216  21/01/87 partial list of PC BIOS calls         <no name>
  13993.  
  13994. DOSREF   ARC    62052  23/08/86 device driver info                    "Cracker"
  13995.  
  13996. DOSTIPS  ARC    28926  15/03/88 info on DOS                        John Chapman
  13997.  
  13998. DOSTIPS1 ARC   159657  25/11/85 various DOS info                   Dean R. Wood
  13999.  
  14000. DOSTIPS3 ARC    59264  25/01/88 various DOS tips (different)       Dean R. Wood
  14001.  
  14002. DOSUNDOC ARC     3840  03/05/86 one of the very first interrupt lists
  14003.                                                            Spyros Sakellariadis
  14004.  
  14005. DRIVPARM ARC    11264   7/01/88 info on DRIVPARM parameters      Joan Friendman
  14006.  
  14007. EGATEK   ARC     8704  15/03/88 IBM EGA registers                   Bill Frantz
  14008.  
  14009. EMS40BIX ARC     3802  21/09/87 BIX announcement of EMS 4.0                 BIX
  14010.  
  14011. ENVIRONM ARC     4255  18/09/88 info on DOS environment           Jan Fagerholm
  14012.  
  14013. ESC_CODE ARC     3072   3/10/88 Laserjet setup codes                     S. Noh
  14014.  
  14015. FILEIO   ARC     8192  24/07/88 TSRs and INDOS flag                   <no name>
  14016.  
  14017. FLOPPIES ARC     9216   2/11/87 info on floppy media                 Ted Jensen
  14018.  
  14019. FOSSIL   ARC     9031  15/07/87 list of FOSSIL functions       Vincent Periello
  14020.  
  14021. FXN4BH   ASM     4503   1/01/80 odd 4Bh behavior                     Ray Duncan
  14022.  
  14023. HAYESET2 ARC     6479   4/09/86 modem commands         Ruth Lubow, Fowler Brown
  14024.  
  14025. HD-DATA  ARC     4096  19/07/87 list of hard drives & specs           <no name>
  14026.                                 I've seen many similar files. I believe the
  14027.                                 original may have been a file or bulletin on
  14028.                                 Sparta BBS
  14029.  
  14030. HDINFO   ARC    11264  19/11/87 updated version of above, evidently by someone
  14031.                                 else                                  <no name>
  14032.  
  14033. HDNOISE  ARC     4159  11/11/87 hard disk information             Clancy Malloy
  14034.  
  14035. HDTIPS   ARC     9660  11/10/87 hard disk information              Barry Gordon
  14036.  
  14037. IBMTAB   ARC     7882  15/03/88 general IBM PC tech info            John S. Lou
  14038.  
  14039. IBMTECH  ARC   136064   4/11/88 error codes, other info               IBM Corp.
  14040.  
  14041. INT-MDOS ARC    20682  31/07/85 one of the original INT lists    Ross Greenberg
  14042.  
  14043. INTER189 LZH   156368  25/06/89 interrupt list                       Ralf Brown
  14044.  
  14045. INTERRUP ARC   157440  19/09/88 interrupt vector list                Ralf Brown
  14046.  
  14047. INTERRPT ARC    42632   4/04/88 interrupt vector list         Marshall Presnell
  14048.                                 this is a very nice list and some programming
  14049.                                 information. If I'd come across it way back
  14050.                                 then it would have saved a ton of typing <sigh>
  14051.  
  14052. JARGON   ARC    49274  16/07/88 dictionary of computer terms          <no name>
  14053.  
  14054. LE_MCLCK.ASM     3489   3/27/86  undoc'd Leading Edge BIOS fns      Bob Plouffe
  14055.  
  14056. LIM-40   ARC    21504  15/10/87 info on LIM 4.0                Stephen Satchell
  14057.  
  14058. LISTINTS ARC     6144   3/12/87 small interrupt list                  <no name>
  14059.  
  14060. MCB      ARC     5120  24/07/88 info on DOS Memory Control Blocks David Gwillim
  14061.  
  14062. MNP-TEXT ARC     6144  30/09/88 MNP modem info                       Mike Focke
  14063.  
  14064. MOUSENG  ARC    10240  13/08/88 Norton Guide file for mouse programming, with
  14065.                                 C examples                            <no name>
  14066.  
  14067. MSLOOKUP ARC    58368  25/12/87 interrupt and function listing     Frank Bonita
  14068.  
  14069. MS-OS2   ARC    25600  15/10/87 MS press release on OS/2        Microsoft Corp.
  14070.  
  14071. MSINT125 ARC    48128  12/01/88 interrupt vector listing             Ralf Brown
  14072.  
  14073. NETBIOS  ARC    17280  29/10/88 NetBIOS tutorial & summary         Tom Thompson
  14074.  
  14075. NOVELINT ARC     4531  18/10/88 NetBIOS calls                        Marc Guyot
  14076.  
  14077. OCOM_520 ARC    53632  19/08/88 FOSSIL tutorial and functions        Rick Moore
  14078.  
  14079. ODDITY   ARC     3072  24/07/88 int 2Eh description               Daniel Briggs
  14080.  
  14081. PINS     ARC     3072  18/01/88 pinouts of various connectors         <no name>
  14082.  
  14083. QUES40   ARC     9081   1/09/88 info on DOS 4.0                       IBM Corp.
  14084.  
  14085. RAW_COOK ARC     2048  15/10/87 info on DOS raw and cooked modes      <no name>
  14086.  
  14087. RESETSWT TXT     3584  23/01/86 add a reset switch to a PC          Don Jenkins
  14088.  
  14089. RLLHINTS ARC    12288  17/10/87 RLL controller info                 Steve Sneed
  14090.  
  14091. RLLMISC  ARC     5120  17/10/87 info on RLL controllers        Richard Driggers
  14092.  
  14093. RLLSTORY ARC     9718  31/07/88 good info on RLL coding           Pete Holzmann
  14094.  
  14095. SEAGATE  ARC     2048   3/03/88 specs for many Seagate drives        Jim McKown
  14096.  
  14097. SECRETS2 ARC   179625  17/04/88 BIX "MS-DOS Secrets" #2               <no name>
  14098.  
  14099. SERCBL2  ARC     4372  16/10/88 serial cable pinouts                   Lee Zeis
  14100.  
  14101. SM2400   ARC     2296   9/08/86 Hayes 2400 baud command set           <no name>
  14102.  
  14103. SPOOL   DOC     29704  03/28/89 Versa-Spool API                     Jeff Newbro
  14104.  
  14105. SSTEP    ARC     2300  11/07/89 explanation of CPU single-step      Ed Burnette
  14106.  
  14107. ST225    ARC    11264   7/10/87 optimizing ST225 and WD cont.         Neil Erbe
  14108.  
  14109. TANDON   ARC     3612  21/02/88 info on Tandon drives             David Welcher
  14110.  
  14111. TECH     ARC    27827   8/05/88 misc tech info - Fidonet?             <no name>
  14112.  
  14113. TOOLS    C      14032   8/10/89 Grid laptop special functions  Fredrick Coffman
  14114.  
  14115. TOS               938  24/03/88 TOS function calls                Mike Crawford
  14116.  
  14117. TRYST    ARC    29312  29/10/88 DOS and hard disk info               Amy Goebel
  14118.  
  14119. UNDOCINT 21H     7168  14/04/87 undocumented DOS calls           Peter Holzmann
  14120.  
  14121. VESA     TXT    41269  01/17/90 VESA standard                              VESA
  14122.  
  14123. VGAKIT   DOC     7634  05/04/90 VGA programming kit                John Bridges
  14124.  
  14125. VGAPIN   ARC     1252  24/10/88 VGA pinout                               "Mike"
  14126.  
  14127. WD-27X   ARC     6144  10/10/87 WD 27X HD controller setup        Steve Shelton
  14128.  
  14129. WDCONFIG ARC     5504  11/10/87 WD-1002 WXS setup              Richard Driggers
  14130.  
  14131. WDCONT   ARC    11264  25/12/87 info on WD hard disk controllers    Peter Fales
  14132.  
  14133. XEB1210  ARC     7947  18/07/87 Xebec HD controller setup      Richard Driggers
  14134.  
  14135. XEBEC    ARC     1036  30/04/88 setup for Xebec HD controller  Richard Driggers
  14136.  
  14137. XEBECTEC ARC     1834  30/04/88 setup for Xebec 1210                  <no name>
  14138.  
  14139. XGADEMO  LZH    23552  01/27/91 IBM XGA programming info v.50        Bert Tyler
  14140.  
  14141. XMS      ARC    75776   1/08/88 Microsoft Extended Memory Specification 1.0
  14142.                                                           Microsoft Corporation
  14143.  
  14144. XTCHARTS ARC    12416   4/11/88 ports, charts                         <no name>
  14145.  
  14146.                       **********************************
  14147.  
  14148. NBRCV.C      Paul McGinnis      NetBIOS API calls
  14149.  
  14150. DESQ10.ASM   James H. LeMay     DesqView API calls
  14151.  
  14152. NETTUT.DOC   Charles L. Hedrick TCP/IP network
  14153.  
  14154. CED10D       Chris Dunford      CED interrupt calls
  14155.  
  14156. LANTSTIC.DOC LANtastic adware   peer-to-peer LAN calls
  14157.  
  14158. GLOSSARY.ARC no author name     computer terms
  14159.  
  14160. 4DOS.DOC     Tom Rawson         4DOS int 2Eh, 2Fh calls, SHELL= bug
  14161.  
  14162.  
  14163. DOSREF isn't a tutorial, and sometimes you need a tutorial.  Microsoft has 
  14164. finally written a half-decent one - The MS-DOS Programmer's Reference,
  14165. Microsoft Press, 1991, ISBN 1-55615-329-5.  This is the DOS 5.0 Tech Ref.
  14166. It covers data structures and DOS programming concepts clearly.  However,
  14167. it has no information on other DOS versions, nor does it (of course) cover 
  14168. undocumented calls.
  14169.  
  14170.                      ------------------------------------
  14171.  
  14172.  Nothing gets written in a vacuum, and I'd like to express my thanks to all
  14173. the people who have been good enough to furnish information and support:
  14174.    (in alphabetical order)
  14175.  
  14176. Tommy Apple, Mike Crawford, Herman Diagostino, Joe Felix, Ron Melson,
  14177. Denis Murphy, & Ben Sansing,
  14178.         who all loaned me documentation and reference material for so long
  14179.         that some of them have forgotten to ask for their stuff back
  14180.  
  14181.  
  14182.  And those users who were kind enough to help out:
  14183.  
  14184. Mike Blaszczak, MA:                                        (blaszczak on BIX)
  14185.         who went rampaging through work and client's sites to find and
  14186.         document various model ID bytes, plus plenty of information on MS OBJ
  14187.         file formats
  14188.  
  14189. Carl Bretteville, Drammen Norway:
  14190.         who sent me a complete Concurrent DOS Programmer's Reference,
  14191.         considerably enriching the Norwegian postal service thereby
  14192.  
  14193. Herman Diagostino, Manassas VA:
  14194.         who worked up the TECHMENU menu file and provided a copy of the
  14195.         rare IBM DOS 4.0 Technical Reference and a copy of the original MSDOS
  14196.         Encyclopedia from Microsoft, info on the Pelican 5.5mb floppy drive,
  14197.         IBM DOS 4.0 command reference, many hard drive specs
  14198.  
  14199. James Drenter, Davenport IA:
  14200.         additional info on int 1Ch
  14201.  
  14202. David Dorling, Buderim, Australia:
  14203.         found one embarrassing error in the device driver info and provided
  14204.         many expansions and clarifications
  14205.  
  14206. Chris Dunford, Columbia MD:                                (CIS 76703,2002)
  14207.         who sent me a copy of the PCED 2.0 API
  14208.  
  14209. Steve Grant, Jersey City NJ:                               (sjgrant on BIX)
  14210.         who granted permission to include his excellent SYSID program with my
  14211.         distribution disks, furnished several model IDs
  14212.  
  14213. Roedy Green, Vancouver BC Canada:                          (roedy on BIX)
  14214.         many names and addresses for Appendix 5, serial and parallel port
  14215.         details and cabling, granted permission to include some of his very
  14216.         educational essays with my distribution disks, plus many details on
  14217.         DOS disk I/O
  14218.  
  14219. Michael Koepke, Wood Dale IL:
  14220.         pinouts on EGA feature connector, PS/2 keyboard connector, DR-DOS
  14221.         programming information, much info on Digital's DR-DOS
  14222.  
  14223. Curt Lankford, Little Rock, AR:
  14224.         loaned his copy of the AT&T 6300 Plus Hardware Technical Reference
  14225.  
  14226. Alan R. Levinstone, Garland TX:
  14227.         80286 LOADALL instruction
  14228.         BIOS Data Area floppy control parameters 40:8B, 40:8F, 40:90
  14229.  
  14230. Brian Long, Twyford UK:
  14231.         provided a copy of the then-nearly-unavailable DPMI 0.9 specification,
  14232.         plus port and address info
  14233.  
  14234. Keith Meade, Rochester MN:                                 (keithm on BIX)
  14235.         who provided a Microsoft Windows 2.11 SDK, copy of IBM TopView
  14236.  
  14237. Feico Nater, Hengelo, Netherlands:
  14238.         additions to FCB calls, several pages of expansions and clarifications
  14239.  
  14240. Bruce Nevins, Tucson AZ:                                   (bnevins on BIX)
  14241.         Irwin low-level tape drive info, DEC PC info
  14242.  
  14243. Patrick O'Riva, San Jose CA:
  14244.         info on what happens to the interleave when the BIOS is finished, and
  14245.         for his interesting online assembly-language magazine
  14246.  
  14247. Klaus Overhage, Stuttgart W.Germany:
  14248.         FANSI-CONSOLE system calls, and translating the TechRef into German
  14249.  
  14250. John Richards, England:                                    (jrichards on BIX)
  14251.         European DOS 4.0 information
  14252.  
  14253. Ben Sansing, Little Rock AR:
  14254.         ANSI.SYS information, documentation for the NEC V20/30 chips, reported
  14255.         error in register chart in Chapter 4, loaned his copy of PC-MOS/386
  14256.         for testing
  14257.  
  14258. Hans Schleichert, Marburg West Germany:
  14259.         information on int 2Fh, fn OAEh (internal DOS commands). Good thing
  14260.         I took some German in high school... <grin>
  14261.  
  14262. John Switzer, CA:                                          (jswitzer on BIX)
  14263.         who allowed me to include his discoveries on alternate DOS entries
  14264.         and file mysteries. (see BACKDOOR.ZIP on BIX, or Oct 1990 Dr. Dobbs')
  14265.  
  14266. Fred Thompson, Rapid City SD:
  14267.         loaned his Sound Blaster manual, provided much info on graphics
  14268.         programming
  14269.  
  14270. Matt Trask:                                                (matt.trask on BIX)
  14271.         who donated a complete copy of the TopView Programmer's Reference
  14272.  
  14273. Richard Vogh, Marietta GA:
  14274.         found several embarrassing errors in the boot sector chart in Chapter
  14275.         8. The shame! The shame! <sigh>
  14276.  
  14277. Jim Wenzel, North Little Rock AR:
  14278.         more PC model ID codes, loaned his copy of the Windows 3.0 SDK
  14279.  
  14280.  
  14281. The Software Link, Atlanta GA:
  14282.         provided a review copy of PC/MOS-386 and the programming guide
  14283.  
  14284. Digital Research, Monterrey CA:
  14285.         provided review copies of DR-DOS 5.0 and DRMDOS
  14286.  
  14287. Microsoft Corporation, Redmond WA:
  14288.         for beta-test versions of DOS 5.0, Windows 3.1, other products,
  14289.         information on DOS 5 and the DOSSHELL API
  14290.  
  14291.  Special thanks to Chris Dunford, who donated his "CED" program to the public
  14292. domain. If it wasn't for CED, I would likely have abandoned MSDOS machines
  14293. entirely and bought a Macin...uh... something else; and to Haruyasu Yoshizaki
  14294. for allowing unrestricted use of his LHarc program used to compress the files
  14295. on these diskettes.
  14296.  
  14297.  
  14298.                                                         Dave Williams
  14299.                                                     --------------------
  14300.                                                       Jacksonville, AR
  14301.  
  14302.  
  14303.  
  14304.        **  Programmer's Technical Reference for MSDOS and the IBM PC **
  14305.                 USA copyright TXG 392-616  ALL RIGHTS RESERVED
  14306. ───────────────────────────────┤ DOSREF (tm) ├────────────────────────────────
  14307.                      ISBN 1-878830-02-3 (disk-based text)
  14308.                     Copyright (c) 1987, 1991 Dave Williams
  14309.                         ┌─────────────────────────────┐
  14310.                         │ Shareware Version, 12/20/91 │
  14311.                         │  Please Register Your Copy  │
  14312.                         └─────────────────────────────┘
  14313.  
  14314.  
  14315.  
  14316.                             Additional Readings...
  14317.  
  14318.  
  14319.  I don't have and haven't seen most of this stuff, but I've come across
  14320. mentions of it. This list is purely FYI...
  14321.  
  14322.  IBM's literature guide lists the following manuals:
  14323.  
  14324. Hardware Technical References:
  14325. PS/2 Model 25            $31.50          75X1055
  14326. PS/2 Model 30            $82.50          68X2201
  14327. PS/2 Model 30/286        $26.75          01F0237
  14328. PC                       $33.00          6322507  (the original)
  14329. PC/AT                    $115.00         6280070
  14330. supplement for AT/339    $54.50          6280099  (enhanced 8mHz)
  14331. XT/286                   $55.00          68X2210
  14332. XT and Portable          $54.50          6280089
  14333. Convertible              $82.50          6280648
  14334. PCjr                     $38.50          1502293  (availability varies)
  14335.  
  14336. PS/2 Hardware Interface  $137.00         68X2330
  14337. (Micro Channel docs)
  14338.  
  14339. PS/2 BIOS Interface      $137.00         68X2341  (no source code listing)
  14340.  
  14341. Advanced BIOS Interface  $50             68X2288
  14342.  
  14343. DOS 3.3 Technical Ref.   $93.00          6280059  (no reference for 4.0)
  14344.  
  14345. DOS 4.0 Command Ref.     $31.50          6280253  (commands only)
  14346.  
  14347. 8514/A Developer's Guide $26.75          68X2279
  14348.  There is supposed to be a DOS 4.0 Technical Reference, but there's no name or
  14349. part number listed in the official IBM literature. You might check with your
  14350. local IBM retailer. (hah!)
  14351.  
  14352. DOS 4.0 Technical Ref.   $--.--          6280254  (not listed in catalog)
  14353.  
  14354. IBM NetBIOS Application
  14355. Development Guide (API)  $49.25          68X2270  (not listed in catalog)
  14356.  
  14357.  
  14358. address:
  14359. IBM Technical Directory                 800-426-7282
  14360. PO Box 2009                             414-633-8108
  14361. Racine WI 53404-3336         BC, Canada 112-800-465-1234
  14362.                                  Canada 800-465-1234
  14363. catalogs are free
  14364.  
  14365.  
  14366. Zenith Data Systems' "MS-DOS version 2 Programmer's Utility" comes with MASM,
  14367. a version of the MS-DOS Programmer's Reference from Microsoft, the assembly
  14368. language source for Zenith's ANSI.SYS driver, an editor, an assortment of
  14369. filters and utilities, and the source listing for the "device dependent"
  14370. portion of MS-DOS for the Z-151.
  14371.  
  14372.  
  14373. "Document Content Architecture: Revisable - Form - Text Reference"
  14374. IBM Document SC23-0758-1
  14375.  
  14376. IGES (International Graphics Exchange Specification) 3.0 documentation,
  14377. Global Engineering Documents (800) 854-7179. Part number NBSIR 86-3359, NBS.
  14378.  
  14379. ISBN 0-672-22027-X "Interfacing To the IBM Personal Computer" by
  14380. Lewis C. Eggebrecht, Howard W Sams & Co., Indianapolis, IN.
  14381.  
  14382. Intel Application Note AP-133, "Getting Started with the Numeric Data
  14383. Processor," by Bill Rash.  February 1981.
  14384.  
  14385. Intel iAPX 286 Programmer's Reference Manual, including the iAPX 286
  14386. Numeric Supplement, Intel part no. 210498-003.  Has some reasonably useful
  14387. example codes in section 4, including ASCII to binary and vice versa on
  14388. pages 4-7 to 4-14 and trig functions on 4-18 to 4-23.  The programming
  14389. style in these examples is rather bizarre but they are better than nothing.
  14390.  
  14391. Intel 80387 Programmer's Reference Manual,  Intel part no. 231917-001.
  14392. Various example listings on pages 7-7 to 7-17, including ASCII to binary
  14393. and binary to ASCII conversions and raising a number to a power.  No trig
  14394. routines in this manual because the 80387 has built-in FSIN, FCOS, and FSINCOS
  14395. instructions and generalized FPTAN and FPATAN instructions that make
  14396. subroutines  unnecessary.
  14397.  
  14398. Hercules sells a graphics library for the Herc board called GRAPHX for $50.
  14399.  
  14400. DoD Trusted Computer System Evaluation Criteria (popularly known as "The
  14401. Orange Book)  GPO Stock No  008-000-00461-7   Cost $6.00
  14402.  
  14403. Information Interchange Standards:
  14404.  
  14405.   ANSI X 3.15-1976        (FIPS 16-1)
  14406.     Bit Sequencing In Serial-By-Bit Data Transmission.
  14407.  
  14408.   ANSI X3.16-1976         (FIPS 17-1)
  14409.     Character Structure and Parity-Sense, Serial-By-Bit.
  14410.  
  14411.   ANSI X3.25-1976         (FIPS 18-1)
  14412.     Character Structure and Parity-Sense, Parallel-By-Bit.
  14413.  
  14414.   ANSI X3.4-1977          (FIPS 1-1)
  14415.     Code for Information Interchange
  14416.  
  14417.   ANSI X3.41-1974         (FIPS 35)
  14418.     Code Extension Techniques for Use With 7-Bit Coded Characters.
  14419.  
  14420.   ANSI X3.64-1979         (FIPS 86)
  14421.     Additional Controls for Use With...
  14422.  
  14423.   ANSI X3.32-1973         (FIPS 1)
  14424.     Graphic Representation of the Control Characters.
  14425.  
  14426.   ANSI X3.78-1981
  14427.     Representation of Vertical Carriage positoning Characters.
  14428.  
  14429.   ANSI X3.42-1975
  14430.     Representation of numeric values in Character Strings.
  14431.  
  14432.   ANSI X3.98-1983
  14433.     Page Image Format (PIF), Text, for Information Systems.
  14434.  
  14435.   ANSI X3.28-1976
  14436.     Procedure for the Use of Communications Control Characters.
  14437.  
  14438.   ANSI X3.66-1979         (FIPS 71)
  14439.     Advanced Data Communications Control Procedures (ADCCP)
  14440.  
  14441. Data Encryption Standards:
  14442.  
  14443.   ANSI-X3.92-1981
  14444.     Data Encryption Algorithm
  14445.  
  14446.   ANSI-X3.105-1983
  14447.     Data Link Encryption
  14448.  
  14449.   ANSI-X3.106-1983
  14450.     Modes of Operation of Data Encryption Algorithm
  14451.  
  14452. Serial Interface Standards:
  14453.  
  14454.   RS-232-C Aug 1969 (June 1981)
  14455.     Interface Between Data Terminal Equipment (DTE) and
  14456.     Data Communications Equipment (DCE)
  14457.  
  14458.     Bulletin #9 May 1971 (Application Notes)
  14459.       ...reviews methods of operation...service and trans-
  14460.       mission facility characteristics...
  14461.  
  14462.     Bulletin #12 Nov 1977 (Application Notes)
  14463.       Interconnection Between RS-449 and RS-232-C ...
  14464.  
  14465.     Bulletin #14 Mar 1982 (Application Notes)
  14466.       Loop Test Circuits Not Defined in RS-232-C
  14467.  
  14468.   RS-336-A Mar 1979
  14469.     Interface Between DTE and Automatic Calling Equipment
  14470.  
  14471.   RS-449 Nov 1977
  14472.   RS-449-1  Addendum 1  Feb 1980
  14473.     General Purpose 37- and 9-Position Interface for DTE
  14474.     and Data Circuit-Terminating Equipment (DCE)...
  14475.  
  14476. Standards Groups:
  14477.  
  14478. AFIP    (Federal Information Processing Standards)
  14479.         Office of Technical Information and Publications
  14480.         National Bureau of Standards
  14481.         Washington, D.C. 20234
  14482.  
  14483. ANSI    American National Standards Institute, Inc.
  14484.         1430 Broadway
  14485.         New York, New York 10018
  14486.  
  14487. BELL    ??
  14488.  
  14489. EIA     Electronic Industries Association
  14490.         2001 Eye Street
  14491.         Washington, D.C. 20006
  14492.  
  14493. CCITT   ??
  14494.  
  14495. ISO     International Standards Organization
  14496.         (available through ANSI)
  14497.  
  14498.  
  14499. Coding and Information Theory       by Richard W. Hamming (Prentice-Hall, 1980)
  14500.  
  14501. Error Correcting Codes        by W. Wesley Peterson (MIT Press and Wiley, 1961)
  14502.  
  14503. Handbook of Software & Hardware Interfacing for IBM PCs
  14504. Jefferey P. Royer
  14505. 1987 by Prentice-Hall, Inc. (Osborne-McGraw-Hill)
  14506. Englewood Cliffs, NJ 07632
  14507. ISBN 0-13-381831-4          hardware and expansion card design and interfacing
  14508.  
  14509. The C Programmer's Guide to NetBios, W. David Schwaderer, Howard W Sams &
  14510. Company, ISBN 0-672-22638-3  $24.95.
  14511.  
  14512. Computer Networks - Andrew S. Tanenbaum,Prentice Hall, ISBN 0-13-162959-X
  14513.  
  14514. Local Area Networks - Thomas W.Madron - Wiley, ISBN 0-471-85989-3
  14515.  
  14516. Netware APIs: There are many API packages available from Novell. Some of them:
  14517. Value-Added Process API $10.00 part number 420-10361-001
  14518. Netware Enhancements Package (security APIs, Queue Management, Accounting
  14519. Services) $15.00 part number 420-010316-110
  14520. Peer to Peer Comm. $15.00 part # 421-10070-001
  14521. Message Handling Service Interface $15.00 part # 420-10360-001
  14522. Novell API Reference Manual vols 1 & 2 $25.00 each part #s 452-760041-001
  14523. and 452-760042-001
  14524. C language Novell API Reference $250.00 part # 452-760043-001
  14525. Programmer's Guide $49.00 part # 420-000089-001
  14526.  
  14527. NetWare Technical Journal, 650 South Clark, Chicago, IL 60605-9960, pub. four
  14528. times a year for $50.00/yr.
  14529.  
  14530.  SCSI specification: $25 from the American National Standards Institute,
  14531.  1430 Broadway, New York, NY 10018, (212) 642-4900.
  14532.  
  14533.  SCSI-2 X3T9.2 committee working documents, CAM committee documents, and the
  14534.  most current draft of the SCSI-2 specification are available for downloading
  14535.  from the SCSI BBS at (316) 636-8700 (300, 1200, or 2400 bps; 24 hours).
  14536.  
  14537.   A paper copy of the SCSI-2 draft specification is available for $60 from
  14538.  Global Engineering Documents 2805 McGaw Ave., Irvine, CA 92714,
  14539.  (800) 854-7179 or (714) 261-1455.
  14540.  
  14541.  SMB protocol (used by Microsoft in MS-Net and Lan Manager) "IBM Personal
  14542.  Computer Seminar Proceedings", Volume 2, Number 8-1, G320-9310-00.
  14543.  
  14544.  Security (DES, etc):  NCSC's VENDOR'S GUIDE (dark green book [part of the
  14545.  Rainbow  series of books]).  Write to:  National Security Agency, ATTN: S613,
  14546.  Ft. George Meade, MD 20755-6000, or call (301) 688-6581.
  14547.  
  14548.         Programmer's Guide to PC & PS/2 Video Systems
  14549.         Richard Wilton
  14550.         Microsoft Press 1987
  14551.         ISBN 1-55615-103-9
  14552.  
  14553.  
  14554. Logitech Mouse Tech. Ref. and Programmer's Guide v2.0, $25   (415)795-0801
  14555.  
  14556.   ============================== I N V O I C E =================SWv2.2========
  14557.  
  14558.   mail invoice to:                       SHIP TO:
  14559.  
  14560.    Dave Williams                     +----------------------------------------
  14561.       DOSREF                         |
  14562.     PO Box 181                       |
  14563.  Jacksonville, AR                    |
  14564.   72076-0181 USA                     |
  14565.                                      |
  14566.           Order #:                   |
  14567.           Date   :                   |
  14568.           PO #   :                   |
  14569.                                      +----------------------------------------
  14570. ===============================================================================
  14571.   item  |    description                             |unit pr| qty |total price
  14572. ===============================================================================
  14573.  
  14574.           Programmer's Technical Reference            _______ _____ _____ _____
  14575.  
  14576.             USA:   $20
  14577.          Canada:   $25 CDN (checks)                  
  14578.                    $20 US  (postal money orders)         
  14579.  United Kingdom:   £15
  14580.     EuroCheques:   £15 UK                        check one:      
  14581.                                                 
  14582.   Cash, checks, or money orders are acceptable.          | | (1)  1.44m disk 
  14583.                                                          | | (1)  1.2mb disk
  14584.   Orders from other countries, please make payment       | | (2)  720k disks
  14585.   in one of the currencies listed above.                 | | (3)  360k disks
  14586.  
  14587. ===============================================================================
  14588.                                                                 mdse  _________
  14589.  
  14590.                                                                 S & H _$1.75___
  14591.  
  14592.    $10 surcharge for approved corporate or government purchase orders _________
  14593.  
  14594.                                                                 total _________
  14595.  
  14596. or charge your American Express card:
  14597.  
  14598. account #:__________________________  expiration date: ____________________
  14599.  
  14600.  
  14601. signature: _______________________________ today's date: __________________
  14602.  
  14603.  
  14604. Where did you hear about DOSREF?  __________________________________________
  14605.  
  14606.  
  14607. Would you like a copy of the latest shareware version to upload or pass out
  14608. to friends or associates?
  14609.                             YES___   NO___
  14610.  
  14611.                                                 THANK YOU!
  14612.  
  14613.  
  14614.           --------------------  QUICK MAILER  ----------------------
  14615.             Please support quality shareware by your registration.
  14616.  
  14617.                           Thank you for your support!
  14618.  
  14619.                          DOSREF 2.2 Registration Form
  14620.  
  14621. make check or money order to:                   Dave Williams
  14622.                                                 PO Box 181  (DOSREF)
  14623. see INVOICE.TRF for foreign orders              Jacksonville AR 72076-0181 USA
  14624.  
  14625.                                                    unit price  
  14626.  
  14627.     Programmer's Technical Reference ................. $20
  14628.     shipping and handling ............................ $1.75
  14629.                                                  Total $___________________
  14630.  
  14631. ------------fold------------ INSTANT REGISTRATION ---------here------------
  14632.  
  14633.  check disk type  | | (1) 5-1/4 inch, 1.2mb       | | (1) 3-1/2 inch, 1.44mb
  14634.  
  14635.                          360k or 720k disks available on request 
  14636.  
  14637. Where did you hear about DOSREF? __________________________________________
  14638.  
  14639.                                  __________________________________________
  14640.  
  14641. Use Address on envelope ( )    check ( )    or:
  14642.  
  14643. Name     ___________________________________________________________________
  14644.  
  14645. Address  ___________________________________________________________________
  14646.  
  14647.          ___________________________________________________________________
  14648.  
  14649.          ___________________________________________________________________
  14650.  
  14651.  Copy this file to the printer.  After the first page prints, you will have
  14652. to turn it over and print the back side for the address.
  14653.  
  14654.  Fold at the page break below with the printing facing out.  Then fold letter
  14655. style, putting this side in and the address side out. If necessary, staple
  14656. the check to the mailer, then staple or tape the sides and top.
  14657.  
  14658.  
  14659.  Check here if you would like a copy of the latest shareware version to
  14660. pass around or upload to a local BBS: _____
  14661.  
  14662.                                                THANK YOU!
  14663.  
  14664.  
  14665.                                                                    ---------
  14666. _________________________________                                 |         |
  14667.                                                                   |         |
  14668. _________________________________                                 |  Stamp  |
  14669.                                                                   |         |
  14670. _________________________________                                 |         |
  14671.                                                                    ---------
  14672.  
  14673.  
  14674.  
  14675.                                          Dave Williams
  14676.                                          PO Box 181   (DOSREF 2.1)
  14677.                                          Jacksonville, AR 72076-0181
  14678.                                          USA
  14679. DOSREF SWv2.2
  14680.  
  14681.