home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 12 / CD_ASCQ_12_0294.iso / maj / 108 / chapter.001 < prev    next >
Text File  |  1994-01-19  |  43KB  |  861 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, 1994 Dave Williams
  7.                    ┌─────────────────────────────┐
  8.                    │ Shareware Version, 01/20/94 │
  9.                    │  Please Register Your Copy  │
  10.                    └─────────────────────────────┘
  11.  
  12.                         C H A P T E R    O N E
  13.  
  14.                           DOS AND THE IBM PC
  15.  
  16.  
  17.                             C O N T E N T S
  18.  
  19. Some History ................................................... 1**1
  20. What is DOS? ................................................... 1**2
  21. Other Operating Systems ........................................ 1**3
  22. Specific Versions of MS/PC-DOS ................................. 1**4
  23. The Operating System Heirarchy ................................. 1**5
  24. DOS Structure .................................................. 1**6
  25. DOS Initialization ............................................. 1**7
  26.  
  27.  
  28.  
  29. Some History ................................................... 1**1
  30.  
  31.   Development of MSDOS/PCDOS began in October 1980, when IBM began 
  32. searching the market for an operating system for the yet-to-be-
  33. introduced IBM PC.
  34.  
  35.   IBM had originally intended to use Digital Research's (actually, 
  36. they had the somewhat pretentious name of "Intergalactic Digital 
  37. Research" at the time) CP/M was then the industry standard operating 
  38. system - you either ran a BASIC with disk functions, someone's 
  39. proprietary OS, or CP/M. 
  40.  
  41.   Folklore reports various stories about the rift between DRI and IBM.  
  42. The most popular story claims Gary Kildall or DRI snubbed the IBM 
  43. executives by flying his airplane when the meeting was scheduled.  
  44. Another story claims Kildall didn't want to release the source for 
  45. CP/M to IBM, which would be odd, since they released it to other 
  46. companies.  One noted industry pundit claims Kildall's wife killed the 
  47. deal by insisting on various contract changes.  I suspect the deal was 
  48. killed by the good ol' boy network.  It's hard to imagine a couple of 
  49. junior IBM executives giving up when ordered to a task as simple as 
  50. licensing an operating system from a vendor.  It wouldn't look good on 
  51. their performance reports.  It would be interesting to hear IBM's 
  52. story... 
  53.  
  54.   IBM then talked to a small company called Microsoft.  Microsoft 
  55. was a language vendor.  Bill Gates and Paul Allen had written 
  56. Microsoft BASIC and were selling it on punched tape or disk to early 
  57. PC hobbyists, which was probably a step up from the company's original 
  58. name and goal - they were Traf-O-Data before, making car counters for
  59. highway departments.
  60.   
  61.   Microsoft had no 8086 real operating system to sell, but quickly made
  62. a deal to license Seattle Computer Products' 86-DOS operating system,
  63. which had been written by Tim Paterson earlier in 1980 for use on that
  64. company's line of 8086, S100 bus micros.  86-DOS (also called QDOS, for
  65. Quick and Dirty Operating System) had been written as more or less a
  66. 16-bit version of CP/M, since Digital Research was showing no hurry in
  67. introducing CP/M-86.  Paterson's DOS 1.0 was approximately 4000 lines of
  68. assembler source. 
  69.  
  70.   This code was quickly polished up and presented to IBM for 
  71. evaluation.
  72.  
  73.   IBM found itself left with Microsoft's offering of "Microsoft Disk 
  74. Operating System 1.0".  An agreement was reached between the two, and 
  75. IBM agreed to accept 86-DOS as the main operating system for their new 
  76. PC.  Microsoft purchased all rights to 86-DOS in July 1981, and "IBM 
  77. Personal Computer DOS 1.0" was ready for the introduction of the IBM 
  78. PC in October 1981.  IBM subjected the operating system to an 
  79. extensive quality-assurance program, reportedly found well over 300 
  80. bugs, and decided to rewrite the programs.  This is why PC-DOS is 
  81. copyrighted by both IBM and Microsoft. 
  82.  
  83.   Some early OEM versions of DOS had different names, such as Compaq-
  84. DOS, Z-DOS, Software Bus 86, etc.  By version 2 Microsoft managed to 
  85. persuade everyone but IBM to refer to the product as "MS-DOS." 
  86.  
  87.   It is sometimes amusing to reflect on the fact that the IBM PC was 
  88. not originally intended to run MS-DOS.  The target operating system at 
  89. the end of the development was for a (not yet in existence) 8086 
  90. version of CP/M.  On the other hand, when DOS was originally written 
  91. the IBM PC did not yet exist!  Although PC-DOS was bundled with the 
  92. computer, Digital Research's CP/M-86 would probably have been the main 
  93. operating system for the PC except for two things - Digital Research 
  94. wanted $495 for CP/M-86 (considering PC-DOS was essentially free) and 
  95. many software developers found it easier to port existing CP/M 
  96. software to DOS than to the new version of CP/M. 
  97.  
  98.   The IBM PC shipped without an operating system.  IBM didn't start 
  99. bundling DOS until the second generation AT/339 came out.  You could 
  100. order one of three operating systems for your PC, assuming you popped 
  101. for the optional disk drive and 64k RAM upgrade (base models had 16k 
  102. and a cassette player port).  These operating systems were IBM
  103. Personal Computer DOS 1.0, a version of the UCSD p-System, which was 
  104. an integrated Pascal operating system something like the souped-up 
  105. BASIC operating systems used by the Commodore 64 and others, or 
  106. Digital Research's CP/M-86, which was officially an option although 
  107. you couldn't buy it until later.  Since IBM's $39.95 DOS was far 
  108. cheaper than anyone else's alternative, darned near everyone bought 
  109. DOS.
  110.  
  111.   The upgrade from DOS 3.3 to 4.0 was done in-house by IBM.  DOS 4.0 
  112. was a completely IBM product, later licensed back to Microsoft.  In 
  113. early 1990 IBM announced that it was ceasing development of DOS and 
  114. all further work would be done solely by Microsoft.  
  115.  
  116.   Microsoft Press' "MSDOS Encyclopedia" shows a reproduction of a late 
  117. DOS 1.25 OEM brochure.  Microsoft was touting future enhancements to 
  118. 1.25 including Xenix-compatible pipes, process forks, and 
  119. multitasking, as well as "graphics and cursor positioning, kanji 
  120. support, multi-user and hard disk support, and networking."  Microsoft 
  121. certainly thought big, but, alas, the forks, multitasking, and 
  122. multiuser support never came about, at least in US versions of DOS.  
  123. Oddly, the flyer claims: 
  124.  
  125.   "MS-DOS has no practical limit on disk size. MS-DOS uses 4-byte XENIX 
  126. OS compatible pointers for file and disk capacity up to 4 gigabytes." 
  127.  
  128.   Umm... yeah.  One sort of gets the idea nobody at Microsoft had a 
  129. hard disk larger than 32 megabytes... 
  130.  
  131.   For the record they actually delivered:
  132.  
  133. Xenix-compatible pipes:
  134.              DOS 2.0  ("|" operator)
  135.  
  136. process forks, and multitasking:
  137.             eDOS 4.0  (not delivered in the US)
  138.  
  139. multi-user:
  140.             never delivered
  141.  
  142. graphics and cursor positioning:
  143.             DOS 2.0  (ANSI.SYS)
  144.  
  145. kanji support:
  146.             DOS 2.01, 2.25 (double-byte character set)
  147.  
  148. hard disk support:
  149.             DOS 2.0  (subdirectories)
  150.  
  151. networking:
  152.             DOS 3.1  (file locking support MS Networks)
  153.             DOS 6.0  (bundled Interlink in with DOS)
  154.  
  155.   Early Microsoft ads pumped DOS' Xenix-like features and promised 
  156. Xenix functionality in future releases. 
  157.  
  158.   We'll probably never know what the real story was behind eDOS/DOS 4/ 
  159. DOS 5/286DOS/OS2.  Microsoft had announced their intent to build a 
  160. multitasking, multiuser version of MSDOS as early as 1982.  They 
  161. shipped betas of "DOS 4.0" in '86 and early '87, before 3.3 was even 
  162. announced.  Microsoft UK announced they had licensed 4.0 to Apricot 
  163. Computer, and the French Postal Service was supposed to be running it.  
  164. I've never been able to find out if Apricot ever shipped any 4.0 to 
  165. end users. 
  166.  
  167.   Despite Gordon Letwin's acid comments about problems with the 80286 
  168. processor, I doubt the '286 was the barrier between users and a 
  169. multitasking MS-DOS.  I also doubt there was any shortage of 
  170. programming talent at Microsoft - Digital Research's Concurrent DOS 
  171. and Software Link's PC-MOS/386 were developed without undue trouble. 
  172.  
  173.  
  174.   MSDOS and PC-DOS have been run on more than just the IBM-PC and 
  175. clones. Some of the following have been done: 
  176.  
  177.   Hardware PC Emulation:
  178.  
  179.         Apple II            ->    TransPC 8088 board
  180.         Apple MacIntosh     ->    AST 80286 board
  181.         Atari 400/800       ->    Co-Power 88 board
  182.         Atari ST            ->    PC-Ditto II cartridge
  183.         Amiga 2000          ->    8088 or A2286D 80286 Bridge Board
  184.         IBM PC/RT           ->    80286 AT adapter
  185.         Kaypro 2            ->    Co-Power Plus board
  186.  
  187.  Software PC Emulation:
  188.  
  189.         Apple MacIntosh     ->    SoftPC
  190.         Atari ST            ->    PC-Ditto I
  191.         IBM RS/6000         ->    DOS emulation
  192.  
  193.  DOS Emulation:
  194.  
  195.         AIX (IBM RS/6000)   ->    DOS emulation with "PCSIMulator"
  196.         OS/2 1.x            ->    DOS emulation in "Compatibility Box"
  197.         OS/2 2.x            ->    executes Virtual DOS Machine
  198.         QNX                 ->    DOS window
  199.         SunOS               ->    DOS window
  200.         Xenix               ->    DOS emulation with DOSMerge
  201.  
  202.  
  203. What Is DOS?.................................................... 1**2
  204.  
  205.   DOS exists as a high-level interface between an application program 
  206. and the computer.  DOS stands for "Disk Operating System", which 
  207. reflects the fact that its main original purpose was to provide an 
  208. interface between the computer and its disk drives. 
  209.  
  210.   DOS now lets your programs do simple memory management, I/O from the 
  211. system console, and assorted system tasks (time and date, etc) as well 
  212. as managing disk operations.  Versions 3.1 and up also incorporate 
  213. basic networking functions. 
  214.  
  215.   With the introduction of installable device drivers and TSR 
  216. (terminate but stay resident) programs in DOS 2.0, the basic DOS 
  217. functions may be expanded to cover virtually any scale of operations 
  218. required. 
  219.  
  220.  
  221. Other Operating Systems ........................................ 1**3
  222.  
  223.   There are a number of compatible replacements for Microsoft's MSDOS. 
  224. Some are: 
  225.  
  226. Alloy 386 Multiware                  (multitasking control prog,
  227.                                       licensed DOS)
  228. Consortium Technologies MultiDOS     (multitasking, multiuser)
  229. Digital Research Concurrent DOS      (multitasking)
  230. Digital Research Concurrent DOS 386  (for 80386 computers)
  231. Digital Research Concurrent DOS XM   (multitasking, multiuser)
  232. Digital Research DR-DOS              (PC-DOS clones)
  233. Digital Research Multiuser DOS       (multitasking, multiuser)
  234. PC-MOS/386                           (multitasking, multiuser)
  235. Wendin-DOS                           (multitasking, multiuser)
  236. VM/386                               (multitasking)
  237. X-DOS                                (DOS 3.31 compatible)
  238.  
  239.   Various other operating systems are available for the IBM PC. These 
  240. include: 
  241.  
  242. Digital Research CP/M-86
  243. Digital Research Concurrent CP/M-86 (multitasking)
  244. Minix (multitasking UNIX workalike)
  245. Pick  (database-operating system)
  246. QNX   (multitasking, multiuser)
  247. UCSD p-System  (Pascal interpreter and operating system)
  248. UNIX  (various systems from IBM itself, Microsoft-SCO, Bell, and
  249.        various UNIX clones, single and multi user, such as AIX,
  250.        Xenix, AT&T System V, etc.)
  251.  
  252.   "Shell" programs exist which use DOS only for disk management while 
  253. they more or less comprise a new operating system.  These include: 
  254.  
  255.      DESQview               Windows                   OmniView 
  256.      GEM                    TopView                   TaskView 
  257.      GeoWorks 
  258.  
  259.  
  260.   TopView and TaskView (later called OmniView) and Omniview are no 
  261. longer sold. 
  262.  
  263.   Systems using the NEC V-series CPUs can execute Intel 8080/8085 8-bit 
  264. instructions as well as the 16-bit 8088-up instructions.  They can run 
  265. standard Digital Research 8-bit CP/M and MP/M directly, as well as 
  266. other operating systems developed for that processor. 
  267.  
  268.  
  269.  
  270. Specific Versions of MS/PC-DOS ................................. 1**4
  271.  
  272.   DOS 1.x is essentially 86-DOS.  DOS 2.x kept the multiple file layout 
  273. (the two hidden files and COMMAND.COM) but for all practical purposes 
  274. is an entirely different operating system with backwards compatibility 
  275. with 1.x.  I seriously doubt there has been much code from 1.x 
  276. retained in 2.x.  DOS 3.x is merely an enhancement of 2.x; there seems 
  277. little justification for jumping a whole version number.  The disk 
  278. handling routines were considerably extended in 3.1, allowing disk 
  279. access in a "virtual" fashion, independent of whether the drive was a 
  280. local or network device.  DOS 4.0, originating as it did from outside 
  281. Microsoft, can justify a version jump.  Unfortunately, 4.0 seemed to 
  282. have very little reason to justify its existence - virtually all of 
  283. its core features could be found in one version or another of DOS 3.x.  
  284. According to Microsoft's Gordon Letwin, DOS 5.0 was a complete rewrite 
  285. with the kernel done in hand optimized assembly language. 
  286.  
  287.   DOS version nomenclature: major.minor.minor.  The digit to the left 
  288. of the decimal point indicates a major DOS version change.  1.0 was 
  289. the first version. 2.0 added support for subdirectories, 3.0 added 
  290. support for networking, 4.0 added some minimal support for Lotus-
  291. Intel-Microsoft EMS. 
  292.  
  293.   The first minor version indicates customization for a major 
  294. application.  For example, 2.1 for the PCjr, 3.3 for the PS/2s.  The 
  295. second minor version does not seem to have any particular meaning. 
  296.  
  297.   The main versions of DOS are:
  298.  
  299.  86-DOS       February 1981  Paterson's Quick'n'Dirty DOS first runs
  300.                              on IBM's wirewrapped PC prototype
  301.  
  302.  PC-DOS 1.0   August   1981  original IBM release
  303.  
  304.  PC-DOS 1.05  -------- ----  fixes to BASIC interpreter
  305.  
  306.  PC-DOS 1.1   June     1982  bugfix, double sided drive support
  307.  
  308.  MS-DOS 1.25  July     1982  for early compatibles. This is the first
  309.                              non-IBM OEM version
  310.  
  311.  PC-DOS 2.0   March    1983  for PC/XT, Unix-type subdirectory support,
  312.                              installable device drivers, I/O
  313.                              redirection, subdirectories, hard disk
  314.                              support, handle calls
  315.  
  316.  PC-DOS 1.85  April    1983  internal IBM - extended 1.1 - not released
  317.                              I found a copy of this one on an old 
  318.                              diskette.  It added a whole host of 
  319.                              features, including an enhanced COMMAND.COM
  320.                              with command line editing.  Too bad none
  321.                              of the goodies made it into DOS 2.0!
  322.  
  323.  MS-DOS 2.01  -------- 1983  first support for individual country
  324.                              formats, Kanji 
  325.  
  326.  PC-DOS 2.1   October  1983  for IBM PCjr, bugfixes for 2.0.
  327.                              No country support
  328.  
  329.  MS-DOS 2.11  December 1983  basically a cross of PC-DOS 2.1 and
  330.                              MS-DOS 2.01
  331.  
  332.  MS-DOS 2.12  -------- ----  special version for TI Professional
  333.                              (nonstandard video and keyboard)
  334.  
  335.  PC-DOS 3.0   August   1984  1.2 meg drive for PC/AT, some new system
  336.                              calls, new external programs, 16-bit FAT,
  337.                              specific support for IBM network
  338.  
  339.  MS-DOS 3.05  November 1984  first OEM version of 3.x
  340.  
  341.  PC-DOS 3.1   November 1984  bugfix for 3.0, implemented generic
  342.                              network support
  343.  
  344.  MS-DOS 2.25  October  1985  extended foreign language support
  345.  
  346.  PC-DOS 3.2   January  1986  720k 3.5 inch drive support, special
  347.                              support for laptops (IBM PC Convertible),
  348.                              XCOPY
  349.  
  350.  MS-DOS 4.0   April    1986  multitasking (Europe only) - withdrawn
  351.                              from market after a very short run
  352.  
  353.  PC-DOS 3.3   April    1987  for PS/2 series, 1.44 meg support,
  354.                              multiple DOS partition support, code page
  355.                              switching, improved foreign language
  356.                              support, some new function calls, support
  357.                              for the AT's CMOS clock.
  358.  
  359.  MS-DOS 3.31  November 1987  over-32 meg DOS partitions. Different
  360.                              versions from different OEMs (not
  361.                              Microsoft).  Compaq and Wyse are most
  362.                              common.
  363.  
  364.  PC-DOS 3.4   -------- ----  internal IBM - not released (4.0
  365.                              development)
  366.  
  367.  MS-DOS 2.11R -------- 1988  bootable ROM DOS for Tandy machines
  368.  
  369.  PC-DOS 4.0   August   1988  32mb disk limit officially broken, minor
  370.                              EMS support, more new function calls,
  371.                              enhanced network support for external
  372.                              commands.  PCjr support dropped.
  373.  
  374.  MS-DOS 4.01  January? 1989  Microsoft version with some bugfixes
  375.  
  376.  MS-DOS 3.21R September1989  DOS in ROM, Flash File System for laptops
  377.  
  378.  MS-DOS 3.3R  -------- 1990  DOS in ROM, introduced for TI laptops
  379.  
  380.  MS-DOS 5.0   June     1991  high memory support, uses up to 8 hard
  381.                              disks, command line editor and aliasing,
  382.                              2.88 floppies, ROMable OEM kit available
  383.  
  384.  MS-DOS V     February 1993  Japanese-market version of 5, with double 
  385.                              byte Kanji character support
  386.  
  387.  MS-DOS 6.0   March    1993  disk compression (Doublespace), multiple
  388.                              configurations in CONFIG.SYS
  389.  
  390.  
  391.   IBM's PC-DOS was long considered to be the "standard" version of DOS.  
  392. Now that MS 5.0 is a commercial product most developers will probably 
  393. write to it. 
  394.  
  395.   Microsoft's policy was once to sell DOS only to OEMs.  Despite this, 
  396. they sold small quantities of DOS 3.2, 3.3, and 4.0 without 
  397. insurmountable difficulties.  DOS 5.0 was conceived from the beginning 
  398. as an over-the-counter retail product. 
  399.  
  400.   Incidentally, IBM refers to its DOS as "The IBM Personal Computer 
  401. DOS."  The term "PC-DOS" is a trademark of IBM's rival DEC. 
  402.  
  403.   Some versions of MS-DOS varied from PC-DOS in the available external 
  404. commands.  Some OEMs only licensed the basic operating system code (the 
  405. xxxDOS and xxxBIO programs, and COMMAND.COM) from Microsoft, and 
  406. either wrote the rest themselves or contracted them from outside 
  407. software houses like Phoenix.  Most of the external programs for DOS 
  408. 3.x and 4.x are written in "C" while the 1.x and 2.x utilities were 
  409. written in assembly language.  Other OEMs required customized versions 
  410. of DOS for their specific hardware configurations, such as Sanyo 55x 
  411. and early Tandy computers, which were unable to exchange their DOS 
  412. with the IBM version. 
  413.  
  414.   PC-DOS 3.0 was extremely buggy on release.  It did not handle the DOS 
  415. environment correctly and there were numerous documented problems with 
  416. the batch file parser.  The network support code was also 
  417. nonfunctional in that DOS version.  It is recommended that users 
  418. upgrade to at least version 3.1. 
  419.  
  420.   DEC MS-DOS versions 2.11 for the Rainbow had the ANSI.SYS device 
  421. driver built into the main code.  The Rainbow also used a unique quad 
  422. density, single-sided floppy drive and its DOS had special support for 
  423. it. 
  424.  
  425.   IBM had a version 1.85 of PC-DOS in April 1983, after the 
  426. introduction of DOS 2.0.  It was evidently for internal use only, 
  427. supported multiple drive file searches (a primitive form of PATH), 
  428. built in MODE sommands for screen support, a /P parameter for TYPE for 
  429. paused screens, an editable command stack like the public domain 
  430. DOSEDIT.COM utility, and could be set up to remain completely resident 
  431. in RAM instead of a resident/transient part like normal DOS.  It is a 
  432. pity some of the neat enhancements didn't make it into DOS 2.0.  IBM 
  433. also had an "internal use only" version 3.4, evidently used while 
  434. developing DOS 4.0. 
  435.  
  436.   Digital Research's DR-DOS is the first widely available DOS clone.  
  437. Version 3.4, released in June 1988, was the one first available to the 
  438. American public. It was somewhat buggy and its use is not recommended.  
  439. DR 3.41 is extremely compatible and its use should pose no problems on 
  440. any machine.  DR-DOS 5.0 (released May, 1990) is functionally 
  441. equivalent to MS-DOS 5.0.  For all practical purposes, MS 5.0 is a 
  442. clone of DR 5.0, since DR beat MS to market by over a year.  According 
  443. to Greg Ewald, DRI's DR-DOS product manager, DR-DOS was developed from 
  444. Concurrent DOS 386 with the multiuser and multitasking code stripped 
  445. out.  DR-DOS 6.0 was introduced in December 1991, and added disk 
  446. compression via bundling the third-party SuperStor program.  Novell DOS
  447. 7.0 (DRI sold out to Novell) in March 1993, at the same time as MS-DOS 
  448. 6.0.  Novell one-upped Microsoft by tossing in their Netware Lite with 
  449. their DOS.
  450.  
  451.   Some versions of DOS used in compatibles do not maintain the 1.x, 
  452. 2.x, ... numbering system.  Columbia Data Products computers labeled 
  453. DOS 1.25 as DOS 2.0.  Early Compaqs labeled DOS 2.0 as DOS 1.x.  Other 
  454. versions incorporated special features - Compaq DOS 3.31 and Wyse DOS 
  455. 3.21 both support >32mb disk partitions in the same fashion as DOS 
  456. 4.x. 
  457.  
  458.   AT&T DOS 3.1 differs from generic MS-DOS 3.10 in its use of cluster-
  459. size and file allocation table structures.  AT&T DOS appears to use 
  460. rules not from version 3, but rather those from version 2. 
  461.  
  462.   Epson Equity III and ComputerLand 3.10 DOS's appear to use cluster 
  463. techniques that are a cross between versions 2 and 3.  On type DOS 
  464. partitions, these DOS's use 3.x rules if the partition is larger than 
  465. 32,680 sectors in total size. This implies 16 bit FAT entries as well.  
  466. On partitions below this size, they will use 2.x rules, including the 
  467. 12 bit FAT entries. 
  468.  
  469.   Zenith DOS 3.x and Wyse DOS 3.2 have a builtin internal device driver 
  470. to handle up to 4 32Mb DOS partitions on a single hard disk. Wyse DOS 
  471. 3.31 will handle single partitions up to 512Mb with a 32-bit FAT. 
  472.  
  473.   According to PC Week Magazine, July 4, 1988, Arabic versions of MS-
  474. DOS are shipping with a hardware copy-protection system from Rainbow 
  475. Technologies.  This is similar to the short-lived system used by 
  476. AutoCAD 2.52 and a very few other MS-DOS programs, where an adapter 
  477. block is plugged into the parallel port and software makes use of 
  478. coded bytes within the block.  This type of copy protection has been 
  479. common on Commodore products for several years, where it is called a 
  480. "dongle." 
  481.   The AutoCAD dongle was defeated by a small program written within 
  482. weeks of version 2.52's debut.  Version 2.62 was released 3 months 
  483. later, without the dongle.  The DOS dongle will, however, prevent the 
  484. system from booting at all unless it is found. 
  485.   This makes the Arabic version of MSDOS the first copy-protected 
  486. operating system, a dubious distinction at best.  The modifications to 
  487. the operating system to support the dongle are not known at this time.  
  488. Frankly, it would seem that burning the operating system into ROMs 
  489. would be cheaper and simpler. 
  490.  
  491.   Versions of DOS sold in Great Britain are either newer than those 
  492. sold in the US or use a different numbering system.  DOS 3.4, 4.0, 
  493. 4.1, 4.2, and 4.3 had been released there between the US releases of 
  494. 3.3 and 4.0. 
  495.   MSDOS 4.0 (eDOS) was introduced in mid-1987 in Europe (at SICOB in 
  496. Paris and sometime earlier by Apricot Computer in the UK).  It offered 
  497. multitasking provided applications were specially written for it. 
  498.   David Fraser (Microsoft UK Managing Director) is on record saying 
  499. that "DOS 4.0 is unlikely to set the world alight and is of interest 
  500. only to specific OEMs who want its features for networking and 
  501. communications."   Standard DOS applications will run under DOS 4.x as 
  502. a foreground task according to uncertain information.  It differs from 
  503. earlier versions only in allowing background tasks to run.  For 
  504. further information, see Chapter 4. 
  505.  
  506.   Microsoft changed their OEM licensing agreements between DOS versions 
  507. 2.x and 3.x.  OEM versions of DOS 3.x must maintain certain data areas 
  508. and undocumented functions in order to provide compatibility with the 
  509. networking features of the operating system.  For this reason, TSR 
  510. programs will be much more reliable when operating under DOS 3.x. 
  511.  
  512.   Several versions of DOS have been modified to be run out of ROM.  The 
  513. Sharp PC5000 had MSDOS 1.25 in ROM, and the Toshiba 1000 and some 
  514. Tandy 1000 models have MSDOS 2.11 in ROM.  In mid-September 1989 
  515. Microsoft introduced 3.21R ROMs for laptops, and in early '90 Texas 
  516. Instruments laptops were the first to get the 3.3R ROMs.  All versions 
  517. of Digital Research's DR-DOS are available in ROM version and Award 
  518. Software is marketing DR-DOS cards to OEMs as a plug-in to ISA-bus 
  519. machines. 
  520.  
  521.   IBM's release of DOS 4.0 (and the immediate subsequent release of a 
  522. bugfix) was a dubious step "forward."  DOS 4.0 was the first version 
  523. of DOS to come with a warranty; the catch is that IBM warranted it 
  524. only for a very slim list of IBM-packaged software.  4.0 had some 
  525. minor EMS support, support for large hard disks, and not much else.  
  526. With its voracious RAM requirements and lack of compatibility with 
  527. previous versions of DOS (many major software packages crashed under 
  528. DOS 4.0), plus the increase in price to a cool $150, there was no 
  529. great rush to go to that version of DOS. 
  530.  
  531.   Microsoft undertook development of MSDOS 5.0 in early 1990, 
  532. soliciting input from Usenet, BIX, and Compuserve among others.
  533. This was quite a surprise after Bill Gates had announced "DOS is dead" 
  534. at every opportunity, trying to build support for OS/2.  Alas, most of 
  535. Microsoft's revenue came from DOS, not OS/2's few sales (at $325 per 
  536. copy) or applications.  Apparently Microsoft realized they were 
  537. shooting themselves in the foot and that there was still plenty of 
  538. life left in DOS.  They dropped OS/2 development shortly after 
  539. starting on DOS 5.0.
  540.  
  541.   5.0 is a functional clone of Digital Research's DR-DOS 5.0.  5.0's 
  542. compatibility was assured by what has been claimed as the largest 
  543. beta-test program in history -in his address to the Boston Computer 
  544. Society, Bill Gates announced over 7,500 testers were involved.
  545.  
  546.   There are many versions of MS-DOS 5.0.  Microsoft's original 
  547. revision reported "Revision A" when you used the at-first-undocumented 
  548. VER/R command.  There was a Revision B and C, which I have personally 
  549. seen right out of the shrinkwrap.  Microsoft has denied (at least up
  550. to late 1992) there ever was a B or C revision, and shortly afterward
  551. new copies started reporting "Revision A" no matter what the 
  552. datestamps on the files were.  IBM DOS 5.0 went through a number of 
  553. CSDs, all of which were available for free download from their BBS in 
  554. Atlanta (see Appendix 5) but most of the revisions related to IBM 
  555. specific hardware problems.
  556.  
  557.   MS-DOS 6.0 was introduced in March 1993.  It bundles some third 
  558. party utilities and disk compression (developed from licensed code), 
  559. but other than boot control via new CONFIG.SYS options, it doesn't add 
  560. any new features.  If it weren't for marketing reasons, it would 
  561. probably have been called DOS 5.1.
  562.  
  563.  
  564.  
  565. The Operating System Hierarchy ................................. 1**5
  566.  
  567.   The Disk Operating System (DOS) and the ROM BIOS serve as an 
  568. insulating layer between the application program and the machine, and 
  569. as a source of services to the application program. 
  570.  
  571.   As the term 'system' might imply, DOS is not one program but a 
  572. collection of programs designed to work together to allow the user 
  573. access to programs and data.  Thus, DOS consists of several layers of 
  574. "control" programs and a set of "utility" programs. 
  575.  
  576.   The system hierarchy may be thought of as a tree, with the lowest 
  577. level being the actual hardware.  The 8088 or V20 processor sees the 
  578. computer's address space as a ladder one byte wide and one million 
  579. bytes long.  Parts of this ladder are in ROM, parts in RAM, and parts 
  580. are not assigned.  There are also 65,536 "ports" that the processor 
  581. can use to control devices. 
  582.  
  583.   The hardware is normally addressed by the ROM BIOS, which will always 
  584. know where everything is in its particular system.  The chips may 
  585. usually also be written to directly, by telling the processor to write 
  586. to a specific address or port.  This sometimes does not work as the 
  587. chips may not always be at the same addresses or have the same 
  588. functions from machine to machine. 
  589.  
  590.  
  591.  
  592. DOS Structure .................................................. 1**6
  593.  
  594. DOS consists of four components:
  595.  
  596.  * The boot record
  597.  * The ROM BIOS interface  (IBMBIO.COM, DRBIOS.SYS, or IO.SYS)
  598.  * The DOS program file    (IBMDOS.COM, DRBDOS.SYS, or MSDOS.SYS)
  599.  * The command processor   (COMMAND.COM or aftermarket replacement)
  600.  
  601.  
  602. * The Boot Record
  603.  
  604.   The boot record begins on track 0, sector 1, side 0 of every diskette 
  605. prepared by the DOS FORMAT command.  The boot record is placed on 
  606. diskettes to produce an error message if you try to start up the 
  607. system with a nonsystem diskette in drive A.  For hard disks, the boot 
  608. record resides on the first sector of the DOS partition.  All media 
  609. supported by DOS use one sector for the boot record. 
  610.  
  611.  
  612. * Read Only Memory (ROM) BIOS Interface and Extensions
  613.  
  614.   The file IBMBIO.COM or IO.SYS is the interface module to the ROM 
  615. BIOS. This file provides a low-level interface to the ROM BIOS device 
  616. routines and may contain extensions or changes to the system board 
  617. ROMs.  Some compatibles do not have a ROM BIOS to extend, and load the 
  618. entire BIOS from disk.  (Sanyo 55x, Viasyn machines).  Some versions 
  619. of MSDOS, such as those from Compaq's MS-DOS and Digital Research's 
  620. DRDOS 5.0, are named IBMBIO.COM but are not IBM files. 
  621.  
  622.   These low-level interface routines include the instructions for 
  623. performing operations such as displaying information on the screen, 
  624. reading the keyboard, sending data out to the printer, operating the 
  625. disk drives, and so on.  It is the operating system's means of 
  626. controlling the hardware.  IBMBIO.COM contains any modifications or 
  627. updates to the ROM BIOS that are needed to correct any bugs or add 
  628. support for other types of hardware such as new disk drives.  By using 
  629. IBMBIO.COM to update the ROM BIOS on the fly when the user turns on 
  630. their computer, IBM does not need to replace the ROM BIOS chip itself, 
  631. but makes any corrections through the cheaper and easier method of 
  632. modifying the IBMBIO.COM file instead. 
  633.  
  634.   IBMBIO.COM also keeps track of hardware operations on an internal 
  635. stack or "scratch pad" area for the operating system to save 
  636. information such as addresses it will need, etc.  An example of the 
  637. use for this stack can be seen when running a program such as a word 
  638. processor.  If you have told the word processor to save your letter, 
  639. it will write the data to your disk.  During this time, if you start 
  640. typing some more information, the keyboard generates a hardware 
  641. interrupt.  Since you don't want the process of writing the 
  642. information to the disk to be interrupted, DOS allocates a slot in the 
  643. stack for the keyboard's hardware interrupt and when it gets a chance, 
  644. (probably after the data has been written to the disk), it can process 
  645. that interrupt and pick up the characters you may have been typing.  
  646. The STACKS= command in DOS 3.2+'s CONFIG.SYS file controls the number 
  647. of stack frames available for this purpose. 
  648.  
  649.   IBMBIO.COM also reads your CONFIG.SYS file and installs any device 
  650. drivers (i.e. DEVICE=ANSI.SYS) or configuration commands it may find 
  651. there. 
  652.  
  653.  
  654.  
  655. * The DOS Program
  656.  
  657.   The actual DOS program is the file IBMDOS.COM or MSDOS.SYS.  It 
  658. provides a high-level interface for user (application) programs.  This 
  659. program consists of file management routines, data blocking/deblocking 
  660. for the disk routines, and a variety of built-in functions easily 
  661. accessible by user programs. 
  662.  
  663.   When a user program calls these function routines, they accept high-
  664. level information by way of register and control block contents.  When 
  665. a user program calls DOS to perform an operation, these functions 
  666. translate the requirement into one or more calls to IBMBIO.COM, 
  667. MSDOS.SYS or system hardware to complete the request. 
  668.  
  669.   This section is often referred to as the "kernel" by systems 
  670. programmers. 
  671.  
  672.  
  673.  
  674. * The Command Interpreter
  675.  
  676.   The command interpreter, COMMAND.COM, is the part you interact with 
  677. on the command line.  COMMAND.COM has three parts.  IBM calls them the 
  678. "resident portion", the "initialization portion" and the "transient 
  679. portion". 
  680.  
  681.   IBM's original documentation spoke of installing alternate command 
  682. interpreters (programs other than COMMAND.COM) with the SHELL= 
  683. statement in CONFIG.SYS.  Unfortunately, IBM chose not to document 
  684. much of the interaction between IBMDOS.COM and IBMBIO.COM.  By the 
  685. time much of the interaction was widely understood, many commercial 
  686. software programs had been written to use peculiarities of COMMAND.COM 
  687. itself. 
  688.  
  689.   Several programs exist that perform as actual "shells" by completely 
  690. replacing COMMAND.COM and substituting their own command interpreter 
  691. to use with the hidden DOS files.  Examples are Command Plus, a 
  692. commercial package, and the shareware 4DOS and FlexShell packages.  
  693. Both supply greatly enhanced batch language and editing capabilities. 
  694.  
  695. NOTE: DOS 3.3+ checks for the presence of a hard disk, and will 
  696.       default to COMSPEC=C:\.  Previous versions default to
  697.       COMSPEC=A:\.  Under some DOS versions, if COMMAND.COM is not
  698.       immediately available for reloading (i.e., swapping to a floppy 
  699.       with COMMAND.COM on it) DOS may crash. 
  700.  
  701.  
  702. Resident Portion:
  703.  
  704.   The resident portion resides in memory immediately following 
  705. IBMDOS.COM and its data area.  This portion contains routines to 
  706. process interrupts 22h (Terminate Address), 23h (Ctrl-Break Handler), 
  707. and 24h (Critical Error Handler), as well as a routine to reload the 
  708. transient portion if needed.  For DOS 3.x, this portion also contains 
  709. a routine to load and execute external commands, such as files with 
  710. exensions of COM or EXE. 
  711.  
  712.   When a program terminates, a checksum is used to determine if the 
  713. application program overlaid the transient portion of COMMAND.COM.  If 
  714. so, the resident portion will reload the transient portion from the 
  715. area designated by COMSPEC= in the DOS environment.  If COMMAND.COM 
  716. cannot be found, the system will halt. 
  717.  
  718.   All standard DOS error handling is done within the resident portion 
  719. of COMMAND.COM.  This includes displaying error messages and 
  720. interpreting the replies to the "Abort, Retry, Ignore, Fail?" message. 
  721.  
  722.   Since the transient portion of COMMAND.COM is so large (containing 
  723. the internal commands and all those error messages), and it is not 
  724. needed when the user is running an application it can be overlaid that 
  725. program if that application needs the room.  When the application is 
  726. through, the resident portion of COMMAND.COM brings the transient 
  727. portion back into memory to show the prompt.  This is why you will 
  728. sometimes see the message "Insert disk with COMMAND.COM".  It needs to 
  729. get the transient portion off the disk since it was overlaid with the 
  730. application program. 
  731.  
  732.   The initialization portion of COMMAND.COM follows the resident 
  733. portion and is given control during the bootup procedure.  This 
  734. section actually processes the AUTOEXEC.BAT file.  It also decides 
  735. where to load the user's programs when they are executed.  Since this 
  736. code is only needed during startup, it is overlaid by the first 
  737. program which COMMAND.COM loads. 
  738.  
  739.   The transient portion is loaded at the high end of memory and it is 
  740. the command processor itself.  It interprets whatever the user types 
  741. in at the keyboard, hence messages such as "Bad command or file name" 
  742. for when the user misspells a command.  This portion contains all the 
  743. internal commands (i.e. COPY, DIR, RENAME, ERASE), the batch file 
  744. processor (to run .BAT files) and a routine to load and execute 
  745. external commands which are either .COM or .EXE files. 
  746.  
  747.   The transient portion of COMMAND.COM produces the system prompt, 
  748. (C>), and reads what the user types in from the keyboard and tries to 
  749. do something with it.  For any .COM or .EXE files, it builds a command 
  750. line and issues an EXEC function call to load the program and transfer 
  751. control to it. 
  752.  
  753.  
  754.  
  755. DOS Initialization ............................................. 1**7
  756.  
  757.   The system is initialized by a software reset (Ctrl-Alt-Del), a 
  758. hardware reset (reset button), or by turning the computer on.  The 
  759. Intel 80x8x series processors always look for their first instruction 
  760. at the end of their address space (0FFFF0h) when powered up or reset.  
  761. This address contains a jump to the first instruction for the ROM 
  762. BIOS. 
  763.  
  764.   Built-in ROM programs (Power-On Self-Test, or POST, in the IBM) check 
  765. machine status and run inspection programs of various sorts.  Some 
  766. machines set up a reserved RAM area with bytes indicating installed 
  767. equipment (AT and PCjr). 
  768.  
  769.   When the ROM BIOS finds a ROM on an adapter card, it lets that ROM 
  770. take control of the system so that it may perform any set up necessary 
  771. to use the hardware or software controlled by that ROM.  The ROM BIOS 
  772. searches absolute addresses C8000h through E0000h in 2K increments in 
  773. search of a valid ROM. A valid ROM is determined by the first few 
  774. bytes in the ROM.  The ROM will have the bytes 55h, AAh, a length 
  775. indicator and then the assembly language instruction to CALL FAR (to 
  776. bring in a "FAR" routine).  A checksum is done on the ROM to verify 
  777. its integrity, then the BIOS performs the CALL FAR to bring in the 
  778. executible code.  The adapter's ROM then performs its initialization 
  779. tasks and hopefully returns control of the computer back to the ROM 
  780. BIOS so it can continue with the booting process. 
  781.  
  782.   The ROM BIOS routines then look for a disk drive at A: or an option 
  783. ROM (usually a hard disk) at absolute address C:800h.  If no floppy 
  784. drive or option ROM is found, the BIOS calls int 19h (ROM BASIC if it 
  785. is an IBM) or displays an error message. 
  786.  
  787.   If a bootable disk is found, the ROM BIOS loads the first sector of 
  788. information from the disk and then jumps into the RAM location holding 
  789. that code.  This code normally is a routine to load the rest of the 
  790. code off the disk, or to "boot" the system. 
  791.  
  792.   The following actions occur after a system initialization:
  793.  
  794.  1.  The boot record is read into memory and given control.
  795.  
  796.  2.  The boot record then checks the root directory to assure that the 
  797.      first two files are IBMBIO.COM and IBMDOS.COM or their OEM
  798.      equivalents.  These files must be in that order, with IBMBIO.COM 
  799.      first, with its sectors in contiguous order. 
  800.      note 1) IBMDOS.COM need not be contiguous in version 3.x+. 
  801.           2) DR-DOS versions 3.40 through 6.0 may have DRBIOS.SYS and 
  802.              DRDOS.SYS anywhere on the hard disk. 
  803.           3) PC-MOS/386' $$MOS.SYS file may be anywhere on the hard 
  804.              disk. 
  805.  
  806.  3.  The boot record loads IBMBIO.COM into memory.
  807.  
  808.  4.  The initialization code in IBMBIO.COM loads IBMDOS.COM, 
  809.      determines equipment status, resets the disk system,
  810.      initializes the attached devices, sets the system parameters
  811.      and loads any installable device drivers according to the
  812.      CONFIG.SYS file in the root directory (if present), sets the
  813.      low-numbered interrupt vectors, relocates IBMDOS.COM downward,
  814.      and calls the first byte of DOS. 
  815.      note 1) CONFIG.SYS may be a hidden file. 
  816.  
  817.  5.  DOS initializes its internal working tables, initializes the 
  818.      interrupt vectors for interrupts 20h through 27h, and builds
  819.      a Program Segment Prefix for COMMAND.COM at the lowest
  820.      available segment.  For DOS versions 3.10 up, DOS also
  821.      initializes the vectors for interrupts 0Fh through 3Fh.  An
  822.      initialization routine is included in the resident portion and 
  823.      assumes control during startup.  This routine contains the
  824.      AUTOEXEC.BAT file handler and determines the segment address
  825.      where user application programs may be loaded.  The
  826.      initialization routine is then no longer needed and is overlaid
  827.      by the first program COMMAND.COM loads. 
  828.      note 1) AUTOEXEC.BAT may be a hidden file. 
  829.  
  830.  6.  IBMDOS.COM uses the EXEC function call to load and start the top-
  831.      level command processor.  The default command processor is
  832.      COMMAND.COM in the root directory of the boot drive.  If
  833.      COMMAND.COM is in a subdirectory or another command processor is
  834.      to be used, it must be specified by a SHELL= statement in the
  835.      CONFIG.SYS file.  A transient portion is loaded at the high end
  836.      of memory.  This is the command processor itself, containing all
  837.      of the internal command processors and the batch file processor.
  838.      For DOS 2.x, this portion also contains a routine to load and
  839.      execute external commands, such as files with extensions of COM
  840.      or EXE.  This portion of COMMAND.COM also produces the DOS prompt
  841.      (such as "A>"), reads the command from the standard input device
  842.      (usually the keyboard or a batch file), and executes the command.
  843.      For external commands, it builds a command line and issues an EXEC
  844.      function call to load and transfer  control to the program. 
  845.  
  846. note 1) COMMAND.COM may be a hidden file.
  847.      2) For IBM DOS 2.x, the transient portion of the command
  848.         processor contains the EXEC routine that loads and executes
  849.         external commands.  For MSDOS 2.x+ and IBM DOS 3.x+, the
  850.         resident portion of the command processor contains the EXEC
  851.         routine.
  852.      3) IBMDOS only checks for a file named "COMMAND.COM".  It will
  853.         load any file of that name if no SHELL= command is used.
  854.  
  855.  
  856.   That pretty much covers the bootup process.  After the command 
  857. processor is loaded, it runs the AUTOEXEC.BAT file and then the user 
  858. gets their prompt to begin working. 
  859.  
  860.  
  861.