home *** CD-ROM | disk | FTP | other *** search
-
- ** Programmer's Technical Reference for MSDOS and the IBM PC **
- ┌─────────────────────────────┐
- │ Shareware Version, 03/21/90 │
- │ Please Register Your Copy │
- └─────────────────────────────┘
- Copyright (c) 1987, 1990 Dave Williams
-
-
- C H A P T E R O N E
-
- DOS TECHNICAL INFORMATION
-
-
- SOME HISTORY├──────────────────────────────────────────────────────────────────
-
- Development of MSDOS/PCDOS began in October 1980, when IBM began searching
- the market for an operating system for the yet-to-be-introduced IBM PC.
- Microsoft had no real operating system to sell, but after some research licensed
- Seattle Computer Products' 86-DOS operating system, which had been written by a
- man named Tim Paterson earlier in 1980 for use on that company's line of 8086,
- S100 bus micros. 86-DOS (also called QDOS, for Quick and Dirty Operating System)
- had been written as more or less a 16-bit version of CP/M, since Digital
- Research was showing no hurry in introducing CP/M-86.
-
- This code was hurriedly polished up and presented to IBM for evaluation. IBM
- had originally intended to use Digital Research's CP/M operating system, which
- was the industry standard at the time. Folklore reports everything from obscure
- legal entanglements to outright snubbing of the IBM representatives by Digital,
- irregardless, IBM found itself left with Microsoft's offering of "Microsoft Disk
- Operating System 1.0". An agreement was reached between the two, and IBM agreed
- to accept 86-DOS as the main operating system for thir new PC. Microsoft
- purchased all rights to 86-DOS in July 1981, and "IBM PC-DOS 1.0" was ready for
- the introduction of the IBM PC in October 1981. IBM subjected the operating
- system to an extensive quality-assurance program, found well over 300 bugs, and
- decided to rewrite the programs. This is why PC-DOS is copyrighted by both IBM
- and Microsoft.
-
- It is sometimes amusing to reflect on the fact that the IBM PC was not
- originally intended to run MSDOS. The target operating system at the end of the
- development was for a (not yet in existence) 8086 version of CP/M. On the other
- hand, when DOS was originally written the IBM PC did not yet exist! Although
- PC-DOS was bundled with the computer, Digital Research's CP/M-86 would probably
- have been the main operating system for the PC except for two things - Digital
- Research wanted $495 for CP/M-86 (considering PC-DOS was essentially free) and
- many software developers found it easier to port existing CP/M software to DOS
- than to the new version of CP/M.
-
- After eight years the wheel has turned a full circle. Digital Research aided
- IBM in writing DOS 4.0, which was subsequently licensed back to Microsoft,
- which has dropped further development of the operating system to tilt at the
- windmills of OS/2.
-
- MSDOS and PC-DOS have been run on more than just the IBM-PC and clones. There
- was an expansion board for the Apple ][ that allowed one to run (some) well -
- behaved DOS programs. There are expansion boards for the Commodore Amiga 2000,
- the Apple MacIntosh II, and the IBM RT PC allowing them to run DOS, the Atari
- STs can run an emulator program called PC-Ditto and boot any version of MSDOS
- with full functionality. Microsoft's OS/2 operating system incorporates the
- so-called "DOS Compatibility Box" to run DOS software; QNX will run DOS as a
- task, and a few Unix systems offer "DOS Merge" or control programs that allow
- DOS to run as a task.
-
-
- WHAT IS DOS?├──────────────────────────────────────────────────────────────────
-
- DOS exists as a high-level interface between an application program and the
- computer. DOS stands for "Disk Operating System", which reflects the fact that
- its main original purpose was to provide an interface between the computer and
- its disk drives.
- DOS now lets your programs do simple memory management, I/O from the system
- console, and assorted system tasks (time and date, etc) as well as managing
- disk operations. Versions 3.1 and up also incorporate basic networking
- functions.
- With the introduction of installable device drivers and TSR (terminate but
- stay resident) programs in DOS 2.0, the basic DOS functions may be expanded to
- cover virtually any scale of operations required.
-
-
- OTHER OPERATING SYSTEMS├───────────────────────────────────────────────────────
-
- Various other operating systems are availible for the IBM PC. These include:
-
- Digital Research CP/M-86
- Digital Research Concurrent CP/M-86 (multitasking)
- Digital Research Concurrent DOS (PC-DOS compatible, multitasking)
- Digital Research Concurrent DOS XM (PC-DOS compatible, multitasking, multiuser)
- Digital Research Concurrent DOS 386 (same, for 80386 computers)
- Digital Research DR-DOS 3.31 and 4.0 (PC-DOS clones)
- Wendin-DOS (PC-DOS compatible, multitasking, multiuser)
- QNX (multitasking, multiuser)
- UNIX (various systems from IBM itself, Microsoft-SCO, Bell, and various UNIX
- clones, single and multi user)
- MINIX (multitasking UNIX clone)
- PC-MOS/386 (PC-DOS clone, multiuser, multitasking)
-
- "Shell" programs exist which use DOS only for disk management while they more
- or less comprise a new operating system. These include:
-
- DesQview Windows OmniView
- GEM TopView TaskView
-
-
- NEC V-series CPUs can execute Intel 8080/8085 8-bit instructions as well as
- the 16-bit 8088-up instructions. They can run standard Digital Research 8-bit
- CP/M and MP/M directly, as well as other operating systems developed for that
- processor.
-
-
-
- SPECIFIC VERSIONS OF MS/PC-DOS├────────────────────────────────────────────────
-
- DOS 1.x is essentially 86-DOS. DOS 2.x kept the multiple file layout (the two
- hidden files and COMMAND.COM) but for all practical purposes is an entirely
- different operating system with backwards compatibility with 1.x. I seriously
- doubt there has been much code from 1.x retained in 2.x. DOS 3.x is merely an
- enhancement of 2.x; there seems little justification for jumping a whole
- version number. DOS 4.0, originating as it did from outside Microsoft, can
- justify a version jump. Unfortunately, 4.x seems to have very little to reason
- justify its existence - virtually all of its core features can be found in one
- version or another of DOS 3.x.
-
- DOS version nomenclature: major.minor.minor. The digit to the left of the
- decimal point indicates a major DOS version change. 1.0 was the first version.
- 2.0 added support for subdirectorites, 3.0 added support for networking, 4.0
- added support for Lotus-Intel-Microsoft EMS.
- The first minor version indicates customization for a major application. For
- example, 2.1 for the PCjr, 3.3 for the PS/2s. The second minor version does not
- seem to have any particular meaning.
-
- The main versions of DOS are:
-
- PC-DOS 1.0 October 1981 original release
- PC-DOS 1.1 June 1982 bugfix, double sided drive support
- MS-DOS 1.25 June 1982 for early compatibles
- PC-DOS 2.0 March 1983 for PC/XT, many UNIX-like functions
- PC-DOS 2.1 October 1983 for PCjr, bugfixes for 2.0
- MS-DOS 2.11 October 1983 compatible equivalent to 2.1
- PC-DOS 3.0 August 1984 1.2 meg drive for PC/AT
- PC-DOS 3.1 November 1984 bugfix for 3.0, implemented network support
- MS-DOS 2.25 October 1985 compatible; extended foreign language support
- PC-DOS 3.2 July 1986 720k 3.5 inch drive support for Convertible
- PC-DOS 3.3 April 1987 for PS/2 series, 1.44 meg, multiple DOS partitions
- PC-DOS 4.0 August 1988 over-32 meg DOS partitions, EMS support
-
- IBM's PC-DOS is considered to be the "standard" version of DOS; Microsoft has
- sold MS-DOS over the counter only since version 3.2 (previously, Microsoft
- sold its versions only to OEMs). Most versions of DOS functionally duplicate
- the external DOS commands such as DISKCOPY, etc. Microsoft has announced that
- they will sell MS-DOS 4.0 only to OEMs, so it looks like the "generic" MS-DOS
- was short-lived.
-
- Some versions of MS-DOS varied from PC-DOS in the availible external commands.
- Some OEMs only licensed the basic operating system code (the xxxDOS and xxxBIO
- programs, and COMMAND.COM) from Microsoft, and either wrote the rest themselves
- or contracted them from outside software houses like Phoenix. Most of the
- external programs for DOS 3.x and 4.x are written in "C" while the 1.x and 2.x
- utilities were written in assembly language. Other OEMs required customized
- versions of DOS for their specific hardware configurations, such as Sanyo 55x
- and early Tandy computers, which were unable to exchange their DOS with the IBM
- version.
-
- At least two versions of DOS have been modified to be run entirely out of ROM.
- The Sharp PC5000 had MSDOS 1.25 in ROM, and the Toshiba 1000 and some Tandy
- models have MSDOS 2.11 in ROM.
-
- PC-DOS 3.0 was extremely buggy on release. It does not handle the DOS
- environment correctly and there are numerous documented problems with the
- batch file parser. The network support code is also nonfunctional in this DOS
- version. It is recommended that users upgrade to at least version 3.1.
-
- DEC MSDOS versions 2.11 for the Rainbow had the ANSI.SYS device driver built
- into the main code. The Rainbow also supported a unique quad density, single
- sided floppy drive.
-
- IBM had a version 1.85 of PC-DOS in April 1983, after the introduction of DOS
- 2.0. It was evidently for internal use only, supported multiple drive file
- searches (a primitive form of PATH), builtin MODE sommands for screen support,
- a /P parameter for TYPE for paused screens, an editable command stack like the
- public domain DOSEDIT.COM utility, and could be set up to remain completely
- resident in RAM instead of a resident/transient part like normal DOS. It is a
- pity some of the neat enhancements didn't make it into DOS 2.0. IBM also had
- an internal use only version 3.4, evidently used while developing DOS 4.0.
-
- Some versions of DOS used in compatibles do not maintain the 1.x, 2.x, .....
- numbering system. Columbia Data Products computers labeled DOS 1.25 as DOS
- 2.0. Early Compaqs labeled DOS 2.0 as DOS 1.x. Other versions incorporated
- special features - Compaq DOS 3.31 and Wyse DOS 3.21 both support 32-bit File
- Allocation Tables.
-
- AT&T DOS 3.1 differs from generic MSDOS 3.10 in its use of cluster-size and
- file allocation table structures. AT&T DOS appears to use rules not from
- version 3, but rather those from version 2.
-
- Epson Equity III and ComputerLand 3.10 DOS's appear to use cluster techniques
- that are a cross between versions 2 and 3. On type DOS partitions, these DOS's
- use 3.x rules if the partition is larger than 32,680 sectors in total size.
- This implies 16 bit FAT entries as well. On partitions below this size, they
- will use 2.x rules, including the 12 bit FAT entries.
-
- Zenith DOS 3.x and Wyse DOS 3.2 have a builtin internal device driver to
- handle up to 4 32Mb DOS partitions on a single hard disk. Wyse DOS 3.31 will
- handle single partitions up to 512Mb with a 32-bit FAT.
-
- According to PC Week Magazine, July 4, 1988, Arabic versions of MSDOS are
- shipping with a hardware copy-protection system from Rainbow Technologies.
- This is similar to the short-lived system used by AutoCAD 2.52 and a very few
- other MSDOS programs, where an adapter block is plugged into the parallel port
- and software makes use of coded bytes within the block. This type of copy
- protection has been common on Commodore products for several years, where it is
- called a "dongle."
- The AutoCAD dongle was defeated by a small program written within weeks of
- version 2.52's debut. Version 2.62 was released 3 months later, without the
- dongle. The DOS dongle will, however, prevent the system from booting at all
- unless it is found.
- This makes the Arabic version of MSDOS the first copy-protected operating
- system, a dubious distinction at best. The modifications to the operating
- system to support the dongle are not known at this time.
-
- Versions of DOS sold in Great Britain are either newer than those sold in the
- US or use a different numbering system. DOS 3.4, 4.0, 4.1, 4.2, and 4.3 had
- been released there between the US releases of 3.3 and 4.0.
- MSDOS 4.0 was introduced in mid-1987 in Europe (at SICOB in Paris and sometime
- earlier by Apricot Computer in the UK). It apparently offers multitasking
- PROVIDED applications are specially written for it.
- David Fraser (UK MD of Microsoft) is on record saying that DOS 4 is unlikely
- to set the world alight and is of interest only to specific OEM's who want its
- features for networking/comms etc. Standard DOS applications will run under DOS
- 4.x as a foreground task according to uncertain information. It differs from
- earlier versions only in allowing background tasks to run. No info about how
- many tasks/memory requirements etc. at this time. It will run an MS-DOS 3.2 or
- earlier type task in a foreground partition, and a specially written task in
- the background.
-
- Microsoft changed their OEM licensing agreements between DOS versions 2.x and
- 3.x. OEM versions of DOS 3.x must maintain certain data areas and undocumented
- functions in order to provide compatibility with the networking features of the
- operating system. For this reason, resident programs will be much more reliable
- when operating under DOS 3.x.
-
- IBM's release of DOS 4.0 (and the immediate subsequent release of a bugfix)
- is a dubious step "forward." DOS 4.0 is the first version of DOS to come with
- a warranty; the catch is that IBM warrants it only for a very slim list of
- IBM-packaged software. 4.0 has some minor EMS support, support for large hard
- disks, and not much else. With its voracious RAM requirements and lack of
- compatibility with previous versions of DOS (many major software packages
- crash under DOS 4.0), plus the increase in price to a cool $150, there has
- been no great rush to go to the newest DOS.
-
-
-
- THE OPERATING SYSTEM HIERARCHY├────────────────────────────────────────────────
-
- The Disk Operating System (DOS) and the ROM BIOS serve as an insulating layer
- between the application program and the machine, and as a source of services
- to the application program.
- The system hierarchy may be thought of as a tree, with the lowest level being
- the actual hardware. The 8088 or V20 processor sees the computer's address
- space as a ladder two bytes wide and one million bytes long. Parts of this
- ladder are in ROM, parts in RAM, and parts are not assigned. There are also
- 256 "ports" that the processor can use to control devices.
- The hardware is normally addressed by the ROM BIOS, which will always know
- where everything is in its particular system. The chips may usually also be
- written to directly, by telling the processor to write to a specific address or
- port. This sometimes does not work as the chips may not always be at the same
- addresses or have the same functions from machine to machine.
-
-
-
- DOS STRUCTURE├─────────────────────────────────────────────────────────────────
-
- DOS consists of four components:
-
- * The boot record
- * The ROM BIOS interface (IBMBIO.COM or IO.SYS)
- * The DOS program file (IBMDOS.COM or MSDOS.SYS)
- * The command processor (COMMAND.COM or aftermarket replacement)
-
-
- * The Boot Record
-
- The boot record begins on track 0, sector 1, side 0 of every diskette formatted
- by the DOS FORMAT command. The boot record is placed on diskettes to produce an
- error message if you try to start up the system with a nonsystem diskette in
- drive A. For hard disks, the boot record resides on the first sector of the DOS
- partition. All media supported by DOS use one sector for the boot record.
-
-
- * Read Only Memory (ROM) BIOS Interface and Extensions
-
- The file IBMBIO.COM or IO.SYS is the interface module to the ROM BIOS.
- This file provides a low-level interface to the ROM BIOS device routines and
- may contain extensions or changes to the system board ROMs. Some compatibles do
- not have a ROM BIOS to extend, and load the entire BIOS from disk. (Sanyo 55x,
- Viasyn machines). Some versions of MSDOS, such as those supplied to Tandy, are
- named IBMBIO.COM but are not IBM files.
-
-
- * The DOS Program
-
- The actual DOS program is the file IBMDOS.COM or MSDOS.SYS. It provides a high-
- level interface for user (application) programs. This program consists of file
- management routines, data blocking/deblocking for the disk routines, and a
- variety of built-in functions easily accessible by user programs.
- When a user program calls these function routines, they accept high-level
- information by way of register and control block contents. When a user program
- calls DOS to perform an operation, these functions translate the requirement
- into one or more calls to IBMBIO.COM, MSDOS.SYS or system hardware to complete
- the request.
-
-
- * The Command Interpreter
-
- The command interpreter, COMMAND.COM, is the part you interact with on the
- command line. It consists of these parts:
-
- Resident Portion:
-
- The resident portion resides in memory immediately following IBMDOS.COM and its
- data area. This portion contains routines to process interrupts 22h (Terminate
- Address), 23h (Ctrl-Break Handler), and 24h (Critical Error Handler), as well as
- a routine to reload the transient portion if needed. For DOS 3.x, this portion
- also contains a routine to load and execute external commands, such as files
- with exensions of COM or EXE.
-
- When a program terminates, a checksum is used to determine if the application
- program overlaid the transient portion of COMMAND.COM. If so, the resident
- portion will reload the transient portion from the area designated by COMSPEC=
- in the DOS environment. If COMMAND.COM cannot be found, the system will halt.
-
- NOTE: DOS 3.3+ checks for the presence of a hard disk, and will default to
- COMSPEC=C:\. Previous versions default to COMSPEC=A:\. Under some DOS
- versions, if COMMAND.COM is not immediately availible for reloading
- (i.e., swapping to a floppy with COMMAND.COM on it) DOS may crash.
-
- All standard DOS error handling is done within the resident portion of
- COMMAND.COM. This includes displaying error messages and interpreting the
- replies to the "Abort, Retry, Ignore, Fail?" message.
-
-
-
-
-
- DOS INITIALIZATION├────────────────────────────────────────────────────────────
-
- The system is initialized by a software reset (Ctrl-Alt-Del), a hardware reset
- (reset button), or by turning the computer on. The Intel 80x8x series processors
- always look for their first instruction at the end of their address space
- (0FFFF0h) when powered up or reset. This address contains a jump to the first
- instruction for the ROM BIOS.
- Built-in ROM programs (Power-On Self-Test, or POST, in the IBM) check machine
- status and run inspection programs of various sorts. Some machines set up a
- reserved RAM area with bytes indicating installed equipment (AT and PCjr).
- The ROM routine looks for a disk drive at A: or an option ROM (usually a hard
- disk) at absolute address C:800h. If no floppy drive or option ROM is found, the
- BIOS calls int 19h (ROM BASIC if it is an IBM) or displays error message.
- If a bootable disk is found, the ROM BIOS loads the first sector of information
- from the disk and then jumps into the RAM location holding that code. This code
- normally is a routine to load the rest of the code off the disk, or to "boot"
- the system.
- The following actions occur after a system initialization:
-
- 1. The boot record is read into memory and given control.
-
- 2. The boot record then checks the root directory to assure that the first
- two files are IBMBIO.COM and IBMDOS.COM. These two files must be the
- first two files, and they must be in that order (IBMBIO.COM first, with
- its sectors in contiguous order).
- NOTE: IBMDOS.COM need not be contiguous in version 3.x+.
-
- 3. The boot record loads IBMBIO.COM into memory.
-
- 4. The initialization code in IBMBIO.COM loads IBMDOS.COM, determines
- equipment status, resets the disk system, initializes the attached
- devices, sets the system parameters and loads any installable device
- drivers according to the CONFIG.SYS file in the root directory (if
- present), sets the low-numbered interrupt vectors, relocates IBMDOS.COM
- downward, and calls the first byte of DOS.
- NOTE: CONFIG.SYS may be a hidden file.
-
-
-
- 5. DOS initializes its internal working tables, initializes the interrupt
- vectors for interrupts 20h through 27h, and builds a Program Segment
- Prefix for COMMAND.COM at the lowest available segment. For DOS versions
- 3.10 up, DOS also initializes the vectors for interrupts 0Fh through 3Fh.
- An initialization routine is included in the resident portion and assumes
- control during startup. This routine contains the AUTOEXEC.BAT file
- handler and determines the segment address where user application programs
- may be loaded. The initialization routine is then no longer needed and is
- overlaid by the first program COMMAND.COM loads.
- NOTE: AUTOEXEC.BAT may be a hidden file.
-
- 6. IBMBIO.COM uses the EXEC function call to load and start the top-level
- command processor. The default command processor is COMMAND.COM in the
- root directory of the boot drive. If COMMAND.COM is in a subdirectory
- or another command processor is to be used, it must be specified by a
- SHELL= statement in the CONFIG.SYS file.
- A transient portion is loaded at the high end of memory. This is the
- command processor itself, containing all of the internal command
- processors and the batch file processor. For DOS 2.x, this portion also
- contains a routine to load and execute external commands, such as files
- with extensions of COM or EXE.
- This portion of COMMAND.COM also produces the DOS prompt (such as "A>"),
- reads the command from the standard input device (usually the keyboard or
- a batch file), and executes the command. For external commands, it builds
- a command line and issues an EXEC function call to load and transfer
- control to the program.
- NOTE: COMMAND.COM may be a hidden file.
- NOTE: For IBM DOS 2.x, the transient portion of the command processor
- contains the EXEC routine that loads and executes external commands.
- For MSDOS 2.x+ and IBM DOS 3.x+, the resident portion of the command
- processor contains the EXEC routine.
- NOTE: IBMBIO only checks for a file *named* "COMMAND.COM". It will load
- any file of that name if no SHELL= command is used.
-
-
- IBM's original documentation spoke of installing alternate command
- interpreters (programs other than COMMAND.COM) with the SHELL= statement in
- CONFIG.SYS. Unfortunately, IBM chose not to document much of the interaction
- between IBMDOS.COM and IBMBIO.COM. By the time much of the interaction was
- widely understood, too many commercial software programs had been written to
- use peculiarities of COMMAND.COM itself. There are only two well-known
- replacements for COMMAND.COM - the commercial Command Plus and the shareware
- 4DOS.
-
-