`TECHNICAL ©
`REFERENCE
`MS - DOS, IBM PC& COMPATIBLES
`
`ile Name Functions
`
`t handle attributes
`handle*attributes
`: anew‘attribute
`- make handle
`- take.handle
`>. id
`
`is volatile
`8 nonvolatile
`pility (for subfuncti
`volatile handles suppo
`latile and non-volat
`ot.
`dle attTibute instructs the mn
`he pages. allocated
`‘the: volaile. attribute. (d faul
`
`eedies should
`EMS: board will retai
`ion 02h can be used t
`the non-volatile attr
`Y the only attribute
`i by the least signif
`
`HUAWEI EX. 1015 - 1/393
`
`HUAWEI EX. 1015 - 1/393
`
`
`
`THE PROGRAMMER’S
`TECHNICAL
`REFERENCE:
`MS-DOS, IBM PC & Compatibles
`
`Dave W.illiams -
`
`SIGMA PRESS - Wilmslow, United Kingdom —
`
`|
`“sh
`
`HUAWEI EX. 1015 - 2/393
`
`HUAWEI EX. 1015 - 2/393
`
`
`
`Copyright ©, D. Williams, 1990
`
`All Rights Reserved. No part of this publication may be reproduced, stored in a
`retrieval system, or transmitted in any form or by any means, electronic, mechanical,
`photocopying, recording or otherwise, without prior written permission.
`
`First published in 1990 by
`
`Sigma Press, 1 South Oak Lane, Wilmslow, Cheshire SK9 6AR, England.
`Reprinted, 1992.
`
`British Library Cataloguing in Publication Data
`
`A CIP catalogue record for this book is available from the British Library.
`
`ISBN: 1-85058-199-1
`
`Typesetting and design by
`
`Sigma Hi-Tech Services Ltd
`Printed in Malta by
`Interprint Ltd.
`_ Distributed by
`
`;
`
`|
`
`John Wiley & Sons Ltd., Baffins Lane, Chichester, West Sussex, England.
`
`Acknowledgement of copyright names
`
`Within this book, various proprietary trade names and names, aslisted below, are
`protected by copyright and are mentioned for descriptive purposes:
`
`UNIX, AT&T, Allied Telephone and Telegraph; AST, RAMpage! AST Corporation;
`Atari, ST, Atari Computer; Borland, Turbo C, Turbo Pascal, Turbo Lightning,
`Borland; Amiga 2000, Commodore Business Machines; Compag, Deskpro, Compaq
`Computer Corporation; Corona, Cordata, Cordata Computer; 10-Net, Fox Research,
`Inc.; Smartmodem, Hayes; IBM, PC, PCjr, PC/XT, PC/AT, XT/286, PS/2, TopView,
`DOS, PC-DOS, Micro Channel 3270 PC, RT PC, Token Ring, IBM Corporation;
`Intel,
`iAPX286, iAPX386, LIM EMS, Communicating Applications Standard,
`Intel,
`Corporation; Logitech, Logimouse, Logitech, Inc.; Microsoft, MS, MS-DOS, OS/2,
`Xenix, Windows, Windows/286, Windows/386, Microsoft Networks, LIM EMS, XMA,
`Microsoft Corp.; Mouse Systems, Mouse Systems Corp.; Novell, NetWare,
`Novell Corp.; DesQview, Quarterdeck Office Systems; ARC, SEAware,
`Inc.;
`DoubleDOS, Softlogic; TaskView, Sunny Hill Software; Tandy, Tandy Corp.; Zenith,
`Z-100, Zenith Radio Corporation; ShowPartner, Paintbrush, ZSoft Corporation;
`‘LIM 4.0’ and ‘Expanded Memory Specification’ are copyright Lotus Development
`Corp, Intel Corp, and Microsoft Corp; ‘EEMS’, ‘AQA 3.1’ and ‘Enhanced Expanded
`Memory Specification’ are copyright by Ashton-Tate, Quadram, and AST.Various
`other names are trademarks of their respective companiesFull acknowledgmentis
`hereby madeofall such protection.
`
`
`
`i
`
`|
`
`|
`
`|
`
`-
`
`HUAWEI EX. 1015 - 3/393
`
`HUAWEI EX. 1015 - 3/393
`
`
`
`Preface
`
`
`
`This bookis a technicalreference.It is NOT a tutorial. It is intended to replace the various (ex-
`pensive) references needed to program for the DOS environment, that stack of magazines
`threatening to take over your work area, and those odd tables and charts you can neverfind
`when you need them.
`
`The various Microsoft and IBM publications and references don’t always have the same infor-
`mation. This has caused someconsternation about the ‘undocumented’featuresto be found in
`DOS.In general,if a call doesn’t appear in the IBM DOSTechnical Referenceit is considered
`‘undocumented’ although it may be in commonuse.
`Microsoft’s offical policy toward DOShasbeento put the burden ofdocumenting and suppor-
`ting their product to their vendors. Microsoft will not answer any questions concerning DOSdi-
`rectly since they don’t officially support it. This leaves what information IBM and other OEMs
`(DEC, Zenith, et al) have chosento publish, and the information obtained from programmers
`who’ve poked aroundinsideit.
`
`Nowthat Microsoft is selling MSDOS3.3 and 4.0 over the counter they seem to be dragging |
`their feet over whether they will have to support the generic version since it doesn’t have an |
`OEM nameonit anymore.In view of their push to OS/2 (OS/2! Just Say No!) further supportof
`DOSseemsunlikely.
`
`A project this size takes a LOToftime andeffort.I’ve tried to verify as much ofthe information
`I’ve received as I could, but there’s just too muchforabsolute certainty.
`
`HUAWEI EX. 1015 - 4/393
`
`HUAWEI EX. 1015 - 4/393
`
`
`
`
`
`HUAWEI EX. 1015 - 5/393
`
`HUAWEI EX. 1015 - 5/393
`
`
`
`Contents
`
`Chapter 1: DOS and the IBM PC
`
`Chapter 2: CPU Port Assignments, System Memory Map, BIOS DataArea,
`Interrupts 00h to 09h
`
`Chapter 3: The PC ROMBIOS
`
`Chapter 4: DOS Interrupts and Function Calls
`
`Chapter5: Interrupts 22h Through 86h
`
`Chapter 6: DOS Control Blocks and Work Areas
`
`Chapter 7: DOSFile Structure
`
`Chapter 8: DOSDisk Information
`
`Chapter 9:Installable Device Drivers
`
`Chapter 10: Expanded and Enhanced Expanded Memory Specifications
`Chapter 11: Conversion Between MSDOSand Foreign Operating Systems
`Chapter 12: Microsoft Windows A.PI.
`
`Chapter 13: NetworkInterfacing
`
`Chapter 14: Mouse Programming |
`
`Chapter 15: Register-Level Hardware Access
`
`Chapter 16: Video Subsystems and Programming
`
`Appendix 1: Keyboard Scan Codes
`Appendix 2: Standard ASCII Character Codes
`
`.
`
`Appendix 3: ASCII Control Codes
`
`Appendix 4: IBM PC Interrupt Usage
`
`Appendix5:List of IBM PC-XT-AT-PS/2 Diagnostic Error Codes
`
`Appendix 6: Pinouts For VariousInterfaces
`
`Appendix 7: ANSISYS
`Bibliography
`
`Index
`
`.
`
`:
`
`1
`
`10
`
`25
`
`34
`
`98
`
`130
`
`140
`
`151
`
`171
`
`185
`208
`210
`
`269
`
`300
`
`310
`
`. 315
`
`328
`342
`
`345
`
`347
`
`349
`
`358
`
`370
`374
`
`380
`
`HUAWEI EX. 1015 - 6/393
`
`HUAWEI EX. 1015 - 6/393
`
`
`
`HUAWEI EX. 1015 - 7/393
`
`HUAWEI EX. 1015 - 7/393
`
`
`
`DOSand the IBM PC
`
`
`
`Some History
`Development ofMS-DOS/PCDOSbeganin October 1980, when IBM began searching the mar-
`ket for an operating system for the yet-to-be-introduced IBM PC. Microsoft had noreal opera-
`ting system to seli, but after some research licensed Seattle Computer Products’ 86-DOSopera-
`ting system, which hadbeen written by a man named Tim Patersonearlier 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 moreorless a 16-bit version of CP/M,since Digital Re-
`search was showing nohurry in introducing CP/M-86.
`This code was hurriedly polished up and presented to IBM forevaluation. IBM had originally in-
`tended 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 snubbingof the
`IBM representatives by Digital. Irregardless, IBM founditself 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-DOSas the main operating system for their new PC. Microsoft purchased
`all rights to 86-DOSin July 1981, and "IBM PC-DOS1.0" was ready for the introduction of the
`IBM PC in October 1981. IBM subjected the operating system to an extensive quality-assurance
`program, reportedly found well over 300 bugs,and decidedto rewrite the programs. This is why
`PC-DOSis copyrighted by both IBM and Microsoft.
`It is sometimes amusingto reflect on the fact that the IBM PC was not originally intended to run
`MS-DOS.Thetarget operating system at the end ofthe developmentwasfor a (notyetin exist-
`ence) 8086 version of CP/M. Onthe other hand, when DOSwas originally written the IBM PC
`did notyet exist! Although PC-DOSwas bundled with the computer, Digital Research’s CP/M-
`86 would probably have been the main operating system for the PC exceptfor two things - Digi-
`tal Research wanted $495 for CP/M-86 (considering PC-DOS was essentially free) and many
`software developersfoundit easier to port existing CP/M software to DOSthanto the new ver-
`sion of CP/M.Several computer magazines claimedthat Digital Research aided IBM in writing
`DOS4.0, which was subsequently licensed back to Microsoft, which has droppedfurther devel-
`opmentof the operating system totilt at the windmills of OS/2. OS/2? Notyet! After using DR-
`DOS3.4 and noting its behaviour, I now tendto seriously doubt Digital had any dealings with
`PC-DOS4.0.
`MS-DOSand PC-DOShavebeen run oa more than just the IBM-PC and clones. Someofthe
`following have been done:
`
`HUAWEI EX. 1015 - 8/393
`
`HUAWEI EX. 1015 - 8/393
`
`
`
`2
`Hardware PC Emulation:
`Commodore Amiga 2000
`IBM PC/AT
`Atari 400/800
`Apple Macintosh
`Atari ST
`Apple II
`
`Software PC Emulation:
`Atari ST
`Apple Macintosh
`
`DOS Emulation:
`Os/2
`QNX
`SunOS
`Xenix
`
`/
`
`The Programmer's Technical Reference
`
`8088 or A2286D 80286 Bridge Board
`80286 AT adapter
`Co-Power88 board
`AST 80286 board
`PC-Ditto II cartridge
`‘TransPC8088 board, QuadRam QuadLink
`
`PC-Ditto I
`SoftPC
`
`;
`
`DOSemulation in "Compatibility Box"
`DOSwindow
`DOS window
`DOSemulation with DOSMerge
`
`Whatis DOS?
`DOSexists as a high-level interface between an application program and the computer. DOS
`stands for "Disk Operating System", whichreflects the fact that its main original purpose wasto
`provide an interface between the computerandits disk drives.
`
`DOSnowlets 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 introductionofinstallable device drivers and TSR (terminate butstay resident) pro-
`grams in DOS2.0, the basic DOSfunctions may be expandedto covervirtually any scale of oper-
`ations required.
`
`i
`
`Other Operating Systems
`There are a number of compatible replacements for Microsoft’s MS-DOS. Someare:
`
`(multitasking, multiuser)
`Consortium Technologies MultiDOS
`Digital Research Concurrent DOS
`(multitasking)
`4
`(for 80386 computers)
`Digital Research Concurrent DOS386
`Digital Research ConcurrentDOSXM_(multitasking, multiuser)
`Digital Research DR-DOS 3.31and4.0
`(PC-DOS clones)
`PC-MOS/386
`(multitasking, multiuser)
`Wendin-DOS
`(multitasking, multiuser)
`VM/386
`(multitasking)
`-
`
`Various other operating systemsare available for the IBM PC. Theseinclude:
`Digital Research CP/M-86
`Digital Research Concurrent CP/M-86 (multitasking)
`Minix (multitasking UNIX workalike)
`Pick (database-operating system)
`
`HUAWEI EX. 1015 - 9/393
`
`HUAWEI EX. 1015 - 9/393
`
`
`
`DOSand the IBM PC
`
`3
`
`QNX(multitasking, multiuser)
`UNIX (various systems from IBMitself, Microsoft-SCO,Bell, and various UNIX clones, single
`and multi user) (AIX, Xenix, AT&T System V, etc.)
`"Shell" programsexist which use DOSonly for disk management while they more or less com-
`prise a new operating system. Theseinclude:
`
`DesQview
`Windows
`OmniView
`GEM
`TopView
`-TaskView
`
`Specific Versions of MS/PC-DOS
`DOS1.xis essentially 86-DOS. DOS2.x kept the multiple file layout (the two hiddenfiles and
`COMMAND.COM)butforall practical purposesis an entirely different operating system with
`backwards compatibility with 1.x. ] seriously doubt there has been much code from Lx retained
`in 2.x. DOS 3.x is merely an enhancementof2.x; there seemslittle justification for jumping a
`whole version number. DOS4.0,originatingas it did from outside Microsoft, can justify a ver-
`sion jump. Unfortunately, 4.x seems to havevery little reason to justify its existence - virtually all
`ofits core features can be found in oneversion or another of DOS 3.x.
`
`DOSversion nomenclature: major.minor.minor. Thedigit to the left of the decimal point indi-
`cates a major DOSversion change. 1.0 was thefirst version. 2.0 added support for subdirec-
`tories, 3.0 added support for networking, 4.0 added some minimal support for Lotus-Intel-
`Microsoft EMS.
`
`Thefirst minor version indicates customization for a major application. For example,2.1 for the
`PCjr,3.3 for the PS/2s. Thesecond minorversion does not seem to have any particular meaning.
`- The main versions of DOSare:
`
`original release
`August 1981
`PC-DOS1.0
`bugfix, double sided drive support
`May 1982
`PC-DOS 1.1
`for early compatibles
`June 1982
`MS-DOS1.25
`for PC/XT, Unix-type subdirectory support
`March 1983
`PC-DOS2.0
`for PCjr, bugfixesfor 2.0
`October 1983
`PC-DOS 2.1
`compatible equivalent to PC-DOS 2.1
`MS-DOS2.11 October 1983
`1.2 meg drive for PC/AT, some new system calls
`PC-DOS3.0
`August 1984
`bugfix for 3.0, implemented network support
`PC-DOS3.1
`November 1984
`compatible; extended foreign language support
`MS-DOS2.25 October 1985
`720k3.5 inch drive supportfor Convertible
`PC-DOS3.2
`December 1985
`for PS/2 series, 1.44 meg, multiple DOSpartitions
`PC-DOS3.3
`April 1987
`over-32 meg DOSpartitions, new function calls
`MS-DOS 3.31 November 1987
`minor EMS support, some newfunctioncalls
`PC-DOS 4.0
`August 1988
`Microsoft version with somebugfixes
`MS-DOS 4.01
`January 1989
`IBM’s PC-DOSis considered to be the "standard" version of DOS; Microsoft has sold MS-DOS
`over the counteronly since version 3.2 (previously, Microsoft sold its versions only to OEMs).
`
`_
`
`HUAWEI EX. 1015 - 10/393
`
`HUAWEI EX. 1015 - 10/393
`
`
`
`4
`
`The Programmer’s Technical Reference
`
`Mostversions of DOSfunctionally duplicate the external DOS commandssuch as DISKCOPY,
`etc. Although Microsoft announced that they would sell MS-DOS4.0 only to OEMs, they ap-
`parently changed the policy and are nowsellingit over the counter.
`
`Someversions of MS-DOSvaried from PC-DOSin the available external commands. Some
`OEMsonly licensed the basic operating system code (the xDOS and xBJO programs, and
`COMMAND.COM)from Microsoft, and either wrote the rest themselves or contracted them
`from outside software houses like Phoenix. Mostof 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 DOSfor their specific hardware configurations, such as Sanyo
`55x andearly Tandy computers, which were unable to exchange their DOSwith the IBM version.
`
`At least two versions of DOS have been modified to be run entirely out of ROM. The Sharp
`PC5000 had MS-DOS1.25 in ROM,and the Toshiba 1000 and some Tandy 1000 models have
`MS-DOS2.11 in ROM.Digital Research has also announced its DR-DOSis available ina ROM
`version and Award Software is marketing DOScards to OEMs asa plug-in.
`
`PC-DOS3.0 was extremely buggy on release. It does not handle the DOS environmentcorrectly
`and there are numerous documentedproblemswith the batch file parser. The network support
`codeis also nonfunctional in this DOSversion. It is recommendedthat users upgrade to at least
`version 3.1.
`
`DEC MS-DOSversions 2.11 for the Rainbow had the ANSI.SYS device driver built into the
`main code. The Rainbowalso used a unique quad density, single-sided floppy drive and its DOS
`had special supportforit.
`
`IBM hada version 1.85 of PC-DOSin April 1983, after the introduction of DOS2.0.It was evi-
`dently for internal use only, supported multiple drive file searches (a primitive form of PATH),
`built in MODE commandsfor screen support, a /P parameter for TYPE for pausedscreens, an
`editable commandstack like the public domain DOSEDIT-COMutility, and could be set up to
`remain completely resident in RAM insteadof a resident/transientpart like normal DOS. It isa
`pity someof the neat enhancements didn’t makeit into DOS 2.0. IBM also had an "internal use
`only"version 3.4, evidently used while developing DOS4.0.
`
`Someversions of DOS used in compatibles do not maintain the 1.x, 2.x, ... numbering system.
`Columbia Data Products computers labelled DOS 1.25 as DOS 2.0. Early Compags labelled
`DOS 2.0 as DOS 1.x. Other versions incorporated special features - Compaq DOS 3.31 and
`Wyse DOS3.21 both support 32-bit file allocation tables in the same fashion as DOS4.x.
`
`According to PCWeek Magazine,July 4, 1988, Arabic versions of MS-DOSare 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 MS-DOSprograms, 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 Commodoreproductsfor several years, whereitis
`called a "dongle".
`
`The AutoCAD dongle was defeated by a small programwritten within weeks of version 2.52’s
`debut. Version 2.62 was released 3 months later, without the dongle. The DOS dongle will, how-
`ever, prevent the system from bootingat all unlessit is found.
`
`This makes the Arabic version of MS-DOSthefirst copy-protected operating system, a dubious
`distinction at best. The modifications to the operating system to. support the dongle are not
`knownat this time. Frankly, it would seem that burning the operating system into ROMs would
`be cheaper and simpler.
`
`'
`
`;
`
`HUAWEI EX. 1015 - 11/393
`
`HUAWEI EX. 1015 - 11/393
`
`
`
`DOSand the IBMPC
`
`|
`
`5
`
`Versions of DOSsold in Great Britain are either newer than those sold in the US or use a differ-
`ent numbering system. DOS3.4,4.0, 4.1, 4.2, and 4.3 had been released here between the USre-
`leases of 3.3 and 4.0.
`
`Microsoft changed their OEM licensing agreements between DOSversions 2.x and 3.x. OEM
`versions of DOS 3.x must maintain certain data areas and undocumentedfunctionsin order to
`provide compatibility with the networking features of the operating system. For this reason,
`resident programswill be much morereliable when operating under DOS3.x.
`
`IBM’srelease of DOS4.0 (and the immediate subsequentrelease of a bugfix) is a dubious step
`"forward". DOS4.0is the first version of DOS to come with a warranty; the catch is that IBM
`warrantsit only for a very slim list of IBM-packagedsoftware. 4.0 has some minor EMSsupport,
`‘Support for large hard disks, and not muchelse. With its voracious RAM requirementsandlack
`of compatibility with previous versions of DOS (many major software packages crash under
`DOS4.0), plus the increasein price to a cool $150, there has beennogreat rushto go to the ne-
`west DOS
`
`The Operating System Hierarchy
`The Disk Operating System (DOS) and the ROM BIOSserve asan insulating layer between the
`application program and the machine, and as a source ofservices to the application program.
`As the term ‘system’ might imply, DOSis not one program but a collection of programsde-
`signed to work together to allow the user access to programs and data. Thus, DOSconsists of
`severallayers of "control" programs anda set of “utility” programs.
`
`The system hierarchy may be thoughtof as a tree, with the lowest level being the actual hard-
`ware. The 8088 or V20 processorsees 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 partsare notas-
`signed. There are also various "ports" that the processorcan useto control devices.
`
`The hardwareis normally addressed by the ROM BIOS,which will always know where every-
`thing 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
`notalways be at the same addresses or have the same functions from machineto machine.
`
`DOS Structure
`
`DOSconsists of four components:
`The boot record
`The ROM BIOSinterface (IBMBIO.COM orIO.SYS)
`The DOSprogram file (IBMDOS.COM or MS-DOS.SYS)
`The command processor (COMMAND.COMoraftermarket replacement)
`
`The Boot Record
`
`The bootrecord begins on track O,sector 1, side 0 of every diskette formatted by the DOS FOR-
`MAT command. The boot record is placed on diskettes to produce an error message if you try to
`Start up the system with a non-system diskette in drive A. For hard disks, the boot record resides
`
`HUAWEI EX. 1015 - 12/393
`
`HUAWEI EX. 1015 - 12/393
`
`
`
`6
`
`The Programmer’s Technical Reference
`
`on thefirst sector of the DOSpartition. All media supported by DOSuse onesectorforthe boot
`record,
`.
`
`Read Only Memory (ROM) BIOSInterface and Extensions
`ThefileI]BMBIO.COMorIO.SYSis the interface module to the ROM BIOS. Thisfile provides
`a low-levelinterface to the ROM BIOSdevice routines and may contain extensions or changes
`to the system board ROMs. Some compatibles do not havea ROM BIOStoextend,and load the
`entire BIOS from disk (Sanyo 55x, Viasyn machines). Some versions of MS-DOS,such as those
`supplied to Tandy, are named IBMBIO.COMbutarenot IBMfiles.
`
`These low-level interface routines include the instructions for performing operations such as
`displaying information on the screen, reading the keyboard, sending data out to the printer,
`operating the disk drives, and soon.It is the operating system’s meansof controlling the hard-
`ware. IBMBIO.COMcontains any modifications or updates to the ROM BIOSthat are needed
`to correct any bugs or add supportfor other types of hardware such as newdisk drives. By using
`IBMBIO.COMto update the ROM BIOSonthefly whenthe user turns on their computer,
`IBM doesnotneedto replace the ROM BIOSchipitself, but makes any corrections through the
`cheaper and easier method of modifying the IBMBIO.COMfile instead.
`
`IBMBIO.COMalso keepstrack of hardware operations on an internal stack or “scratch pad"
`area for the operating system to save information such as addressesit will need, etc. An example
`of the use for this stack can be seen when running a program such as a wordprocessor.If you
`have told the word processorto save yourletter, it will write the data to your disk. During this
`time, if you start typing some moreinformation, the keyboard generates a hardwareinterrupt.
`Since you don’t wantthe processof writing the information to the disk to be interrupted, DOS
`allocates a slot in the stack for the keyboard’s hardware interrupt and whenit gets a chance,
`(probably after the data has been written to the disk), it can process that interrupt and pick up
`the characters you may have been typing. The STACKS= command in DOS 3.2+’s
`CONFIG.SYSfile controls the numberofstack frames available for this purpose.
`IBMBIO.COM also reads your CONFIG.SYS file and installs any device drivers (i.e.
`DEVICE=ANSISYS)or configuration commandsit mayfind there.
`
`The DOS Program
`
`The actual DOSprogramis the file IBMDOS.COM or MS-DOS.SYS.It provides a high-level
`interface for user (application) programs. This program consists of file managementroutines,
`data blocking/deblocking for the disk routines, and a. variety of built-in functions easily
`accessible by user programs.
`
`‘
`
`Whena userprogram calls these function routines, they accept high-level information by way of
`_ Tegister and control block contents. Whena user program calls DOSto perform anoperation,
`these functions translate the requirement
`into one or more calls to IBMBIO.COM,
`MS-DOS.SYSorsystem hardware to complete the request.
`
`The CommandInterpreter
`
`The commandinterpreter, COMMAND.COM,is thepart you interact with on the command
`line. COMMAND.COMhasthree parts. IBM calls them the "residentportion", the "initializa-
`tion portion"and the "transientportion".
`
`HUAWEI EX. 1015 - 13/393
`
`HUAWEI EX. 1015 - 13/393
`
`
`
`DOSand the IBM PC
`
`7
`
`IBM’s original documentation spokeof installing alternate commandinterpreters (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 IBM-
`BIO.COM.Bythe time muchofthe interaction was widely understood, many commercial soft-
`ware programshad beenwrittento use peculiarities of COMMAND.COMitself.
`‘Two programsexist that perform as actual "shells" by completely replacing COMMAND.COM
`and substituting their own commandinterpreter to use with the hidden DOSfiles. These are
`CommandPlus, a commercial package, and the very interesting shareware 4DOSpackage. Both
`supply greatly enhancedbatch language andediting capabilities.
`
`Note: DOS 3.3 + checks for the presenceofa hard disk, and will default to COMSPEC=C\\,Pre-
`- vious versions default to COMSPEC=A.;\, Under some DOSversions, ifCOMMAND.COMis
`not immediately available for reloading(i.e., swapping to a floppy with COMMAND.COM on
`it) DOS maycrash.
`
`Resident Portion
`
`The resident portion resides in memory immediately following IBMDOS.COMandits 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 containsa routine to load and executé external
`commands, such asfiles with extensions of COM or EXE.
`
`Whena program terminates, a checksum is usedto determineif the application program over-
`laid the transient portion of COMMAND.COM..Ifso,the resident portion will reload the tran-
`sient portion from the area designated by COMSPEC=in the DOS environment. If COM-
`MAND.COM cannotbe found, the system will halt.
`
`All standard DOSerror handling is done within the resident portion of COMMAND.COM.
`This includesdisplaying error messages andinterpreting the replies to the "Abort, Retry, Ig-
`nore, Fail?" message.
`
`Since the transient portion of COMMAND.COMisso large (containing the internal com-
`mands and all those error messages), andit is not needed whenthe useris running an applica-
`tion it can be overlaid that program if that application needs the room. Whenthe applicationis
`through, the resident portion of COMMAND.COMbrings the transient portion back into
`memory to show the prompt. This is why you will sometimes see the message "Insert disk with
`COMMAND.COM".It needsto get the transient portion off the disk since it was overlaid with
`the application program.
`
`Theinitialization portion of COMMAND.COMfollowsthe resident portion and is given con-
`trol during the boot-up procedure. This section actually processes the AUTOEXEC.BATfile.It
`also decides whereto load the user’s programs whenthey are executed. Since this code is only
`needed during start-up,it is overlaid by thefirst program which COMMAND.COMloads.
`Thetransient portionis loaded at the high end of memory andit is the commandprocessorit-
`self. It interprets whateverthe user types in at the keyboard, hence messages such as ‘Bad com-
`mandorfile name’ for whenthe user misspells a command.This portion contains all the internal
`commands(i.e. COPY, DIR, RENAME, ERASE), the batchfile processor (to run .BATfiles)
`and a routine to load and execute external commandswhich are either .COM or EXE files.
`Thetransient portion of COMMAND.COM produces the system prompt, (C), and reads what
`
`HUAWEI EX. 1015 - 14/393
`
`HUAWEI EX. 1015 - 14/393
`
`
`
`&
`
`The Programmer’s Technical Reference
`
`the user types in from the keyboard andtries to do something with it. For any .COM or .EXE
`files, it builds a commandline and issues an EXECfunctioncall to load the program andtrans-
`fer controlto it.
`
`DOS Initialization
`
`The systemis initialized by a softwarereset (Ctrl-Alt-Del), a hardware reset(reset button), or by
`turning the computeron. TheIntel 80x8x series processors always lookfortheirfirst instruction
`at the endof their address space (OFFFFOh) when powereduporreset. This address contains a
`jumpto thefirst instruction for the ROM BIOS.
`
`Built-in ROM programs (Power-OnSelf-Test, or POST, in the IBM) check machine status and
`run inspection programsofvarious sorts. Some machinesset up a reserved RAM areawith bytes
`indicating installed equipment(AT and PCjr).
`
`When the ROM BIOSfinds a ROM on anadaptercard,it lets that ROM takecontrol ofthe sys-
`tem so that it may perform any set up necessary to use the hardwareor software controlled by
`that ROM. The ROM BIOSsearches absolute addresses 0C8000h through OE0000hin 2Kin-
`crements in search of a valid ROM.A valid ROM is determined by the first few bytes in the
`ROM.The ROMwill have the bytes 55h, OAAh, a length indicator and then the assembly lan-
`guage instruction to CALL FAR (tobring in a ‘FAR’routine). A checksum is done on the ROM
`to verify its integrity, then the BIOS performs the CALL FAR to bring in the executable code.
`The adapter’s ROM then performsits initialization tasks and hopefully returns control of the
`computer back to the ROM BIOSsoit can continue with the booting process.
`
`The ROM BIOSroutines then lookfora 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 BIOScalls int 19h
`(ROM BASICifit is an IBM)or displays an error message.
`
`Ifa bootable disk is found, the ROM BIOSloadsthefirst sector of data from the disk and then
`- jumpsinto the RAM location holding that code. This code normally is a routine to load the rest
`of the codeoff the disk,or to ‘boot’ the system.
`The followingactions occurafter a system initialization:
`The bootrecordis read into memory andgiven control.
`2. The boot record then checks the rootdirectory to assure that thefirst twofiles are
`IBMBIO.COM and IBMDOS.COM.Thesetwofiles mustbe thefirst two files, and they
`mustbe in that order (IBMBIO.COMfirst, with its sectors in contiguous order).
`Note: IBMDOS.COM neednotbe contiguousin version 3.x+.
`3. The boot record loads IBMBIO.COMinto memory.
`4. The initialization code in ]BMBIO.COM loads IBMDOS.COM,determines equipment
`status, resets the disk system,initializes the attached devices, sets the system parameters
`and loads anyinstallable device drivers according to the CONFIG.SYSfile in the root
`directory (if present), sets the low-numberedinterrupt vectors, relocates]BMDOS.COM
`downward, andcalls the firstbyte of DOS.
`Note: CONFIG.SYS maybe a hiddenfile.
`_DOSinitializesits internal workingtables,initializes the interrupt vectors for interrupts
`20h through 27h, and builds a Program SegmentPrefix forCOMMAND.COMatthe lowest
`available segment. For DOSversions 3.10 up, DOSalsoinitializes the vectors for interrupts
`
`5.
`
`HUAWEI EX. 1015 - 15/393
`
`HUAWEI EX. 1015 - 15/393
`
`
`
`DOSand the IBM PC
`
`.
`
`.
`
`9
`
`OFh through 3Fh.An initialization routine is included in the resident portion and assumes
`control duringstart-up. This routine contains the AUTOEXEC.BATfile handler and
`determines the segmentaddress whereuser application programs maybe loaded. The
`initialization routine is then no longer needed andis overlaid by thefirst program
`COMMAND.COMloads.
`Note: AUTOEXEC.BATmaybeahiddenfile.
`6.
`IBMBIO.COMuses the EXECfunctioncall to load andstart the top-level command
`processor. The default commandprocessor is COMMAND.COMintherootdirectory of
`the boot drive. If COMMAND.COMisin a subdirectory or another commandprocessoris
`to be used,it must be specified bya SHELL= statementin the CONFIG.SYSfile. A
`transient portionis loadedat the high end of memory.This is the commandprocessoritself,
`containing all of the internal commandprocessorsandthe batch file processor. For
`DOS2.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.COMalso produces
`the DOS prompt(suchas ‘A), reads the commandfrom the standard input device (usually
`the keyboard ora batch file), and executes the command. For external commands,it builds a
`commandline and issues an EXECfunction call to load and transfer control to the
`program.
`
`Note 1.
`
`COMMAND.COM maybea hiddenfile.
`
`2.
`
`3.
`
`ForIBMDOS 2.x,the transientportion of the commandprocessorcontains the
`EXEC routine that loads and executes external commands. For MS-DOS 2.x+ and
`IBM DOS3.x+, the resident portion of the command processorcontains the
`EXEC routine.
`.
`
`IBMBIO only checksfor a file named COMMAND.COM.It will load anyfile of
`that name ifno SHELL= command is used.
`
`That pretty much covers the boot-up process. After COMMAND.COMisloaded,it runs the
`AUTOEXEC.BATfile and then the user gets a promptto begin working.
`
`HUAWEI EX. 1015 - 16/393
`
`HUAWEI EX. 1015 - 16/393
`
`
`
`CPU Port Assignments, System
`Memory Map, BIOS Data Area,
`Interrupts 00h to 09h
`
`Introduction
`
`For consistency in this reference, all locations and offsets are in hexadecimal unless otherwise
`specified. All hex numbersare prefaced with a leadingzeroif they begin with an alphabetic char-
`acter, and are terminated with a lowercase H (h). The formats vary according to commonusage.
`
`System Memory Map
`
`The IBM PC handlesits address space in 64k segments,divided into 16k fractions and then fur-
`then as necessary.
`start
`start
`end
`
`addr. addr.
`(dec)
`(hex)
`
`addr
`
`usage
`
`*640k RAM Area*
`
`start of RAM, first K is interrupt vector table
`PC-0 system board RAM ends
`
`PC-1 system board RAM ends
`
`0k
`16k
`32k
`48k
`64k
`80k
`96k
`112k
`128k
`144k
`160k
`176k
`
`192k
`208k
`224k
`240k
`
`00000-03FFF
`04000-0O7FFF
`08000-OBFFF
`10000-13FFF
`14000-17FFF
`18000-1BFFF
`1C000-~1FFFF
`20000-23FFF
`24000~27FFF
`28000-2BFFF
`2C000-2FFFF
`
`30000-33FFF
`34000-37FFF
`38000-3BFFF
`3C000-3FFFF
`
`HUAWEI EX. 101