DOS AND THE IBM PC
** Programmer's Technical Reference for MSDOS and the IBM PC **
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ Shareware Version, 06/17/91 ³
³ Please Register Your Copy ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
Copyright (c) 1987, 1991 Dave Williams
USA copyright TXG 392-616 ALL RIGHTS RESERVED
ISBN 1-878830-02-3 (disk-based text)
C H A P T E R O N E
DOS AND THE IBM PC
C O N T E N T S
Some History .......................................................... 1**1
What is DOS? .......................................................... 1**2
Other Operating Systems ............................................... 1**3
Specific Versions of MS/PC-DOS ........................................ 1**4
The Operating System Heirarchy ........................................ 1**5
DOS Structure ......................................................... 1**6
DOS Initialization .................................................... 1**7
SOME HISTORYÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 1**1
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 8086 real operating system to sell, but quickly made a deal
to license Seattle Computer Products' 86-DOS operating system, which had been
written by 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 quickly 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 various stories about the rift between DRI and IBM. The most
popular story claims Gary Kildall or DRI snubbed the IBM executives by flying
his airplane when the meeting was scheduled. Another story claims Kildall
didn't want to release the source for CP/M to IBM, which would be odd, since
they released it to other companies. Industry pundit Jerry Pournelle claims
Kildall's wife killed the deal by insisting on various contract changes. I
suspect the deal was killed by the good ol'boy network. It's hard to imagine
a couple of junior IBM executives giving up when ordered to a task as simple
as licensing an operating system from a vendor. Wouldn't look good on their
performance reports. It would be interesting to hear IBM's story...
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 Personal Computer 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,
reportedly found well over 300 bugs, and decided to rewrite the programs. This
is why PC-DOS is copyrighted by both IBM and Microsoft.
Some early OEM versions of DOS had different names, such as Compaq-DOS, Z-DOS,
Software Bus 86, etc. By version 2 Microsoft managed to persuade everyone but
IBM to refer to the product as "MS-DOS."
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.
The upgrade from DOS 3.3 to 4.0 was done in-house by IBM. DOS 4.0 was a
completely IBM product, later licensed back to Microsoft. In early 1990 IBM
announced that it was ceasing development of DOS and all further work would
be done solely by Microsoft.
Microsoft Press' "MSDOS Encyclopedia" shows a reproduction of a late
DOS 1.25 OEM brochure. Microsoft was touting future enhancements to
1.25 including Xenix-compatible pipes, process forks, and multitasking,
as well as "graphics and cursor positioning, kanji support, multi-user
and hard disk support, and networking." Microsoft certainly thought
big, but, alas, the forks, multitasking, and multiuser support never
came about, at least in US versions of DOS. Oddly, the flyer claims
that
"MS-DOS has no practical limit on disk size. MS-DOS uses 4-byte XENIX
OS compatible pointers for file and disk capacity up to 4 gigabytes."
Umm... yeah. One sort of gets the idea nobody at Microsoft had a hard
disk larger than 32 megabytes...
For the record they actually delivered:
Xenix-compatible pipes DOS 2.0 ("|" operator)
process forks, and multitasking eDOS 4.0 (not delivered in the US)
multi-user never delivered
graphics and cursor positioning DOS 2.0 (ANSI.SYS, more than likely)
kanji support DOS 2.01, 2.25 (double-byte char set)
hard disk support DOS 2.0 (subdirectories)
networking DOS 3.1 (file locking, MS Networks)
Early Microsoft ads pumped DOS' Xenix-like features and promised Xenix
functionality in future releases.
We'll probably never know what the real story was behind eDOS/DOS 4/
DOS 5/286DOS/OS2. Microsoft had announced their intent to build a
multitasking, multiuser version of MSDOS as early as 1982. They shipped
betas of "DOS 4.0" in '86 and early '87, before 3.3 was even announced.
Microsoft UK announced they had licensed 4.0 to Apricot Computer, and
the French Postal Service was supposed to be running it. I've never
been able to find out if Apricot ever shipped any 4.0 to end users.
Despite Gordon Letwin's acid comments about problems with the 80286
processor, I doubt the '286 was the barrier between users and a
multitasking MSDOS. I also doubt there was any shortage of programming
talent at Microsoft - Digital Research's Concurrent DOS and Software
Link's PC-MOS were developed without undue trouble.
MSDOS and PC-DOS have been run on more than just the IBM-PC and clones. Some
of the following have been done:
Hardware PC Emulation:
Apple II -> TransPC 8088 board
Apple MacIntosh -> AST 80286 board
Atari 400/800 -> Co-Power 88 board
Atari ST -> PC-Ditto II cartridge
Commodore Amiga 2000 -> 8088 or A2286D 80286 Bridge Board
IBM PC/RT -> 80286 AT adapter
Kaypro 2 -> Co-Power Plus board
Software PC Emulation:
Apple MacIntosh -> SoftPC
Atari ST -> PC-Ditto I
IBM RS/6000 -> DOS emulation
DOS Emulation:
AIX (IBM RS/6000) -> DOS emulation with "PCSIMulator"
OS/2 -> DOS emulation in "Compatibility Box"
QNX -> DOS window
SunOS -> DOS window
Xenix -> DOS emulation with DOSMerge
WHAT IS DOS?ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 1**2
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ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 1**3
There are a number of compatible replacements for Microsoft's MSDOS. Some are:
Consortium Technologies MultiDOS (multitasking, multiuser)
Digital Research Concurrent DOS (multitasking)
Digital Research Concurrent DOS 386 (for 80386 computers)
Digital Research Concurrent DOS XM (multitasking, multiuser)
Digital Research DR-DOS 3.31 and 4.0 (PC-DOS clones)
PC-MOS/386 (multitasking, multiuser)
Wendin-DOS (multitasking, multiuser)
VM/386 (multitasking)
Various other operating systems are available for the IBM PC. These include:
Digital Research CP/M-86
Digital Research Concurrent CP/M-86 (multitasking)
Minix (multitasking UNIX workalike)
Pick (database-operating system)
QNX (multitasking, multiuser)
UNIX (various systems from IBM itself, Microsoft-SCO, Bell, and various UNIX
clones, single and multi user) (AIX, Xenix, AT&T System V, etc.)
"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
Systems using the 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ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 1**4
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. The disk handling routines were considerably extended in 3.1,
allowing disk access in a "virtual" fashion, independent of whether the drive
was a local or network device. DOS 4.0, originating as it did from outside
Microsoft, can justify a version jump. Unfortunately, 4.x seems to have very
little reason to justify its existence - virtually all of its core features
can be found in one version or another of DOS 3.x. At this time DOS 5 is still
in beta testing. Gordon Letwin of Microsoft says the entire kernel has been
rewritten in hand-optimized assembler and DOS 5 will take advantage of the
'286 and later processors to get extra usable memory.
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 subdirectories, 3.0 added support for networking, 4.0
added some minimal 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:
86-DOS February 1981 Paterson's Quick'n'Dirty DOS first runs on PC
PC-DOS 1.0 August 1981 original IBM release
PC-DOS 1.05 -------- ---- fixes to BASIC interpreter
PC-DOS 1.1 June 1982 bugfix, double sided drive support
MS-DOS 1.25 July 1982 for early compatibles. This is the first non-IBM
OEM version
PC-DOS 2.0 March 1983 for PC/XT, Unix-type subdirectory support,
installable device drivers, I/O redirection,
subdirectories, hard disk support, handle calls
PC-DOS 1.85 April 1983 internal IBM - extended 1.1 - not released
MS-DOS 2.01 -------- 1983 first support for individual country formats, Kanji
PC-DOS 2.1 October 1983 for IBM PCjr, bugfixes for 2.0. No country support
MS-DOS 2.11 October 1983 basically a cross of PC-DOS 2.1 and MS-DOS 2.01
MS-DOS 2.12 -------- ---- special version for TI Professional
PC-DOS 3.0 August 1984 1.2 meg drive for PC/AT, some new system calls,
new external programs, 16-bit FAT, specific support
for IBM network
MS-DOS 3.05 -------- 1984 first OEM version of 3.x
PC-DOS 3.1 November 1984 bugfix for 3.0, implemented generic network support
MS-DOS 2.25 October 1985 extended foreign language support
PC-DOS 3.2 January 1986 720k 3.5 inch drive support, special support for
laptops (IBM PC Convertible), XCOPY
MS-DOS 4.0 April 1986 multitasking (Europe only) - withdrawn from market
PC-DOS 3.3 April 1987 for PS/2 series, 1.44 meg support, multiple DOS
partition support, code page switching, improved
foreign language support, some new function calls,
support for the AT's CMOS clock.
MS-DOS 3.31 November 1987 over-32 meg DOS partitions. Different versions
from different OEMs (not Microsoft). Compaq and
Wyse are most common.
PC-DOS 3.4 -------- ---- internal IBM - not released (4.0 development)
MS-DOS 2.11R -------- 1988 bootable ROM DOS for Tandy machines
PC-DOS 4.0 August 1988 32mb limit officially broken, minor EMS support,
more new function calls, enhanced network support
for external commands
MS-DOS 4.01 January? 1989 Microsoft version with some bugfixes
MS-DOS 3.21R September1989 DOS in ROM, Flash File System for laptops
MS-DOS 3.3R -------- 1990 DOS in ROM, introduced for TI laptops
MS-DOS 5.0 June 1991 new high memory support, uses up to 8 hard disks,
command line editor and aliasing
IBM's PC-DOS was long considered to be the "standard" version of DOS. Now
that MS 5.0 is a commercial product most developers will probably write to it.
Microsoft's policy has been to sell DOS only to OEMs. Despite this, they
sold small quantities of DOS 3.2, 3.3, and 4.0 without insurmountable
difficulties. DOS 5.0 was concieved from the beginning as an over-the-counter
retail product.
Incidentally, IBM refers to its DOS as "The IBM Personal Computer DOS." The
term "PCDOS" is a trademark of IBM's rival DEC.
Some versions of MS-DOS varied from PC-DOS in the available 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.
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 used a unique quad density, single-sided
floppy drive and its DOS had special support for it.
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.
Digital Research's DR-DOS is the first widely available DOS clone. Version
3.4, released in June 1988, was the one first available to the American public.
It was somewhat buggy and its use is not recommended. DR 3.41 is extremely
compatible and its use should pose no problems on any machine. DR-DOS 5.0
(released May, 1990) is functionally equivalent to MS-DOS 5.0. For all
practical purposes, MS 5.0 is a clone of DR 5.0, since DR beat MS to market by
over a year. According to Greg Ewald, DRI's DR-DOS product manager, DR-DOS was
developed from Concurrent DOS 386 with the multiuser and multitasking code
stripped out.
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 >32mb disk
partitions in the same fashion as DOS 4.x.
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. Frankly, it would
seem that burning the operating system into ROMs would be cheaper and simpler.
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 (eDOS) was introduced in mid-1987 in Europe (at SICOB in Paris and
sometime earlier by Apricot Computer in the UK). It offered multitasking
provided applications were specially written for it.
David Fraser (Microsoft UK Managing Director) is on record saying that "DOS
4.0 is unlikely to set the world alight and is of interest only to specific
OEMs who want its features for networking and communications." 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. For further information, see Chapter 4.
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.
Several versions of DOS have been modified to be run out of ROM. The Sharp
PC5000 had MSDOS 1.25 in ROM, and the Toshiba 1000 and some Tandy 1000 models
have MSDOS 2.11 in ROM. In mid September 1989 Microsoft introduced 3.21R ROMs
for laptops, and in early '90 Texas Instruments laptops were the first to get
the 3.3R ROMs. Digital Research has also announced its DR-DOS 3.41 and 5.0 is
available in a ROM version and Award Software is marketing DOS cards to OEMs
as a plug-in to ISA-bus machines.
IBM's release of DOS 4.0 (and the immediate subsequent release of a bugfix)
was a dubious step "forward." DOS 4.0 was the first version of DOS to come with
a warranty; the catch is that IBM warranted it only for a very slim list of
IBM-packaged software. 4.0 had 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 was
no great rush to go to that version of DOS.
Microsoft undertook development of MSDOS 5.0 in early 1990, soliciting
input from Usenet, BIX, and Compuserve among others. 5.0 is a functional
clone of Digital Research's DR-DOS 5.0. 5.0's compatibility was assured
by what has been claimed as the largest beta-test program in history -
in his address to the Boston Computer Society, Bill Gates announced over
7,500 testers were involved.
THE OPERATING SYSTEM HIERARCHYÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 1**5
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.
As the term 'system' might imply, DOS is not one program but a collection
of programs designed to work together to allow the user access to programs
and data. Thus, DOS consists of several layers of "control"programs and a set
of "utility" programs.
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 one byte wide and one million bytes long. Parts of this
ladder are in ROM, parts in RAM, and parts are not assigned. There are also
65,536 "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ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 1**6
DOS consists of four components:
* The boot record
* The ROM BIOS interface (IBMBIO.COM, DRBIOS.SYS, or IO.SYS)
* The DOS program file (IBMDOS.COM, DRBDOS.SYS, 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.
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 so on. It is
the operating system's means of controlling the hardware. IBMBIO.COM contains
any modifications or updates to the ROM BIOS that are needed to correct any
bugs or add support for other types of hardware such as new disk drives. By
using IBMBIO.COM to update the ROM BIOS on the fly when the user turns on their
computer, IBM does not need to replace the ROM BIOS chip itself, but makes any
corrections through the cheaper and easier method of modifying the IBMBIO.COM
file instead.
IBMBIO.COM also keeps track of hardware operations on an internal stack or
"scratch pad" area for the operating system to save information such as
addresses it will need, etc. An example of the use for this stack can be seen
when running a program such as a word processor. If you have told the word
processor to save your letter, it will write the data to your disk. During this
time, if you start typing some more information, the keyboard generates a
hardware interrupt. Since you don't want the process of writing the information
to the disk to be interrupted, DOS allocates a slot in the stack for the
keyboard's hardware interrupt and when it 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.SYS file controls the number of stack frames availible for this
purpose.
IBMBIO.COM also reads your CONFIG.SYS file and installs any device drivers
(i.e. DEVICE=ANSI.SYS) or configuration commands it may find there.
* 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.
This section is often referred to as the "kernel" by systems programmers.
* The Command Interpreter
The command interpreter, COMMAND.COM, is the part you interact with on the
command line. COMMAND.COM has three parts. IBM calls them the "resident
portion", the "initialization portion" and the "transient portion".
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, many commercial software programs had been written to use
peculiarities of COMMAND.COM itself.
Two programs exist that perform as actual "shells" by completely replacing
COMMAND.COM and substituting their own command interpreter to use with the
hidden DOS files. These are Command Plus, a commercial package, and the very
interesting shareware 4DOS package. Both supply greatly enhanced batch
language and editing capabilities.
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.
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.
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.
Since the transient portion of COMMAND.COM is so large (containing the
internal commands and all those error messages), and it is not needed when the
user is running an application it can be overlaid that program if that
application needs the room. When the application is through, the resident
portion of COMMAND.COM brings 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 needs to get the transient portion off the disk since it was
overlaid with the application program.
The initialization portion of COMMAND.COM follows the resident portion and is
given control during the bootup procedure. This section actually processes the
AUTOEXEC.BAT file. It also decides where to load the user's programs when they
are executed. Since this code is only needed during startup, it is overlaid by
the first program which COMMAND.COM loads.
The transient portion is loaded at the high end of memory and it is the
command processor itself. It interprets whatever the user types in at the
keyboard, hence messages such as "Bad command or file name" for when the user
misspells a command. This portion contains all the internal commands (i.e.
COPY, DIR, RENAME, ERASE), the batch file processor (to run .BAT files) and
a routine to load and execute external commands which are either .COM or
.EXE files.
The transient portion of COMMAND.COM produces the system prompt, (C>), and
reads what the user types in from the keyboard and tries to do something with
it. For any .COM or .EXE files, it builds a command line and issues an EXEC
function call to load the program and transfer control to it.
DOS INITIALIZATIONÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 1**7
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).
When the ROM BIOS finds a ROM on an adapter card, it lets that ROM take
control of the system so that it may perform any set up necessary to use the
hardware or software controlled by that ROM. The ROM BIOS searches absolute
addresses C8000h through E0000h in 2K increments in search of a valid ROM.
A valid ROM is determined by the first few bytes in the ROM. The ROM will have
the bytes 55h, AAh, a length indicator and then the assembly language
instruction to CALL FAR (to bring 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 executible code. The adapter's ROM then performs its initialization
tasks and hopefully returns control of the computer back to the ROM BIOS so it
can continue with the booting process.
The ROM BIOS routines then look 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
an 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. IBMDOS.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 1) COMMAND.COM may be a hidden file.
2) 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.
3) IBMDOS only checks for a file named "COMMAND.COM". It will load
any file of that name if no SHELL= command is used.
That pretty much covers the bootup process. After the command processor is
loaded, it runs the AUTOEXEC.BAT file and then the user gets their prompt to
begin working.
** Programmer's Technical Reference for MSDOS and the IBM PC **
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ Shareware Version, 06/17/91 ³
³ Please Register Your Copy ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
Copyright (c) 1987, 1991 Dave Williams
USA copyright TXG 392-616 ALL RIGHTS RESERVED
ISBN 1-878830-02-3 (disk-based text)
C H A P T E R T W O
CPU Port Assignments, System Memory Map, BIOS Data Area, Interrupts 00h to 09h
C O N T E N T S
Introduction .......................................................... 2**1
System Memory Map ..................................................... 2**2
A Brief Guide to Current Memory Terminology ........................... 2**3
PC Port Assignment .................................................... 2**4
Reserved Memory Locations ............................................. 2**5
Absolute Addresses .................................................... 2**6
The IBM PC System Interrupts (Overview) ............................... 2**7
Quick Chart of Interrupts 00h-0FFh .................................... 2**8
The IBM-PC System Interrupts 00h-0Fh (in detail) ...................... 2**9
Introduction .......................................................... 2**1
For consistency in this reference, all locations and offsets are in
hexadecimal unless otherwise specified. All hex numbers are prefaced with a
leading zero if they begin with an alphabetic character, and are terminated
with a lowercase H (h). The formats vary according to common usage.
System Memory Map ..................................................... 2**2
The IBM PC handles its address space in 64k segments, divided into 16k
fractions and then further as necessary.
ÚÄÄÄÄÄÄÂÄÄÄÄÄÂÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³start ³start³end ³ ³
³addr. ³addr.³addr.³ usage ³
³(dec) ³ (hex) ³ ³
ÃÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ *640k RAM Area* ³
ÃÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 0k ³ ³ start of RAM, first K is interrupt vector table ³
³ 16k ³00000-03FFF³ PC-0 system board RAM ends ³
³ 32k ³04000-07FFF³ ³
³ 48k ³08000-0BFFF³ ³
ÃÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 64k ³10000-13FFF³ PC-1 system board RAM ends ³
³ 80k ³14000-17FFF³ ³
³ 96k ³18000-1BFFF³ ³
³ 112k ³1C000-1FFFF³ ³
ÃÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 128k ³20000-23FFF³ ³
³ 144k ³24000-27FFF³ ³
³ 160k ³28000-2BFFF³ ³
³ 176k ³2C000-2FFFF³ ³
ÃÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 192k ³30000-33FFF³ ³
³ 208k ³34000-37FFF³ ³
³ 224k ³38000-3BFFF³ ³
³ 240k ³3C000-3FFFF³ ³
ÃÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 256k ³40000-43FFF³ PC-2 system board RAM ends ³
³ 272k ³44000-47FFF³ ³
³ 288k ³48000-4BFFF³ ³
³ 304k ³4C000-4FFFF³ ³
ÃÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 320k ³50000-53FFF³ ³
³ 336k ³54000-57FFF³ ³
³ 352k ³58000-5BFFF³ ³
³ 368k ³5C000-5FFFF³ ³
ÃÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 384k ³60000-63FFF³ ³
³ 400k ³64000-67FFF³ ³
³ 416k ³68000-6BFFF³ ³
³ 432k ³6C000-6FFFF³ ³
ÃÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 448k ³70000-73FFF³ ³
³ 464k ³74000-77FFF³ ³
³ 480k ³78000-7BFFF³ ³
³ 496k ³7C000-7FFFF³ ³
ÃÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 512k ³80000-83FFF³ ³
³ 528k ³84000-87FFF³ ³
³ 544k ³88000-8BFFF³ the original IBM PC-1 BIOS limited memory to 544k ³
³ 560k ³8C000-8FFFF³ ³
ÃÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 576k ³90000-93FFF³ ³
³ 592k ³94000-97FFF³ ³
³ 609k ³98000-9BFFF³ ³
³ 624k ³9C000-9FFFF³ to 640k (top of RAM address space) ³
ÃÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³A0000 ***** 64k ***** EGA/VGA starting address ³
³A0000 ***** 64k ***** Toshiba 1000 DOS ROM (MS-DOS 2.11V) ³
ÃÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 640k ³A0000-A95B0³ MCGA 320x200 256 color video buffer ³
³ ³ -AF8C0³ MCGA 640x480 2 color video buffer ³
³ ³ -A3FFF³ ³
³ 656k ³A4000-A7FFF³ ³
³ 672k ³A8000-ABFFF³ this 64k segment may be used for contiguous DOS ³
³ 688k ³AC000-AFFFF³ RAM with appropriate hardware and software ³
ÃÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³B0000 ***** 64k ***** mono and CGA address ³
ÃÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 704k ³B0000-B3FFF³ 4k monochrome display | The PCjr and early Tandy 1000³
³ 720k ³B4000-B7FFF³ | BIOS revector direct write to³
³ 736k ³B8000-BBFFF³ 16k CGA uses | the B8 area to the Video Gate³
³ 756k ³BC000-BFFFF³ | Array and reserved system RAM³
ÃÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³C0000 ***** 64k *************** expansion ROM ³
ÃÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 768k ³C0000-C3FFF³ 16k EGA BIOS C000:001E EGA BIOS signature (letters IBM ³
³ 784k ³C4000-C5FFF³ ³
³ ³C6000-C63FF³ 256 bytes Professional Graphics Display comm. area ³
³ ³C6400-C7FFF³ ³
³ 800k ³C8000-CBFFF³ 16k hard disk controller BIOS, drive 0 default ³
³ ³CA000 ³ some 2nd floppy (high density) controller BIOS ³
³ 816k ³CC000-CDFFF³ 8k IBM PC Network NETBIOS ³
³ ³CE000-CFFFF³ ³
ÃÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³D0000 ***** 64k ***** expansion ROM ³
ÃÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 832k ³D0000-D7FFF³ 32k IBM Cluster Adapter | PCjr first ROM cartridge ³
³ ³ DA000³ voice communications | address area. ³
³ 848k ³D4000-D7FFF³ | Common expanded memory board ³
³ 864k ³D8000-DBFFF³ | paging area. ³
³ 880k ³DC000-DFFFF³ | ³
³ ³DE000 ³ TI Pro default video buffer, 4k in length ³
ÃÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³E0000 ***** 64k ***** expansion ROM ³
ÃÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 896k ³E0000-E3FFF³ | PCjr second ROM cartridge ³
³ 912k ³E4000-E7FFF³ | address area ³
³ 928k ³E8000-EBFFF³ | ³
³ 944k ³EC000-EFFFF³ | spare ROM sockets on AT ³
ÃÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³F0000 ***** 64k ***** system ³
ÃÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 960k ³F0000-F3FFF³ reserved by IBM | cartridge address ³
³ 976k ³F4000- ³ | area (PCjr cartridge ³
³ ³F6000 ³ ROM BASIC Begins | BASIC) ³
³ 992k ³F8000-FB000³ | ³
³ 1008k³FC000-FFFFF³ ROM BASIC and original | ³
³ ³ ³ BIOS (Compatibility BIOS | ³
³ ³ ³ in PS/2) | ³
³ 1024k³ FFFFF³ end of memory (1024k) for 8088 machines ³
ÃÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÁÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 384k ³100000-15FFFF³ 80286/AT extended memory area, 1Mb motherboard ³
³ 15Mb ³100000-FFFFFF³ 80286/AT extended memory address space ³
³ 15Mb ³160000-FDFFFF³ Micro Channel RAM expansion (15Mb extended memory) ³
³ 128k ³FE0000-FFFFFF³ system board ROM (PS/2 Advanced BIOS) ³
ÃÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 64k ³C0000000-C000FFFF³ Weitek "Abacus" math coprocessor memory-mapped I/O ³
ÀÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
Note that the ROM BIOS has a duplicated address space which causes it to
"appear" both at the end of the 1 megabyte real mode space and at the end of
the 16 megabyte protected mode space. The addresses from 0E0000 to 0FFFFF are
equal to 0FE0000 to 0FFFFFF. This is necessary due to differences in the memory
addressing between Real and Protected Modes.
A Brief Guide to Current Memory Terminology ........................... 2**3
LOW MEMORY - 0000h to around 0:5(something), comprising the 80x8x interrupt
vector table, the BIOS Data Area, DOS Data Area, etc.
CONVENTIONAL MEMORY - from the end of low memory to the beginning of the
"reserved by IBM" A000 segment (640k).
HIGH MEMORY - originally noncontiguous RAM stuffed into the "reserved for
ROM expansion" areas, typically segments D000 and E000. DOS
normally can't access this memory without a driver of some
sort, but it's easy to put RAMdisks and stuff in there.
CONVENTIONAL MEMORY - extra RAM stuck at A000, assuming the machine already
has 640k, appears as conventional memory accessible to DOS
and applications. IBM clones can typically add 64k before
bumping into a mono card or 96k before hitting a color card.
This address is part of the EGA/VGA video RAM area and most
EGA cards don't like system memory at A000.
EXPANDED MEMORY - LIM 3.2, LIM 4.0, or EEMS 3.2 bank switched memory. A
RAM "window" allows an app to save a block of RAM to an expansion
board. The window size and location varies according to the
EMS standard being used.
EXTENDED MEMORY - this is the "native mode" address space of the 80286 and
later chips. The "real mode", or 8088 addressing scheme,
sees RAM as a collection of segments and offsets with a limit
on segment size. "Protected mode" addressing uses a flat linear
addressing scheme. 8088 and 80188 chips do not have extended
memory.
HIGH MEMORY - by fiddling a bit with the segment/offset stuff, you can
get an extra block of addressable 8088-mode memory just over
the 1 meg address space. Microsoft issued their "HMA" (High
Memory Area) standard to try to standardize use of this block.
Though it really is "high" memory, "high" had for many years
referred to memory between 640k and 1mb. This creates more
confusion for new programmers.
EMS - this is expanded memory as described above
XMS - Microsoft is pushing an "Extended Memory Standard" which defines
a page-switching scheme much like EMS. The only real difference is
that XMS uses protected-mode RAM instead of a special paged RAM board.
XMS - some severely brain-damaged jerk at IBM issued documentation for some
IBM *EMS* boards referring to the boards as *XMS*. This was a classic
blunder, and now some IBM-followers are picking up the aberrant
terminology. This is guaranteed to confuse some people. To make it
simple, if it needs an expansion board, it is EMS no matter what the
vendor calls it.
PC Port Assignment .................................................... 2**4
These are functions common across the IBM range. The PCjr, PC-AT, PC
Convertible and PS/2 (both buses) have enhancements. In some cases, the
AT and PS/2 series ignore, duplicate, or reassign ports arbitrarily. If
your code incorporates specific port addresses for video or system board
control it would be wise to have your application determine the machine
type and video adapter and address the ports as required.
hex address Function Models
PCjr|PC|XT|AT|CVT|M30|PS2
0000-000F 8237 DMA controller PC
0010-001F 8237 DMA controller AT PS2
0020-0027 8259A interrupt controller
0020-002F IOSGA interrupt function PS2
0020-003F 8259A interrupt controller (AT)
0020-0021 interrupt controller 1, 8259A PC AT PS2
0040-0043 programmable timer 8253 PC
0040-0047 programmable timers PS2
0040-005F 8253-5 programmable timers AT
note 1) 0041 was memory refresh in PCs. Not used in PS/2.
2) A few early 80386 machines used static RAM and did
not use refresh at all. The PCjr refreshes by the
video vertical retrace signal.
0060-0063 keyboard controller 8255A PC
0060-006F 8042 keyboard controller AT
0060 IOSGA keyboard input port PS2
0061 speaker PCjr PC XT AT CVT
0061 IOSGA speaker control M30 PS2
0061 On some clones, setting or clearing bit 2 controls Turbo mode
0061 Toshiba 1000 - system command
0062 IOSGA configuration control M30 PS2
0062 Toshiba 1000 - System Status, port C
0063 SSGA, undocumented PS2
0063 Toshiba 1000 - mode set
0064 keyboard auxiliary device PS2
0065-006A SSGA, undocumented PS2
006B SSGA, RAM enable/remap PS2
006C-006F SSGA, undocumented PS2
0070 AT CMOS write internal register
0071 AT CMOS read internal register
0070-0071 CMOS real-time clock, NMI mask PS2
0070-007F CMOS real-time clock, NMI mask AT
0074-0076 reserved PS2
0800-008F SSGA DMA page registers PS2
0080-009F DMA page registers, 74LS612 AT
0090 central arbitration control port (Micro Channel)
0091 card selected feedback (Micro Channel)
0092 system control port A (Micro Channel)
0093 reserved (Micro Channel)
0094 system board setup (Micro Channel)
0096 POS "CD SETUP" selector (Micro Channel)
00A0-00A1 Interrupt controller 2, 8259A AT PS2
00A0-00AF IOSGA NMI mask register PS2
00B0-00BF realtime clock/calendar, (undocumented) PS2
00C0-00DF reserved PCjr PC XT AT CVT M30
00C0-00CF DOS ROM register, Toshiba 1000
00D0-00EF "special" register, Toshiba 1000
00C0 0C1 key register, Toshiba 1000
00C1 keyboard transfer register, Toshiba 1000
00C2 keyboard receive register, Toshiba 1000
00C3 keyboard status register, Toshiba 1000
00C8 DOS ROM page register, Toshiba 1000
00E0 CPU speed control, Toshiba 1000
00E1 keyboard status/0E2 key register, Toshiba 1000
00E2 work register, Toshiba 1000
00E3 0E4 key register, Toshiba 1000
00E4 system control register 0, Toshiba 1000
00E4 Weitek ABACUS NDP - bit 0=1, ABACUS is present
00E5 0E6 key register, Toshiba 1000
00E6 system control register 1, Toshiba 1000
00EE EMS unit index, Toshiba 1000
00EF EMS unit data, Toshiba 1000
00C0-00DF DMA controller 2, 8237A-5 AT PS2
00E0-00EF realtime clock/calendar (undocumented) M30 PS2
00F0-00FF PS/2 math coprocessor I/O (Model 50+) (diskette IO on PCjr)
0100-0101 PS/2 POS adapter ID response (Micro Channel)
0102-0107 PS/2 POS adapter configuration response (Micro Channel)
01F0-01F8 hard disk AT PS2
0200-0201 game-control adapter (joystick)
0200-020F game controller PC AT
0208-0209 Chips & Technology CS8221 chipset default EMS ports
alternate addresses: 218h, 258h, 268h, 2A8h, 2B8h, 2E8h
0208-020F Toshiba 1000 - EMS unit I/O #1
020C-020D reserved by IBM
0210-0217 expansion box (PC, XT)
0218-021F Toshiba 1000 - EMS unit I/O #2
021F reserved by IBM
0258-025F Toshiba 1000 - EMS unit I/O #3
0258-0259 LIM EMS 3.1 (not defined in 3.2+)
0268-026F Toshiba 1000 - EMS unit I/O #4
0278-027F parallel printer port 2 AT
0278-027B parallel printer port 3 PS2
02A2 clock chip in early Sperry PCs
02A8-02AF Toshiba 1000 - EMS unit I/O #5
02B8-02BF Toshiba 1000 - EMS unit I/O #6
02B0-02DF EGA (alternate) PC AT
02C0-02DF Toshiba 1000 - realtime clock
02E1 GPIB (adapter 0) AT
02E2-02E3 data acquisition (adapter 0) AT
02E8 "industry standard" COM4
02E8-02EF Toshiba 1000 - EMS unit I/O #7
02F8-02FF serial communications (COM2) PC AT PS2
0300-031F prototype card PC AT
0300-031F Leading Edge Model D clock -------------------
0320-032F hard disk controller PC
0320 Perstor HD controller, primary -------------------
0324 Perstor HD controller, secondary -------------------
0340 Sony CD-ROM -------------------
0348-0357 DCA 3278
0360-0367 PC Network (low address)
0368-036F PC Network (high address) AT
0370 Colorado Memory external tape backup control port -------
some "second controller" floppy cards -------------------
0378-037F parallel printer port PC AT
0378-037B parallel printer port PS2
0380-038F Eicon Technology Network Adapter (X.25) board (default)
0380-038F SDLC, bi-synchronous 2 PC AT
0380-0389 BSC communications (alternate) PC
0390-039F Eicon Technology Network Adapter (X.25) board (alternate)
0390-0393 cluster (adapter 0) PC AT
03A0-03A9 BSC communications (primary) PC AT
03B0-03BF monochrome/parallel printer adapter PC AT
03B4-03B5 video subsystem PS2
03BA video subsystem PS2
03BC-03BF parallel printer port 1 PS2
03C0-03CF Enhanced Graphics Adapter
03C0-03DA video subsystem and DAC PS2
03DA video status register AT&T 6300, Olivetti PC
03D0-03DF CGA, MCGA, VGA adapter control
03DE video mode selector register AT&T 6300, Olivetti PC
03E8h "industry standard" COM3
03F0-03F7 floppy disk controller PC AT PS2
03F0 Colorado Memory internal tape backup control port -------
03F2 DTK high-density XT floppy controller (output only)
03F5 DTK high-density XT floppy controller
03F8-03FF serial communications (COM1) PC AT PS2
06E2-06E3 data acquisition (adapter 1) AT
0790-0793 cluster (adapter 1) PC AT
0878 Compaq 386SX VGA BIOS relocation AT
0AE2-0AE3 data acquisition (adapter 2) AT
0B90-0B93 cluster (adapter 2) PC AT
0EE2-0EE3 data acquisition (adapter 3) AT
1390-1393 cluster (adapter 3) PC AT
22E1 GPIB (adapter 1)
2390-2393 cluster (adapter 4) PC AT
4258 LIM EMS 3.1 (not defined in 3.2+) -------------------
42E1 GPIB (adapter 2) AT
62E1 GPIB (adapter 3) AT
8258 LIM EMS 3.1 (not defined in 3.2+) -------------------
82E1 GPIB (adapter 4) AT
A2E1 GPIB (adapter 5) AT
C258 LIM EMS 3.1 (not defined in 3.2+) -------------------
C2E1 GPIB (adapter 6) AT
E2E1 GPIB (adapter 7) AT
note 1) IOSGA = I/O Support Gate Array
SSGA = System Support Gate Array
2) I/O Addresses, hex 000 to 0FF, are reserved for the system board I/O.
Hex 100 to 3FF are available on the I/O channel.
3) These are the addresses decoded by the current set of adapter cards.
IBM may use any of the unlisted addresses for future use.
4) SDLC Communication and Secondary Binary Synchronous Communications
cannot be used together because their port addresses overlap.
Reserved Memory Locations ............................................. 2**5
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
³ 000-3FF - 1k DOS interrupt vector table, 4 byte vectors for ints 00h-0FFh.
³ 30:00 - used as a stack area during POST and bootstrap routines. This
³to 3F:FF stack area may be revectored by an application program.
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
³ ** The BIOS Data Area ** addresses from 400h to 4FFh
ÃÄÄÄÄÄÂÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
³addr.³ size ³ description
ÃÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
³40:00³ word ³ COM1 port address | These addresses are zeroed out in the
³40:02³ word ³ COM2 port address | OS/2 DOS Compatibility Box if any of
³40:04³ word ³ COM3 port address | the OS/2 COMxx.SYS drivers are loaded.
³40:06³ word ³ COM4 port address |
³40:08³ word ³ LPT1 port address
³40:0A³ word ³ LPT2 port address
³40:0C³ word ³ LPT3 port address
³40:0E³ word ³ LPT4 port address (not valid in PS/2 machines)
³40:0E³ word ³ PS/2 pointer to 1k extended BIOS Data Area at top of RAM
³40:10³ word ³ equipment flag (see int 11h)
ÀÄÄÄÄÄÁÄÄÄÄÄÄÄ´ bits:
³ 0 0 no floppy drive present
³ 1 if floppy drive present (see bits 6&7)
³ 1 0 no math coprocessor installed
³ 1 if 80x87 installed (not valid in PCjr)
³ 2,3 system board RAM (not used on AT or PS/2)
³ 0,0 16k 0,1 32k
³ 1,0 48k 1,1 64k
³ 4,5 initial video mode
³ 0,0 no video adapter
³ 0,1 40 column color (PCjr default)
³ 1,0 80 column color
³ 1,1 MDA
³ 6,7 number of diskette drives
³ 0,0 1 drive 0,1 2 drives
³ 1,0 3 drives 1,1 4 drives
³ 8 0 DMA present
³ 1 DMA not present (PCjr, Tandy 1400, Sanyo 55x)
³ 9,A,B number of RS232 serial ports
³ C game adapter (joystick)
³ 0 no game adapter
³ 1 if game adapter
³ D serial printer (PCjr only)
³ 0 no printer
³ 1 serial printer present
ÚÄÄÄÄÄÄÙ E,F number of parallel printers installed
³note 1) The IBM PC and AT store the settings of the system board
ÀÄÄÄ¿ switches or CMOS RAM setup information (as obtained by the BIOS
³ in the Power-On Self Test (POST)) at addresses 40:10h and
³ 40:13h. 00000001b indicates "on", 00000000b is "off".
ÚÄÄÄÄÄÂÄÄÄÄÁÄÄ¿
³40:12³ byte ³ reserved (PC, AT)
ÀÄÄÄÄÄÁÄÄÄÄÄÄÄ´ number of errors detected by infrared keyboard link (PCjr)
ÚÄÄÄÄÄÂÄÄÄÄÄÄÄ´ POST status (Convertible)
³40:13³ word ³ availible memory size in Kbytes (less display RAM in PCjr)
ÃÄÄÄÄÄÅÄÄÄÄÄÄÄ´ this is the value returned by int 12h
³40:15³ word ³ reserved
³40:17³ byte ³ keyboard flag byte 0 (see int 9h)
ÀÄÄÄÄÄÁÄÄÄÄÄÄÄ´ bit 7 insert mode on 3 alt pressed
³ 6 capslock on 2 ctrl pressed
³ 5 numlock on 1 left shift pressed
ÚÄÄÄÄÄÂÄÄÄÄÄÄÄ´ 4 scrollock on 0 right shift pressed
³40:18³ byte ³ keyboard flag byte 1 (see int 9h)
ÀÄÄÄÄÄÁÄÄÄÄÄÄÄ´ bit 7 insert pressed 3 ctrl-numlock (pause) toggled
³ 6 capslock pressed 2 PCjr keyboard click active
³ 5 numlock pressed 1 PCjr ctrl-alt-capslock held
ÚÄÄÄÄÄÂÄÄÄÄÄÄÄ´ 4 scrollock pressed 0
³40:19³ byte ³ storage for alternate keypad entry (not normally used)
³40:1A³ word ³ pointer to keyboard buffer head character
³40:1C³ word ³ pointer to keyboard buffer tail character
³40:1E³32bytes³ 16 2-byte entries for keyboard circular buffer, read by int 16h
³40:3E³ byte ³ drive seek status - if bit=0, next seek will recalibrate by
ÀÄÄÄÄÄÁÄÄÄÄÄÄÄ´ repositioning to Track 0.
³ bit 3 drive D bit 2 drive C
ÚÄÄÄÄÄÂÄÄÄÄÄÄÄ´ 1 drive B 0 drive A
³40:3F³ byte ³ diskette motor status (bit set to indicate condition)
ÀÄÄÄÄÄÁÄÄÄÄÄÄÄ´ bit 7 write in progress 3 motor on (floppy 3)
³ 6 2 motor on (floppy 2)
³ 5 1 B: motor on (floppy 1)
ÚÄÄÄÄÄÂÄÄÄÄÄÄÄ´ 4 0 A: motor on (floppy 0)
³40:40³ byte ³ motor off counter
³ ³ ³ starts at 37 and is decremented 1 by each system clock tick.
³ ³ ³ motor is shut off when count = 0.
³40:41³ byte ³ status of last diskette operation where:
ÀÄÄÄÄÄÁÄÄÄÄÄÄÄ´ bit 7 timeout failure 3 DMA overrun
³ 6 seek failure 2 sector not found
³ 5 controller failure 1 address not found
ÚÄÄÄÄÄÂÄÄÄÄÄÄÄ´ 4 CRC failure 0 bad command
³40:42³7 bytes³ NEC floppy controller chip status
³40:49³ byte ³ Video Control Data Area 1 from 0040:0049 through 0040:0066
ÀÄÄÄÄÄÁÄÄÄÄÄÄÄ´ current CRT mode (hex value)
³ 00h 40x25 BW (CGA) 01h 40x25 color (CGA)
³ 02h 80x25 BW (CGA) 03h 80x25 color (CGA)
³ 04h 320x200 color (CGA) 05h 320x200 BW (CGA)
³ 06h 640x200 BW (CGA) 07h monochrome (MDA)
³extended video modes (EGA/MCGA/VGA or other)
³ 08h lores,16 color 09h med res,16 color
³ 0Ah hires,4 color 0Bh n/a
³ 0Ch med res,16 color 0Dh hires,16 color
ÚÄÄÄÄÄÂÄÄÄÄÄÄÄ´ 0Eh hires,4 color 0Fh hires,64 color
³40:4A³ word ³ number of columns on screen, coded as hex number of columns
ÀÄÄÄÄÄÁÄÄÄÄÄÄÄ´ 20 col = 14h (video mode 8, low res 160x200 CGA graphics)
³ 40 col = 28h
ÚÄÄÄÄÄÂÄÄÄÄÄÄÄ´ 80 col = 46h
³40:4C³ word ³ screen buffer length in bytes
ÃÄÄÄÄÄÅÄÄÄÄÄÄÄ´(number of bytes used per screen page, varies with video mode)
³40:4E³ word ³ current screen buffer starting offset (active page)
³40:50³8 words³ cursor position pages 1-8
ÀÄÄÄÄÄÁÄÄÄÄÄÄÄ´ the first byte of each word gives the column (0-19, 39, or 79)
ÚÄÄÄÄÄÂÄÄÄÄÄÄÄ´ the second byte gives the row (0-24)
³40:60³ byte ³ end line for cursor (normally 1)
³40:61³ byte ³ start line for cursor (normally 0)
³40:62³ byte ³ current video page being displayed (0-7)
³40:63³ word ³ base port address of 6845 CRT controller or equivalent
ÃÄÄÄÄÄÅÄÄÄÄÄÄÄ´ for active display 3B4h=mono, 3D4h=color
³40:65³ byte ³ current setting of the CRT mode register
³40:66³ byte ³ current palette mask setting (CGA)
³40:67³5 bytes³ temporary storage for SS:SP during shutdown (cassette interface)
³40:6C³ word ³ timer counter low word
³40:6E³ word ³ timer counter high word
³40:69³ byte ³ HD_INSTALL (Columbia PCs) (not valid on most clone computers)
ÀÄÄÄÄÄÁÄÄÄÄÄÄÄ´ bit 0 0 8 inch external floppy drives
³ 1 5-1/4 external floppy drives
³ 1,2 highest drive address which int 13 will accept
³ (since the floppy drives are assigned 0-3,subtract
³ 3 to obtain the number of hard disks installed)
³ 4,5 # of hard disks connected to expansion controller
³ 6,7 # of hard disks on motherboard controller
³ (if bit 6 or 7 = 1, no A: floppy is present and
ÚÄÄÄÄÄÂÄÄÄÄÄÄÄ´ the maximum number of floppies from int 11 is 3)
³40:70³ byte ³ 24 hour timer overflow 1 if timer went past midnight
ÃÄÄÄÄÄÅÄÄÄÄÄÄÄ´ it is reset to 0 each time it is read by int 1Ah
³40:71³ byte ³ BIOS break flag (bit 7 = 1 means break key hit)
³40:72³ word ³ reset flag
ÀÄÄÄÄÄÁÄÄÄÄÄÄÄ´ PCjr keeps 1234h here for softboot when a cartridge is installed
³ bits 1234h = soft reset, memory check will be bypassed
³ 4321h = preserve memory (PS/2 only)
³ 5678h = system suspended (Convertible)
³ 9ABCh = manufacturing test mode (Convertible)
ÚÄÄÄÄÄÂÄÄÄÄÄÄÄ´ ABCDh = system POST loop mode (Convertible)
³40:74³ byte ³ status of last hard disk operation ; PCjr special disk control
³40:75³ byte ³ # of hard disks attached (0-2) ; PCjr special disk control
³40:76³ byte ³ HD control byte; temp holding area for 6th param table entry
³40:77³ byte ³ port offset to current hd adapter ; PCjr special disk control
³40:78³4 bytes³ timeout value for LPT1,LPT2,LPT3,LPT4
³40:7C³4 bytes³ timeout value for COM1,COM2,COM3,COM4 (0-0FFh secs, default 1)
³40:80³ word ³ pointer to start of circular keyboard buffer, default 03:1E
³40:82³ word ³ pointer to end of circular keyboard buffer, default 03:3E
ÀÄÄÄÄÄÁÄÄÄÄÄÄÄ´ note: early Zenith Z183 BIOS set these pointers to zero and
ÚÄÄÄÄÄÂÄÄÄÄÄÄÄ´ ignored them.
³40:84³ .... ³ Video Control Data Area 2, 0040:0084 through 0040:008A
³40:84³ byte ³ rows on the screen minus 1 (EGA only)
³40:84³ byte ³ PCjr interrupt flag; timer channel 0 (used by POST)
³40:85³ word ³ bytes per character (EGA only)
³40:85³2 bytes³ (PCjr only) typamatic character to repeat
³40:86³2 bytes³ (PCjr only) typamatic initial delay
³40:87³ byte ³ mode options (EGA only)
ÀÄÄÄÄÄÁÄÄÄÄÄÄÄ´ bit 0 0 cursor emulation in effect
³ 1 no cursor emulation
³ 1 0 EGA is connected to a color display
³ 1 EGA is connected to monochrome TTL display
³ 2 0 wait for vertical retrace (CGA active)
³ 1 don't wait for vertical retrace (EGA or MDA active)
³ 3 0 EGA is the active display,
³ 1 "other" display is active.
³ 4 reserved
³ 5,6 EGA memory size
³ 0,0 64k
³ 0,1 128k
³ 1,0 192k
³ 1,1 256k
³ 7 0 don't clear screen on mode changes
³ 1 if the last "set mode" specified not to clear the
³ video buffer
³ mode combinations:
³ bit3 bit1 Meaning
³ 0 0 EGA is active display and is color
³ 0 1 EGA is active display and is monochrome
³ 1 0 EGA is not active, a mono card is active
ÚÄÄÄÄÄÂÄÄÄÄÄÄÄ´ 1 1 EGA is not active, a CGA is active
³40:87³ byte ³ (PCjr only) current Fn key code
ÃÄÄÄÄÄÅÄÄÄÄÄÄÄ´ 80h bit indicates make/break key code?
³40:88³ byte ³ feature bits and switches (EGA only) 0=on, 1=off
ÀÄÄÄÄÄÁÄÄÄÄÄÄÄ´ bit 0 switch 1
³ 1 switch 2
³ 2 switch 3
³ 3 switch 4
ÚÄÄÄÄÄÂÄÄÄÄÄÄÄ´ 4-7 feature bits
³40:88³ byte ³ (PCjr only) special keyboard status byte
ÀÄÄÄÄÄÁÄÄÄÄÄÄÄ´ bit 7 function flag 3 typamatic (0=enable,1=disable)
³ 6 Fn-B break 2 typamatic speed (0=slow,1=fast)
³ 5 Fn pressed 1 extra delay bef.typamatic (0=enable)
ÚÄÄÄÄÄÂÄÄÄÄÄÄÄ´ 4 Fn lock 0 write char, typamatic delay elapsed
³40:89³ byte ³ (PCjr) current value of 6845 reg 2 (horizontal synch) used by
ÀÄÄÄÄÄÁÄÄÄÄÄÄÄ´ ctrl-alt-cursor screen positioning routine in ROM
³ (VGA)
³ bit 0 reserved
³ 1 video summing enabled
³ 2 0 for color monitor attached
³ 1 for mono monitor
³ 3 0 for default palette loading enabled
³ 4 0 for 8x8 text font
³ 1 for 8x16 text font
ÚÄÄÄÄÄÂÄÄÄÄÄÄÄ´ 5-7 reserved
³40:8A³ byte ³ (PCjr) CRT/CPU Page Register Image, default 3Fh
ÀÄÄÄÄÄÁÄÄÄÄÄÄÄ´ (VGA) Display Combination Code Index. This is the value
³ set/returned by function 1Ah of the Video BIOS. This byte
³ contains an index into the ROM BIOS Display Combination Code
³ table, which is a list of byte pairs that specify valid
³ combinations of one or two video subsystems. Video subsystems
³ are designated by the following values:
³ 00h no display
³ 01h MDA with monochrome display
³ 02h CGA with color display
³ 03h reserved
³ 04h EGA with color display
³ 05h EGA with monochrome display
³ 06h Professional Graphics Adapter
³ 07h VGA with analog monochrome display
³ 08h VGA with analog color display
³ 09h reserved
³ 0Ah MCGA with digital color display
³ 0Bh MCGA with analog monochrome display
³ 0Ch MCGA with analog color display
ÚÄÄÄÄÄÂÄÄÄÄÄÄÄ´ 0FFh unrecognized video subsystem
³40:8B³ byte ³ last diskette data rate selected
ÀÄÄÄÄÄÁÄÄÄÄÄÄÄ´ bit 7,6 starting data transfer rate to use
³ 0,0 500 kb/sec
³ 0,1 300 kb/sec
³ 1,0 250 kb/sec
³ 1,1 reserved
³ 5,4 last step rate selected
³ 3 ending data transfer rate to use
³ 2 reserved
³ 1 reserved
³ 0 1 combination floppy/fixed disk controller detected
³ 0 XT floppy only controller (for 360kb drive) detected
³ Data Transfer Rates
³ Kbits/sec Media Drive Sectors/Track
³ 250 360k 360k 9
³ 300 360k 1.2M 9
³ 500 1.2M 1.2M 15
³ 250 720k 720k 9
³ 250 720k 1.4M 9
ÚÄÄÄÄÄÂÄÄÄÄÄÄÄ´ 500 1.4M 1.4M 18
³40:8C³ byte ³ hard disk status returned by controller
³40:8D³ byte ³ hard disk error returned by controller
³40:8E³ byte ³ hard disk interrupt (bit 7=working interrupt)
³40:8F³ byte ³ combo_card - status of drives 0 and 1
ÀÄÄÄÄÄÁÄÄÄÄÄÄÄ´ bit 7 reserved
³ 6 drive type determined for drive 1
³ 5 drive multiple data rate capability for drive 1
³ 0 no multiple data rate
³ 1 multiple data rate
³ 4 1 then drive 1 has 80 tracks
³ 0 then drive 1 has 40 tracks
³ 3 reserved
³ 2 drive type determined for drive 0
³ 1 drive multiple data rate capability for drive 0
³ 0 no multiple data rate
³ 1 multiple data rate
³ 0 1 the drive 0 has 80 tracks
ÚÄÄÄÄÄÂÄÄÄÄÄÄÄ´ 0 the drive 0 has 40 tracks
³40:90³4 bytes³ media state drive 0, 1, 2, 3
ÀÄÄÄÄÄÁÄÄÄÄÄÄÄ´ floppy_media_state
³ bit 7,6 Data transfer rate
³ 00 - 500 K/sec
³ 01 - 300 K/sec
³ 10 - 250 K/sec
³ 11 - reserved
³ 5 double stepping required
³ 4 media/drive determined
³ 3 reserved
³ 2-0 present state
³ 000 360k in 360k unestablished
³ 001 360k in 1.2M unestablished
³ 010 1.2M in 1.2M unestablished
³ 011 360k in 360k established
³ 100 360k in 1.2M established
³ 101 1.2M in 1.2M established
³ 110 reserved
ÚÄÄÄÄÄÂÄÄÄÄÄÄÄ´ 111 none of the above
³40:94³2 bytes³ track currently seeked to drive 0, 1
³40:96³ byte ³ keyboard flag byte 3 (see int 9h)
³40:97³ byte ³ keyboard flag byte 2 (see int 9h)
³40:98³ dword ³ segment:offset pointer to users wait flag
³40:9C³ dword ³ users timeout value in microseconds
³40:A0³ byte ³ real time clock wait function in use
ÀÄÄÄÄÄÁÄÄÄÄÄÄÄ´ bits 7 wait time elapsed and posted flag
³ 6-1 reserved
ÚÄÄÄÄÄÂÄÄÄÄÄÄÄ´ 0 int 15h, function 86h (WAIT) has occurred
³40:A1³ byte ³ LAN A DMA channel flags
³40:A2³2 bytes³ status LAN A 0,1
³40:A4³ dword ³ saved hard disk interrupt vector
³40:A8³ dword ³ SAVE_PTR: EGA pointer to table of 7 parameters in segment:
ÀÄÄÄÄÄÁÄÄÄÄÄÄÄ´ offset format. Format of table:
³ D_1 dword pointer to 1472 byte table of 64 video parameters
³ D_2 dword reserved
³ D_3 dword reserved
³ D_4 dword reserved
³ D_5 dword reserved for future use
³ D_6 dword reserved for future use
ÚÄÄÄÄÄÂÄÄÄÄÄÄÄ´ D_7 dword reserved for future use
³40:B0³2 words³ international support (Tandy 1000 TX)
³40:B4³ byte ³ keyboard NMI control flags (Convertible)
³40:B4³ byte ³ monochrome monitor hookup detect (Tandy 1000 TX)
³ ³ ³ 00h not present 0FFh present
³40:B5³ dword ³ keyboard break pending flags (Convertible)
³40:B5³ byte ³ extended equipment detect (5 bits) (Tandy 1000 TX)
ÀÄÄÄÄÄÁÄÄÄÄÄÄÄ´ bit 0 = 0 drive A is 5¬
³ 1 drive A is 3«
³ 1 = 0 drive A is 5¬
³ 1 drive A is 3«
³ 2 = 0 Tandy 1000 keyboard layout
³ 1 IBM keyboard layout
³ 3 = 0 CPU slow mode
³ 1 CPU fast mode
³ 4 = 0 internal color video support enabled
³ 1 internal color video support disabled, external
³ video enabled (chg from mb'd to expansion card)
³ 5 = 0 no external monochrome video installed
ÚÄÄÄÄÄÂÄÄÄÄÄÄÄ´ 1 external monochrome video installed
³40:B6³ byte ³ extended equipment detect (1 bit) (Tandy 1000 TX)
ÀÄÄÄÄÄÁÄÄÄÄÄÄÄ´ bit 0 = 0 drive C is 5¬
ÚÄÄÄÄÄÂÄÄÄÄÄÄÄ´ 1 drive C is 3«
³40:B9³ byte ³ port 60 single byte queue (Convertible)
³40:BA³ byte ³ scan code of last key (Convertible)
³40:BB³ byte ³ pointer to NMI buffer head (Convertible)
³40:BC³ byte ³ pointer to NMI buffer tail (Convertible)
³40:BD³16bytes³ NMI scan code buffer (Convertible)
³40:CE³ word ³ day counter (Convertible and after)
³ to ³ -04:8F³ end of BIOS Data Area
ÃÄÄÄÄÄÁÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
³ ** End of BIOS Data Area **
ÃÄÄÄÄÄÂÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
³40:90³-40:EF ³ reserved by IBM
³40:F0³16bytes³ Inter-Application Communications Area (for use by applications
³40:FF³ ³ to transfer data or parameters to each other)
ÀÄÄÄÄÄÁÄÄÄÄÄÄÄ´ 1) Used by Turbo Power's FMARK (mark memory for TSRs).
³ 2) Used by Norton Utilities' TimeMark to store the time.
³ 3) Used by BRIEF editor.
ÚÄÄÄÄÄÂÄÄÄÄÄÄÄ´
³50:00³ byte ³ DOS print screen status flag
ÀÄÄÄÄÄÁÄÄÄÄÄÄÄ´ 00h not active or successful completion
³ 01h print screen in progress
ÚÄÄÄÄÄÂÄÄÄÄÄÄÄ´ 0FFh error during print screen operation
³50:01³ ³ Used by BASIC
³50:02-03 ³ PCjr POST and diagnostics work area
³50:04³ byte ³ Single drive mode status byte - not used by AT&T DOS 2.11!
ÀÄÄÄÄÄÁÄÄÄÄÄÄÄ´ 00 logical drive A was last active
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄ´ 01 logical drive B was last active
³50:05-0E ³ PCjr POST and diagnostics work area
³50:0F³ ³ BASIC: SHELL flag (set to 02h if there is a current SHELL)
³50:10³ word ³ BASIC: segment address storage (set with DEF SEG)
³50:12³4 bytes³ BASIC: int 1Ch clock interrupt vector segment:offset storage
³50:16³4 bytes³ BASIC: int 23h ctrl-break interrupt segment:offset storage
³50:1A³4 bytes³ BASIC: int 24h disk error int vector segment:offset storage
³50:1B-1F ³ Used by BASIC for dynamic storage
³50:20-21 ³ Used by DOS for dynamic storage
³50:22-2C ³ Used by DOS for diskette parameter table. See int 1Eh for values
ÀÄÄÄÄÄÁÄÄÄÄÄÄÄ´ In DOS 1.0 this is located in the ROM BIOS, but in DOS 1.1 and
³ subsequent it is a part of DOS located at 05:22. The first byte
³ (out of eleven) of the Disk Parameter contains the hexadecimal
³ value CF in DOS 1.0 and DF in DOS 1.1 and later.
³ DOS 1.0 24ms
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄ´ DOS 1.1 26ms
³50:30-33 ³ Used by MODE command
³50:81³ ³ number of floppies installed in the system?
³50:82³ ³ first hard disk drive?
³50:83³ ³ last hard disk drive?
³50:34-FF ³ Unknown - Reserved for DOS
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Absolute Addresses .................................................... 2**6
0008:0047 IO.SYS or IBMBIO.COM IRET instruction. This is the dummy routine that
interrupts 01h, 03h, and 0Fh are initialized to during POST.
C000:001E EGA BIOS signature (the letters IBM)
F000:FA6E table of characters 00h-7Fh used by int 10h video BIOS
The first 128 characters are stored here and each occupies 8 bytes.
The high bit ones are somewhere on the video adapter card.
F000:FFF5 BIOS release date
F000:FFFE PC model identification
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ ROM BIOS Ú model byte ³
³ copyright ³ Ú submodel byte machine ³
³ date ³ ³ Ú revision ³
ÃÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÅÄÄÄÄÅÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ ³ 00 ³ 00 ³ 00 ³ AT&T 6300, Olivetti PC ³
³ 09/02/86 ³ FA ³ 00 ³ 00 ³ PS/2 Model 30 ³
³ 01/10/86 ³ FB ³ 00 ³ 00 ³ XT-2 (early) ³
³ 01/10/86 ³ FB ³ 00 ³ 01 ³ XT Model 089 ³
³ 05/09/86 ³ FB ³ 01 ³ 02 ³ XT-2 (revised) ³
³ 01/10/84 ³ FC ³ -- ³ -- ³ AT Model 099 (original) ³
³ 06/10/85 ³ FC ³ 00 ³ 01 ³ AT Model 239 6mHz (6.6 max governor) ³
³ 11/15/85 ³ FC ³ 01 ³ 00 ³ AT Model 339, 339 8mHz (8.6 max governor) ³
³ ³ FC ³ 01 ³ 00 ³ Compaq 386/16 ³
³ ³ FC ³ 01 ³ 03 ³ some Phoenix 386 BIOS ³
³ ³ FC ³ 01 ³ 81 ³ some Phoenix 386 BIOS ³
³ 04/21/86 ³ FC ³ 02 ³ 00 ³ XT/286 ³
³ 02/13/87 ³ FC ³ 04 ³ 00 ³ PS/2 Model 50 ³
³ 02/13/87 ³ FC ³ 05 ³ 00 ³ PS/2 Model 60 ³
³ ³ FC ³ 00 ³ ³ 7531/2 Industrial AT ³
³ ³ FC ³ 06 ³ ³ 7552 "Gearbox" ³
³ 04/18/88 ³ FC ³ 04 ³ 03 ³ PS/2 50Z ³
³ 01/24/90 ³ FC ³ 01 ³ 00 ³ Compaq Deskpro 80386/25e ³
³ 10/02/89 ³ FC ³ 02 ³ 00 ³ Compaq Deskpro 386s, 386SX, 16mHz ³
³ 06/01/83 ³ FD ³ -- ³ -- ³ PCjr ³
³ 11/08/82 ³ FE ³ -- ³ -- ³ XT, Portable PC, XT/370, 3270PC ³
³ 04/24/81 ³ FF ³ -- ³ -- ³ PC-0 (16k motherboard) ³
³ 10/19/81 ³ FF ³ -- ³ -- ³ PC-1 (64k motherboard) ³
³ 08/16/82 ³ FF ³ -- ³ -- ³ PC, XT, XT/370 (256k motherboard) ³
³ 10/27/82 ³ FF ³ -- ³ -- ³ PC, XT, XT/370 (256k motherboard) ³
³ ? 1987 ³ F8 ³ 00 ³ 00 ³ PS/2 Model 80 ³
³ 3/30/87 ³ F8 ³ 00 ³ 00 ³ PS/2 Model 80-041 16mHz ³
³ 08/28/87 ³ F8 ³ ?? ³ ?? ³ PS/2 Model 80-071 16mHz ³
³ ? 1987 ³ F8 ³ 01 ³ 00 ³ PS/2 Model 80 20mHz ³
³ 09/17/87 ³ F8 ³ 01 ³ 01 ³ PS/2 Model 80-111 20mHz ³
³ ? ³ F8 ³ 04 ³ ? ³ PS/2 Model 70-121 ³
³ 01/18/89 ³ F8 ³ 0B ³ 00 ³ PS/2 Model 70 Portable ³
³ 04/11/88 ³ F8 ³ 09 ³ 02 ³ PS/2 Model 70 desktop ³
³ 02/20/89 ³ F8 ³ 0D ³ ³ PS/2 Model 70-A21 ³
³ 09/13/85 ³ F9 ³ 00 ³ 00 ³ Convertible ³
³ ³ 2D ³ -- ³ -- ³ Compaq PC (4.77mHz original) ³
³ ³ 9A ³ -- ³ -- ³ Compaq Plus (XT compatible) ³
ÀÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÁÄÄÄÄÁÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
The IBM PC System Interrupts (Overview) ............................... 2**7
The interrupt table is stored in the very lowest location in memory, starting
at 0000:0000h. The locations are offset from segment 0, i.e. location 0000h has
the address for int 0, etc. The table is 1024 bytes in length and contains 256
four byte vectors from 00h to 0FFh. Each address' location in memory can be
found by multiplying the interrupt number by 4. For example, int 7 could be
found by (7x4=28) or 1Bh (0000:001Bh).
These interrupt vectors normally point to ROM tables or are taken over by DOS
when an application is run. Some applications revector these interrupts to
their own code to change the way the system responds to the user. DOS provides
int 21h function 25h to change interrupts from a high level; altering the
interrupt vector table directly is not recommended, nor would it really get
you anywhere.
Quick Chart of Interrupts 00h-0FFh .................................... 2**8
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ Interrupt Address ³ ³
ÃÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÂÄÄÄÄÄÙ Function ³
³ Number³ (Hex) ³ Type ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 0 ³ 00-03 ³ CPU ³ Divide by Zero ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 1 ³ 04-07 ³ CPU ³ Single Step ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 2 ³ 08-0B ³ CPU ³ Nonmaskable ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 3 ³ 0C-0F ³ CPU ³ Breakpoint ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 4 ³ 10-13 ³ CPU ³ Overflow ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 5 ³ 14-17 ³ BIOS³ Print Screen ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 6 ³ 18-1B ³ hdw ³ Reserved ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 7 ³ 1C-1F ³ hdw ³ Reserved ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 8 ³ 20-23 ³ hdw ³ Time of Day ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 9 ³ 24-27 ³ hdw ³ Keyboard ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ A ³ 28-2B ³ hdw ³ Reserved ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ B ³ 2C-2F ³ hdw ³ Communications (8259) ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ C ³ 30-33 ³ hdw ³ Communications ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ D ³ 34-37 ³ hdw ³ Disk ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ E ³ 38-3B ³ hdw ³ Diskette ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ F ³ 3C-3F ³ hdw ³ Printer ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 10 ³ 40-43 ³ BIOS³ Video ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 11 ³ 44-47 ³ BIOS³ Equipment Check ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 12 ³ 48-4B ³ BIOS³ Memory ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 13 ³ 4C-4F ³ BIOS³ Diskette/Disk ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 14 ³ 50-53 ³ BIOS³ Serial Communications ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 15 ³ 54-57 ³ BIOS³ Cassette, System Services ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 16 ³ 58-5B ³ BIOS³ Keyboard ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 17 ³ 5C-5F ³ BIOS³ Parallel Printer ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 18 ³ 60-63 ³ BIOS³ ROM BASIC Loader ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 19 ³ 64-67 ³ BIOS³ Bootstrap Loader ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 1A ³ 68-6B ³ BIOS³ Time of Day ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 1B ³ 6C-6F ³ BIOS³ Keyboard Break ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 1C ³ 70-73 ³ BIOS³ Timer Tick ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 1D ³ 74-77 ³ BIOS³ Video Initialization ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 1E ³ 78-7B ³ BIOS³ Diskette Parameters ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 1F ³ 7C-7F ³ BIOS³ Video Graphics Characters, second set ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 20 ³ 80-83 ³ DOS ³ General Program Termination ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 21 ³ 84-87 ³ DOS ³ DOS Services Function Request ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 22 ³ 88-8B ³ DOS ³ Called Program Termination Address ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 23 ³ 8C-8F ³ DOS ³ Control Break Termination Address ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 24 ³ 90-93 ³ DOS ³ Critical Error Handler ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 25 ³ 94-97 ³ DOS ³ Absolute Disk Read ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 26 ³ 98-9B ³ DOS ³ Absolute Disk Write ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 27 ³ 9C-9F ³ DOS ³ Terminate and Stay Resident ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 28-3F ³ A0-FF ³ DOS ³ Reserved for DOS ³
ÀÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÁÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ *29h Fast Screen Write ³
³ *2Ah Microsoft Networks - Session Layer Interrupt ³
³ 2Fh Multiplex Interrupt ³
³ *30h Far jump instruction for CP/M-style calls ³
³ 33h Used by Microsoft Mouse Driver ³
ÚÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÂÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 40-43 ³100-115³ BIOS³ Reserved for BIOS ³
ÀÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÁÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 40h Hard Disk BIOS ³
³ 41h Hard Disk Parameters (except PC1) ³
³ 42h Pointer to screen BIOS entry (EGA, VGA, PS/2) ³
³ 43h Pointer to EGA initialization parameter table ³
ÚÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÂÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 44 ³116-119³ BIOS³ First 128 Graphics Characters ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 45-47 ³120-131³ BIOS³ Reserved for BIOS ³
ÀÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÁÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 45h Reserved by IBM (not initialized) ³
³ 46h Pointer to hard disk 2 params (AT, PS/2) ³
³ 47h Reserved by IBM (not initialized) ³
ÚÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÂÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 48 ³132-135³ BIOS³ PCjr Cordless Keyboard Translation ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 49 ³136-139³ BIOS³ PCjr Non-Keyboard Scancode Translation Table ³
ÀÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÁÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 4Ah Real-Time Clock Alarm (Convertible, PS/2) ³
ÚÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÂÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 50-5F ³140-17F³ BIOS³ Reserved for BIOS ³
ÀÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÁÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 5Ah Cluster Adapter BIOS entry address ³
³ *5Bh IBM (cluster adapter?) ³
³ 5Ch NETBIOS interface entry port ³
ÚÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÂÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 60-67 ³180-19F³ User Program Interrupts (availible for general use) ³
ÀÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÁÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 60h 10-Net Network ³
³ 67h Used by LIM & AQA EMS, EEMS ³
ÚÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÂÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 68-7F ³1A0-1FF³ Reserved by IBM ³
ÀÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÁÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 6Ch System Resume Vector (Convertible) ³
³ 6Fh some Novell and 10-Net API functions ³
³ 70h IRQ 8, Real Time Clock Interrupt (AT, PS/2) ³
³ 71h IRQ 9, LAN Adapter 1 ³
³ 72h IRQ 10 (AT, XT/286, PS/2) Reserved ³
³ 73h IRQ 11 (AT, XT/286, PS/2) Reserved ³
³ 74h IRQ 12 Mouse Interrupt (PS/2) ³
³ 75h IRQ 13, Coprocessor Error ³
³ 76h IRQ 14, Hard Disk Controller (AT, PS/2) ³
³ 77h IRQ 15 (AT, XT/286, PS/2) Reserved ³
³ 7Ch IBM REXX88PC command language ³
ÚÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÂÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 80-85 ³200-217³ ROM BASIC ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 86-F0 ³218-3C3³ Used by BASIC Interpreter When BASIC is running ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ F1-FF ³3C4-3FF³ Reserved by IBM ³
ÀÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÁÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ *0F8h Set Shell Interrupt (OEM) ³
³ *0F9h OEM SHELL service codes ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
The IBM-PC System Interrupts (in detail) .............................. 2**9
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 00h Divide by Zero ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:0000h) (processor error). Automatically called at end of DIV or IDIV
operation that results in error. Normally set by DOS to display an
error message and abort the program.
note On an 8086/8088, the return address points to the following instruction
On an 80286/80386, the return address points to the divide instruction
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 01h Single step ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:0004h) Taken after every instruction when CPU Trap Flag indicates
single-step mode (bit 8 of FLAGS is 1). This is what makes the "T"
command of DEBUG work for single stepping. Is not generated after MOV
to segment register or POP of segment register. (unless you have a
very early 8088 with the microcode bug).
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 02h Non-maskable interrupt ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:0008h) Vector not disabled via CLI. Generated by NMI signal in
hardware. This function is called in the event of a memory
parity error or may occur in the event of other hardware
problems or failures depending on the specific manufacturer's
hardware. Displays the appropriate error message and halts the
processor.
Some AT chip sets apparently use int 02h to signal I/O errors
as well as parity errors.
This signal has various uses:
POST parity error: all except PCjr and Convertible
80x87 coprocessor interrupt: all except PCjr and Convertible
Keyboard interrupt: PCjr, Convertible
I/O channel check: Convertible, PS/2 50+
Disk controller power-on request: Convertible
System suspend: Convertible
Realtime clock: Convertible
System watchdog timer: PS/2 50+
Timeout interrupt: PS/2 50+
DMA timer time-out interrupt: PS/2 50+
Infrared keyboard link: PCjr
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 03h Breakpoint ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:000Ch) Taken when CPU executes the 1-byte int 3 (0CCh). Similar to 8080's
(internal) RST instruction. Generally used to set breakpoints for DEBUG.
note 1) Also used by Turbo Pascal versions 1,2,3 when {$U+} specified.
2) Int 3s are sometimes inserted by the Microsoft Linker in response to
an unresolved symbol.
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 04h Divide overflow ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:0010h) Generated by INTO instruction if OF flag is set. If flag is not set,
(internal) INTO is effectively a NOP. Used to trap any arithmetic errors when
program is ready to handle them rather than immediately when they
occur.
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 05h Print Screen ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:0014h) Service dumps the screen to the printer. Invoked by int 9 for shifted
key 55 (PrtSc). Automatically called by keyboard scan when PrtSc key
is pressed. Normally executes a routine to print the screen, but may
call any routine that can safely be executed from inside the keyboard
handler. Status and result byte are at address 0050:0000.
(internal) BOUND Check Failed (80286+)
Generated by BOUND instruction when the value to be tested is less
than the indicated lower bound or greater than the indicated upper
bound.
entry AH 05h
return absolute address 50:0
00h print screen has not been called, or upon return from a call
there were no errors
01h print screen is already in progress
0FFh error encountered during printing
note 1) Uses BIOS services to read the screen.
2) Output is directed to LPT1.
3) Revectored into GRAPHICS.COM if GRAPHICS.COM is loaded.
4) On the Tandy 1000TX this interrupt can be enabled or disabled across
the expansion slots via a DIP switch.
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 06h Reserved by IBM ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:0018h)
On the Tandy 1000TX this interrupt can be enabled or disabled across
the expansion slots via a DIP switch.
(internal) Undefined Opcode (80286+)
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 07h Reserved by IBM ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:00C0h)
On the Tandy 1000TX this interrupt can be enabled or disabled across
the expansion slots via a DIP switch.
(internal) No Math Unit Available (80286+)
note The 80286 and later can be programmed to generate an int 7 whenever
an ESC instruction is encountered. This could be used to emulate an
80x87 series coprocessor in software and be transparent to the
application software. It could also be used to make a non-Intel
floating point processor emulate an 80x87.
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 08h Timer ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:0020h) 55ms timer "tick" issued 18.2 times per second.
(IRQ0) 8259-1 Interrupt Controller
Updates the system time at [0040:006C] (low word) and [0040:006E]
(high word) and issues an int 1Ch (timer). (int 1Ch points to an
IRET instruction unless changed by a resident program). The timer
interrupt is given the highest maskable interrupt priority upon
power up.
(internal) Double Fault (80286+ protected mode) Called when multiple exceptions
occur on one instruction, or an exception occurs in an exception
handler. If an exception occurs in the double fault handler, the CPU
goes into SHUTDOWN mode (which circuitry in the PC/AT converts to a
reset).
entry AH 08h
return absolute addresses:
40:6C number of interrupts since power on (4 bytes)
40:70 number of days since power on (1 byte)
40:67 day counter on all products after AT
40:40 motor control count - gets decremented and shuts off diskette
motor if zero
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 09h Keyboard ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:0024h) Taken whenever a key is pressed or released. This is normally a scan
(IRQ1) code, but may also be an ACK or NAK of a command on AT-type
keyboards. The hardware provides the key pressed in a non-ASCII scan
code format read at I/O port 60h. The servicer acknowledges receipt
of the key by toggling bit 7 of port 61h. (Port 61h should be read
first, then bit 7 ORed on, output to port 61h, then ANDed off, and
resent to port 61h).
The read key is decoded to yield an ASCII character, special
function key (such as F1) or a control function like Left Shift Key.
The converted ASCII character is placed into the next available
position in the circular queue keyboard. It is put in the position
indicated by queue tail when it will not cause the loss of earlier
entered data. The queue head points to the oldest key pressed in the
buffer which has not been removed from the queue (the normal process
uses int 16h to remove keys from the queue and return the key value
to the int 16h caller).
The 16 word queue holds up to 16 keys. If the queue head equals the
queue tail, the queue is empty. Valid keys in the queue comprise
the upper byte scan code and the lower byte ASCII character. If the
key pressed has no ASCII equivalent (i.e F1 to F12), the lower byte
is zero.
Toggle and shift keys are not placed in the buffer, but appear in
the two status bytes at absolute addr. [0040:0017,18].
Special key combinations will cause other events to occur:
a) Ctrl-Alt_Del - Reset computer by jumping to power_on_reset
b) Print screen - Call int_5_prn_scrn to print the current screen
c) Ctrl-Break - Call int_1Bh control break key processor (DOS)
d) Pause - Wait until an ASCII key is pressed, without
placing the key in the queue
(internal) Math Unit Protection Fault (80286+ protected mode)
entry AH 09h
return at absolute memory addresses:
40:17 bit
0 right shift key depressed
1 left shift key depressed
2 control key depressed
3 alt key depressed
4 ScrollLock state has been toggled
5 NumLock state has been toggled
6 CapsLock state has been toggled
7 insert state is active
40:18 bit
0 left control key depressed
1 left alt key depressed
2 SysReq key depressed
3 Pause key has been toggled
4 ScrollLock key is depressed
5 NumLock key is depressed
6 CapsLock key is depressed
7 Insert key is depressed
40:96 bit
0 last code was the E1h hidden code
1 last code was the E0h hidden code
2 right control key down
3 right alt key down
4 101 key Enhanced keyboard installed
5 force NumLock if rd ID & kbx
6 last character was first ID character
7 doing a read ID (must be bit 0)
40:97 bit
0 ScrollLock indicator
1 NumLock indicator
2 CapsLock indicator
3 circus system indicator
4 ACK received
5 resend received flag
6 mode indicator update
7 keyboard transmit error flag
40:1E keyboard buffer (20h bytes)
40:1C buffer tail pointer
40:72 1234h if ctrl-alt-del pressed on keyboard
AL scan code
note 1) Int 05h invoked if PrtSc key pressed.
2) Int 1Bh invoked if Ctrl-Break key sequence pressed.
3) Int 15h, AH=85h invoked on AT and after if SysReq key is pressed.
4) Int 15h, AH=4Fh invoked on machines after AT.
5) Int 16h, BIOS keyboard functions, uses this interrupt.
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 0Ah EGA Vertical Retrace ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:0028h) used by EGA vertical retrace
(IRQ2) 8259-1 Interrupt Controller
note 1) The TOPS and PCnet adapters use this IRQ line by default.
2) On systems equipped with 2 interrupt controller chips (8259), IRQ 2
is used to support the second interrupt controller. In this case,
int 71h (IRQ 9) is used to replace IRQ 2. Hardware calls to int 71h
are redirected to this interrupt to maintain compatibility.
3) Many VGA boards to not use this interrupt.
(internal) Invalid Task State Segment (80286+ protected mode)
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 0Bh Communications Controller (serial port) hdw. entry ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:002Ch) Serial Port 2 (COM2) 8259-1
(IRQ3)
note 1) IRQ 3 may be used by SDLC (synchronous data-link control) or
bisynchronous communications cards instead of a serial port.
2) The TOPS and PCnet adapters use this interrupt request line as an
alternate.
3) On PS/2s, COM2 through COM8 share this IRQ.
4) For most serial boards, COM4 shares this IRQ.
5) On the Commodore Amiga 2000 with the PC Bridge Board, this interrupt
is used for communication between the Amiga system board and the
Bridge Board. This was probably the lowest IRQ level they felt safe
using, but limits the A2000's use of network cards, etc.
6) This interrupt is used by part of the stack-switching code added
to DOS 3.2 for use with Local Area Network adapters.
7) The PS/2 puts COM3 through COM8 at port addresses above 3FFh (not
properly decoded by older PCs) and has all of them sharing IRQ3.
(internal) Not Present (80286+ protected mode)
Generated when loading a segment register if the segment descriptor
indicates that the segment is not currently in memory. May be used
to implement virtual memory.
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 0Ch Communications Controller (serial port) Hardware Entry ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:0030h) Serial Port 1 (COM1) or internal modem in PCjr or Convertible
(IRQ4) 8259-1
note 1) IRQ 4 may be used by SDLC (synchronous data-link control) or
bisynchronous communications cards instead of a serial port.
2) On some PCs, this interrupt is shared by COM3.
3) Tandy computers use IRQ4 instead of IRQ5 for the hard disk interrupt.
4) Best performance of mice sometimes happens when they are configured
for IRQ4 instead of IRQ3, since some mouse drivers may lock system
interrupts for long periods.
(internal) Stack Fault (80286+ protected mode)
Generated on stack overflow/underflow. Note that the 80286 will shut
down in real mode if SP=1 before a push.
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 0Dh Hard Disk ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:0034h) Miscelleneous uses
(IRQ5) 8259-1
note 1) Various Tandy 1000 models may use this line for the 60Hhz RAM refresh
or as "optional bus interrupt."
2) Used by hard disk on IBM XT and most compatibles.
3) LPT2 on AT, XT/286, and PS/2
4) Dummy CRT vertical retrace on PCjr
(internal) General Protection Violation (80286+)
Called in real mode when an instruction attempts to access a word
operand located at offset 0FFFFh or a PUSH MEM or POP MEM
instruction contains an invalid bit code in the second byte, or
when an instruction exceeds the maximum length allowed (10 bytes
for 80286, 15 bytes for 80386)
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 0Eh Diskette Interrupt ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:0038h) Generated by floppy controller on completion of an operation
(IRQ6) (sets bit 8 of 40:3E)
(internal) Page Fault (80386+ native mode)
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 0Fh Reserved by IBM ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:003Ch) IRQ7 used by 8259 PPI interrupt (LPT1, LPT2)
(IRQ7)
note 1) Generated by the LPT1 printer adapter when printer becomes ready. Many
printer adapters do not reliably generate this interrupt.
2) This interrupt is normally avoided. If a bad interrupt occurs, it will
vector to this spot (when caused by a misprogrammed 8259 PIC)
** Programmer's Technical Reference for MSDOS and the IBM PC **
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ Shareware Version, 06/17/91 ³
³ Please Register Your Copy ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
Copyright (c) 1987, 1991 Dave Williams
USA copyright TXG 392-616 ALL RIGHTS RESERVED
ISBN 1-878830-02-3 (disk-based text)
C H A P T E R T H R E E
THE PC ROM BIOS - Interrupts 10h through 19h
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 10h Video I/O - services to handle video output ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:0040h) The ROM video routines in the original PC BIOS are designed for
use with the Color Graphics Adapter and incorporate code to test
for the horizontal retrace before writing. The check is
performed no matter what actual display adapter is installed.
The ROM character table for the first 128 characters is located
at 0FA6Eh in the PC. Int 01Fh can be used to point to a second
table of 128 characters.
CS, SS, DS, ES, BX, CX, DX are preserved during call. All
others are destroyed.
Function 00h Determine or Set Video State
entry AH 00h set video mode
AL display mode: CGA|PCjr|MDA|MCGA|EGA|VGA|8514
00h 40x25 B/W text CGA|PCjr| | |EGA| |
16 color 40x25, 320x400 graphics | | |MCGA| | |
16 color 40x25, 360x400 graphics | | | | |VGA|
16 color 01h 40x25 color text CGA|PCjr| | |EGA| |
02h 80x25 B/W text CGA|PCjr| | |EGA| |
16 color 80x25 640x400 graphics | | |MCGA| | |
16 color 80x25 720x400 graphics | | | |VGA| |
16 color 03h 80x25 color text CGA|PCjr| | |EGA|VGA|
4 color 04h 320x200 color graphics CGA|PCjr| | |EGA| |
4 tone gray 05h 320x200 B/W graphics CGA|PCjr| | |EGA| |
2 color 06h 640x200 B/W graphics CGA|PCjr| | |EGA| |
monochrome 07h 80x25 monochrome text | |MDA| |EGA| |
16 color 08h 160x200 color graphics CGA|PCjr| | | | |
16 color 09h 320x200 color graphics |PCjr| | | |VGA|
4 color 0Ah 640x200 color graphics |PCjr| | | | |
N/A 0Bh BIOS font load | | | |EGA|VGA|
N/A 0Ch BIOS font load | | | |EGA|VGA|
16 color 0Dh 320x200 graphics | | | |EGA|VGA|
16 color 0Eh 640x200 graphics | | | |EGA|VGA|
monochrome 0Fh 640x350 graphics | | | |EGA|VGA|
16 & 64 color 10h 640x350 color hi-res | | | |EGA|VGA|
2 color 11h 640x480 graphics | | |MCGA| |VGA|
16 color 12h 640x480 graphics | | | | |VGA|
256 color 13h 320x200 graphics | | |MCGA| |VGA|8514
14h-20h used by EGA and VGA graphics modes
18h 132x44 8x8 char mono | Tseng Labs EVA
19h 132x25 8x14 char mono | Tseng Labs EVA
1Ah 132x28 8x13 char mono | Tseng Labs EVA
monochrome 21h Hercules Graphics, Graphics Page 1
monochrome 22h Hercules Graphics, Graphics Page 2
22h 132x44 | Tseng, Ahead
23h 132x25 | Tseng Labs EVA
132x25 | Ahead Systems EGA2001
132x25 | ATI EGA Wonder
24h 132x28 | Tseng Labs EVA
25h 80x60 640x480 | Tseng Labs EVA
16 color 640x480 | VEGA VGA
26h 80x60 | Tseng Labs EVA
80x60 640x480 | Ahead Systems EGA2001
16 color 27h 720x512 | VEGA VGA
monochrome 132x25 | ATI EGA Wonder
28h unknown | VEGA VGA
16 color 29h 800x600 | VEGA VGA
256 color 2Dh 640x350 | VEGA VGA
256 color 2Eh 640x480 | VEGA VGA
256 color 2Fh 720x512 | VEGA VGA
256 color 30h 800x600 | VEGA VGA
unknown | AT&T 6300
16 color 36h 960x720 | VEGA VGA
16 color 37h 1024x768 | VEGA VGA
monochrome 132x44 | ATI EGA Wonder
2 color 40h 640x400 | AT&T 6300
80x43 | VEGA VGA
16 color 41h 640x200 | AT&T 6300
132x25 | VEGA VGA
16 color 42h 640x400 | AT&T 6300
132x43 | VEGA VGA
43h unsupported 640x200 of 640x400 viewport AT&T 6300
80x60 | VEGA VGA
44h disable VDC and DEB output | AT&T 6300
100x60 | VEGA VGA
48h 80x50 640x400 | AT&T 6300
4Dh 120x25 | VEGA VGA
4Eh 120x43 | VEGA VGA
4Fh 132x25 | VEGA VGA
monochrome 50h 132x25 | Ahead Systems EGA2001
16 color 640x480 | Paradise EGA-480
monochrome 80x43 | VEGA VGA
640x480 mono? | Taxan 565 EGA
51h 80x30 | Paradise EGA-480
monochrome 132x25 | VEGA VGA
640x480 ? | ATI EGA Wonder
monochrome 52h 132x44 | Ahead Systems EGA2001
monochrome 132x43 | VEGA VGA
752x410 ? | ATI EGA Wonder
53h 800x560 ? | ATI EGA Wonder
54h 132x43 | Paradise EGA-480
16 color 132x43 | Paradise VGA
16 color 132x43 | Paradise VGA on multisync
132x43 | Taxan 565 EGA
55h 132x25 | Paradise EGA-480
16 color 132x25 | Paradise VGA
16 color 132x25 | Paradise VGA on multisync
132x25 | Taxan 565 EGA
56h 132x43 | NSI Smart EGA+
132x43 | Paradise VGA
132x43 | Paradise VGA on multisync
monochrome 132x43 | Taxan 565 EGA
57h 132x25 | NSI Smart EGA+
132x25 | Paradise VGA
132x25 | Paradise VGA on multisync
monochrome 132x25 | Taxan 565 EGA
58h 100x75 800x600 16/256k | Paradise VGA
59h 100x75 800x600 | Paradise VGA
5Eh 640x400 | Paradise VGA,VEGA VGA
5Fh 640x480 | Paradise VGA
60h 80x? ?x400 | Corona/Cordata BIOS v4.10+
752x410 | VEGA VGA
60h 400 line graphics+80 col text |(Corona/Cordata)
61h 400 line graphics | Corona/Cordata BIOS v4.10+
720x540 | VEGA VGA
62h 800x600 | VEGA VGA
16 color 71h 100x35 800x600 | NSI Smart EGA+
74h 640x400 graphics | Toshiba 3100
7Eh Special Mode Set | Paradise VGA (see below)
BX horizontal dimension of the mode desired
CX vertical dimension of the mode desired
(both BX/CX in pixels for graphics modes, rows
for text modes)
DX number of colors of the mode desired
(use 0 for monochrome modes)
return BH 7Eh if successful
7Fh Special Function Set | Paradise VGA (see below)
BH 00h Set VGA Operation
01h Set Non-VGA Operation
02h Query Mode Status
return BL 0 if operating in VGA mode
1 if non-VGA mode.
CH total video RAM size in 64k byte units
CL video RAM used by the current mode
03h Lock Current Mode
Allows current mode (VGA or non-VGA) to
survive reboot.
BH 0Ah,0Bh,0Ch,0Dh,0Eh,0Fh
write paradise registers 0,1,2,3,4,5
(port 03CEh indexes A,B,C,D,E,F)
BL value to set in the paradise register.
BH 1Ah,1Bh,1Ch,1Dh,1Eh,1Fh
read paradise registers 0,1,2,3,4,5
(port 03CEh indexes A,B,C,D,E,F)
return BL value of the Paradise register
BH 7Fh if successful.
note Color modes (0,1,2,3,4,5,6) will set non-VGA CGA
operation. Monochrome mode 7 will set non-VGA
MDA/Hercules operation.
82h 80x25 B&W | AT&T VDC overlay mode *
83h 80x25 | AT&T VDC overlay mode *
86h 640x200 B&W | AT&T VDC overlay mode *
C0h 640x400 2/prog pallet | AT&T VDC overlay mode *
C4h disable output | AT&T VDC overlay mode *
D0h 640x400 | DEC VAXmate AT&T mode
unknown 640x225 | Z-100
unknown 640x400 | Z-100
note 1) If the high bit in AL is set, the display buffer is not cleared when a
new mode is selected. This may be used to mix modes on the display;
for example, characters of two difference sizes might be displayed
2) Modes 8-10 are available on the PCjr, Tandy 1000, and PS/2
3) IBM claims 100% software and hardware emulation of the CGA with the
MCGA chipset. All registers may be read and written as CGA. All
characters are double-scanned to give 80x25 with 400 line resolution.
The attributes for setting border color may be set on MCGA, but the
borders will remain the default color (they cannot actually be set)
4) The IBM Color Graphics Adapter (CGA) is too slow for the screen to
be updated before the vertical retrace of the monitor is completed.
If the video RAM is addressed directly, the screen will have "snow"
or interference. IBM's default is to turn the adapter off when it is
being updated, ie "flickering" when the display is scrolled.
5) The vertical retrace signal may be ignored when using the MCGA adapter.
The MCGA will not generate snow when written to. There is no flicker
with the MCGA.
6) The PCjr Video Gate Array uses a user-defined block of main system RAM
from 4 to 32k in size instead of having dedicated memory for the
display. Vertical retrace may be ignored when writing to the PCjr.
There is no flicker with the PCjr display.
7) The Hercules Graphics Card has 750x348 resolution
8) The Hercules Graphics Card takes 64k beginning at B:000 (same as MDA)
9) The CGA, MCGA, and VGA adapters use hardware address B:800
10) The BIOS clears the screen when the mode is set or reset.
11) For AT&T VDC overlay modes, BL contains the DEB mode, which may be 06h,
40h, or 44h
12) Int 10 will take the shapes of the first 128 characters (00h-7Fh) from
the table located in ROM at absolute address F000:FA6E. The EGA and VGA
have hardware capability to change this.
Function 01h Set Cursor Type - set the size of the cursor or turn it off
entry AH 01h
CH bit values:
bits 0-4 top line for cursor in character cell
bits 5-6 blink attribute
00 normal
01 invisible (no cursor)
10 slow (not used on original IBM PC)
11 fast
CL bit values:
bits 0-4 bottom line for cursor in character cell
return none
note 1) The ROM BIOS default cursors are: start end
monochrome mode 07h: 11 12
text modes 00h-03h: 6 7
2) The blinking in text mode is caused by hardware and cannot be turned
off, though some kludges can temporarily fake a nonblinking cursor
3) The cursor is automatically turned off in graphics mode
4) Another method of turning off the cursor in text mode is to position it
to a nondisplayable address, such as (X,Y)=(0,25)
5) Buggy on EGA systems - BIOS remaps cursor shape in 43 line modes, but
returns unmapped cursor shape
Function 02h Set Cursor Position - reposition the cursor to (X,Y)
entry AH 02h
BH video page
00h graphics mode
03h modes 2 and 3
07h modes 0 and 1
DH row (Y=0-24)
DL column (X=0-79 or 0-39)
return none
note 1) (0,0) is upper left corner of the screen
Function 03h Read Cursor Position - return the position of the cursor
entry AH 03h
BH page number
00h in graphics modes
03h in modes 2 & 3
07h in modes 0 & 1
return CH top line for cursor (bits 4-0)
CL bottom line for cursor (bits 4-0)
DH row number (Y=0-24)
DL column number (X=0-79 or 0-39)
Function 04h Read Light Pen - fetch light pen information
entry AH 04h
return AH 00h light pen not triggered
AH 01h light pen is triggered, values in resgisters
BX pixel column (X=0-319 or 0-639) graphics mode
CH raster line (Y=0-199) old graphics modes
CX (EGA) raster line (0-nnn) new graphics modes
DH row of current position (Y=0-24) text mode
DL column of current position (X=0-79 or 0-39) text mode
note Not supported on PS/2
Function 05h Select Active Page - set page number for services 6 and 7
entry AH 05h
AL number of new active page
0-7 modes 00h and 01h (CGA)
0-3 modes 02h and 03h (CGA)
0-7 modes 02h and 03h (EGA)
0-7 mode 0Dh (EGA)
0-3 mode 0Eh (EGA)
0-1 mode 0Fh (EGA)
0-1 mode 10h (EGA)
0 set address of graphics bitmap buffer (modes 60h,61h)
BX segment of buffer
0Fh get address of graphics bitmap buffer (modes 60h,61h)
BX segment of buffer
for PCjr only:
AL 80h to read CRT/CPU page registers
81h to set CPU page register to value in BL
82h to set CRT page register to value in BH
83h to set both CPU and page registers
(and Corona/Cordata BIOS v4.10+)
BH CRT page number for subfunctions 82h and 83h
BL CPU page register for subfunctions 81h and 83h
return standard PC none
PCjr if called with AH bit 7=1 then
BH CRT page register (if AL >= 80h)
BL CPU page register (if AL >= 80h)
DX segment of graphics bitmap buffer (video modes 60h,61h; AL=0Fh)
note 1) Mono adapter has only one display page
2) CGA has four 80x25 text pages or eight 40x25 text pages
3) A separate cursor is maintained for each display page
4) Switching between pages does not affect their contents
5) Higher page numbers indicate higher memory positions
Function 06h Scroll Page Up - scroll up or clear a display "window"
entry AH 06h
AL number of lines blanked at bottom of page
0 = blank entire window
BH attributes to be used on blank line
CH row (Y) of upper left corner or window
CL column (X) of upper left corner of window
DH row (Y) of lower right corner of window
DL column (X) of lower right corner of window
return none
note 1) Push BP before scrolling, pop after
2) If in CGA text mode, affects current page only
Function 07h Scroll Page Down - scroll down or clear a display "window"
entry AH 07h
AL number of lines to be blanked at top of page
0 = blank entire window
BH attributes to be used on blank line
CH row (Y) of upper left corner or window
CL column (X) of upper left corner of window
DH row (Y) of lower right corner of window
DL column (X) of lower right corner of window
return none
note 1) Push BP before scrolling, pop after
2) If in CGA text mode, affects current page only
Function 08h Read Character Attribute - of character at current cursor pos.
entry AH 08h
BH display page number - text mode
return AH character attribute - text mode
AL ASCII code of character at current cursor position
Function 09h Write Character and Attribute - at current cursor position
entry AH 09h
AL ASCII code of character to display
BH display page number - text mode
BL attribute/color of character
CX number of characters to write
return none
note 1) CX should not exceed actual rows availible, or results may be erratic
2) Setting CX to zero will cause runaway
3) All values of AL result in some sort of display; the various control
characters are not recognized as special and do not change the current
cursor position
4) Does not change cursor position when called - the cursor must be
advanced with int 10 function 0Ah.
5) If used to write characters in graphics mode with bit 7 of AH set to 1
the character will by XORed with the current display contents.
6) In graphics mode the bit patterns for ASCII character codes 80h-0FFh
are obtained from a table. On the standard PC and AT, the location is at
interrupt vector 01Fh (0000:007C). For ASCII characters 00h-07Fh, the
table is at an address in ROM. On the PCjr the table is at interrupt
vector 44h (0000:00110) and is in addressable RAM (may be replaced by
the user)
7) All characters are displayed, including CR, LF, and BS
Function 0Ah Write Character - display character(s) (use current attribute)
entry AH 0Ah
AL ASCII code of character to display
BH display page - text mode
BL color of character (graphics mode, PCjr only)
CX number of times to write character
return none
note 1) CX should not exceed actual rows availible, or results may be erratic
2) All values of AL result in some sort of display; the various control
characters are not recognized as special and do not change the current
cursor position
3) If used to write characters in graphics mode with bit 7 of AH set to 1
the character will by XORed with the current display contents.
4) In graphics mode the bit patterns for ASCII character codes 80h-0FFh
are obtained from a table. On the standard PC and AT, the location is at
interrupt vector 01Fh (0000:007C). For ASCII characters 00h-07Fh, the
table is at an address in ROM. On the PCjr the table is at interrupt
vector 44h (0000:00110) and is in addressable RAM (may be replaced by
the user)
5) In EGA in graphics modes, replication count in CX works correctly only
if all characters written are contained on the same row
6) All characters are displayed, including CR, LF, and BS
Function 0Bh Set Color Palette - set palette for graphics or text border
entry AH 0Bh
BH 00h select border (text mode)
BL color 0-15, 16-31 for high-intensity characters
BH 01h set graphics palette with value in BL
(CGA) BL 0 green/red/yellow
1 cyan/magenta/white
(EGA) (graphics modes)
BH 0
BL has border color (0-15) & high intensity bkgr'd color (16-31)
BH 1
BL contains palette being selected (0-1)
return none
note 1) Valid in CGA mode 04h, PCjr modes 06h, 08h-0Ah
2) Although the registers in the MCGA may be set as if to change the
border, the MCGA will not display a border no matter what register
settings are used.
Function 0Ch Write Dot - plot one graphics pixel
entry AH 0Ch
AL dot color code (0/1 in mode 6, 0-3 in modes 4 and 5)
(set bit 7 to XOR the dot with current color)
0-3 mode 04h, 05h
0-1 mode 06h
BH page number (ignored if adapter supports only one page)
CX column (X=0000h - 027Fh)
(0 - 319 in modes 4,5,13, 0 - 639 in modes 6,14,15,16)
DX row (Y=0000h - 00C7h) (0 - 199 CGA)
return none
note Video graphics modes 4-6 only
Function 0Dh Read Dot - determine the color of one graphics pixel
entry AH 0Dh
CX column (X=0000h - 027Fh) (0-319 or 639)
DX row (Y=0000h - 00C7h) (0-199)
return AL color of dot
note Only valid in graphics mode
Function 0Eh Write TTY - write one character and update cursor. Also handles
CR (0Dh), beep (07h), backspace (10h), and scrolling
entry AH 0Eh
AL ASCII code of character to be written
BH page number (text)
BL foreground color (video modes 6 & 7 only) (graphics)
return none
note 1) The ASCII codes for bell, backspace, carriage return, and linefeed are
recognized and appropriate action taken. All other characters are
written to the screen and the cursor is advanced to the next position
2) Text can be written to any CGA page regardless of current active page
3) Automatic linewrap and scrolling are provided through this function
4) This is the function used by the DOS CON console driver.
5) This function does not explicitly allow the use of attributes to the
characters written. Attributes may be provided by first writing an ASCII
27h (blank) with the desired attributes using function 09h, then
overwriting with the actual character using this function. While clumsy
this allows use of the linewrap and scrolling services provided by
this function
Function 0Fh Return Current Video State - mode and size of the screen
entry AH 0Fh
return AH number of character columns on screen
AL mode currently set (see AH=00h for display mode codes)
BH current active display page
note If mode was set with bit 7 set ("no blanking"), the returned mode will
also have bit 7 set
Function 10h Set Palette Registers (PCjr, Tandy 1000, EGA, MCGA, VGA)
entry AH 10h
AL 00h set individual palette register
BH color value to store
BL palette register to set
(on MCGA, only BX = 0712h is supported)
01h set border color palette register
BH color value to store
02h set all palette registers and overscan
ES:DX pointer to 17-byte list
bytes 0-15 values for palette regs. 0-15
byte 16 value for border color register
03h toggle blink/intensity bit (Jr, EGA, MCGA, VGA)
BL 00h enable intensity
01h enable blink
04h unknown
05h unknown
06h unknown
07h read individual palette register (VGA)
BL palette register number
return BH palette register value
08h read overscan (order color) register (VGA)
return BH value
09h read all palette registers and overscan register (VGA)
ES:DX pointer to buffer address (17 bytes)
10h set individual video DAC color register (MCGA, VGA)
BX register number
CH new value for green (0-63)
CL new value for blue (0-63)
DH new value for red (0-63)
11h unknown
12h set block of video DAC color registers (MCGA, VGA)
BX starting color register
CX number of registers to set
ES:DX table of 3*CX bytes where each 3 byte group
represents one byte each of red, green and
blue (0-63)
13h set video DAC color page (VGA)
BH 00h select 4 blocks of 64
BH 01h select 16 blocks of 16
BL 00h select paging mode
BL 01h select Page
BH page number (00h to 03h) or (00h to 0Fh)
(not valid in mode 13h)
14h unknown
15h read individual video DAC color register (MCGA, VGA)
BL palette register number
return DH red value
CH green value
CL blue value
16h unknown
17h read block of video DAC color registers (MCGA, VGA)
BX starting palette register
CX number of palette registers to read
ES:DX buffer (3 * CX bytes in size)
return CX number of red, green and blue triples in buffer
18h *UNDOCUMENTED* set PEL mask
BL new PEL value
19h *UNDOCUMENTED* read PEL mask
BL value read
1Ah read video DAC color-page state (VGA)
return BL paging mode
0 four pages of 64
1 sixteen pages of 16
BH current page
1Bh perform gray-scale summing (MCGA, VGA)
BX starting palette register
CX number of registers to convert
BH color value
BL if AL=00h palette register to set (00h-0Fh)
if AL=03h 0 to enable intensity
1 to enable blinking
ES:DX if AL=02h pointer to 16-byte table of register values
followed by the overscan value:
bytes 0-15 values for palette registers 0-15
byte 16 value for border register
return none
note DAC is Digital to Analog Convertor circuit in MCGA/VGA chips
Function 11h Character Generator Routine (EGA and after)
entry AH 11h
The following functions will cause a mode set, completely
resetting the video environment, but without clearing the video
buffer.
AL 00h, 10h load user-specified patterns
BH number of bytes per character pattern
BL block to load in map 2
CX count of patterns to store
DX character offset into map 2 block
ES:BP pointer to user table
01h, 11h load ROM monochrome patterns (8 by 14)
BL block to load
02h, 12h load ROM 8 by 8 double-dot patterns
BL block to load
03h set block specifier
BL block specifier
(EGA/MCGA) bits 0,1 = block selected by chars with attribute
bit 3 = 0
bits 2,3 = block selected by chars with attribute
bit 3 = 1
(VGA) bits 0,1,4 = block selected by attribute bit 3 = 0
bits 2,3,5 = block selected by attribute bit 3 = 1
04h,14h load 8x16 text character set (MCGA, VGA)
The routines called with AL=1x are designed to be
called only immediately after a mode set and are
similar to the routines called with AL=0x, except
that:
Page 0 must be active.
Bytes/character is recalculated.
Max character rows is recalculated.
CRT buffer length is recalculated.
CRTC registers are reprogrammed as follows:
reg09h bytes/char-1; max scan line (mode 7 only)
reg0Ah bytes/char-2; cursor start
reg0Bh 0 ; cursor end
reg12h ((rows+1)*(bytes/char))-1
; vertical display end
reg14h bytes/char ; underline loc
(* BUG: should be 1 less *)
The following functions are meant to be called only
after a mode set:
20h user 8 by 8 graphics characters (int 1Fh)
ES:BP pointer to user table
21h user graphics characters
ES:BP pointer to user table
CX bytes per character
BL row specifier
0 user set
DL number of rows
1 14 rows
2 25 rows
3 43 rows
22h ROM 8 by 14 set
BL row specifier
23h ROM 8 by 8 double dot
BL row specifier
24h load 8x16 graphics characters (MCGA, VGA)
BL row specifier
30h Get Font Information (EGA, MCGA, VGA)
BH pointer specifier
0 int 1Fh pointer
1 int 44h pointer
2 ROM 8 by 14 character font pointer
3 ROM 8 by 8 double dot font pointer
4 ROM 8 by 8 DD font (top half)
5 ROM text alternate (9 by 14) pointer
return ES:BP specified pointer value
CX bytes/character
DL character rows on screen
Function 12h Alternate Select (EGA and after)
entry AH 12h
BL 10h return EGA information
return BH 00h if color mode is in effect (3Dx)
01h if mono mode is in effect (3Dx)
BL 00h if 64k EGA memory
01h if 128k EGA memory
02h if 192k EGA memory
03h if 256k EGA memory
CH feature bits
CL switch settings
20h select alternate print screen routine
30h select vertical resolution for text modes (VGA)
AL 00h 200 scan lines
01h 350 scan lines
02h 400 scan lines
return AL 12h if function supported
31h enable/disable default palette loading (MCGA, VGA)
AL 00h enable default palette loading
01h disable default palette loading
return AL 12h if function was supported
32h enable/disable video addressing (MCGA, VGA)
AL 00h enable video
01h disable video
return AL 12h if function was supported
33h enable/disable default gray scale summing (MCGA, VGA)
AL 00h enable gray scale summing
01h disable gray scale summing
return AL 12h if function was supported
34h enable/disable text cursor emulation (VGA)
AL 00h enable cursor emulation
01h disable cursor emulation
return AL 12h if function was supported
35h display-switch interface (PS/2)
AL 00h initial adapter video off
01h initial planar video on
02h switch active video off
03h switch inactive video on
80h *undocumented* set system board video
active flag
ES:DX buffer (128 byte save area if AL = 0, 2 or 3)
return AL 12h if function was supported
36h video refresh control (VGA)
AL 00h enable refresh
01h disable refresh
return AL 12h if function supported
BX 5500h (used by ATI and TAXAN)
BX 5502h (used by ATI and TAXAN)
Function 13h Enhanced String Write (AT, XT/286, PS/2)
entry AH 13h
AL 00h Write String, Don't Move Cursor
01h Write String, Move Cursor
02h Write String of Alternating Characters and Attributes;
Don't Move Cursor
bit 0: set in order to move cursor after write
bit 1: set if string contains alternating chars and
attributes
03h Write String of Alternating Characters and Attributes;
Move Cursor
bit 0: set in order to move cursor after write
bit 1: set if string contains alternating characters
and attributes
BH display page number
BL attribute if AL bit 1 clear
CX length of string
DH row of starting cursor position
DL column of starting cursor position
ES:BP pointer to start of string
return none
note Recognizes CR, LF, BS, and bell
Function 14h Load LCD Character Font (Convertible)
entry AH 14h
AL 00h load user specified font
BH number of bytes per character
BL 00h load main font (block 0)
01h load alternate font (block 1)
CX number of characters to store
DX character offset into RAM font area
ES:DI pointer to character font
AL 01h load system ROM default font
BL 00h load main font (block 0)
01h load alternate font (block 1)
AL 02h set mapping of LCD high intensity attribute
BL 00h ignore high intensity attribute
01h map high intensity to underscore
02h map high intensity to reverse video
03h map high intensity to seleected alternate font
return unknown
Function 15h Return Physical Display Parameters (Convertible)
entry AH 15h
return AX Alternate display adapter type
ES:DI pointer to parameter table:
word # information
01h monitor model number
02h vertical pixels per meter
03h horizontal pixels per meter
04h total number of vertical pixels
05h total number of horizontal pixels
06h horizontal pixel separation in micrometers
07h vertical pixel separation in micrometers
Function 1Ah Display Combination Code (MCGA, VGA)
Using the compatibility BIOS of the PS/2 Models 50, 60, 80 there
is a way to determine which video controller and attached
display are on the system. The Display Combination Code (DCC)
is a Video BIOS function that provides the capability.
entry AH 1Ah
AL 00h read display combination code
01h write display combination code
return AL 1Ah indicates Compatibility BIOS is supported,
any other value is invalid
BH Display Combination Code (DCC)
00h no display
01h IBM monochrome adapter and display
02h IBM color/graphics monitor adapter w/color display
03h reserved
04h IBM EGA, color display
05h IBM EGA, monochrome display
06h IBM PGA, color display
07h VGA, analog monochrome display
08h VGA, analog color display
09h reserved
0Ah MCGA, digital color display
0Bh MCGA, analog monochrome display
0Ch MCGA, analog color display
0FFh unknown display type
BL active display device code
note This function may be used to test for VGA, since it is not supported in
earlier adapters. If AL is still 1Ah when the call completes, a VGA
compatible adapter is present.
Function 1Bh Functionality/State Information (MCGA, VGA)
entry AH 1Bh
BX implementation type
0000h return funtionality/state information
ES:DI pointer to 64 byte buffer
return AL 1Bh if function supported
ES:DI buffer filled
00h address of functionality table
01h unknown
02h unknown
03h unknown
04h current video mode
05h number of columns
06h unknown
07h length of regen buffer in bytes
09h starting address of regen buffer
0Bh cursor position for page 0
0Dh cursor position for page 1
0Fh cursor position for page 2
11h cursor position for page 3
13h cursor position for page 4
15h cursor position for page 5
17h cursor position for page 6
19h cursor position for page 7
1Bh cursor type
1Dh active display page
1Eh CRTC port address
20h current setting of register (3?8)
21h current setting of register (3?9)
22h number of rows
23h bytes/character
25h DCC of active display
26h DCC of alternate display
27h number of colors supported in current mode
29h number of pages supported in current mode
2Ah number of scan lines active
(0,1,2,3) = (200,350,400,480)
2Bh primary character block
2Ch secondary character block
2Dh miscellaneous flags byte
bit 0 all modes on all displays on
1 gray summing on
2 monochrome display attached
3 default palette loading disabled
4 cursor emulation enabled
5 0=intensity; 1=blinking
6 reserved
7 reserved
2Eh to 30h reserved
31h video memory available
00h=64K, 01h=128K, 02h=192K, 03h=256K
32h save pointer state flags byte
bit 0 512 character set active
1 dynamic save area present
2 alphanumeric font override active
3 graphics font override active
4 palette override active
5 DCC override active
6 reserved
7 reserved
33h to 3Fh reserved
note State Functionality Table format (16 bytes)
00h modes supported #1
bit 0 to bit 7 = 1 modes 0,1,2,3,4,5,6 supported
01h modes supported #2
bit 0 to bit 7 = 1 modes 8,9,A,B,C,D,E,F supported
02h modes supported #3
bit 0 to bit 3 = 1 modes 10,11,12,13 supported
bit 4 to bit 7 reserved
03h to 06h reserved
07h scan lines supported
bit 0 to bit 2 = 1 if scan lines 200,350,400 supported
08h total number of character blocks available in text modes
09h maximum number of active character blocks in text modes
0Ah miscellaneous function flags #1
bit 0 all modes on all displays function supported
1 gray summing function supported
2 character font loading function supported
3 default palette loading enable/disable supported
4 cursor emulation function supported
5 EGA palette present
6 color palette present
7 color paging function supported
0Bh miscellaneous function flags #2
bit 0 light pen supported
1 save/restore state function 1Ch supported
2 intensity blinking function supported
3 Display Combination Code supported
4-7 reserved
0Ch to 0Dh reserved
0Eh Save pointer function flags
bit 0 512 character set supported
1 dynamic save area supported
2 text font override supported
3 graphics font override supported
4 palette override supported
5 DCC extension supported
6 reserved
7 reserved
0Fh reserved
Function 1Ch Save/Restore Video State (VGA)
entry AH 1Ch
AL 00h return state buffer size
01h save video state
ES:BX buffer address
02h restore video state
ES:BX buffer address of previously saved state
CX requested states
bit 0 video hardware
1 BIOS data areas
2 color registers and DAC state
3-15 reserved
return AL 1Ch if function supported
BX number of 64 byte blocks needed (function 00h)
note VGA only
Function 40h Set Graphics Mode (Hercules Graphics Card Plus)
entry AH 40h
return unknown
Function 41h Set Text Mode (Hercules Graphics Card Plus)
entry AH 41h
return unknown
Function 42h Clear Current Page (Hercules Graphics Card Plus)
entry AH 42h
return unknown
Function 43h Select Drawing Page (Hercules Graphics Card Plus)
entry AH 43h
AL page number (0,1)
return unknown
Function 44h Select Drawing Function (Hercules Graphics Card Plus)
entry AH 44h
AL 0 clear pixels
1 set pixels
2 invert pixels
return unknown
Function 45h Select Page to Display (Hercules Graphics Card Plus)
entry AH 45h
AL page number (0,1)
return unknown
Function 46h Draw One Pixel (Hercules Graphics Card Plus)
entry AH 46h
DI x (0-720)
BP y (0-347)
return unknown
note Function 44h determines operation and function 43h which page to use.
Function 47h Find Pixel Value (Hercules Graphics Card Plus)
entry AH 47h
DI x (0-720)
BP y (0-347)
return AL 0 pixel clear
1 pixel set
note Function 43h specifies page that is used.
Function 48h Move to Point (Hercules Graphics Card Plus)
entry AH 48h
DI x (0-720)
BP y (0-347)
return unknown
Function 49h Draw to Point (Hercules Graphics Card Plus)
entry AH 49h
DI x (0-720)
BP y (0-347)
return unknown
note Function 48h or 49h specify first point, 44h operation and 43h page
to use.
Function 4Ah Block Fill (Hercules Graphics Card Plus)
entry AH 4Ah
return unknown
Function 4Bh Display Character (Hercules Graphics Card Plus)
entry AH 4Bh
AL ASCII code for character to display
DI x (0-720)
BP y (0-347)
return unknown
note Unlike the other BIOS character functions character position is
specified in pixels rather than rows and columns.
Function 4Ch Draw Arc (Hercules Graphics Card Plus)
entry AH 4Ch
return unknown
Function 4Dh Draw Circle (Hercules Graphics Card Plus)
entry AH 4Dh
return unknown
Function 4Eh Fill Area (Hercules Graphics Card Plus)
entry AH 4Eh
return unknown
Function 6Ah Direct Graphics Interface Standard (DGIS)
entry AH 6Ah
AL 00h Inquire Available Devices
BX 0
CX 0
DX buffer length (may be 0)
ES:DI address of buffer
return BX number of bytes stored in buffer
CX bytes req'd for all descriptions (0 if no DGIS)
note Buffer contains descriptions and addresses of DGIS-
compatible display(s) and printer(s)
01h Redirect Character Output
CX 0
ES:DI address of device to send INT 10 output to
return CX 0 output could not be redirected
else INT 10h output now routed to requested display
02h Inquire int 10 Output Device
ES:DI 0:0
return ES:DI 0:0 if current display is non-DGIS
else address of the current DGIS INT 10 display
Function 6Fh Set Video Mode (VEGA Extended EGA/VGA)
entry AH 6F
AL 05h
BL mode| (graphics mode if graphics resolution listed)
| text |pixel| graphic|color|disp|scrn| system
| resol|box |resoltn | |page|addr|
62h 800x600 16 VEGA Extended EGA
65h 1024x768 16 VEGA Extended EGA
66h 640x400 256 VEGA Extended VGA
67h 640x480 256 VEGA Extended VGA
68h 720x540 256 VEGA Extended VGA
69h 800x600 256 VEGA Extended VGA
Function 70h Get Video RAM Address (Tandy 1000)
entry AH 70h
return AX segment addresses of the following
BX offset address of green plane
CX segment address of green plane
DX segment address of red/blue plane
note (red offset = 0, blue offset = 4000)
Function 71h Get INCRAM Addresses (Tandy 1000)
entry AH 71h
return AX segment address of the following
BX segment address of INCRAM
CX offset address of INCRAM
Function 72h Scroll Screen Right (Tandy 1000)
entry AH 72h
AL number of columns blanked at left of page
00h blank window
BH attributes to be used on blank columns
CH,CL row, column address of upper left corner
DH,DL row, column address of lower right corner
Function 73h Scroll Screen Left (Tandy 1000)
entry AH 73h
AL number of columns blanked at right of page
00h blank window
BH attributes to be used on blank columns
CH,CL row, column address of upper left corner
DH,DL row, column address of lower right corner
Function 80h DESQview - Set (something)
entry AH 80h
DX 4456h ('DV')
ES:DI pointer to FAR subroutine to be called on?
return DS segment of DESQview data structure for video buffer
note 1) This function is probably meant for internal use only, due to the magic
value required in DX
2) The subroutine seems to be called when the DESQview menu is accessed
on entry, AL = 03h or 04h
Function 81h DESQview video - Get something?
entry AH 81h
DX 4456h ('DV')
return ES segment of DESQview data structure for video buffer
byte ES:[0] = current window number
note This function is probably meant for internal use only, due to the
magic value required in DX
Function 82h DESQview - Get Current Window Info
entry AH 82h
DX 4456h ('DV')
return AH unknown
AL current window number
BH unknown
BL direct screen writes
0 program does not do direct writes
1 program does direct writes, so shadow buffer not usable
CH unknown
CL current video mode
DS segment in DESQview for data structure
in DV 2.00,
byte DS:[0] = window number
word DS:[1] = segment of other data structure
word DS:[3] = segment of window's object handle
ES segment of DESQview data structure for video buffer
note This function is probably meant for internal use only, due to the magic
value required in DX
Function 0F0h Microsoft Mouse driver EGA support - Read One Register
entry AX 0F0h
BL register number
DX group index
(pointer/data chips)
00h CRT Controller (25 reg) 3B4h mono, 3D4h color
08h sequencer (5 registers) 3C4h
10h graphics controller (9 registers) 3CEh
18h attribute controller (20 registers) 3C0h
(single registers)
20h miscellaneous output register 3C2h
28h feature control register (3BAh mono, 3DAh color
30h graphics 1 position register 3CCh
38h graphics 2 position register 3CAh
return BL data
Function 0F1h Microsoft Mouse driver EGA support - Write One Register
entry AX 0F1h
DX group index (see function F0h)
BL register number
BH value to write
return BL data
Function 0F2h Microsoft Mouse driver EGA support - Read Register Range
entry AX 0F2h
CH starting register number
CL number of registers (>1)
DX group index
00h CRTC (3B4h mono modes, 3D4h color modes)
08h sequencer 3C4h
10h graphics controller 3CEh
18h attribute controller 3C0h
ES:BX pointer to buffer, CL bytes
Function 0F3h Microsoft Mouse driver EGA support - Write Register Range
entry AX 0F3h
CH starting register
CL number of registers (>1)
DX group index
00h CRTC (3B4h mono modes, 3D4h color modes)
08h sequencer 3C4h
10h graphics controller 3CEh
18h attribute controller 3C0h
ES:BX pointer to buffer, CL bytes
Function 0F4h Microsoft Mouse driver EGA support - Read Register Set
entry AX 0F4h
CX number of registers (>1)
ES:BX pointer to table of records in this format:
bytes 1-2 group index
(pointer/data chips)
00h CRTC (3B4h mono modes, 3D4h color modes)
08h sequencer 3C4h
10h graphics controller 3CEh
18h attribute controller 3C0h
(single registers)
20h miscellaneous output register 3C2h
28h feature control register (3BAh mono modes, 3DAh color)
30h graphics 1 position register 3CCh
38h graphics 2 position register 3CAh
byte 3 register number (0 for single registers)
byte 4 register value
Function 0F5h Microsoft Mouse driver EGA support - Read Register Set
entry AX 0F5h
CX number of registers (>1)
ES:BX pointer to table of records in this format:
bytes 1-2 group index
(pointer/data chips)
00h CRTC (3B4h mono modes, 3D4h color modes)
08h sequencer 3C4h
10h graphics controller 3CEh
18h attribute controller 3C0h
(single registers)
20h miscellaneous output register 3C2h
28h feature control register (3BAh mono modes, 3DAh color)
30h graphics 1 position register 3CCh
38h graphics 2 position register 3CAh
byte 3 register number (0 for single registers)
byte 4 register value
Function 0F6h Microsoft Mouse driver EGA support
Revert to Default Registers
entry AX 0F6h
return unknown
Function 0F7h Microsoft Mouse driver EGA support
Define Default Register Table
entry AX 0F7h
DX port number
ES:BX address of table of one byte entries, one byte to be written to
each register
(pointer/data chips)
00h CRTC (3B4h mono modes, 3D4h color modes)
08h sequencer 3C4h
10h graphics controller 3CEh
18h attribute controller 3C0h
(single registers)
20h miscellaneous output register 3C2h
28h feature control register (3BAh mono, 3DAh color)
30h graphics 1 position register 3CCh
38h graphics 2 position register 3CAh
Function 0FAh Microsoft Mouse driver EGA support - Interrogate Driver
entry AX 0FAh
BX 00h
return BX 00h if mouse driver not present
ES:BX pointer to EGA Register Interface version number, if present:
byte 1 major release number
byte 2 minor release number
Function 0FEh Get Alternate Screen Buffer Address (text mode only)
(Topview/DesQview/Taskview)
entry AH 0FEh
ES:DI segment:offset of assumed video buffer
return: ES:DI segment:offset of actual video buffer
note 1) This alternate video buffer can be written to directly, in the same
manner as writing to B:000 or B:800. The MT program will manage the
actual display.
2) There is no need to synchronize vertical retrace when writing to the
alternate buffer; this is managed by the MT program
3) If TopView or DESQview is not running, ES:DI is returned unchanged.
4) TopView requires that function 0FFh be called every time you write into
the buffer to tell TopView that something changed
Function 0FFh Update Real Display (text mode only) (TopView)
Update Video Buffer (Topview/DesQview/Taskview)
entry AH 0FFh
CX number of sequential characters that have been modified
DI offset of first character that has been modified
ES segment of video buffer
return unknown
note 1) DesQview supports this call, but does not require it
2) Avoid CX=0
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 11h Equipment Check ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:0044h) fetch a code describing active peripherals.
entry AH 11h
return AX Equipment listing word Bits are:
0 number of floppy drives
0 no drives
1 bootable (IPL) diskette drive installed
1 math chip
0 no math coprocessor (80x87) present
1 math coprocessor (80x87) present
(PS/2) 2 0 mouse not installed
1 mouse installed
(PC) 2,3 system board RAM
0,0 16k (PC-0, PC-1)
1,1 64k (PC-2, XT)
note 1) not commonly used. Set both bits to 1
2) both bits always 1 in AT
4,5 initial video mode
0,0 no video installed (use with dumb terminal)
0,1 40x25 color (CGA)
1,0 80x25 color (CGA, EGA, PGA, MCGA, VGA)
1,1 80x25 monochrome (MDA or Hercules, most super-
hires mono systems)
6,7 number of diskette drives (only if bit 0 1)
0,0 1 drives
0,1 2 drives
1,0 3 drives
1,1 4 drives
8 0 DMA present
1 no DMA (PCjr, some Tandy 1000s, 1400LT)
9,A,B number of RS232 serial ports (0-3)
0,0,0 none
0,0,1 1
0,1,0 2
0,1,1 3
1,0,0 4
C 0 no game I/O attached
1 game I/O attached (default for PCjr)
D serial accessory installation
0 no serial accessories installed
1 Convertible - internal modem installed
1 PCjr - serial printer attached
E,F number of parallel printers
0,0 none
0,1 one (LPT1, PRN)
1,0 two (LPT2)
1,1 three (LPT3)
note Models before PS/2 would allow a fourth
parallel printer. Remapping of the BIOS in the
PS/2s does not allow the use of LPT4.
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 12h Memory Size ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:0048h) get system memory
return AX number of contiguous 1K RAM blocks
note 1) This service does not depend on the setting of the motherboard switches
2) This is the same value stored in absolute address 04:13h
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 13h Disk I/O - access the disk drives (floppy and hard disk) ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:004Ch) does not try rereading disk if an error is returned
Function 00h Reset - reset the disk controller chip
entry AH 00h
DL drive (if bit 7 is set both hard disks and floppy disks reset)
return AH status
note 1) Forces controller chip to recalibrate read/write heads
2) Some systems (Sanyo 55x) this resets all drives
Function 01h Get Status of disk system
entry AH 01h
DL drive (hard disk if bit 7 set)
return AL status of most recent operation
00h successful completion
01h bad command
02h address mark not found
03h tried to write on write-protected disk
04h sector not found
05h reset failed (hard disk)
06h diskette removed or changed
07h bad parameter table (hard disk)
08h DMA overrun
09h attempt to DMA across 64K boundary
0Ah bad sector detected (hard disk)
0Bh bad track detected (hard disk)
0Ch unsupported track
0Dh invalid number of sectors on format (hard disk)
0Eh control data address mark detected (hard disk)
0Fh DMA arbitration error (hard disk)
10h bad CRC/EEC on read
11h data ECC corrected
20h controller failure
40h seek failed
80h timeout
0AAh drive not ready (hard disk)
0BBh undefined error (hard disk)
0CCh write fault (hard disk)
0E0h status error (hard disk)
0FFh sense operation failed (hard disk)
Function 02h Read Sectors - read one or more sectors from diskette
entry AH 02h
AL number of sectors to read
BX address of buffer (ES=segment)
CH track number (0-39 or 0-79 for floppies)
(for hard disk, bits 8,9 in high bits of CL)
CL sector number (1 to 18, not value checked)
DH head number (0 or 1)
DL drive (0=A, 1=B, etc.) (bit 7=0) (drive 0-7)
ES:BX address to store/fetch data (buffer to fill)
[0000:0078] dword pointer to diskette parms
return CF clear (0) for successful
set (1) failure
AH status (00h, 02h, 03h, 04h, 08h, 09h, 10h, 0Ah, 20h,
40h, 80h)
AL number of sectors transferred
note 1) Number of sectors begins with 1, not 0
2) Trying to read zero sectors is considered a programming error; results
are not defined
Function 03h Write Sectors - write from memory to disk
entry AH 03h
AL number of sectors to write (1-8)
CH track number (for hard disk, bits 8,9 in high bits of CL)
CL beginning sector number
(if hard disk, high two bits are high bits of track #)
DH head number
DL drive number (0-7)
ES:BX address of buffer for data
return CF set if error
AH status (see above)
AL number of sectors written
note 1) Number of sectors begins with 1, not 0
2) Trying to write zero sectors is considered a programming error; results
are not defined
Function 04h Verify - verify that a write operation was successful
entry AH 04h
AL number of sectors to verify (1-8)
CH track number (for hard disk, bits 8,9 in high bits of CL)
CL beginning sector number
DH head number
DL drive number (0-7)
return CF set on error
AH status (see above)
AL number of sectors verified
Function 05h Format Track - write sector ID bytes for 1 track
entry AH 05h
AL number of sectors to create on this track
CH track (or cylinder) number
CL sector number
DH head number (0, 1)
DL drive number (0-3)
ES:BX pointer to 4-byte address field (C-H-R-N)
byte 1 = (C) cylinder or track
byte 2 = (H) head
byte 3 = (R) sector
byte 4 = (N) bytes/sector (0 = 128, 1 = 256, 2 = 512, 3 = 1024)
return CF set if error occurred
AH status code (see above)
note Not valid for ESDI hard disks on PS/2
Function 06h Hard Disk - format track and set bad sector flags
(PC2, PC-XT, and Portable)
entry AH 06h
AL interleave value (XT only)
CH cylinder number (bits 8,9 in high bits of CL)
CL sector number
DH head
DL drive
ES:BX 512 byte format buffer
the first 2*(sectors/track) bytes contain f,n for each sector
f 00Fh for good sector
80h for bad sector
n sector number
return AH status code
Function 07h Hard Disk - format the drive starting at the desired track
(PC2, PC-XT and Portable)
entry AH 07h
AL interleave value (XT only) (01h-10h)
CH cylinder number (bits 8,9 in high bits of CL) (00h-03FFh)
CL sector number
DH head number (0-7)
DL drive number (80h-87h, 80h=C, 81h=D,...)
ES:BX format buffer, size = 512 bytes
the first 2*(sectors/track) bytes contain f,n for each sector
f=00h for good sector
80h for bad sector
n=sector number
return AH status code (see above)
note Award AT BIOS routines are extended to handle more than 1024 cylinders.
AL number of sectors
CH cylinder numberm low 8 bits
CL sector number bits 0-5, bits 6-7 are high 2 cylinder bits
DH head number (bits 0-5) bits 6-7 are extended high cyls (>1024)
DL drive number (0-1 for diskette, 80h-81h for hard disk)
ES:BX transfer address
Function 08h Read Drive Parameters (XT, CONV, AT, XT/286, PS/2)
entry AH 08h
DL drive number (0-2)
return CF set on error
AH status code (see above)
BL drive type (see AH=17h below) (AT/PS2 floppies only)
CH maximum useable value for cylinder number
CL maximum useable value for sector number or cylinder number
DH maximum usable value for head number
DL number of consecutive acknowledging drives (0-2)
ES:DI drive parameter table
Function 09h Initialize Two Fixed Disk Base Tables (XT, AT, XT/286, PS/2)
(install nonstandard drive)
entry AH 09h
return CF set on error
AH status code (see above)
data block definitions:
+0 maximum number of cylinders (dw)
+2 maximum number of heads (db)
+3 starting reduced write current cylinder (dw - XT only)
+5 starting write precomp cylinder (dw)
+7 maximum ECC data burst length (db - XT only)
+8 control byte: Bits
0,1,2 Ä drive option
3,4,5 - always zero
6 - disable ECC retries
7 - disable access retries
note 1) Int 41h points to table for drive 0
2) Int 46h points to table for drive 1
3) 41h used by XT, 41h and 46h used by AT
Function 0Ah Read Long (Hard disk) (XT, AT, XT/286, PS/2)
entry AH 0Ah
CH cylinder number (bits 8,9 in high bits of CL)
CL sector number
DL drive ID
DH head number
ES:BX pointer to buffer to fill
return CF set on error
AH status code (see above)
AL number of sectors actually transferred
note 1) A "long" sector includes a 4 byte EEC (Extended Error Correction) code
2) Used for diagnostics only on PS/2 systems
Function 0Bh Write Long (XT, AT, XT/286, PS/2)
entry AH 0Bh
CH cylinder (bits 8,9 in high bits of CL)
CL sector number
DH head number
DL drive ID
ES:BX pointer to buffer containing data
return CF set on error
AH status code (see above)
AL number of sectors actually transferred
note 1) A "long" sector includes a 4 byte EEC (Extended Error Correction) code
2) Used for diagnostics only on PS/2 systems
Function 0Ch Seek To Cylinder (except PC, PCjr)
entry AH 0Ch
CH cylinder number (bits 8,9 in high bits of CL)
DH head number
DL drive ID
return CF set on error
AH status code (see above)
note 1) Positions heads over a particular cylinder
Function 0Dh Alternate Disk Reset (except PC, PCjr)
entry AH 0Dh
DL drive ID
return CF set on error
AH status code (see above)
note Not for PS/2 ESDI hard disks
Function 0Eh Read Sector Buffer (XT, Portable PS/2)
entry AH 0Eh
AL number of sectors
CH cylinder (bits 8,9 in top two bits of CL)
CL sector number
DH head number
DL drive number
ES:BX pointer to buffer
return CF set on error
AH status code (see above)
AL number of sectors actually transferred
note 1) Transfers controller's sector buffer. No data is read from the drive
2) Used for diagnostics only on PS/2 systems
Function 0Fh Write sector buffer (XT, Portable)
entry AH 0Fh
AL number of sectors
CH cylinder (bits 8,9 in top two bits of CL)
CL sector number
DH head number
DL drive number
ES:BX pointer to buffer
return CF set if error
AH status code
AL number of sectors actually transferred
note 1) Should be called before formatting to initialize the controller's
sector buffer.
2) Used for diagnostics only on PS/2 systems
Function 10h Test For Drive Ready
entry AH 10h
DL drive ID
return CF set on error
AH status code (see above)
Function 11h Recalibrate Drive
entry AH 11h
DL drive ID
return CF set on error
AH status code (see above)
Function 12h Controller RAM Diagnostic (XT, Portable, PS/2)
entry AH 12h
return CF set on error
AH status code (see AH=1 above)
note Used for diagnostics only on PS/2 systems
Function 13h Drive Diagnostic (XT, Portable)
entry AH 13h
return CF set on error
AH status code (see above)
note Used for diagnostics only on PS/2 systems
Function 14h Controller Internal Diagnostic (AT, XT/286)
entry AH 14h
return CF set on error
AH status code (see above)
note 1) OEM is Western Digital 1003-WA2 hard/floppy combination controller
in AT and XT/286.
2) Used for diagnostics only in PS/2 systems
Function 15h Get Disk Type (except PC and XT)
entry AH 15h
DL drive ID
return AH disk type
00h no drive is present
01h diskette, no change detection present
02h diskette, change detection present
03h fixed disk
CX:DX number of 512-byte sectors when AH = 03h
Function 16h Change of Disk Status (diskette) (except PC and XT)
entry AH 16h
return AH disk change status
00h no disk change
01h disk changed
DL drive that had disk change
Function 17h Set Disk Type for Format (diskette) (except PC and XT)
entry AH 17h
AL 00h no disk
01h 360kb diskette in 360Kb drive
02h 360kb diskette in 1.2M drive
03h 1.2M diskette in 1.2M drive
04h 720kb diskette in 720Kb drive
DL drive number
return AH status of operation
note This function is probably enhanced for the PS/2 series to detect
1.44 in 1.44 and 720k in 1.44.
Function 18h Set Media Type For Format (diskette) (AT, XT/286, PS/2)
entry AH 18h
CH lower 8 bits of number of tracks
CL high 2 bits of number of tracks (6,7) sectors per track
(bits 0-5)
DL drive number
return AH 00h if requested combination supported
01h if function not available
0Ch if not suppported or drive type unknown
80h if there is no media in the drive
ES:DI pointer to 11-byte parameter table
Function 19h Park Hard Disk Heads (XT/286, PS/2)
entry AH 19h
DL drive
return CF set on error
AH error code
Function 1Ah ESDI Hard Disk - Format (PS/2)
entry AH 1Ah
AL defect table count
CL format modifiers
bits 0 ignore primary defect map
1 ignore secondary defect map
2 update secondary defect map
3 perform surface analysis
4 generate periodic interrupt
DL drive
ES:BX pointer to defect table
return CF set on error
AH status (see AH=1 above)
note If periodic interrupt selected, int 15h/AH=0Fh is called after each
cylinder is formatted
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 14h Initialize and Access Serial Port For Int 14 ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:0050h) the following status is defined:
serial status byte:
bits 0 delta clear to send
1 delta data set ready
2 trailing edge ring detector
3 delta receive line signal detect
4 clear to send
5 data set ready
6 ring indicator
7 receive line signal detect
line status byte:
bits 0 data ready
1 overrun error
2 parity error
3 framing error
4 break detect
5 transmit holding register empty
6 transmit shift register empty
7 time out note: if bit 7 set then other bits are invalid
All routines have AH=function number and DX=RS232 card number (0 based).
AL=character to send or received character on exit, unless otherwise noted.
entry AH 00h Initialize And Access Serial Communications Port
bit pattern: BBBPPSLL
BBB = baud rate: 110,150,300,600,1200,2400,4800,9600
PP = parity: 01 = odd, 11 = even
S = stop bits: 0 = 1, 1 = 2
LL = word length: 10 = 7-bits, 11 = 8-bits
AL parms for initialization:
bit pattern:
0 word length
1 word length
2 stop bits
3 parity
4 parity
5 baud rate
6 baud rate
7 baud rate
word length 10 7 bits
11 8 bits
stop bits 0 1 stop bit
1 2 stop bits
parity 00 none
01 odd
11 even
baud rate 000 110 baud
001 150 baud
010 300 baud
011 600 baud
100 1200 baud
101 2400 baud
110 4800 baud
111 9600 baud (4800 on PCjr)
DX port number
return AH line status
AL modem status
Function 01h Send Character in AL to Comm Port DX (0 or 1)
entry AH 01h
AL character
DX port number (0 or 1)
return AH RS232 status code
bit 0 data ready
1 overrun error
2 parity error
3 framing error
4 break detected
5 transmission buffer register empty
6 transmission shift register empty
7 timeout
AL modem status
bit
0 delta clear-to-send
1 delta data-set-ready
2 trailing edge ring detected
3 change, receive line signal detected
4 clear-to-send
5 data-set-ready
6 ring received
7 receive line signal detected
Function 02h Wait For A Character From Comm Port DX
entry AH 02h
return AL character received
AH error code (see above)(00h for no error)
Function 03h Fetch the Status of Comm Port DX (0 or 1)
entry AH 03h
return AH set bits (01h) indicate comm-line status
bit 7 timeout
bit 6 empty transmit shift register
bit 5 empty transmit holding register
bit 4 break detected ("long-space")
bit 3 framing error
bit 2 parity error
bit 1 overrun error
bit 0 data ready
AL set bits indicate modem status
bit 7 received line signal detect
bit 6 ring indicator
bit 5 data set ready
bit 4 clear to send
bit 3 delta receive line signal detect
bit 2 trailing edge ring detector
bit 1 delta data set ready
bit 0 delta clear to send
Function 04h Extended Initialize (PC Convertible)
entry AH 04h
AL break status
01h if break
00h if no break
BH parity
00h no parity
01h odd parity
02h even parity
03h stick parity odd
04h stick parity even
BL number of stop bits
00h one stop bit
01h 2 stop bits (1« if 5 bit word length)
CH word length
00h 5 bits
01h 6 bits
02h 7 bits
03h 8 bits
CL baud rate
00h 110
01h 150
02h 300
03h 600
04h 1200
05h 2400
06h 4800
07h 9600
08h 19200
return AL modem status
AH line control status
Function 05h Extended Communication Port Control (PS/2)
entry AH 05h
AL 00h read modem control register
return BL modem control reg (see AL=1)
AL 01h write modem control register
BL modem control register: (for AL=00 and AL=01) bits
0 data terminal ready
1 request to send
2 out1
3 out2
4 loop
5,6,7 reserved
return AH status
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 15h Cassette I/O ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:0054h) Renamed "System Services" on PS/2 line
Function 00h Turn Cassette Motor On (PC, PCjr only)
entry AH 00h
return AH 86h no cassette present
CF set on error
AH error code
00h no errors
01h CRC error
02h bad tape signals
no data transitions (PCjr)
03h no data found on tape
not used (PCjr)
04h no data
no leader (PCjr)
80h invalid command
86h no cassette present
not valid in PCjr
note NOP for systems where cassette not supported
Function 01h Turn Cassette Motor Off (PC, PCjr only)
entry AH 01h
return AH 86h no cassette present
CF set on error
AH error code
note NOP for systems where cassette not supported
Function 02h Read Blocks From Cassette (PC, PCjr only)
entry AH 02h
CX count of bytes to read
ES:BX pointer to data buffer
return CF set on error
AH error code
DX count of bytes actually read
ES:BX pointer past last byte written
note 1) NOP for systems where cassette not supported
2) Cassette operations normally read 256 byte blocks
Function 03h Write Data Blocks to Cassette (PC, PCjr only)
entry AH 03h
CX count of bytes to write
ES:BX pointer to data buffer
return CF set on error
AH error code (see 02h)
CX 0
ES:BX pointer to last byte written+1
note 1) NOP for systems where cassette not supported
2) The last block is padded to 256 bytes with zeroes if needed
3) No errors are returned by this service
Function 0Fh ESDI Format Unit Periodic Interrupt (PS/2 50, 60, 80)
entry AH 0Fh
AL phase code
00h reserved
01h surface analysis
02h formatting
return CF clear if formatting should continue
set if it should terminate
note Called during ESDI drive formatting after each cylinder is completed
Function 10h TopView API Function Calls (TopView)
entry AH 00h PAUSE Give Up CPU Time
return 00h after other processes run
01h GETMEM allocate "system" memory
BX number of bytes to allocate
return ES:DI pointer to block of memory
02h PUTMEM deallocate "system" memory
ES:DI pointer to previously allocated block
return block freed
03h PRINTC display character/attribute on screen
BH attribute
BL character
DX segment of object handle for window
note BX=0 does not display anything, it only
positions the hardware cursor
10h unknown
AL 04h thru 12h
return TopView - unimplemented in DV 2.0x
pops up "Programming error" window in DV 2.0x
11h unknown
12h unknown
13h GETBIT define a 2nd-level interrupt handler
ES:DI pointer to FAR service routine
return BX bit mask indicating which bit was
allocated
0 if no more bits available
14h FREEBIT undefine a 2nd-level interrupt handler
BX bit mask from int 15/AH 13h
15h SETBIT schedule one or more 2nd-level interrupts
BX bit mask for interrupts to post
return indicated routines will be called at next ???
16h ISOBJ verify object handle
ES:DI possible object handle
return BX -1 if ES:DI is a valid object handle
0 if ES:DI is not
17h TopView - unimplemented in DV 2.00
return pops up "Programming Error" window in DV 2.00
18h LOCATE Find Window at a Given Screen Location
BH column
BL row
ES segment of object handle for ?
(0 = use default)
return ES segment of object handle for window
which is visible at the indicated
position
19h SOUND Make Tone
BX frequency in Hertz
CX duration in clock ticks (18.2 ticks/sec)
return immediately, tone continues to completion
note If another tone is already playing, the new tone
does not start until completion of the previous
one. In DV 2.00, it is possible to enqueue
about 32 tones before the process is blocked
until a note completes.
In DV 2.00, the lowest tone allowed is 20 Hz
1Ah OSTACK Switch to Task's Internal Stack
return stack switched
1Bh BEGINC Begin Critical Region
return task-switching temporarily disabled
note Will not task-switch until END CRITICAL REGION
(AH=1Ch) is called
1Ch ENDC End Critical Region
return task-switching enabled
1Dh STOP STOP TASK
ES segment of object handle for task to be stopped
(= handle of main window for that task)
return indicated task will no longer get CPU time
note At least in DV 2.00, this function is ignored
unless the indicated task is the current task.
1Eh START Start Task
ES segment of object handle for task to be started
(== handle of main window for that task)
return Indicated task is started up again
1Fh DISPEROR Pop-Up Error Window
BX bit fields:
0-12 number of characters to display
13,14 which mouse button may be pressed to
remove window
00 either
01 left
10 right
11 either
15 beep if 1
DS:DI pointer to text of message
CH width of error window (0 = default)
CL height of error window (0 = default)
DX segment of object handle
return BX status:
1 left button pressed
2 right button pressed
27 ESC key pressed
note Window remains on-screen until ESC or indicated
mouse button is pressed
20h TopView - unimplemented in DV 2.0x
return pops up "Programming Error" window in DV 2.0x
21h PGMINT Interrupt Another Task
BX segment of object handle for task to interrupt
DX:CX address of FAR routine to jump to next time
task is run
return nothing?
note The current ES, DS, SI, DI, and BP are passed
to the FAR routine
22h GETVER Get Version
BX 00h
return BX nonzero, TopView or compatible loaded
BH minor version
BL major version
notes TaskView returns BX = 0001h
DESQview 2.0 returns BX = 0A01h
23h POSWIN Position Window
BX segment of object handle for parent window
within which to position the window (0 = full
screen)
CH # columns to offset from position in DL
CL # rows to offset from position in DL
DL bit flags
0,1 horizontal position
00 current
01 center
10 left
11 right
2,3 vertical position
00 current
01 center
10 top
11 bottom
4 don't redraw screen if set
5-7 not used
ES segment of object handle for window to be
positioned
return nothing
24h GETBUF Get Virtual Screen Information
BX segment of object handle for window (0=default)
return CX size of virtual screen in bytes
DL 0 or 1, unknown
ES:DI address of virtual screen
25h USTACK Switch Back to User's Stack
return stack switched back
note Call only after int 15h,fn1Ah
26h-2Ah DesQview (TopView?) - unimplemented in DV 2.0x
return pops up "Programming Error" window in DV 2.0x
2Bh POSTTASK Awaken Task DesQview 2.0 (TopView?)
BX segment of object handle for task
return nothing
2Ch Start New Application in New Process
DesQview 2.0 (TopView?)
ES:DI pointer to contents of .PIF/.DVP file
BX size of .PIF/.DVP info
return BX segment of object handle for new task
2Dh Keyboard Mouse Control DesQview 2.0
BL subfunction
00h determine whether using keyboard mouse
01h turn keyboard mouse on
02h turn keyboard mouse off
return (calling BL was 00h)
BL 0 using real mouse
1 using keyboard mouse
Function 11h Topview commands
entry AH 11h
AL various
note In DesQview 2.0x, these function calls are identical to AH=0DEh, so
see those below
Function 20h PRINT.COM (DOS internal) (AT, XT-286, PS/2 50+)
entry AH 20h
AL subfunction
00h unknown (PRINT)
01h unknown (PRINT)
10h sets up SysReq routine on AT, XT/286, PS/2
11h completion of SysReq routine (software only)
note 1) AL=0 or 1 sets or resets some flags which affect what PRINT does when
it tries to access the disk
Function 21h Power-On Self Test (POST) Error Log (PS/2 50+)
entry AH 21h
AL 00h read POST log
01h write POST log
BH device ID
BL error code
return CF set on error
AH status
00h OK
BX number of error codes stored
ES:DI pointer to error log
01h list full
80h invalid command
86h unsupported
note The log is a series of words, the first byte of which identifies the
error code and the second the device.
Function 40h Read/Modify Profiles (Convertible)
entry AH 40h
AL 00h read system profile in CX,BX
01h write system profile from CX, BX
02h read internal modem profile in BX
03h write internal modem profile from BX
BX profile info
return BX internal modem profile (from 02h)
CX,BX system profile (from 00h)
Function 41h Wait On External Event (Convertible)
entry AH 41h
AL condition type
bits 0-2: condition to wait for
0 any external event
1 compare and return if equal
2 compare and return if not equal
3 test and return if not zero
4 test and return if zero
bit 3: reserved
bit 4: 1=port address, 0=user byte
bits 5-7: reserved
BH condition compare or mask value
condition codes:
0 any external event
1 compare and return if equal
2 compare and return if not equal
3 test and return if not zero
4 test and return if zero
BL timeout value times 55 milliseconds
0 if no time limit
DX I/O port address (if AL bit 4 = 1)
ES:DI pointer to user byte (if AL bit 4 = 0)
Function 42h Request System Power Off (Convertible)
entry AH 42h
AL 00h to use system profile
01h to force suspend regardless of profile
Function 43h Read System Status (Convertible)
entry AH 43h
return AL status bits:
0 LCD detached
1 reserved
2 RS232/parallel powered on
3 internal modem powered on
4 power activated by alarm
5 standby power lost
6 external power in use
7 battery low
Function 44h (De)activate Internal Modem Power (Convertible)
entry AH 44h
AL 00h to power off
01h to power on
Function 4Fh Keyboard Intercept (except PC, PCjr, and XT)
entry AH 4Fh
AL scan code, CF set
return AL scan code, CF set if processing desired
note Called by int 9 handler to translate scan codes
Function 80h Device Open (AT, XT/286, PS/2)
entry AH 80h
BX device ID
CX process ID
return CF set on error
AH status
Function 81h Device Close (AT, XT/286, PS/2)
entry AH 81h
BX device ID
CX process ID
return CF set on error
AH status
Function 82h Program Termination (AT, XT/286, PS/2)
AH 82h
BX device ID
return: CF set on error
AH status
note Closes all devices opened with function 80h
Function 83h Event Wait (AT, XT/286, Convertible, PS/2)
entry AH 83h
AL 00h to set interval
10h to cancel
CX,DX number of microseconds to wait (granularity is 976 microseconds)
ES:BX pointer to memory flag (bit 7 is set when interval expires)
(pointer is to caller's memory)
return CF set (1) if function already busy
Function 84h Read Joystick Input Settings (AT, XT/286, PS/2)
entry AH 84h
DX 00h to read the current switch settings (return in AL)
01h to read the resistive inputs
return AX A(X) value
BX A(Y) value
CX B(X) value
DX B(Y) value
AL switch settings (bits 7-4)
Function 85h System Request (SysReq) Key Pressed (except PC, PCjr, XT)
entry AH 85h
return AL 00h key pressed
01h key released
note Called by keyboard decode routine
Function 86h Elapsed Time Wait (except PC, PCjr, XT)
AH 86h
CX,DX number of microseconds to wait
return CF clear after wait elapses
CF set immediately due to error
note Only accurate to 977 microseconds
Function 87h Extended Memory Block Move (286/386 machines only)
AH 87h
CX number of words to move
ES:SI pointer to Global Descriptor Table (GDT)
offset 00h null descriptor
08h uninitialized, will be made into GDT descriptor
10h descriptor for source of move
18h descriptor for destination of move
20h uninitialized, used by BIOS
28h uninitialized, will be made into SS descriptor
return CF set on error
AH status
00h source copied into destination
01h parity error
02h interrupt error
03h address line 20 gating failed
Function 88h Extended Memory Size Determine (AT, XT/286, PS/2)
entry AH 88h
return AX # of contiguous 1K blocks of memory starting at address 1024k
Function 89h Switch Processor to Protected Mode (AT, XT/286, PS/2)
entry AH 89h
BH interrupt number of IRQ 8 (IRQ 9Fh use next 7 interrupts)
BL interrupt number of IRQ 0 (IRQ 17h use next 7 interrupts)
CX offset into protected mode CS to jump to
DS:SI pointer to Global Descriptor Table for protected mode
offset 00h null descriptor
08h GDT descriptor
10h IDT descriptor
18h DS
20h ES
28h SS
30h CS
38h uninitialized, used to build descriptor for
BIOS CS
return AH 0FFh error enabling address line 20
CF set on error
Function 90h Device Busy Loop (except PC, PCjr, XT)
entry AH 90h
AL type code:
00h disk
01h diskette
02h keyboard
03h PS/2 pointing device
80h network (ES:BX = pointer to network control block)
0FCh hard disk reset (PS/2)
0FDh diskette motor start
0FEh printer
ES:BX pointer to request block for type codes 80h through 0BFh
return CF 1 (set) if wait time satisfied
0 (clear) if driver must perform wait
note Used by NETBIOS
Type codes are allocated as follows:
00h-7Fh non-reentrant devices; OS must arbitrate access
80h-BFh reentrant devices; ES:BX points to a unique control block
C0h-FFh wait-only calls, no complementary int 15, fn91h call
Function 91h Set Flag and Complete Interrupt (except PC, PCjr, XT)
entry AH 91h
AL type code (see AH=90h above)
ES:BX pointer to request block for type codes 80h through 0BFh
return AH 0
note Used by NETBIOS
Function 0C0h Get System Configuration (XT after 1/10/86, PC Convertible,
XT/286, AT, PS/2)
entry AH 0C0h
return CF 1 if BIOS doesn't support call
ES:BX pointer to ROM system descriptor table
dword number of bytes in the following table (norm. 16 bytes)
byte system ID byte; see Chapter 2 for interpretation
byte secondary ID distingushes between AT and XT/286, etc.
byte BIOS revision level, 0 for 1st release, 1 for 2nd, etc.
byte feature information
80h DMA channel 3 used by hard disk BIOS
40h 2nd 8259 installed
20h realtime clock installed
10h int 15h, fn 04h called upon int 09h
08h wait for external event supported (int 15fn41)
used on Convertible; reserved on PS/2 systems
04h extended BIOS area allocated at 640k
03h reserved
02h bus is Micro Channel instead of PC
01h reserved
00h reserved
byte unknown (set to 0) (reserved by IBM)
byte unknown (set to 0) (reserved by IBM)
byte unknown (set to 0)
byte unknown (set to 0) (Award copyright here)
note 1) Int 15h is also used for the Multitask Hook on PS/2 machines. No
register settings availible yet.
2) The 1/10/86 XT BIOS returns an incorrect value for the feature byte.
Function 0C1h System - Return Extended-BIOS Data-Area Segment Address (PS/2)
entry AH 0C1h
return CF set on error
ES segment of data area
Function 0C2h Pointing Device BIOS Interface (DesQview 2.x) (PS/2)
entry AH 0C2h
AL 00h enable/disable
BH 00h disable
01h reset
return BH device ID
02h set sampling rate
BH 00h 10/second
01h 20/second
02h 40/second
03h 60/second
04h 80/second
05h 100/second
06h 200/second
03h set resolution
BH 00h one count per mm
01h two counts per mm
02h four counts per mm
03h eight counts per mm
04h get type
return BH device ID
05h initialize
BH data package size (1 - 8 bytes)
06h get/set scaling factor
BH 00h return device status
return BL status byte
bit 0: right button pressed
bit 1: reserved
bit 2: left button pressed
bit 3: reserved
bit 4: 0=1:1 scaling, 1=2:1 scaling
bit 5: device enabled
bit 6: 0=stream mode, 1=remote mode
bit 7: reserved
CL resolution (see function 03h)
DL sample rate, reports per second
01h set scaling at 1:1
02h set scaling at 2:1
07h set device handler address
ES:BX user device handler
return AL 00h
return CF set on error
AH status
00h successful
01h invalid function
02h invalid input
03h interface error
04h need to resend
05h no device handler installed
note The values in BH for those functions that take it as input are stored
in different locations for each subfunction
Function 0C3h Enable/Disable Watchdog Timeout (PS/2 50+)
entry AH 0C3h
AL 00h disable
01h enable
BX timer counter
return CF set on error
note The watchdog timer generates an NMI
Function 0C4h Programmable Option Select (PS/2 50+)
entry AH 04Ch
AL 00h return base POS register address
01h enable slot
BL slot number
02h enable adapter
return CF set on error
DX base POS register address (if function 00h)
Function 0DEh DesQview Services (DesQview)
entry AH 0DEh
AL 00h Get Program Name
return AX offset into DESQVIEW.DVO of current
program's record:
byte length of name
n bytes name
2 bytes keys to invoke program (second
= 00h if only one key used)
word ? (I see 0 always)
byte end flag: 00h for all but last
entry, which is 0FFh
01h Update "Open Window" Menu
return none
note Reads DESQVIEW.DVO, disables Open menu if file
not in current directory
02h unimplemented in DV 2.0x
return nothing (NOP in DV 2.0x)
03h unimplemented in DV 2.0x
return nothing (NOP in DV 2.0x)
04h Get Available Common Memory
return BX bytes of common memory available
CX largest block available
DX total common memory in bytes
05h Get Available Conventional Memory
return BX K of memory available
CX largest block available
DX total conventional memory in K
06h Get Available Expanded Memory
return BX K of expanded memory available
CX largest block available
DX total expanded memory in K
07h APPNUM Get Current Program's Number
return AX number of program as it appears on the
"Switch Windows" menu
08h GET (unknown)
return AX 0 unknown
1 unknown
09h unimplemented in DV 2.00
return nothing (NOP in DV 2.00)
0Ah DBGPOKE Display Character on Status Line
BL character
return character displayed, next call will display in
next position (which wraps back to the start of
the line if off the right edge of screen)
note 1) Displays character on bottom line of *physical*
screen, regardless of current size of window
(even entirely hidden)
2) Does not know about graphics display modes,
just pokes the characters into display memory
0Bh APILEVEL Define Minimum API Level Required
BL API level
>2 pops up "You need a newer version" error
window in DV 2.00
BH unknown
return AX maximum API level?
0Ch GETMEM Allocate "System" Memory
BX number of bytes
return ES:DI pointer to allocated block
0Dh PUTMEM Deallocate "System" Memory
ES:DI pointer to previously allocated block
return nothing
0Eh Find Mailbox by Name (DV 2.0+)
ES:DI pointer to name to find
CX length of name
return BX 0 not found
1 found
DS:SI object handle
0Fh Enable DesQview Extensions (DV 2.0+)
return AX and BX destroyed (seems to be bug, weren't
saved & restored)
note 1) Sends a manager stream with opcodes AEh, BDh,
and BFh to task's window
2) Enables an additional mouse mode
10h PUSHKEY PUT KEY INTO KEYBOARD INPUT STREAM (DV 2.0+)
BH scan code
BL character
return BX unknown (sometimes, but not always,
same as BX passed in)
note A later read will get the keystroke as if it
had been typed by the user
11h ENABLE/DISABLE AUTO JUSTIFICATION OF WINDOW (DV 2.0+)
BL 0 viewport will not move automatically
nonzero viewport will move to keep cursor
visible
return none
12h unknown (DV 2.0+)
BX 0 clear something?
nonzero set something?
return none
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 16h Keyboard I/O ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:0058h) access the keyboard
Function 00h Get Keyboard Input - read the next character in keyboard buffer,
if no key ready, wait for one.
entry AH 00h
return AH scan code
AL ASCII character
Function 01h Check Keystroke Buffer - Do Not Clear
entry AH 01h
return ZF 0 (clear) if character in buffer
1 (set) if no character in buffer
AH scan code of character (if ZF=0)
AL ASCII character if applicable
note Keystroke is not removed from buffer
Function 02h Shift Status - fetch bit flags indicating shift status
entry AH 02h
return AL bit codes (same as [0040:0017])
bit 7 Insert state
bit 6 CapsLock state
bit 5 NumLock state
bit 4 ScrollLock state
bit 3 Alt key
bit 2 Control key
bit 1 Left shift (left caps-shift key)
bit 0 Right shift (right caps-shift key)
note other codes found at [0040:0018]
bit 7 Insert shift (Ins key)
bit 6 Caps shift (CapsLock key)
bit 5 Num shift (NumLock key)
bit 4 Scroll shift (ScrollLock key)
bit 3 Hold state (Ctrl-NumLock is in effect)
Function 03h Keyboard - Set Repeat Rate (PCjr, AT, XT/286, PS/2)
entry AH 03h
AL 00h reset typematic (PCjr)
01h increase initial delay (PCjr)
02h increase continuing delay (PCjr)
03h increase both delays (PCjr)
04h turn off typematic (PCjr)
05h set typematic rate (AT, PS/2)
BH 00h-03h for delays of 250ms, 500ms, 750ms, or 1second
0,0 250ms
0,1 500ms
1,0 750ms
1,1 1 second
BL 00h-1Fh for typematic rates of 30cps down to 2cps
00000 30 01011 10.9 10101 4.5
00001 26.7 01100 10 10110 4.3
00010 24 01101 9.2 10111 4
00011 21.8 01110 8.6 11000 3.7
00100 20 01111 8 11001 3.3
00101 18.5 10000 7.5 11010 3
00110 17.1 10001 6.7 11011 2.7
00111 16 10010 6 11100 2.5
01000 15 10011 5.5 11101 2.3
01001 13.3 10011 5.5 11110 2.1
01010 12 10100 5 11111 2
Function 04h Keyboard Click Toggle (PCjr and Convertible)
entry AH 04h
AL 00h for click off
01h for click on
Function 05h Keyboard Buffer Write (AT or PS/2 with enhanced kbd)
(XT/286, PS/2, AT with "Enhanced" keyboard)
entry AH 05h
CH scan code
CL ASCII character
return AL 01h if buffer full
Function 10h Get Enhanced Keystroke And Read (F11, F12 Enhanced Keyb'd)
(XT/286, PS/2, AT with "Enhanced" keyboard)
entry AH 10h
return AH scan code
AL ASCII character if applicable
Function 11h Check Enhanced Keystroke (F11-F12 on enhanced keyboard)
(XT/286, PS/2, AT with "Enhanced" keyboard)
entry AH 11h
return ZF 0 (clear) if key pressed
1 if buffer empty
AH scan code (when ZF=0)
AL ASCII character if applicable (when ZF=0)
note Keystroke is not removed from buffer
Function 12h Extended Get Shift Status (F11, F12 Enhanced keyboard)
entry AH 12h
return AL bit
0 right Shift key depressed
1 left Shift key depressed
2 Control key depressed
3 Alt key depressed
4 ScrollLock state active
5 NumLock state active
6 CapsLock state active
7 insert state is active
AH 0 left Control key pressed
1 left Alt key depressed
2 right Control key pressed
3 right Alt key depressed
4 Scroll Lock key depressed
5 NumLock key depressed
6 CapsLock key depressed
7 SysReq key depressed
Function F0h Set CPU speed (Compaq 386)
entry AH F0h set speed
return unknown
note used by Compaq DOS MODE command.
parameters not availible
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 17h Printer ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:005Ch) access the parallel printer(s)
AH is changed. All other registers left alone.
Function 00h Print Character/send AL to printer DX (0, 1, or 2)
entry AH 00h
AL character
DX printer to be used (0,1,2)
return AH status byte
bit
0 time out
1 unused
2 unused
3 I/O error
4 selected
5 out of paper
6 acknowledge
7 not busy
Function 01h Initialize Printer - set init line low, send 0Ch to printer DX
entry AH 01h
DX printer port to be initialized (0,1,2)
return status as below
Function 02h Printer Status - read status of printer DX into AH
entry AH 02h
DX printer port to be used (0,1,2)
return AH bit flags bit 7 0 = printer is busy
bit 6 ACKnowledge line state
bit 5 out-of-paper line state
bit 4 printer selected line state
bit 3 I/O error
bit 2 unused
bit 1 unused
bit 0 time-out error
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 18h ROM BASIC ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:0060h) Execute ROM BASIC at address 0F600h:0000h
note 1) Often reboots a compatible
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 19h Bootstrap Loader ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:0064h) Reads track 0, sector 1 into address 0000h:7C00h, then transfers
control to that address. If no diskette drive available,
transfers to ROM-BASIC or displays loader error message.
Causes reboot of disk system if invoked while running.
(no memory test performed).
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 1Ah Time of Day ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:0068h) access the PC internal clock
Function 00h Read System Time Counter
entry AH 00h
return CX high word of clock count
DX low word of clock count
AL 00h if clock was read or written (via AH=0,1) within the current
24-hour period. Otherwise, AL > 0
Function 01h Set Clock - set # of 55ms clock ticks in system time counter
entry AH 01h
CX:DX high word/low word count of timer ticks
return none
note 1) The clock ticks are incremented by timer interrupt at 18.2065 times
per second or 54.9254milliseconds/count. Therefore:
counts per second = 18 (12h)
counts per minute = 1092 (444h)
counts per hour = 65543 (10011h)
counts per day = 1573040 (1800B0h)
2) counter is zeroed when system is rebooted
Function 02h Read Real Time Clock Time (AT and after)
entry AH 02h
return CH hours in BCD
CL minutes in BCD
DH seconds in BCD
DL 1 (set) if daylight savings time option
CF 1 (set) if clock not operating
Function 03h Set Real Time Clock Time (AT and after)
entry AH 03h
CH hours in BCD
CL minutes in BCD
DH seconds in BCD
DL 0 (clear) if standard time
1 (set) if daylight savings time option
return none
Function 04h Read Real Time Clock Date (AT and after)
entry AH 04h
return CH century in BCD (19 or 20)
CL year in BCD
DH month in BCD
DL day in BCD
CF 1 (set) if clock not operating
Function 05h Set Real Time Clock Date (AT and after)
entry AH 05h
CH century in BCD (19 or 20)
CL year in BCD
DH month in BCD
DL day in BCD
return none
Function 06h Set Real Time Clock Alarm (AT and after)
entry AH 06h
CH hours in BCD
CL minutes in BCD
DH seconds in BCD
return CF set if alarm already set or clock inoperable
note Int 4Ah occurs at specified alarm time every 24hrs until reset
Function 07h Reset Real Time Clock Alarm (AT and after)
entry AH 07h
return none
Function 08h Set Real Time Clock Activated Power On Mode (Convertible)
entry AH 08h
CH hours in BCD
CL minutes in BCD
DH seconds in BCD
Function 09h Read Real Time Clock Alarm Time and Status
(Convertible and PS/2 Model 30)
entry AH 09h
return CH hours in BCD
CL minutes in BCD
DH seconds in BCD
DL alarm status:
00h if alarm not enabled
01h if alarm enabled but will not power up system
02h if alarm will power up system
Function 0Ah Read System-Timer Day Counter (XT-2 [640k motherboard], PS/2)
entry AH 0Ah
return CF set on error
CX count of days since Jan 1,1980
Function 0Bh Set System-Timer Day Counter (XT-2 [640k motherboard], PS/2)
entry AH 0Bh
CX count of days since Jan 1,1980
return CF set on error
Function 80h Set Up Sound Multiplexor (PCjr) (Tandy 1000?)
entry AH 80h
AL 00h source is 8253 channel 2
01h source is cassette input
02h source is I/O channel "audio in"
03h source is TI sound generator chip
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 1Bh Control-Break ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:006Ch) This interrupt is called when the keyboard scanner of the IBM
machines detects Ctrl and Break pressed at the same time.
note 1) If the break occurred while processing an interrupt, one or more
end of interrupt commands must be send to the 8259 Programmable
Interrupt Controller.
2) All I/O devices should be reset in case an operation was underway at
the time.
3) It is normally pointed to an IRET during system initialization so that
it does nothing, but some programs change it to return a ctrl-C scan
code and thus invoke int 23h.
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 1Ch Timer Tick ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:0070h)
note 1) Taken 18.2065 times per second
2) Normally vectors to dummy IRET unless PRINT.COM has been installed.
3) If an application moves the interrupt pointer, it is the responsibility
of that application to save and restore all registers that may be
modified.
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 1Dh Vector of Video Initialization Parameters ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:0074h) This doubleword address points to 3 sets of 16-bytes containing
data to initialize for video modes for video modes 0 & 1 (40
column), 2 & 3 (80 column), and 4, 5 & 6 (graphics) on the
Motorola 6845 CRT controller chip.
6845 registers:
R0 horizontal total (horizontal sync in characters)
R1 horizontal displayed (characters per line)
R2 horizontal sync position (move display left or right)
R3 sync width (vertical and horizontal pulse: 4-bits each)
R4 vertical total (total character lines)
R5 vertical adjust (adjust for 50 or 60 Hz refresh)
R6 vertical displayed (lines of chars displayed)
R7 vertical sync position (lines shifted up or down)
R8 interlace (bits 4 and 5) and skew (bits 6 and 7)
R9 max scan line addr (scan lines per character row)
R10 cursor start (starting scan line of cursor)
R11 cursor stop (ending scan line of cursor)
R12 video memory start address high byte (6-bits)
R13 video memory start address low byte (8-bits)
R14 cursor address high byte (6-bits)
R15 cursor address low byte (8-bits)
6845 Video Init Tables:
table for modes 0 and 1 \
table for modes 2 and 3 \ each table is 16 bytes long and
table for modes 4,5, and 6 / contains values for 6845 registers
table for mode 7 /
4 words: size of video RAM for modes 0/1, 2/3, 4/5, and 6/7
8 bytes: number of columns in each mode
8 bytes: video controller mode byte for each mode
note 1) There are 4 separate tables, and all 4 must be initialized if all
video modes will be used.
2) The power-on initialization code of the computer points this vector
to the ROM BIOS video routines.
3) IBM recommends that if this table needs to be modified, it should be
copied into RAM and only the nescessary changes made.
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 1Eh Vector of Diskette Controller Parameters ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:0078h) Dword address points to data base table that is used by BIOS.
Default location is at 0F000:0EFC7h. 11-byte table format:
bytes:
00h 4-bit step rate, 4-bit head unload time
01h 7-bit head load time, 1-bit DMA flag
02h 54.9254 ms counts - delay till motor off (37-38 typ)
03h sector size:
00h 128 bytes
01h 256 bytes
02h 512 bytes
03h 1024 bytes
04h last sector on track (8 or 9 typical)
05h gap between sectors on read/write (42 typical)
06h data length for DMA transfers (0FFh typical)
07h gap length between sectors for format (80 typical)
08h sector fill byte for format (0F6h typical)
09h head settle time (in milliseconds) (15 to 25 typical)
DOS 1.0 0
DOS 2.10 15
DOS 3.1 1
10h motor start time (in 1/8 second intervals) (2 to 4 typ.)
DOS 2.10 2
note 1) This vector is pointed to the ROM BIOS diskette tables on system
initialization
2) IBM recommends that if this table needs to be modified, it should be
copied into RAM and only the nescessary changes made.
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 1Fh Pointer to Graphics Character Extensions (Graphics Set 2) ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:007Ch) This is the pointer to data used by the ROM video routines to
display characters above ASCII 127 while in CGA medium and high
res graphics modes.
note 1) Doubleword address points to 1K table composed of 28 8-byte character
definition bit-patterns. First byte of each entry is top row, last byte
is bottom row.
2) The first 128 character patterns are located in system ROM.
3) This vector is set to 000:0 at system initialization
4) Used by DOS' external GRAFTABL command
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 20h Terminate Current Program ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:0080h)
Issue int 20h to exit from a program. This vector transfers to the logic in
DOS to restore the terminate address, the Ctrl-Break address,and the critical
error exit address to the values they had on entry to the program. All the file
buffers are flushed and all handles are closed. You should close all files
changed in length (see function calls 10h and 3Eh) before issuing this
interrupt. If the changed file is not closed, its length, time, and date are
not recorded correctly in the directory.
For a program to pass a completion code or an error code when terminating, it
must use either function call 4Ch (Terminate a Process) or 31h (Terminate
Process and Stay Resident). These two methods are preferred over using
int 20h and the codes returned by them can be interrogated in batch processing.
Important: Before you issue an interrupt 20h, your program must ensure that
the CS register contains the segment of its program segment prefix.
Interrupt 20h DOS - Terminate Program
entry no parameters
return The following vectors are restored from the Program Segment Prefix:
0Ah Program Terminate
0Eh Control-C
12h Critical Error
note IBM and Microsoft recommend using int 21 Fn 4Ch. Using int 20 is
officially frowned upon since the introduction of DOS 2.0
** Programmer's Technical Reference for MSDOS and the IBM PC **
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ Shareware Version, 06/17/91 ³
³ Please Register Your Copy ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
Copyright (c) 1987, 1991 Dave Williams
USA copyright TXG 392-616 ALL RIGHTS RESERVED
ISBN 1-878830-02-3 (disk-based text)
C H A P T E R F O U R
DOS INTERRUPTS AND FUNCTION CALLS
note: The registered version of this chapter is twice this size.
DOS REGISTERSÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
DOS uses the following registers, pointers, and flags when it executes
interrupts and function calls:
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³GENERAL REGISTERS ³ register ³ definition ³
³ ÃÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ ³ AX ³ accumulator (16 bit) ³
³ ³ AH ³ accumulator high-order byte (8 bit) ³
³ ³ AL ³ accumulator low order byte (8 bit) ³
³ ³ BX ³ base (16 bit) ³
³ ³ BH ³ base high-order byte (8 bit) ³
³ ³ BL ³ base low-order byte (8 bit) ³
³ ³ CX ³ count (16 bit) ³
³ ³ CH ³ count high order byte (8 bit) ³
³ ³ CL ³ count low order byte (8 bit) ³
³ ³ DX ³ data (16 bit) ³
³ ³ DH ³ date high order byte (8 bit) ³
³ ³ DL ³ data low order byte (8 bit) ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³SEGMENT REGISTERS ³ register ³ definition ³
³ ÃÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ ³ CS ³ code segment (16 bit) ³
³ ³ DS ³ data segment (16 bit) ³
³ ³ SS ³ stack segment (16 bit) ³
³ ³ ES ³ extra segment (16 bit) ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³INDEX REGISTERS ³ register ³ definition ³
³ ÃÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ ³ DI ³ destination index (16 bit) ³
³ ³ SI ³ stack index (16 bit) ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³SEGMENT REGISTERS ³ register ³ definition ³
³ ÃÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ ³ CS ³ code segment (16 bit) ³
³ ³ DS ³ data segment (16 bit) ³
³ ³ SS ³ stack segment (16 bit) ³
³ ³ ES ³ extra segment (16 bit) ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³INDEX REGISTERS ³ register ³ definition ³
³ ÃÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ ³ DI ³ destination index (16 bit) ³
³ ³ SI ³ stack index (16 bit) ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³POINTERS ³ register ³ definition ³
³ ÃÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ ³ SP ³ stack pointer (16 bit) ³
³ ³ BP ³ base pointer (16 bit) ³
³ ³ IP ³ instruction pointer (16 bit) ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³FLAGS AF, CF, DF, IF, OF, PF, SF, TF, ZF ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
These registers, pointers, and flags are "lowest common denominator" 8088-8086
CPU oriented. DOS makes no attempt to use any of the special or enhanced
instructions availible on the later CPUs which will execute 8088 code, such as
the 80186, 80286, 80386, or NEV V20, V30, V40, or V50.
When DOS takes control after a function call, it switches to an internal
stack. Registers which are not used to return information (other than AX) are
preserved. The calling program's stack must be large enough to accomodate the
interrupt system - at least 128 bytes in addition to other interrupts.
DOS actually maintains three stacks -
stack 1: 384 bytes (in DOS 3.1)
for functions 00h and for 0Dh and up, and for ints 25h and 26h.
stack 2: 384 bytes (in DOS 3.1)
for function calls 01h through 0Ch.
stack 3: 48 bytes (in DOS 3.1)
for functions 0Dh and above. This stack is the initial stack used by
the int 21h handler before it decides which of the other two to use.
It is also used by function 59h (get extended error), and 01h to 0Ch if
they are called during an int 24h (critical error) handler. Functions
33h (get/set break flag), 50h (set process ID), 51h (get process ID)
and 62h (get PSP address) do not use any DOS stack under DOS 3.x
(under 2.x, 50h and 51h use stack number 2).
IBM and Microsoft made a change back in DOS 3.0 or 3.1 to reduce the size of
DOS. They reduced the space allocated for scratch areas when interrupts are
being processed. The default seems to vary with the DOS version and the
machine, but 8 stack frames seems to ring a bell. That means that if you get
more than 8 interrupts at the same time, clock, disk, printer spooler,
keyboard, com port, etc., the system will crash. It seems to happen usually on
a network. STACKS=16,256 means allow 16 interrupts to interrupt each other and
allow 256 bytes for each for scratch area. Eight is marginal.
DOS 3.2 does some different stack switching than previous versions. The
interrupts which are switched are 02h, 08h, 09h, 0Ah, 0Bh, 0Ch, 0Dh, 0Eh, 70h,
72h, 73h, 74h, 75h, 76h, and 77h. DOS 3.2 has a special check in the
initialization code for a PCjr and don't enable stack switching on that machine.
INTERRUPTSÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Microsoft recommends that a program wishing to examine or set the contents of
any interrupt vector use the DOS function calls 35h and 25h provided for those
purposes and avoid referencing the interrupt vector locations directly.
DOS reserves interrupt numbers 20h to 3Fh for its own use. This means absolute
memory locations 80h to 0FFh are reserved by DOS. The defined interrupts are as
follows with all values in hexadecimal.
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Interrupt 21h Function Call Request ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
(0:0084h)
DOS provides a wide variety of function calls for character device I/O, file
management, memory management, date and time functions,execution of other
programs, and more. They are grouped as follows:
call description
00h program terminate
01h-0Ch character device I/O, CP/M compatibility format
0Dh-24h file management, CP/M compatibility format
25h-26h nondevice functions, CP/M compatibility format
27h-29h file management, CP/M compatibility format
2Ah-2Eh nondevice functions, CP/M compatibility format
2Fh-38h extended functions
39h-3Bh directory group
3Ch-46h extended file management
47h directory group
48h-4Bh extended memory management
54h-57h extended functions
5Eh-5Fh networking
60h-62h extended functions
63h-66h enhanced foreign language support
List of DOS services: * = undocumented
00h terminate program
01h get keyboard input
02h display character to STDIO
03h get character from STDAUX
04h output character to STDAUX
05h output character to STDPRN
06h direct console I/O - keyboard to screen
07h get char from std I/O without echo
08h get char from std I/O without echo, checks for ^C
09h display a string to STDOUT
0Ah buffered keyboard input
0Bh check STDIN status
0Ch clear keyboard buffer and invoke keyboard function
0Dh flush all disk buffers
0Eh select disk
0Fh open file with File Control Block
10h close file opened with File Control Block
11h search for first matching file entry
12h search for next matching file entry
13h delete file specified by File Control Block
14h sequential read from file specified by File Control Block
15h sequential write to file specified by File Control Block
16h find or create firectory entry for file
17h rename file specified by file control block
18h* unknown
19h return current disk drive
1Ah set disk transfer area (DTA)
1Bh get current disk drive FAT
1Ch get disk FAT for any drive
1Dh* unknown
1Eh* unknown
1Fh* read DOS disk block, default drive
20h* unknown
21h random read from file specified by FCB
22h random write to file specified by FCB
23h return number of records in file specified by FCB
24h set relative file record size field for file specified by FCB
25h set interrupt vector
26h create new Program Segment Prefix (PSP)
27h random file block read from file specified by FCB
28h random file block write to file specified by FCB
29h parse the command line for file name
2Ah get the system date
2Bh set the system date
2Ch get the system time
2Dh set the system time
2Eh set/clear disk write VERIFY
2Fh get the Disk Transfer Address (DTA)
30h get DOS version number
31h TSR, files opened remain open
32h* read DOS Disk Block
33h get or set Ctrl-Break
34h* INDOS Critical Section Flag
35h get segment and offset address for an interrupt
36h get free disk space
37h* get/set option marking character (SWITCHAR)
38h return country-dependent information
39h create subdirectory
3Ah remove subdirectory
3Bh change current directory
3Ch create and return file handle
3Dh open file and return file handle
3Eh close file referenced by file handle
3Fh read from file referenced by file handle
40h write to file referenced by file handle
41h delete file
42h move file pointer (move read-write pointer for file)
43h set/return file attributes
44h device IOCTL (I/O control) info
45h duplicate file handle
46h force a duplicate file handle
47h get current directory
48h allocate memory
49h release allocated memory
4Ah modify allocated memory
4Bh load or execute a program
4Ch terminate prog and return to DOS
4Dh get return code of subprocess created by 4Bh
4Eh find first matching file
4Fh find next matching file
50h* set new current Program Segment Prefix (PSP)
51h* puts current PSP into BX
52h* pointer to the DOS list of lists
53h* translates BPB (Bios Parameter Block, see below)
54h get disk verification status (VERIFY)
55h* create PSP: similar to function 26h
56h rename a file
57h get/set file date and time
58h get/set allocation strategy (DOS 3.x)
59h get extended error information
5Ah create a unique filename
5Bh create a DOS file
5Ch lock/unlock file contents
5Dh* network
5Eh* network printer
5Fh* network redirection
60h* parse pathname
61h* unknown
62h get program segment prefix (PSP)
63h* get lead byte table (DOS 2.25)
64h* unknown
65h get extended country information (DOS 3.3)
66h get/set global code page table (DOS 3.3)
67h set handle count (DOS 3.3)
68h commit file (DOS 3.3)
69h disk serial number (DOS 4.0)
6Ah unknown
6Bh unknown
6Ch extended open/create (DOS 4.0)
CALLING THE DOS SERVICESÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
The DOS services are invoked by placing the number of the desired function in
register AH, subfunction in AL, setting the other registers to any specific
requirements of the function, and invoking int 21h.
On return, the requested service will be performed if possible. Most codes
will return an error; some return more information. Details are contained in
the listings for the individual functions. Extended error return may be
obtained by calling function 59h (see 59h).
Register settings listed are the ones used by DOS. Some functions will return
with garbage values in unused registers. Do not test for values in unspecified
registers; your program may exhibit odd behavior.
DS:DX pointers are the data segment register (DS) indexed to the DH and DL
registers (DX). DX always contains the offset address, DS contains the segment
address.
The File Control Block services (FCB services) were part of DOS 1.0. Since
the release of DOS 2.0, Microsoft has recommended that these services not be
used. A set of considerably more enhanced services (handle services) were
introduced with DOS 2.0. The handle services provide support for wildcards and
subdirectories, and enhanced error detection via function 59h.
The data for the following calls was compiled from various Intel, Microsoft,
IBM, and other publications. There are many subtle differences between MSDOS
and PCDOS and between the individual versions. Differences between the
versions are noted as they occur.
There are various ways of calling the DOS functions. For all methods, the
function number is loaded into register AH, subfunctions and/or parameters are
loaded into AL or other registers, and call int 21 by one of the following
methods:
A) call interrupt 21h directly (the recommended procedure)
B) perform a long call to offset 50h in the program's PSP.
1) This method will not work under DOS 1.x
2) Though recommended by Microsoft for DOS 2.0, this method takes more
time and is no longer recommended.
C) place the function number in CL and perform an intrasegment call to
location 05h in the current code segment. This location contains a long
call to the DOS function dispatcher.
1) IBM recommends this method be used only when using existing programs
written for different calling conventions. (such as converting CP/M
programs). This method should be avoided unless you have some specific
use for it.
2) AX is always destroyed by this method.
3) This method is valid only for functions 00h-24h.
There are also various ways of exiting from a program. (assuming it is not
intended to be a TSR). All methods except call 4Ch must ensure that the
segment register contains the segment address of the PSP.
A) Interrupt 21h, function 4Ch (Terminate with Result Code). This is the
"official" recommended method of returning to DOS.
B) Interrupt 21h, function 00h (Exit Program). This is the early style
int 21 function call. It simply calls int 20h.
C) Interrupt 20h (Exit).
D) A JMP instruction to offset 00h (int 20h vector) in the Program Segment
Prefix. This is just a roundabout method to call int 20h. This method
was set up in DOS 1.0 for ease of conversion for CP/M programs. It is no
longer recommended for use.
E) A JMP instruction to offset 05h (int 21 vector) in the Program Segment
Prefix, with AH set to 00h or 4Ch. This is another CP/M type function.
INT 21H DOS services
Function (hex)
* Indicates Functions not documented in the IBM DOS Technical Reference.
Note some functions have been documented in other Microsoft or licensed OEM
documentation.
Function 00h Terminate Program
Ends program, updates, FAT, flushes buffers, restores registers
entry AH 00h
CS segment address of PSP
return none
note 1) Program must place the segment address of the PSP control block in CS
before calling this function.
2) The terminate, ctrl-break,and critical error exit addresses (0Ah, 0Eh,
12h) are restored to the values they had on entry to the terminating
program, from the values saved in the program segment prefix at
locations PSP:000Ah, PSP:000Eh, and PSP:0012h.
3) All file buffers are flushed and the handles opened by the process are
closed.
4) Any files that have changed in length and are not closed are not
recorded properly in the directory.
5) Control transfers to the terminate address.
6) This call performs exactly the same function as int 20h.
7) All memory used by the program is returned to DOS.
Function 01h Get Keyboard Input
Waits for char at STDIN (if nescessary), echoes to STDOUT
entry AH 01h
return AL ASCII character from STDIN (8 bits)
note 1) Checks char for Ctrl-C, if char is Ctrl-C, executes int 23h.
2) For function call 06h, extended ASCII codes require two function calls.
The first call returns 00h as an indicator that the next call will be an
extended ASCII code.
3) Input and output are redirectable. If redirected, there is no way to
detect EOF.
Function 02h Display Output
Outputs char in DL to STDOUT
entry AH 02h
DL 8 bit data (usually ASCII character)
return none
note 1) If char is 08 (backspace) the cursor is moved 1 char to the left
(nondestructive backspace).
2) If Ctrl-C is detected after input, int 23h is executed.
3) Input and output are redirectable. If redirected, there is no way to
detect disk full.
Function 03h Auxiliary Input
Get (or wait until) character from STDAUX
entry AH 03h
return AL char from auxiliary device
note 1) AUX, COM1, COM2 is unbuffered and not interrupt driven
2) This function call does not return status or error codes. For greater
control it is recommended that you use ROM BIOS routine (int 14h) or
write an AUX device driver and use IOCTL.
3) At startup, PC-DOS initializes the first auxiliary port (COM1) to 2400
baud, no parity, one stop bit, and an 8-bit word. MSDOS may differ.
4) If Ctrl-C is has been entered from STDIN, int 23h is executed.
Function 04h Auxiliary Output
Write character to STDAUX
entry AH 04h
DL char to send to AUX
return none
note 1) This function call does not return status or error codes. For greater
control it is recommended that you use ROM BIOS routine (int 14h) or
write an AUX device driver and use IOCTL.
2) If Ctrl-C is has been entered from STDIN, int 23h is executed.
3) Default is COM1 unless redirected by DOS.
4) If the device is busy, this function will wait until it is ready.
Function 05h Printer Output
Write character to STDPRN
entry AL 05h
DL character to send
return none
note 1) If Ctrl-C is has been entered from STDIN, int 23h is executed.
2) Default is PRN or LPT1 unless redirected with the MODE command.
3) If the printer is busy, this function will wait until it is ready.
Function 06h Direct Console I/O
Get character from STDIN; echo character to STDOUT
entry AH 06h
DL 0FFh for console input, or 00h-0FEh for console output
return ZF set (1) = no character
clear (0) = character recieved
AL character
note 1) Extended ASCII codes require two function calls. The first call returns
00h to indicate the next call will return an extended code.
2) If DL is not 0FFh, DL is assumed to have a valid character that is
output to STDOUT.
3) This function does not check for Ctrl-C or Ctrl-PrtSc.
4) Does not echo input to screen
5) If I/O is redirected, EOF or disk full cannot be detected.
Function 07h Direct Console Input Without Echo (does not check BREAK)
Get or wait for char at STDIN, returns char in AL
entry AH 07h
return AL character from standard input device
note 1) Extended ASCII codes require two function calls. The first call returns
00h to indicate the next call will return an extended code.
2) No checking for Ctrl-C or Ctrl-PrtSc is done.
3) Input is redirectable.
Function 08h Console Input Without Echo (checks BREAK)
Get or Wait for char at STDIN, return char in AL
entry AH 08h
return AL char from standard input device
note 1) Char is checked for ctrl-C. If ctrl-C is detected, executes int 23h.
2) For function call 08h, extended ASCII characters require two function
calls. The first call returns 00h to signify an extended ASCII code.
The next call returns the actual code.
3) Input is redirectable. If redirected, there is no way to check EOF.
Function 09h Print String
Outputs Characters in the Print String to the STDOUT
entry AH 09h
DS:DX pointer to the Character String to be displayed
return none
note 1) The character string in memory must be terminated by a $ (24h)
The $ is not displayed.
2) Output to STDOUT is the same as function call 02h.
Function 0Ah Buffered Keyboard Input
Reads characters from STDIN and places them in the buffer beginning
at the third byte.
entry AH 0Ah
DS:DX pointer to an input buffer
return none
note 1) Min buffer size = 1, max = 255
2) Char is checked for ctrl-C. If ctrl-C is detected, executes int 23h.
3) Format of buffer DX:
byte contents
1 Maximum number of chars the buffer will take, including CR.
Reading STDIN and filling the buffer continues until a carriage
return (<Enter> or 0Dh) is read. If the buffer fills to one less
than the maximum number the buffer can hold, each additional
number read is ignored and ASCII 7 (BEL) is output to the
display until a carriage return is read. (you must set this
value)
2 Actual number of characters received, excluding the carriage
return, which is always the last character. (the function sets
this value)
3-n Characters received are placed into the buffer starting here.
Buffer must be at least as long as the number in byte 1.
4) Input is redirectable. If redirected, there is no way to check EOF.
5) The string may be edited with the standard DOS editing commands as it
is being entered.
6) Extended ASCII characters are stored as 2 bytes, the first byte being
zero.
Function 0Bh Check Standard Input (STDIN) status
Checks for character availible at STDIN
entry AH 0Bh
return AL 0FFh if a character is availible from STDIN
00h if no character is availible from STDIN
note 1) Checks for Ctrl-C. If Ctrl-C is detected, int 23h is executed
2) Input can be redirected.
3) Checks for character only, it is not read into the application
4) IBM reports that this call does not work properly under the DOSSHELL
program in DOS 4.00 and 4.01. DOSSHELL will return all zeroes. This
function works correctly from the command line or application.
Function 0Ch Clear Keyboard Buffer & Invoke a Keyboard Function (FCB)
Dumps buffer, executes function in AL (01h,06h,07h,08h,0Ah only)
entry AH 0Ch
AL function number (must be 01h, 06h, 07h, 08h, or 0Ah)
return AL 00h buffer was flushed, no other processing performed
other any other value has no meaning
note 1) Forces system to wait until a character is typed.
2) Flushes all typeahead input, then executes function specified by AL (by
moving it to AH and repeating the int 21 call).
3) If AL contains a value not in the list above, the keyboard buffer is
flushed and no other action is taken.
Function 0Dh Disk Reset
Flushes all currently open file buffers to disk
entry AH 0Dh
return none
note 1) Does not close files. Does not update directory entries; files changed
in size but not closed are not properly recorded in the directory
2) Sets DTA address to DS:0080h
3) Should be used before a disk change, Ctrl-C handlers, and to flush
the buffers to disk.
Function 0Eh Select Disk
Sets the drive specified in DL (if valid) as the default drive
entry AL 0Eh
DL new default drive number (0=A:,1=B:,2=C:,etc.)
return AL total number of logical drives (not nescessarily physical)
note 1) For DOS 1.x and 2.x, the minimum value for AL is 2.
2) For DOS 3.x and 4.x, the minimum value for AL is 5.
3) The drive number returned is not nescessarily a valid drive.
4) For DOS 1.x: 16 logical drives are availible, A-P.
For DOS 2.x: 63 logical drives are availible. (Letters are only used for
the first 26 drives. If more than 26 logical drives are
used, further drive letters will be other ASCII characters
ie {,], etc.
For DOS 3.x: 26 logical drives are availible, A-Z.
For DOS 4.x: 26 logical drives are availible, A-Z.
Function 0Fh Open Disk File (FCB)
Searches current directory for specified filename and opens it
entry AH 0Fh
DS:DX pointer to an unopened FCB
return AL 00h if file found
0FFh if file not not found
note 1) If the drive code was 0 (default drive) it is changed to the actual
drive used (1=A:,2=B:,3=C:, etc). This allows changing the default drive
without interfering with subsequent operations on this file.
2) The current block field (FCB bytes C-D, offset 0Ch) is set to zero.
3) The size of the record to be worked with (FCB bytes E-F, offset 0Eh) is
set to the system default of 80h. The size of the file (offset 10h) and
the date (offset 14h) are set from information obtained in the root
directory. You can change the default value for the record size (FCB
bytes E-F) or set the random record size and/or current record field.
Perform these actions after the open but before any disk operations.
4) The file is opened in compatibility mode.
5) Microsoft recommends handle function call 3Dh be used instead.
6) This call is also used by the APPEND command in DOS 3.2+
7) Before performing a sequential disk operation on the file, you must
set the Current Record field (offset 20h). Before performing a random
disk operation on the file, you must set the Relative Record field
(offset 21h). If the default record size of 128 bytes is incorrect, set
it to the correct value.
Function 10h Close File (FCB)
Closes a File After a File Write
entry AH 10h
DS:DX pointer to an opened FCB
return AL 00h if the file is found and closed
0FFh if the file is not found in the current directory
note 1) This function call must be done on open files that are no longer needed,
and after file writes to insure all directory information is updated.
2) If the file is not found in its correct position in the current
directory, it is assumed that the diskette was changed and AL returns
0FFh. This error return is reportedly not completely reliable with DOS
version 2.x.
3) If found, the directory is updated to reflect the status in the FCB, the
buffers to that file are flushed, and AL returns 00h.
Function 11h Search For First Matching Entry (FCB)
Searches current disk & directory for first matching filename
entry AH 11h
DS:DX pointer to address of FCB
return AL 00h successful match
0FFh no matching filename found
note 1) The FCB may contain the wildcard character ? under Dos 2.x, and ? or *
under 3.x and 4.x.
2) The original FCB at DS:DX contains information to continue the search
with function 12h, and should not be modified.
3) If a matching filename is found, AL returns 00h and the locations at the
Disk Transfer Address are set as follows:
a) If the FCB provided for searching was an extended FCB, then the first
byte at the disk transfer address is set to 0FFh followed by 5 bytes
of zeroes, then the attribute byte from the search FCB, then the
drive number used (1=A, 2=B, etc) then the 32 bytes of the directory
entry. Thus, the disk transfer address contains a valid unopened FCB
with the same search attributes as the search FCB.
b) If the FCB provided for searching was a standard FCB, then the first
byte is set to the drive number used (1=A,2=b,etc), and the next 32
bytes contain the matching directory entry. Thus, the disk transfer
address contains a valid unopened normal FCB.
4) If an extended FCB is used, the following search pattern is used:
a) If the FCB attribute byte is zero, only normal file entries are
found. Entries for volume label, subdirectories, hidden or system
files, are not returned.
b) If the attribute byte is set for hidden or system files, or
subdirectory entries, it is to be considered as an inclusive search.
All normal file entries plus all entries matching the specified
attributes are returned. To look at all directory entries except the
volume label, the attribute byte may be set to hidden + system +
directory (all 3 bits on).
c) If the attribute field is set for the volume label, it is considered
an exclusive search, and ONLY the volume label entry is returned.
5) This call is also used by the APPEND command in DOS 3.2+
Function 12h Search For Next Entry Using FCB (FCB)
Search for next matching filename
entry AH 12h
DS:DX pointer to the unopened FCB specified from the previous Search
First (11h) or Search Next (12h)
return AL 00h if matching filename found
0FFh if matching filename was not found
note 1) After a matching filename has been found using function call 11h,
function 12h may be called to find the next match to an ambiguous
request. For DOS 2.x, ?'s are allowed in the filename. For DOS 3.x
and 4.x, global (*) filename characters are allowed.
2) The DTA contains info from the previous Search First or Search Next.
3) All of the FCB except for the name/extension field is used to keep
information nescessary for continuing the search, so no disk operations
may be performed with this FCB between a previous function 11h or 12h
call and this one.
4) If the file is found, an FCB is created at the DTA address and set up to
open or delete it.
Function 13h Delete File Via FCB (FCB)
Deletes file specified in FCB from current directory
entry AH 13h
DS:DX pointer to address of FCB
return AL 00h file deleted
0FFh if file not found or was read-only
note 1) All matching current directory entries are deleted. The global filename
character "?" is allowed in the filename.
2) Will not delete files with read-only attribute set
3) Close open files before deleting them.
4) Requires Network Access Rights
Function 14h Sequential Disk File Read (FCB)
Reads record sequentially from disk via FCB
entry AH 14h
DS:DX pointer to an opened FCB
return AL 00h successful read
01h end of file (no data read)
02h Data Transfer Area too small for record size specified
or segment overflow
03h partial record read, EOF found
note 1) The record size is set to the value at offset 0Eh in the FCB.
2) The record pointed to by the Current Block (offset 0Ch) and the Current
Record (offset 20h) fields is loaded at the DTA, then the Current Block
and Current Record fields are incremented.
3) The record is read into memory at the current DTA address as specified
by the most recent call to function 1Ah. If the size of the record and
location of the DTA are such that a segment overflow or wraparound would
occur, the error return is set to AL=02h
4) If a partial record is read at the end of the file, it is passed to the
requested size with zeroes and the error return is set to AL=03h.
Function 15h Sequential Disk Write (FCB)
Writes record specified by FCB sequentially to disk
entry AH 15h
DS:DX pointer to address of FCB
return AL 00h successful write
01h diskette full, write canceled
02h disk transfer area (DTA) too small or segment wrap
note 1) The data to write is obtained from the disk transfer area
2) The record size is set to the value at offset 0Eh in the FCB.
3) This service cannot write to files set as read-only
4) The record pointed to by the Current Block (offset 0Ch) and the Current
Record (offset 20h) fields is loaded at the DTA, then the Current Block
and Current Record fields are incremented.
5) If the record size is less than a sector, the data in the DTA is written
to a buffer; the buffer is written to disk when it contains a full
sector of data, the file is closed, or a Reset Disk (function 0Dh) is
issued.
6) The record is written to disk at the current DTA address as specified
by the most recent call to function 1Ah. If the size of the record and
location of the DTA are such that a segment overflow or wraparound would
occur, the error return is set to AL=02h
Function 16h Create A Disk File (FCB)
Search and open or create directory entry for file
entry AH 16h
DS:DX pointer to an FCB
return AL 00h successful creation
0FFh no room in directory
note 1) If a matching directory entry is found, the file is truncated to zero
bytes.
2) If there is no matching filename, a filename is created.
3) This function calls function 0Fh (Open File) after creating or
truncating a file.
4) A hidden file can be created by using an extended FCB with the attribute
byte (offset FCB-1) set to 2.
Function 17h Rename File Specified by File Control Block (FCB)
Renames file in current directory
entry AH 17h
DS:DX pointer to an FCB (see note 4)
return AL 00h successfully renamed
0FFh file not found or filename already exists
note 1) This service cannot rename read-only files
2) The "?" wildcard may be used.
3) If the "?" wildcard is used in the second filename, the corresponding
letters in the filename of the directory entry are not changed.
4) The FCB must have a drive number, filename, and extension in the usual
position, and a second filename starting 6 bytes after the first, at
offset 11h.
5) The two filenames cannot have the same name.
6) FCB contains new name starting at byte 17h.
Function 18h Internal to DOS
* Unknown
entry AH 18h
return AL 0
Function 19h Get Current Disk Drive
Return designation of current default disk drive
entry AH 19h
return AL current default drive (0=A, 1=B,etc.)
note Some other DOS functions use 0 for default, 1=A, 2=B, etc.
Function 1Ah Set Disk Transfer Area Address (DTA)
Sets DTA address to the address specified in DS:DX
entry AH 1Ah
DS:DX pointer to buffer
return none
note 1) The default DTA is 128 bytes at offset 80h in the PSP. DOS uses the
DTA for all file I/O.
2) Registers are unchanged.
3) No error codes are returned.
2) Disk transfers cannot wrap around from the end of the segment to the
beginning or overflow into another segment.
Function 1Bh Get Current Drive File Allocation Table Information
Returns information from the FAT on the current drive
entry AH 1Bh
exit AL number of sectors per allocation unit (cluster)
DS:BX address of the current drive's media descriptor byte
CX number of bytes per sector
DX number of allocation units (clusters) for default drive
note 1) Save DS before calling this function.
2) This call returned a pointer to the FAT in DOS 1.x. Beginning with
DOS 2.00, it returns a pointer only to the table's ID byte.
3) IBM recommends programmers avoid this call and use int 25h instead.
Function 1Ch Get File Allocation Table Information for Specific Device
Returns information on specified drive
entry AH 1Ch
DL drive number (1=A, 2=B, 3=C, etc)
return AL number of sectors per allocation unit (cluster)
DS:BX address of media descriptor byte for drive in DL
CX sector size in bytes
DX number of allocation units (clusters)
note 1) DL = 0 for default.
2) Save DS before calling this function.
3) Format of media-descriptor byte:
bits: 0 0 (clear) not double sided
1 (set) double sided
1 0 (clear) not 8 sector
1 (set) 8 sector
2 0 (clear) nonremovable device
1 (set) removable device
3-7 always set (1)
4) This call returned a pointer to the FAT in DOS 1.x. Beginning with
DOS 2.00, it returns a pointer only to the table's ID byte.
5) IBM recommends programmers avoid this call and use int 25h instead.
Function 1Dh Not Documented by Microsoft
* Unknown
entry AH 1Dh
return AL 0
Function 1Eh Not Documented by Microsoft
* Unknown
entry AH 1Eh
return AL 0
note Apparently does nothing
Function 1Fh Get Default Drive Parameter Block
* Same as function call 32h (below), except that the table is accessed from
the default drive
entry AH 1Fh
other registers unknown
return AL 00h no error
0FFh error
DS:BX points to DOS Disk Parameter Block for default drive.
note 1) Unknown vector returned in ES:BX.
2) For DOS 2.x and 3.x, this just invokes function 32h (undocumented,
Read DOS Disk Block) with DL=0
Function 20h Unknown
* Internal - does nothing?
entry AH 20h
return AL 0
Function 21h Random Read from File Specified by File Control Block (FCB)
Reads one record as specified in the FCB into the current DTA.
entry AH 21h
DS:DX address of the opened FCB
return AL 00h successful read operation
01h end of file (EOF), no data read
02h DTA too small for the record size specified
03h end of file (EOF), partial data read
note 1) The current block and current record fields are set to agree with the
random record field. Then the record addressed by these fields is read
into memory at the current Disk Transfer Address.
2) The current file pointers are NOT incremented this function.
3) If the DTA is larger than the file, the file is padded to the requested
length with zeroes.
Function 22h Random Write to File Specified by FCB (FCB)
Writes one record as specified in the FCB to the current DTA
entry AH 22h
DS:DX address of the opened FCB
return AL 00h successful write operation
01h disk full; no data written (write was canceled)
02h DTA too small for the record size specified (write was
canceled)
note 1) This service cannot write to read-only files.
2) The record pointed to by the Current Block (offset 0Ch) and the Current
Record (offset 20h) fields is loaded at the DTA, then the Current Block
and Current Record fields are incremented.
3) If the record size is less than a sector, the data in the DTA is written
to a buffer; the buffer is written to disk when it contains a full
sector of data, the file is closed, or a Reset Disk (function 0Dh) is
issued.
4) The current file pointers are NOT incremented this function.
5) The record is written to disk at the current DTA address as specified
by the most recent call to function 1Ah. If the size of the record and
location of the DTA are such that a segment overflow or wraparound would
occur, the error return is set to AL=02h
Function 23h Get File Size (FCB)
Searches current subdirectory for matching file, returns size in FCB
entry AH 23h
DS:DX address of an unopened FCB
return AL 00h file found
0FFh file not found
note 1) Record size field (offset 0Eh) must be set before invoking this function
2) The disk directory is searched for the matching entry. If a matching
entry is found, the random record field is set to the number of records
in the file. If the value of the Record Size field is not an even
divisor of the file size, the value set in the relative record field is
rounded up. This gives a returned value larger than the actual file size
3) This call is used by the APPEND command in DOS 3.2+
Function 24h Set Relative Record Field (FCB)
Set random record field specified by an FCB
entry AH 24h
DS:DX address of an opened FCB
return Random Record Field of FCB is set to be same as Current Block
and Current Record.
note 1) You must invoke this function before performing random file access.
2) The relative record field of FCB (offset 21h) is set to be same as the
Current Block (offset 0Ch) and Current Record (offset 20h).
3) No error codes are returned.
4) The FCB must already be opened.
Function 25h Set Interrupt Vector
Sets the address of the code DOS is to perform each time the specified
interrupt is invoked.
entry AH 25h
AL int number to reassign the handler to
DS:DX address of new interrupt vector
return none
note 1) Registers are unchanged.
2) No error codes are returned.
3) The interrupt vector table for the interrupt number specified in AL
is set to the address contained in DS:DX. Use function 35h (Get Vector)
to get the contents of the interrupt vector and save it for later use.
4) When you use function 25 to set an interrupt vector, DOS 3.2 doesn't
point the actual interrupt vector to what you requested. Instead, it
sets the interrupt vector to point to a routine inside DOS, which does
this:
1. Save old stack pointer
2. Switch to new stack pointer allocated from DOS's stack pool
3. Call your routine
4. Restore old stack pointer
The purpose for this was to avoid possible stack overflows when there
are a large number of active interrupts. IBM was concerned (this was an
IBM change, not Microsoft) that on a Token Ring network there would be
a lot of interrupts going on, and applications that hadn't allocated
very much stack space would get clobbered.
Function 26h Create New Program Segment Prefix (PSP)
This service copies the current program-segment prefix to a new memory
location for the creation of a new program or overlay. Once the new PSP is
in place, a DOS program can read a DOS COM or overlay file into the memory
location immediately following the new PSP and pass control to it.
entry AH 26h
DX segment number for the new PSP
return none
note 1) Microsoft recommends you use the newer DOS service 4Bh (EXEC) instead.
2) The entire 100h area at location 0 in the current PSP is copied into
location 0 of the new PSP. The memory size information at location 6
in the new segment is updated and the current termination, ctrl-break,
and critical error addresses from interrupt vector table entries for
ints 22h, 23h, and 24 are saved in the new program segment starting at
0Ah. They are restored from this area when the program terminates.
3) Current PSP is copied to specified segment
Function 27h Random Block Read From File Specified by FCB
Similar to 21h (Random Read) except allows multiple files to be read.
entry AH 27h
CX number of records to be read
DS:DX address of an opened FCB
return AL 00h successful read
01h end of file, no data read
02h DTA too small for record size specified (read canceled)
03h end of file
CX actual number of records read (includes partial if AL=03h)
note 1) The record size is specified in the FCB. The service updates the Current
Block (offset 0Ch) and Current Record (offset 20h) fields to the next
record not read.
2) If CX contained 0 on entry, this is a NOP.
3) If the DTA is larger than the file, the file is padded to the requested
length with zeroes.
4) This function assumes that the FCB record size field (0Eh) is correctly
set. If not set by the user, the default is 128 bytes.
5) The record is written to disk at the current DTA address as specified
by the most recent call to function 1Ah. If the size of the record and
location of the DTA are such that a segment overflow or wraparound would
occur, the error return is set to AL=02h
Function 28h Random Block Write to File Specified in FCB
Similar to 27h (Random Write) except allows multiple files to be read.
entry AH 28h
CX number of records to write
DS:DX address of an opened FCB
return AL 00h successful write
01h disk full, no data written
02h DTA too small for record size specified (write canceled)
CX number of records written
note 1) The record size is specified in the FCB.
2) This service allocates disk clusters as required.
3) This function assumes that the FCB Record Size field (offset 0Eh) is
correctly set. If not set by the user, the default is 128 bytes.
4) The record size is specified in the FCB. The service updates the Current
Block (offset 0Ch) and Current Record (offset 20h) fields to the next
record not read.
5) The record is written to disk at the current DTA address as specified
by the most recent call to function 1Ah. If the size of the record and
location of the DTA are such that a segment overflow or wraparound would
occur, the error return is set to AL=02h
6) If called with CX=0, no records are written, but the FCB's File Size
entry (offset 1Ch) is set to the size specified by the FCB's Relative
Record field (offset 21h).
Function 29h Parse the Command Line for Filename
Parses a text string into the fields of a File Control Block
entry AH 29h
DS:SI pointer to string to parse
ES:DI pointer to memory buffer to fill with unopened FCB
AL bit mask to control parsing
bit 0 = 0: parsing stops if file seperator found
1: causes service to scan past leading chars such as
blanks. Otherwise assumes the filename begins in
the first byte
1 = 0: drive number in FCB set to default (0) if string
contains no drive number
1: drive number in FCB not changed
2 = 0: filename in FCB set to 8 blanks if no filename in
string
1: filename in FCB not changed if string does not
contain a filename
3 = 0: extension in FCB set to 3 blanks if no extension in
string
1: extension left unchanged
4-7 must be zero
return AL 00h no wildcards in name or extension
01h wildcards appeared in name or extension
0FFh invalid drive specifier
DS:SI pointer to the first byte after the parsed string
ES:DI pointer to a buffer filled with the unopened FCB
note 1) If the * wildcard characters are found in the command line, this service
will replace all subsequent chars in the FCB with question marks.
2) This service uses the characters as filename separators
DOS 1 : ; . , + / [ ] = " TAB SPACE
DOS 2,3 : ; . , + = TAB SPACE
3) This service uses the characters
: ; . , + < > | / \ [ ] = " TAB SPACE
or any control characters as valid filename separators
4) A filename cannot contain a filename terminator. If one is encountered,
all processing stops. The handle functions will allow use of some of
these characters.
5) If no valid filename was found on the command line, ES:DI +1 points
to a blank (ASCII 32).
6) This function cannot be used with filespecs which include a path
7) Parsing is in the form D:FILENAME.EXT. If one is found, a corresponding
unopened FCB is built at ES:DI
Function 2Ah Get Date
Returns day of the week, year, month, and date
entry AH 2Ah
return CX year (1980-2099)
DH month (1-12)
DL day (1-31)
AL weekday 00h Sunday
01h Monday
02h Tuesday
03h Wednesday
04h Thursday
05h Friday
06h Saturday
note 1) Date is adjusted automatically if clock rolls over to the next day,
and takes leap years and number of days in each month into account.
2) Although DOS cannot set an invalid date, it can read one, such as
1/32/80, etc.
3) DesQview also accepts CX = 4445h and DX = 5351h, i.e. 'DESQ' as valid
4) DOS will accept CH=0 (midnight) as a valid time, but if a file's time
is set to exactly midnight the time will not be displayed by the DIR
command.
Function 2Bh Set Date
set current system date
entry AH 2Bh
CX year (1980-2099)
DH month (1-12)
DL day (1-31)
return AL 00h no error (valid date)
0FFh invalid date specified
note 1) On entry, CX:DX must have a valid date in the same format as returned
by function call 2Ah
2) DOS 3.3 also sets CMOS clock
Function 2Ch Get Time
Get current system time from CLOCK$ driver
entry AH 2Ch
return CH hours (0-23)
CL minutes (0-59)
DH seconds (0-59)
DL hundredths of a second (0-99)
note 1) Time is updated every 5/100 second.
2) The date and time are in binary format
Function 2Dh Set Time
Sets current system time
entry AH 2Dh
CH hours (0-23)
CL minutes (0-59)
DH seconds (0-59)
DL hundredths of seconds (0-99)
return AL 00h if no error
0FFh if bad value sent to routine
note 1) DOS 3.3 also sets CMOS clock
2) CX and DX must contain a valid time in binary
Function 2Eh Set/Reset Verify Switch
Set verify flag
entry AH 2Eh
AL 00 to turn verify off (default)
01 to turn verify on
return none
note 1) This is the call invoked by the DOS VERIFY command
2) Setting of the verify switch can be obtained by calling call 54h
3) This call is not supported on network drives
4) DOS checks this flag each time it accesses a disk
Function 2Fh Get Disk Transfer Address (DTA)
Returns current disk transfer address used by all DOS read/write operations
entry AH 2Fh
return ES:BX address of DTA
note 1) The DTA is set by function call 1Ah
2) Default DTA address is a 128 byte buffer at offset 80h in that program's
Program Segment Prefix
Function 30h Get DOS Version Number
Return DOS version and/or user number
entry AH 30h
return AH minor version number (i.e., DOS 2.10 returns AX = 0A02h)
AL major version number
BH OEM ID number
00h IBM
16h DEC (others not known)
BL:CX 24-bit user serial number
note 1) If AL returns a major version number of zero, the DOS version is
below 1.28 for MSDOS and below 2.00 for PCDOS.
2) IBM PC-DOS always returns 0000h in BX and CX.
3) OS/2 v1.0 Compatibility Box returns a value of 10 for major version.
4) Due to the OS/2 return and the fact that some European versions of DOS
carry higher version numbers than IBM's DOS, utilities which check
for a DOS version should not abort if a higher version than required
is found unless some specific problems are known.
Function 31h Terminate Process and Stay Resident
KEEP, or TSR
entry AH 31h
AL exit code
DX program memory requirement in 16 byte paragraphs
return AX return code (retrieveable by function 4Dh)
note 1) Files opened by the application are not closed when this call is made
2) Memory can be used more efficiently if the block containing the copy of
the DOS environment is deallocated before terminating. This can be done
by loading ES with the segment contained in 2Ch of the PSP and issuing
function call 49h (Free Allocated Memory).
3) Unlike int 27h, more than 64k may be made resident with this call
Function 32h Read DOS Disk Block
* Retrieve the pointer to the drive parameter block for a drive
entry AH 32h
DL drive (0=default, 1=A:, etc.).
return AL 00h if drive is valid
0FFh if drive is not valid
DS:BX pointer to DOS Drive Parameter Table. Format of block:
Bytes Type Value
00h byte Drive: 0=A:, 1=B:, etc.
01h byte Unit within drive (0, 1, 2, etc.)
02h-03h word Bytes per sector
04h byte Sectors per cluster - 1
05h byte Cluster to sector shift (i.e., how far to shift-
left the bytes/sector to get bytes/cluster)
06h-07h word Number of reserved (boot) sectors
08h byte Number of FATs
09h-0Ah word Number of root directory entries
0Bh-0Ch word Sector # of 1st data. Should be same as # of
sectors/track.
0Dh-0Eh word # of clusters + 1 (=last cluster #)
0Fh byte Sectors for FAT
10h-11h word First sector of root directory
12h-15h dword Address of device driver header for this drive
16h byte Media Descriptor Byte for this drive
17h byte 0FFh indicates block must be rebuilt
(DOS 3.x) 00h indicates block device has
been accessed
18h-1Bh dword address of next DOS Disk Block (0FFFFh means
last in chain)
22h byte Current Working Directory (2.0 only) (64 bytes)
note 1) Use [BX+0D] to find no. of clusters (>1000H, 16-bit FAT; if not, 12-bit
(exact dividing line is probably a little below 1000h to allow for
bad sectors, EOF markers, etc.)
2) Short article by C.Petzold, PC Magazine Vol.5,no.8, and the article
"Finding Disk Parameters" in the May 1986 issue of PC Tech Journal.
3) This call is mostly supported in OS/2 1.0's DOS Compatibility Box. The
dword at 12h will not return the address of the next device driver when
in the Compatibility Box.
4) used by CHKDSK
Function 33h Control-Break Check
Get or set control-break checking at CON
entry AH 33h
AL 00h to test for break checking
01h to set break checking
DL 00h to disable break checking
01h to enable break checking
02h internal, called by PRINT.COM (DOS 3.1)
03h unknown
04h unknown
05h boot drive (DOS 4.0+)
return DL 00h if break=off
01h if break=on
(if AL=05h) boot drive, A=1, B=2, etc)
AL 0FFh error
Function 34h Return INDOS Flag
* Returns ES:BX pointing to Critical Section Flag, byte indicating whether
it is safe to interrupt DOS.
entry AH 34h
return ES:BX points to DOS "critical section flag"
note 1) If byte is 0, it is safe to interrupt DOS. This was mentioned in some
documentation by Microsoft on a TSR standard, and PC Magazine reports
it functions reliably under DOS versions 2.0 through 3.3. Chris
Dunford (of CED fame) and a number of anonymous messages on the BBSs
indicate it may not be totally reliable.
2) The byte at ES:BX+1 is used by the Print program for this same purpose,
so it's probably safer to check the WORD at ES:BX.
3) Reportedly, examination of DOS 2.10 code in this area indicates that the
byte immediately following this "critical section flag" must be 00h to
permit the PRINT.COM interrupt to be called. For DOS 3.0 and 3.1 (except
Compaq DOS 3.0), the byte before the "critical section flag" must be
zero; for Compaq DOS 3.0, the byte 01AAh before it must be zero.
4) In DOS 3.10 this reportedly changed to word value, with preceding byte.
5) This call is supported in OS/2 1.0's DOS Compatibility Box
6) Gordon Letwin of Microsoft discussed this call on ARPAnet in 1984. He
stated:
a) this is not supported under any version of the DOS
b) it usually works under DOS 2, but there may be circumstances
when it doesn't (general disclaimer, don't know of a specific
circumstance)
c) it will usually not work under DOS 3 and DOS 3.1; the DOS is
considerably restructured and this flag takes on additional
meanings and uses
d) it will fail catastrophically under DOS 4.0 and forward.
Obviously this information is incorrect since the call works fine
through DOS 3.3. Microsoft glasnost?
Function 35h Get Vector
Get interrupt vector
entry AH 35h
AL interrupt number (hexadecimal)
return ES:BX address of interrupt vector
note Use function call 25h to set the interrupt vectors
Function 36h Get Disk Free Space
get information on specified drive
entry AH 36h
DL drive number (0=default, 1=A:, 2=B:, etc)
return AX number of sectors per cluster
0FFFFh means drive specified in DL is invalid
BX number of availible clusters
CX bytes per sector
DX clusters per drive
note 1) Mult AX * CX * BX for free space on disk
2) Mult AX * CX * DX for total disk space
3) Function 36h returns an incorrect value after an ASSIGN command. Prior
to ASSIGN, the DX register contains 0943h on return, which is the free
space in clusters on the HC diskette. After ASSIGN, even with no
parameters, 0901h is returned in the DX register; this is an incorrect
value. Similar results occur with DD diskettes on a PC-XT or a PC-AT.
This occurs only when the disk is not the default drive. Results are as
expected when the drive is the default drive. Therefore, the
circumvention is to make the desired drive the default drive prior to
issuing this function call.
4) Int 21h, function call 36h returns an incorrect value after an ASSIGN
command. Prior to ASSIGN, the DX register contains 0943h on return,
which is the free space in clusters on the HC diskette. After ASSIGN,
even with no parameters, 0901h is returned in the DX register; this is
an incorrect value. Similar results occur with DD diskettes on a PC-XT
or a PC-AT. This occurs only when the disk is not the default drive.
Results are as expected when the drive is the default drive. Therefore,
the circumvention is to make the desired drive the default drive prior
to issuing this function call.
5) This function supercedes functions 1Bh and 1Ch.
Function 37h SWITCHAR / AVAILDEV
* Get/set option marking character (is usually "/"), and device type
entry AH 37h
AL 00h read switch character (returns current character in DL)
01h set character in DL as new switch character
(DOS 2.x) 02h read device availability (as set by function AL=3) into
DL. A 0 means devices that devices must be accessed in
file I/O calls by /dev/device. A non-zero value means
that devices are accessible at every level of the
directory tree (e.g., PRN is the printer and not a file
PRN).
AL=2 to return flag in DL, AL=3 to set from DL (0 = set,
1 = not set).
(DOS 2.x) 03h get device availability, where:
DL 00h means /dev/ must precede device names
01h means /dev/ need not precede device names
return DL switch character (if AL=0 or 1)
device availability flag (if AL=2 or 3)
AL 0FFh the value in AL was not in the range 0-3.
note 1) Functions 2 & 3 appear not to be implemented for DOS 3.x.
2) It is documented on page 4.324 of the MS-DOS (version 2) Programmer's
Utility Pack (Microsoft - published by Zenith).
3) Works on all versions of IBM PC-DOS from 2.0 through 3.3.1.
4) The SWITCHAR is the character used for "switches" in DOS command
arguments (defaults to '/', as in "DIR/P"). '-' is popular to make a
system look more like UNIX; if the SWITCHAR is anything other than '/',
then '/' may be used instead of '\' for pathnames
5) Ignored by XCOPY, PKARC, LIST
6) SWITCHAR may not be set to any character used in a filename
7) In DOS 3.x you can still read the "AVAILDEV" byte with subfunction 02h
but it always returns 0FFh even if you try to change it to 0 with
subfunction 03h.
8) AVAILDEV=0 means that devices must be referenced in an imaginary
subdirectory "\dev" (similar to UNIX's /dev/*); a filename "PRN.DAT"
can be created on disk and manipulated like any other. If AVAILDEV != 0
then device names are recognized anywhere (this is the default):
"PRN.DAT" is synonymous with "PRN:".
9) These functions reportedly are not supported in the same fashion in
various implementations of DOS.
10) used by DOS 3.3 CHKDSK, BASIC, DEBUG
Function 38h Return Country Dependent Information
(PCDOS 2.0, 2.1, MSDOS 2.00 only)
entry AH 38h
AL function code (must be 0 in DOS 2.x)
DS:DX pointer to 32 byte memory buffer for returned information
return CF set on error
AX error code (02h)
BX country code
DS:DX pointer to buffer filled with country information:
bytes 0,1 date/time format
0 USA standard H:M:S M/D/Y
1 European standard H:M:S D/M/Y
2 Japanese standard H:M:S D:M:Y
byte2 ASCIIZ string currency symbol
byte3 zeroes
byte4 ASCIIZ string thousands separator
byte5 zeroes
byte6 ASCIIZ string decimal separator
byte7 zeroes
bytes 8,1Fh 24 bytes reserved
Function 38h Get Country Dependent Information
(PCDOS 3.x+, MSDOS 2.01+)
entry AH 38h
AL function code
00h to get current country information
01h-0FEh country code to get information for, for countries
with codes less than 255
0FFh to get country information for countries with a code
greater than 255
BX 16 bit country code if AL=0FFh
DS:DX pointer to the memory buffer where the data will be returned
DX 0FFFFh if setting country code rather than getting info
return CF 0 (clear) function completed
1 (set) error
AX error code
02h invalid country code (no table for it)
(if DX <> 0FFFFh)
BX country code (usually international telephone code)
DS:DX pointer to country data buffer
bytes 0,1 date/time format
0 USA standard H:M:S M/D/Y
1 European standard H:M:S D/M/Y
2 Japanese standard H:M:S D:M:Y
bytes 2-6 currency symbol null terminated
byte 07h thousands separator null terminated
byte 08h zeroes
byte 09h decimal separator null terminated
byte 0Ah zeroes
byte 0Bh date separator null terminated
byte 0Ch zeroes
byte 0Dh time separator null terminated
byte 0Eh zeroes
byte 0Fh bit field currency format
bit 0 = 0 if currency symbol precedes the value
1 if currency symbol is after the value
bit 1 = 0 no spaces between value and currency symbol
1 one space between value and currency symbol
bit 2 = 1 set if currency symbol replaces decimal pt
bits 3-7 not defined by Microsoft
byte 10h number of significant decimal digits in currency
(number of places to right of decimal point)
byte 11h time format
bit 0 = 0 12 hour clock
1 24 hour clock
bits 1-7 unknown, probably not used
bytes 12h-15h address of case map routine (FAR CALL, AL = char)
entry AL ASCII code of character to be converted to
uppercase
return AL ASCII code of the uppercase input character
byte 16h data-list separator character
byte 17h zeroes
bytes 18h-21h 5 words reserved
note 1) When an alternate keyboard handler is invoked, the keyboard routine is
loaded into user memory starting at the lowest portion of availible
user memory. The BIOS interrupt vector that services the keyboard is
redirected to the memory area where the new routine resides. Each new
routine takes up about 1.6K of memory and has lookup tables that return
values unique to each language. (KEYBxx in the DOS book)
Once the keyboard interrupt vector is changed by the DOS keyboard
routine, the new routine services all calls unless the system is
returned to the US format by the ctrl-alt-F1 keystroke combination. This
does not change the interrupt vector back to the BIOS location; it
merely passes the table lookup to the ROM locations.
2) Ctrl-Alt-F1 will only change systems with US ROMS to the US layout.
Some systems are delivered with non-US keyboard handler routines in ROM
3) Case mapping call: the segment/offset of a FAR procedure that performs
country-specific lower-to-upper case mapping on ASCII characters 80h to
0FFh. It is called with the character to be mapped in AL. If there is
an uppercase code for the letter, it is returned in AL, if there is no
code or the function was called with a value of less than 80h AL is
returned unchanged.
4) This call is fully implemented in MS-DOS version 2.01 and higher. It
is in version 2.00 but not fully implemented (according to Microsoft)
Function 38h Set Country Dependent Information
entry AH 38h
AL code country code to set information for, for countries
with codes less than 255
0FFh to set country information for countries with a code
greater than 255
BX 16 bit country code if AL=0FFh
DX 0FFFFh
return CF clear successful
set if error
AX error code (02h)
Function 39h Create Subdirectory (MKDIR)
Makes a subdirectory along the indicated path
entry AH 39h
DS:DX address of ASCIIZ pathname string
return flag CF 0 successful
1 error
AX error code if any (3, 5)
note 1) The ASCIIZ string may contain drive and subdirectory.
2) Drive may be any valid drive (not nescessarily current drive)
3) The pathname cannot exceed 64 characters
Function 3Ah Remove Subdirectory (RMDIR)
entry AH 3Ah
DS:DX address of ASCIIZ pathname string
return CF clear successful
set AX error code if any (3, 5, 16)
note 1) The ASCIIZ string may contain drive and subdirectory.
2) Drive may be any valid drive (not nescessarily current drive)
3) The pathname cannot exceed 64 characters
Function 3Bh Change Current Directory (CHDIR)
entry AH 3Bh
DS:DX address of ASCIIZ string
return flag CF 0 successful
1 error
AX error code if any (3)
note 1) The pathname cannot exceed 64 characters
2) The ASCIIZ string may contain drive and subdirectory.
3) Drive may be any valid drive (not nescessarily current drive)
Function 3Ch Create A File (CREAT)
Create a file with handle
entry AH 3Ch
CX attributes for file
00h normal
01h read only
02h hidden
03h system
DS:DX address of ASCIIZ filename string
return flag CF 0 successful creation
1 error
AX 16 bit file handle
or error code (3, 4, 5)
note 1) The ASCIIZ string may contain drive and subdirectory.
2) Drive may be any valid drive (not nescessarily current drive)
3) If the volume label or subdirectory bits are set in CX, they are ignored
4) The file is opened in read/write mode
5) If the file does not exist, it is created. If one of the same name
exists, it is truncated to a length of 0.
6) Good practice is to attempt to open a file with fn 3Dh and jump to an
error routine if successful, create file if 3Dh fails. That way an
existing file will not be truncated and overwritten.
Function 3Dh Open A File
Open disk file with handle
entry AH 3Dh
AL access code byte
(DOS 2.x) bits 0-2 file attribute
000 read only
001 write only
010 read/write
bits 3-7 should be set to zero
(DOS 3.x) bits 0-2 file attribute
000 read only
001 write only
010 read/write
bit 3 reserved
0 should be set to zero
bits 4-6 sharing mode (network)
000 compatibility mode (the way FCBs open files)
001 read/write access denied (exclusive)
010 write access denied
011 read access denied
100 full access permitted
bit 7 inheritance flag
0 file inherited by child process
1 file private to child process
DS:DX address of ASCIIZ pathname string
return flag CF set on error
AX error code
1 error
AX 16 bit file handle
or error code (1, 2, 4, 5, 0Ch)
note 1) Opens any normal, system, or hidden file
2) Files that end in a colon are not opened
3) The rear/write pointer is set at the first byte of the file and the
record size of the file is 1 byte (the read/write pointer can be changed
through function call 42h). The returned file handle must be used for
all subsequent input and output to the file.
4) If the file handle was inherited from a parent process or was
duplicated by DUP or FORCEDUP, all sharing and access restrictions are
also inherited.
5) A file sharing error (error 1) causes an int 24h to execute with an
error code of 2
Function 3Eh Close A File Handle
Close a file and release handle for reuse
entry AH 3Eh
BX file handle
return flag CF 0 successful close
1 error
AX error code if error (6)
note 1) When executed, the file is closed, the directory is updated, and all
buffers for that file are flushed. If the file was changed, the time
and date stamps are changed to current
2) If called with the handle 00000, it will close STDIN (normally the
keyboard).
Function 3Fh Read From A File Or Device
Read from file with handle
entry AH 3Fh
BX file handle
CX number of bytes to read
DS:DX address of buffer
return flag CF 0 successful read
1 error
AX 0 pointer was already at end of file
or number of bytes read
or error code (5, 6)
note 1) This function attempts to transfer the number of bytes specified in CX
to a buffer location. It is not guaranteed that all bytes will be read.
If AX < CX a partial record was read.
2) If performed from STDIN (file handle 0000), the input can be redirected
3) If used to read the keyboard, it will only read to the first CR
4) The file pointer is incremented to the last byte read.
Function 40h Write To A File Or Device
Write to file with handle
entry AH 40h
BX file handle
CX number of bytes to write
DS:DX address of buffer
return flag CF 0 successful write
1 error
AX number of bytes written
or error code (5, 6)
note 1) This call attempts to transfer the number of bytes indicated in CX
from a buffer to a file. If CX and AX do not match after the write,
an error has taken place; however no error code will be returned for
this problem. This is usually caused by a full disk.
2) If the write is performed to STDOUT (handle 0001), it may be redirected
3) To truncate the file at the current position of the file pointer, set
the number of bytes in CX to zero before calling int 21h. The pointer
can be moved to any desired position with function 42h.
4) This function will not write to a file or device marked read-only.
5) May also be used to display strings to CON instead of fn 09h. This
function will write CX bytes and stop; fn 09h will continue to write
until a $ character is found.
6) This is the call that DOS actually uses to write to the screen in DOS
2.x and above.
Function 41h Delete A File From A Specified Subdirectory (UNLINK)
entry AH 41h
DS:DX pointer to ASCIIZ filespec to delete
return CF 0 successful
1 error
AX error code if any (2, 5)
note 1) This function will not work on a file marked read-only
2) Wildcards are not accepted
Function 42h Move a File Read/Write Pointer (LSEEK)
entry AH 42h
AL method code
00h offset from beginning of file
01h offset from present location
02h offset from end of file
BX file handle
CX most significant half of offset
DX least significant half of offset
return AX low offset of new file pointer
DX high offset of new file pointer
CF 0 successful move
1 error
AX error code (1, 6)
note 1) If pointer is at end of file, reflects file size in bytes.
2) The value in DX:AX is the absolute 32 bit byte offset from the beginning
of the file
Function 43h Get/Set file attributes (CHMOD)
entry AH 43h
AL 00h get file attributes
01h set file attributes
CX file attributes to set
bit 0 read only
1 hidden file
2 system file
3 volume label
4 subdirectory
5 written since backup
DS:DX pointer to full ASCIIZ file name
return CF set if error
AX error code (1, 2, 3, 5)
CX file attributes on get
attributes:
01h read only
02h hidden
04h system
0FFh archive
note 1) This call will not change the volume label or directory bits
Function 44h I/O Control for Devices (IOCTL)
Get or Set Device Information
entry AH 44h
AL 00h Get Device Information (from DX)
BX file or device handle
return DX device info
If bit 7 set: (character device)
bit 0: console input device
1: console output device
2: NUL device
3: CLOCK$ device
4: device is special
5: binary (raw) mode
6: not EOF
12: network device (DOS 3.x)
14: can process IOCTL control
strings (func 2-5)
If bit 7 clear: (file)
bits 0-5: block device number
6: file has not been written
12: Network device (DOS 3.x)
15: file is remote (DOS 3.x)
01h Set Device Information (DH must be zero for this call)
DX bits:
0 1 console input device
1 1 console output device
2 1 null device
3 1 clock device
4 1 reserved
5 0 binary mode - don't check for control chars
1 cooked mode - check for control chars
6 0 EOF - End Of File on input
7 device is character device if set, if not, EOF
is 0 if channel has been written, bits 0-5 are
block device number
12 network device
14 1 can process control strings (AL 2-5, can only be
read, cannot be set)
15 n reserved
02h Read CX bytes to device in DS:DX from BX control chan
03h Write Device Control String
BX device handle
CX number of bytes to write
DS:DX pointer to buffer
return AX number of bytes written
04h Read From Block Device (drive number in BL)
BL drive number (0=default)
CX number of bytes to read
DS:DX pointer to buffer
return AX number of bytes read
05h Write to Block Device (drive number in BL)
AX number of bytes transfered
06h Get Input Handle Status
BX file or device handle
return AL 0FFh device ready
00h device not ready
07h Get Output Handle Status
return AL 00h not ready
0FFh ready
note: for DOS 2.x, files are always ready for output
08h Removable Media Bit (DOS 3.x+)
return AX 00h device is removable
01h device is nonremovable
0Fh invalid drive specification
09h Test whether Local or Network Device in BL (DOS 3.x+)
BL drive number (0=default)
return DX attribute word, bit 12 set if device is
remote
0Ah Is Handle in BX Local or Remote? (DOS 3.x+)
BX file handle
return DX (attribute word) bit 15 set if file is remote
0Bh Change Sharing Retry Count to DX (default=3), (DOS 3.x+)
CX delay (default=1)
DX retry count (default=3)
0Ch General IOCTL (DOS 3.3 [3.2?]) allows a device driver to
prepare, select, refresh, and query Code Pages
0Dh Block Device Request (DOS 3.3+)
BL drive number (0=default)
CH major subfunction
CL minor subfunction
40h set device parameters
41h write logical device track
42h format and verify logical device track
60h get device parameters
61h read logical device track
62h verify logical device track
DS:DX pointer to parameter block
0Eh Get Logical Device (DOS 3.3+)
BL drive number (0=default)
return AL=0 block device has only one logical drive
assigned 1..n the last letter used to reference
the device (1=A:,etc)
0Fh Set Logical Device (DOS 3.3+)
BL drive number: 0=default, 1=A:, 2=B:, etc.
BX file handle
CX number of bytes to read or write
DS:DX data or buffer
DX data
return AX number of bytes transferred
or error code (call function 59h for extended error codes)
or status 00h not ready
0FFh ready
CF set if error
Function 45h Duplicate a File Handle (DUP)
entry AH 45h
BX file handle to duplicate
return CF clear AX duplicate handle
set AX error code (4, 6)
note 1) If you move the pointed of one handle, the pointer of the other will
also be moved.
2) The handle in BX must be open
Function 46h Force Duplicate of a Handle (FORCEDUP or CDUP)
Forces handle in CX to refer to the same file at the same
position as BX
entry AH 46h
BX existing file handle
CX new file handle
return CF clear both handles now refer to existing file
set error
AX error code (4, 6)
note 1) If CX was an open file, it is closed first
2) If you move the read/write pointer of either file, both will move
3) The handle in BX must be open
Function 47h Get Current Directory
Places full pathname of current directory/drive into a buffer
entry AH 47h
DL drive (0=default, 1=A:, etc.)
DS:SI points to 64-byte buffer area
return CF clear DS:DI pointer to ASCIIZ pathname of current directory
set AX error code (0Fh)
note String does not begin with a drive identifier or a backslash
Function 48h Allocate Memory
Allocates requested number of 16-byte paragraphs of memory
entry AH 48h
BX number of 16-byte paragraphs desired
return CF clear AX segment address of allocated space
BX maximum number paragraphs available
set AX error code (7, 8)
note BX indicates maximum memory availible only if allocation fails
Function 49h Free Allocated Memory
Frees specified memory blocks
entry AH 49h
ES segment address of area to be freed
return CF clear successful
set AX error code (7, 9)
note 1) This call is only valid when freeing memory obtained by function 48h.
2) A program should not try to release memory not belonging to it.
Function 4Ah Modify Allocated Memory Blocks (SETBLOCK)
Expand or shrink memory for a program
entry AH 4AH
BX new size in 16 byte paragraphs
ES segment address of block to change
return CF clear nothing
set AX error code (7, 8, 9)
or BX max number paragraphs available
note 1) Max number paragraphs availible is returned only if the call fails
2) Memory can be expanded only if there is memory availible
Function 4Bh Load or Execute a Program (EXEC)
entry AH 4Bh
AL 00h load and execute program. A PSP is built for the program
the ctrl-break and terminate addresses are set to the
new PSP.
*01h load but don't execute (note 1)
*01h load but don't execute (internal, DOS 3.x & DESQview)
*02h load but do not execute (internal, DOS 2.x only)
03h load overlay (do not create PSP, do not begin execution)
DS:DX points to the ASCIIZ string with the drive, path, and filename
to be loaded
ES:BX points to a parameter block for the load
(AL=00h) word segment address of environment string to be
passed
dword pointer to the command line to be placed at
PSP+80h
dword pointer to default FCB to be passed at PSP+5Ch
dword pointer to default FCB to be passed at PSP+6Ch
(*AL=01h) word segment of environment (0 = use current)
dword pointer to command line
dword pointer to FCB 1
dword pointer to FCB 2
dword will hold SS:SP on return
dword will hold program entry point (CS:IP) on return
(*AL=02h) word segment of environment (0 = use current)
dword pointer to command line
dword pointer to FCB 1
dword pointer to FCB 2
(AL=03h) word segment address where file will be loaded
word relocation factor to be applied to the image
return CF set error
AX error code (1, 2, 8, 0Ah, 0Bh)
note 1) If you make this call with AL=1 the program will be loaded as if you
made the call with AL=0 except that the program will not be executed.
Additionally, with AL=1 the stack segment and pointer along with the
program's CS:IP entry point are returned to the program which made the
4B01h call. These values are put in the four words at ES:BX+0Eh. On
entry to the call ES:BX points to the environment address, the command
line and the two default FCBs. This form of EXEC is used by DEBUG.COM.
2) Application programs may invoke a secondary copy of the command
processor (normally COMMAND.COM) by using the EXEC function. Your
program may pass a DOS command as a parameter that the secondary
command processor will execute as though it had been entered from the
standard input device.
The procedure is:
A. Assure that adequate free memory (17k for 2.x and 3.0, 23k for 3.1
up) exists to contain the second copy of the command processor and
the command it is to execute. This is accomplished by executing
function call 4Ah to shrink memory allocated to that of your current
requirements. Next, execute function call 48h with BX=0FFFFh. This
returns the amount of memory availible.
B. Build a parameter string for the secondary command processor in the
form:
1 byte length of parameter string
xx bytes parameter string
1 byte 0Dh (carriage return)
For example, the assembly language statement below would build the
string to cause execution of the command FOO.EXE:
DB 19,"/C C:FOO",13
C. Use the EXEC function call (4Bh), function value 0 to cause execution
of the secondary copy of the command processor. (The drive,
directory, and name of the command processor can be gotten from the
COMSPEC variable in the DOS environment passed to you at PSP+2Ch.)
D. Remember to set offset 2 of the EXEC control block to point to the
string built above.
3) All open files of a process are duplicated in the newly created
process after an EXEC, except for files originally opened with the
inheritance bit set to 1.
4) The environment is a copy of the original command processor's
environment. Changes to the EXECed environment are not passed back to
the original. The environment is followed by a copy of the DS:DX
filename passed to the child process. A zero value will cause the
child process to inherit the environment of the calling process. The
segment address of the environment is placed at offset 2Ch of the
PSP of the program being invoked.
5) This function uses the same resident part of COMMAND.COM, but makes a
duplicate of the transient part.
6) How EXEC knows where to return to: Basically the vector for int 22h
holds the terminate address for the current process. When a process
gets started, the previous contents of int 22h get tucked away in the
PSP for that process, then int 22h gets modified. So if Process A
EXECs process B, while Process B is running, the vector for int 22h
holds the address to return to in Process A, while the save location in
Process B's PSP holds the address that process A will return to when
*it* terminates. When Process B terminates by one of the usual legal
means, the contents of int 22h are (surmising) shoved onto the stack,
the old terminate vector contents are copied back to int 22h vector from
Process B's PSP, then a RETF or equivalent is executed to return control
to process A.
7) To load an overlay file with 4B: first, don't de-allocate the memory
that the overlay will load into. With the other 4Bh functions, the
opposite is true--you have to free the memory first, with function 4Ah.
Second, the "segment address where the file will be loaded" (first item
in the parameter block for sub-function 03) should be a paragraph
boundary within your currently-allocated memory. Third, if the
procedures within the overlay are FAR procs (while they execute, CS will
be equal to the segment address of the overlay area), the relocation
factor should be set to zero. On the other hand, if the CS register
will be different from the overlay area's segment address, the
relocation factor should be set to represent the difference. You
determine where in memory the overlay file will load by using the
segment address mentioned above. Overlay files are .EXEs (containing
header, relocation table, and memory image).
8) When function 00h returns, all registers are changed, including the
stack. You must resore SS, SP, and any other required registers.
Function 4Ch Terminate a Process (EXIT)
Quit with ERRORLEVEL exit code
entry AH 4Ch
AL exit code in AL when called, if any, is passed to next process
return none
note 1) Control passes to DOS or calling program
2) return code from AL can be retrieved by ERRORLEVEL or function 4Dh
3) all files opened by this process are closed, buffers are flushed, and
the disk directory is updated
4) Restores Terminate vector from PSP:000Ah
Ctrl-C vector from PSP:000Eh
Critical Error vector from PSP:0012h
Function 4Dh Get Return Code of a Subprocess (WAIT)
Gets return code from functions 31h and 4Dh (ERRORLEVEL)
entry AH 4Dh
return AL exit code of subprogram (functions 31h or 4Ch)
AH circumstance which caused termination
00h normal termination
01h control-break
02h critical device error
03h terminate and stay resident (function 31h)
note The exit code is only returned once
Function 4Eh Find First Matching File (FIND FIRST)
entry AH 4Eh
CX search attributes
DS:DX pointer to ASCIIZ filename (with attributes)
return CF set AX error code (2, 12h)
clear data block written at current DTA
format of block is: (info from BIX)
documented by Micro- |00h 1 byte attribute byte of search
soft as "reserved for |01h 1 byte drive letter for search
DOS' use on subsquent |02h 11 bytes the search name used
Find Next calls" |0Ch 2 bytes word value of last entry
function 4Fh |0Fh 4 bytes dword pointer to this DTA
|13h 2 bytes word directory start
| PC-DOS 3.10 (from INTERRUP.ARC)
|00h 1 byte drive letter
|01h-0Bh bytes search template
|0Ch 1 byte search attributes
| DOS 2.x (and DOS 3.x except 3.1?) (from INTERRUP.ARC)
|00h 1 byte search attributes
|01h 1 byte drive letter
|02h-0Ch bytes search template
|0Dh-0Eh 2 bytes entry count within directory
|0Fh-12h bytes reserved
|13h-14h 2 bytes cluster number of parent directory
15h 1 byte file attribute
16h 2 bytes file time
18h 2 bytes file date
1Ah 2 bytes low word of file size
1Ch 2 bytes high word of file size
1Eh 13 bytes name and extension of file found, plus
1 byte of 0s. All blanks are removed
from the name and extension, and if an
extension is present it is preceded by a
period.
note 1) Will not find volume label
2) This function does not support network operations
3) Wildcards are allowed in the filespec
4) If the attribute is zero, only ordinary files are found. If the volume
label bit is set, only volume labels will be found. Any other attribute
will return that attribute and all normal files together.
5) To look for everything except the volume label, set the hidden, system,
and subdirectory bits all to 1
Function 4Fh Find Next Matching File (FIND NEXT)
Find next ASCIIZ file
entry AH 4Fh
return CF clear data block written at current DTA
set AX error code (2, 12h)
note 1) If file found, DTA is formatted as in call 4Eh
2) Volume label searches using 4Eh/4Fh reportedly aren't 100% reliable
under DOS 2.x. The calls sometime report there's a volume label and
point to a garbage DTA, and if the volume label is the only item they
often won't find it
3) This function does not support network operations
4) Use of this call assumes that the original filespec contained wildcards
Function 50h "Used Internally by DOS" - Set PSP
* Set new Program Segment Prefix (current Process ID)
entry AH 50h
BX segment address of new PSP
return none - swaps PSP's regarded as current by DOS
note 1) By putting the PSP segment value into BX and issuing call 50h DOS stores
that value into a variable and uses that value whenever a file call is
made.
2) Note that in the PSP (or PDB) is a table of 20 (decimal) open file
handles. The table starts at offset 18h into the PSP. If there is an
0FFh in a byte then that handle is not in use. A number in one of the
bytes is an index into an internal FB table for that handle. For
instance the byte at offset 18h is for handle 0, at offset 19h handle
1, etc. up to 13h. If the high bit is set then the file associated by
the handle is not shared by child processes EXEC'd with call 4Bh.
3) Function 50h is dangerous in background operations prior to DOS 3.x as
it uses the wrong stack for saving registers. (same as functions
0..0Ch in DOS 2.x)
4) Under DOS 2.x, this function cannot be invoked inside an int 28h handler
without setting the Critical Error flag
5) Open File information, etc. is stored in the PSP DOS views as current.
If a program (eg. a resident program) creates a need for a second PSP,
then the second PSP should be set as current to make sure DOS closes
that as opposed to the first when the second application finishes.
6) See PC Mag Vol.5, No 9, p.314 for discussion.
7) Used by DOS 3.3 PRINT & DEBUG, DesQview 2.01, Windows 1.03, SYMDEB
from MASM 4.0
Function 51h "Used Internally by DOS" - Get Program Segment Prefix
* Returns the PSP address of currently executing program
entry AH 51h
return BX address of currently executing program
offset
00h program exit point
02h memory size in paragraphs
04h unused (0)
05h CP/M style entry point (far call to DOS)
0Ah terminate address (old int 22h)
0Ch terminate segment
0Eh break address (old int 23h)
10h break segment
12h error address (old int 24h)
14h error segment
16h parent PSP segment
18h DOS 2.0+ open files, 0FFh = unused
2Ch DOS 2.0+ environment segment
2Eh far ptr to process's SS:SP
32h DOS 3.x max open files
34h DOS 3.x openfile table address
36h DOS 3.x openfile table segment
38h unused by DOS versions <= 3.3
50h DOS function dispatcher (FAR routine)
53h unused
55h FCB #1 extension
5Ch FCB #1
6Ch FCB #2
80h command tail / default DTA buffer
note 1) Used in DOS 2.x, 3.x uses 62h
2) Function 51h is dangerous in background operations prior to DOS 3.x as
it uses the wrong stack for saving registers. (same as functions
0..0Ch in DOS 2.x)
3) 50h and 51h might be used if you have more than one process in a PC.
For instance if you have a resident program that needs to open a file
you could first call 51h to save the current id and then call 50h to set
the ID to your PSP.
4) Under DOS 2.x, this function cannot be invoked inside an int 28h handler
without setting the Critical Error flag
5) Used by DOS 3.3 PRINT, DEBUG
Function 52h "Used Internally by DOS" - IN-VARS
* Returns a pointer to a set of DOS data variables MCB chain,
pointer to first device driver and a pointer to disk parameter
blocks (first one)
entry AH 52h
return ES:BX pointer to the DOS list of lists, for disk information. Does not
access the disk, so information in tables might be incorrect if
disk has been changed. Returns a pointer to the following array
of longword pointers:
Bytes Value
-2h,-1h segment of first memory control block
00h-03h pointer to first DOS disk block (see function 36h)
04h-07h Pointer to list of DOS file tables
dword pointer to next file table
word number of files in this table
35h bytes per file
00h-01h number of file handles referring to
this file
02h-06h unknown
07h-0Ah pointer to device driver header if
character device; pointer to DOS Device
Control Block if block device (see
fn 32h for format)
0Bh-1Fh unknown
20h-2Ah filename in FCB format (no path, no
period, blank-padded)
2Bh-2Ch PSP segment of file's owner
2Dh-30h unknown - 0 always
31h-32h unknown
33h-34h unknown
8h-0Bh pointer to CLOCK$ device driver, whether installable or
resident
0Ch-0Fh pointer to actual CON: device driver, whether
installable or resident
(DOS 2.x)
10 number of logical drives in system
11-12 maximum bytes/block of any block device
13-16 unknown
17 beginning (not a pointer. The real beginning!) of NUL
device driver. This is the first device on DOS's linked
list of device drivers.
(DOS 3.x)
10h-11h maximum bytes/block of any block device (0200h)
12h-15h pointer to first disk buffer
16h-19h partially undefined: Pointer to array of drive info:
51h bytes per drive, starting with A: ...
00h-3Fh current path as ASCIIZ, starting with 'x:\'
40h-43h unknown zeros always
44h unknown flags? Usually 40h, except for
entry after last valid entry = 00h
45h-48h pointer to DOS disk block for this drive
49h-4Ah unknown. Current track or block?
-1 if never accessed
4Bh-4Eh unknown -1 always
4Fh-52h unknown 2 always
1Ah-1Dh pointer to FCB table (if CONFIG.SYS contains FCBS=)
1Eh-1Fh size of FCB table
20h number of block devices
21h value of LASTDRIVE command in CONFIG.SYS (default 5)
22h beginning (not a pointer. The real beginning!) of NUL
device driver. This is the first device on DOS's linked
list of device drivers.
note 1) This call is not supported in OS/2 1.0's DOS Compatibility Box
2) Used by DOS 4.0 MEM.EXE, DOS 3.3 ASSIGN.COM, PRINT.COM, SUBST.EXE
Function 53h "Used Internally by DOS" - Translate BPB
* Translates BPB (BIOS Parameter Block, see below) into a DOS Disk
Block (see function call 32h).
entry AH 53h
DS:SI pointer to BPB
ES:BP pointer to area for DOS Disk Block.
Layout of Disk Block:
bytes value
00h-01h bytes per sector, get from DDB bytes 02h-03h.
02h sectors per cluster, get from (DDB byte 4) + 1
03h-04h reserved sectors, get from DDB bytes 06h-07h
05h number of FATs, get from DDB byte 08h
06h-07h number of root dir entries, get from DDB bytes 09h-0Ah
08h-09h total number of sectors, get from:
((DDB bytes 0Dh-0Eh) - 1) * (sectors per cluster (BPB
byte 2)) + (DDB bytes 0Bh-0Ch)
0Ah media descriptor byte, get from DDB byte 16h
0Bh-0Ch number of sectors per FAT, get from DDB byte 0Fh
return unknown
Function 54h Get Verify Setting
Get verify flag status
entry AH 54h
return AL 00h if flag off
01h if flag on
note Flag can be set with function 2Eh
Function 55h "Used Internally by DOS" - Create "Child" PSP
* Create PSP: similar to function 26h (which creates a new Program
Segment Prefix at segment in DX) except creates a "child" PSP
rather than copying the existing one.
entry AH 55h
DX segment number at which to create new PSP.
return unknown
note 1) This call is similar to call 26h which creates a PSP except that unlike
call 26h the segment address of the parent process is obtained from the
current process ID rather than from the CS value on the stack (from the
INT 21h call). DX has the new PSP value and SI contains the value to be
placed into PSP:2 (top of memory).
2) Function 55 is merely a substitute for function 26h. It will copy the
current PSP to the segment address DX with the addition that SI is
assumed to hold the new memory top segment. This means that function
26h sets SI to the segment found in the current PSP and then calls
function 55h.
Function 56h Rename a File
entry AH 56h
DS:DX pointer to ASCIIZ old pathname
ES:DI pointer to ASCIIZ new pathname
return CF clear successful rename
set AX error code (2, 3, 5, 11h)
note 1) Works with files in same drive only
2) Global characters not allowed in filename
3) The name of a file is its full pathname. The file's full pathname can
be changed, while leaving the actual FILENAME.EXT unchanged. Changing
the pathname allows the file to be "moved" from subdirectory to
subdirectory on a logical drive without actually copying the file.
4) DOS 3.x allows renaming of directories
** Programmer's Technical Reference for MSDOS and the IBM PC **
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ Shareware Version, 06/17/91 ³
³ Please Register Your Copy ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
Copyright (c) 1987, 1991 Dave Williams
USA copyright TXG 392-616 ALL RIGHTS RESERVED
ISBN 1-878830-02-3 (disk-based text)
C H A P T E R F I V E
Interrupts 22h Through 86h
note: the registered version of this chapter is more than twice this size.
Interrupt 22h Terminate Address
(0:0088h)
This interrupt transfers control to the far (dword) address at this interrupt
location when an application program terminates. The default address for this
interrupt is 0:0088h through 0:008Bh. This address is copied into the program's
Program Segment Prefix at bytes 0Ah through 0Dh at the time the segment is
created and is restored from the PSP when the program terminates. The calling
program is normally COMMAND.COM or an application. Do not issue this interrupt
directly, as the EXEC function call does this for you. If an application
spawns a child process, it must set the Terminate Address prior to issuing the
EXEC function call, otherwise when the second program terminated it would
return to the calling program's Terminate Address rather than its own. This
address may be set with int 21, function 25h.
Interrupt 23h Ctrl-Break Exit Address
(0:008Ch)
If the user enters a Ctrl-Break during STDIN, STDOUT, STDPRN, or STDAUX, int
23h is executed. If BREAK is on, int 23h is checked on MOST function calls
(notably 06h). If the user written Ctrl-Break routine saves all registers, it
may end with a return-from-interrupt instruction (IRET) to continue program
execution. If the user-written interrupt program returns with a long return, the
carry flag is used to determine whether the program will be aborted. If the
carry flag is set, the program is aborted, otherwise execution continues (as
with a return by IRET). If the user-written Ctrl-Break interrupt uses function
calls 09h or 0Ah, (Display String or Buffered Keyboard Input) then a three-byte
string of 03h-0Dh-0Ah (ETX/CR/LF) is sent to STDOUT. If execution is continued
with an IRET, I/O continues from the start of the line. When the interrupt
occurs, all registers are set to the value they had when the original function
call to DOS was made. There are no restrictions on what the Ctrl-Break handler
is allowed to do, including DOS function calls, as long as the registers are
unchanged if an IRET is used. If the program creates a new segment and loads a
second program which itself changes the Ctrl-Break address, the termination of
the second program and return to the first causes the Ctrl-Break address to
be restored from the PSP to the value it had before execution of the second
program.
Interrupt 24h Critical Error Handler
(0:0090h)
When a critical error occurs within DOS, control is transferred to an error
handler with an int 24h. This may be the standard DOS error handler (ABORT,
RETRY, IGNORE) or a user-written routine.
On entry to the error handler, AH will have its bit 7=0 (high order bit)
if the error was a disk error (probably the most common error), bit 7=1 if
not.
BP:SI contains the address of a Device Header Control Block from which
additional information can be retrieved (see below).
The register is set up for a retry operation and an error code is in the
lower half of the DI register with the upper half undefined. These are the
error codes:
The user stack is in effect and contains the following from top to bottom:
IP DOS registers from issuing int 24h
CS int 24h
flags
AX user registers at time of signal
BX int 21h request
CX
DX
SI
DI
BP
DS
ES
IP from original int 21h
CS
flags
To reroute the critical error handler to a user-writen critical error handler,
the following should be done:
Before an int 24h occurs:
1) The user application initialization code should save the int 24h vector and
replace the vector with one pointing to the user error routine.
When the int 24h occurs:
2) When the user error routine received control it should push the flag
registers onto the stack and execute a far call to the original int 24h
vector saved in step 1.
3) DOS gives the appropriate prompt, and waits for user input (Abort, Retry,
Ignore, Fail). After the user input, DOS returns control to the user error
routine instruction following the far call.
4) The user error routine can now do any tasks nescessary. To return to the
original application at the point the error occurred, the error routine needs
to execute an IRET instruction. Otherwise, the user error routine should
remove the IP, CS, and flag registers from the stack. Control can then be
passed to the desired point.
Int 24h provides the following values in registers on entry to the interrupt
handler:
entry AH status byte (bits)
7 0 disk I/O hard error
1 other error - if block device, bad FAT
- if char device, code in DI
6 unused
5 0 if IGNORE is not allowed
1 if IGNORE is allowed
4 0 if RETRY is not allowed
1 if RETRY is allowed
3 0 if FAIL is not allowed
1 if FAIL is allowed
2 \ disk area of error 00 = DOS area 01 = FAT
1 / 10 = root dir 11 = data area
0 0 if read operation
1 if write operation
AL drive number if AH bit 7 = 1, otherwise undefined
If it is as hard error on disk (AH bit 7=0), register AL
contains the failing drive number (0=A:, 1=B:, etc.).
BP:SI address of a Device Header Control Block for which error
occurred block device if high bit of BP:SI+4 = 1
low byte of DI: error code (note: high byte is undefined)
error code description
00h attempt to write on write-protected diskette
01h unknown unit
02h drive not ready
03h unknown command
04h data error (bad CRC)
05h bad request structure length
06h seek error
07h unknown media type
08h sector not found
09h printer out of paper
0Ah write fault
0Bh read fault
0Ch general failure
0Fh invalid disk change (DOS 3.x+)
10h (DOS 3.x) FCB unavailable
11h (DOS 3.x) sharing buffer overflow
The handler must return this information:
The registers are set such that if an IRET is executed, DOS responds according
to (AL) as follows:
AL 00h ignore the error
01h retry the operation
02h terminate via int 22h
03h fail the system call that is in progress (DOS 3.x+)
note 1) Be careful when choosing to ignore a response because this causes DOS to
beleive that an operation has completed successfully when it may not
have.
2) If the error was a character device, the contents of AL are invalid.
OTHER ERRORS
If AH bit 7=1, the error occurred on a character device, or was the result of
a bad memory image of the FAT. The device header passed in BP:SI can be examined
to determine which case exists. If the attribute byte high-order bit indicates
a block device, then the error was a bad FAT. Otherwise, the error is on a
character device.
If a character device is involved, the contents of AL are unpredictable, the
error code is in DI as above.
Notes:
1. Before giving this routine control for disk errors, DOS performs several
retries. The number of retries varies according to the DOS version.
2. For disk errors, this exit is taken only for errors occurring during an
int 21h function call. It is not used for errors during an int 25h or 26h.
3. This routine is entered in a disabled state.
4. All registers must be preserved.
5. This interrupt handler should refrain from using DOS function calls. If
necessary, it may use calls 01h through 12h. Use of any other call destroys
the DOS stack and leaves DOS in an unpredictable state.
6. The interrupt handler must not change the contents of the device header.
7. If the interrupt handler handles errors itself rather than returning to DOS,
it should restore the application program's registers from the stack,
remove all but the last three words on the stack, then issue an IRET. This
will return to the program immediately after the int 21h that experienced
the error. Note that if this is done DOS will be in an unstable state until
a function call higher than 12h is issued, therefore not recommended.
8. For DOS 3.x, IGNORE requests (AL=0) are converted to FAIL for critical
errors that occur on FAT or DIR sectors.
9. For DOS 3.10 up, IGNORE requests (AL=0) are converted to FAIL requests
for network critical errors (50-79).
The device header pointed to by BP:SI is as follows:
DWORD Pointer to next device (0FFFFh if last device)
WORD Attributes:
Bit 15 1 if character device.
If bit 15 is 1:
Bit 0 = 1 if current standard input
Bit 1 = 1 if current standard output
Bit 2 = 1 if current NULL device
Bit 3 = 1 if current CLOCK device
0 if block device
Bit 14 is the IOCTL bit
WORD pointer to device driver strategy entry point
WORD pointer to device driver interrupt entry point
8-BYTE character device named field for block devices. The first byte is the
number of units.
To tell if the error occurred on a block or character device, look at bit 15
in the attribute field (WORD at BP:SI+4).
If the name of the character device is desired, look at the eight bytes
starting at BP:SI+10.
HANDLING OF INVALID RESPONSES (DOS 3.x)
A) If IGNORE (AL=0) is specified by the user and IGNORE is not allowed
(bit 5=0), make the response FAIL (AL=3).
B) If RETRY (AL=1) is specified by the user and RETRY is not allowed
(bit 4=0), make the response FAIL (AL=3).
C) If FAIL (AL=3) is specified by the user and FAIL is not allowed (bit
3=0), make the response ABORT. (AL=2)
Interrupt 25h Absolute Disk Read
Interrupt 26h Absolute Disk Write
(0:0094h, 0:0098h)
These transfer control directly to the device driver. On return, the original
flags are still on the stack (put there by the INT instruction). This is
necessary because return information is passed back in the current flags.
The number of sectors specified is transferred between the given drive and the
transfer address. Logical sector numbers are obtained by numbering each sector
sequentially starting from track 0, head 0, sector 1 (logical sector 0) and
continuing along the same head, then to the next head until the last sector on
the last head of the track is counted. Thus, logical sector 1 is track 0, head
0, sector 2; logical sector 2 is track 0, head 0, sector 3; and so on. Numbering
then continues wih sector 1 on head 0 of the next track. Note that although the
sectors are sequentially numbered (for example, sectors 2 and 3 on track 0 in
the example above), they may not be physically adjacent on disk, due to
interleaving. Note that the mapping is different from that used by DOS 1.10 for
dual-sided diskettes.
The request is as follows:
int 25 for Absolute Disk Read,
int 26 for Absolute Disk Write
entry AL drive number (0=A:, 1=B:, etc)
CX number of sectors to read
DS:BX disk transfer address (buffer)
DX first relative sector to read - beginning logical sector number
return CF set if error
AL error code issued to int 24h in low half of DI
AH 01h bad command
02h bad address mark
03h write-protected disk
04h requested sector not found
08h DMA failure
10h data error (bad CRC)
20h controller failed
40h seek operation failed
80h attachment failed to respond
note 1) Original flags on stack! Be sure to pop the stack to prevent
uncontrolled growth
2) Ints 25 and 26 will try rereading a disk if they get an error the first
time.
3) All registers except the segment registers are destroyed by these calls
Interrupt 25h ABSOLUTE DISK READ
(except DOS 4.0/Compaq DOS 3.31 >32M partition)
entry AL drive number (0=A, 1=B, etc)
DS:BX pointer to Disk Transfer Address (buffer)
CX number of sectors to read
DX first relative sector to read
return CF 1 if error
AL error code issued to int 24h in low half of DI
AH 80h attachment failed to respond
40h seek operation failed
20h controller failed
10h data error (bad CRC)
08h DMA failure
04h requested sector not found
03h write-protected disk
02h bad address mark
01h bad command
note Original flags on stack!
Interrupt 25h DOS 4.0/Compaq DOS 3.31 - ABSOLUTE DISK READ
(>32M hard-disk partition)
entry AL drive number (0=A, 1=B, etc)
CX 0FFFFh
DS:BX Packet address
DWORD sector number
WORD number of sectors to read
DWORD transfer address
return same as above?
note Partition is potentially >32Mb (and requires this form of the call) if
bit 1 of device attribute word in device driver is set
Interrupt 26h ABSOLUTE DISK WRITE
(except DOS 4.0/Compaq DOS 3.31 >32M partition)
entry AL drive number (0=A, 1=B, etc)
DS:BX pointer to Disk Transfer Address (buffer)
CX number of sectors to write
DX first relative sector to write
return CF 1 if error
AL error code issued to int 24h in low half of DI
AH same error codes as for int 25h
note Original flags on stack!
Interrupt 26h DOS 4.0/Compaq DOS 3.31 - ABSOLUTE DISK WRITE
(>32M hard disk partitions)
entry AL drive number (0=A, 1=B, etc)
CX 0FFFFh
DS:BX Packet address
DWORD sector number
WORD number of sectors to write
DWORD transfer address
return same as above?
note Partition is potentially >32M (and requires this form of the call) if
bit 1 of device attribute word in device driver is set
Interrupt 27h Terminate And Stay Resident
(0:009Ch) (obsolete)
This vector is used by programs that are to remain resident when COMMAND.COM
regains control.
After initializing itself, the program must set DX to its last address plus
one relative to the program's initial DS or ES value (the offset at which other
programs can be loaded), then execute interrupt 27h. DOS then considers the
program as an extension of itself, so the program is not overlaid when other
programs are executed. This is useful for loading programs such as utilities
and interrupt handlers that must remain resident.
entry CS current program segment
DX last program byte + 1
return none
note 1) This interrupt must not be used by .EXE programs that are loaded into
the high end of memory.
2) This interrupt restores the interrupt 22h, 23h, and 24h vectors in the
same manner as interrupt 20h. Therefore, it cannot be used to install
permanently resident Ctrl-Break or critical error handler routines.
3) The maximum size of memory that can be made resident by this method is
64K.
4) Memory can be more efficiently used if the block containing a copy of
the environment is deallocated before terminating. This can be done by
loading ES with the segment contained in 2Ch of the PSP, and issuing
function call 49h (Free Allocated Memory).
5) DOS function call 4Ch allows a program to pass a completion code to DOS,
which can be interpreted with processing (see function call 31h).
6) Terminate and stay resident programs do not close files.
7) Int 21, function 31h is the preferred method to cause a program to
remain resident because this allows return information to be passed and
allows a program larger than 64K to remain resident.
Interrupt 28h (not documented by Microsoft)
* DOS Idle Interrupt
Int 28h has been provided by DOS since release 2.0. The int 28h process is
similar to the "Timer Tick" process provided by BIOS via int 1Ch in that it is
an "outbound" (from DOS) call which an application can "hook onto" to get
service at a particular entry point. DOS normally only issues int 28h when it
recieves a function call (int 21h) from a foreground application with an
argument in the range of 0 thru 12 (0Ch) in the AH register, or when it is
idling waiting for keyboard input. In effect, when DOS issues int 28h, it is
saying to the background task "I'm not doing anything hot right now, if you can
use the time, go ahead." This means that a foreground application which doesn't
do many low-number DOS functions can preempt CPU time easily.
It is possible, if you are careful, to enhance the background priority by
providing more int 28h calls than DOS normally would issue.
When int 28h is being issued it is usually safe to do DOS calls. You won't get
int 28hs if a program is running that doesn't do its keyboard input through
DOS. You should rely on the timer interrupt for these.
It is used primarily by the PRINT.COM routines, but any number of other
routines can be chained to it by saving the original vector and calling it with
a FAR call (or just JMPing to it) at the end of the new routine.
Int 28h is not called at all when any non-trivial foreground task is running.
As soon as a foreground program has a file open, int 28h no longer gets called.
Could make a good driver for for a background program that works as long as
there is nothing else going on in the machine.
DOS uses 3 separate internal stacks: one for calls 01h through 0Ch; another
for calls 0Dh and above; and a third for calls 01h through 0Ch when a Critical
Error is in progress. When int 28h is called, any calls above 0Ch can be
executed without destroying the internal stack used by DOS at the time.
The byte which is pushed on the stack before an int 28h just indicates which
stack area is being used by the current int 21h call. In DOS 3.1, the code
sequence that calls int 28h looks like this:
PUSH SS:[0304]
INT 28
POP SS:[0304]
The low-order byte of the word pushed contains 1 if the int 21h call currently
in progress is for services 1 through 0Ch, and 0 for service 0 and for 0Dh and
up. Assuming that the last DOS call was not a reentrant one, this tells you
which set of DOS services should be safe to call.
If the InDOS flag is zero on int 28h, then it was called by someone other than
DOS, and the word on the stack should NOT be examined.
entry no parameters availible
return none
note 1) The int 28h handler may invoke any int 21h function except functions
00h through 0Ch (and 50h/51h under DOS 2.x unless DOS CritErr flag is
set).
2) Apparently int 28h is also called during screen writes
3) Until some program installs its own routine, this interrupt vector
simply points to an IRET opcode.
4) Supported in OS/2 1.0's DOS Compatibility Box
Interrupt 29h (not documented by Microsoft)
* Internal - Quick Screen Output
This method is extremely fast (much faster than DOS 21h subfunctions 2 and 9,
for example), and it is portable, even to "non-compatible" MS-DOS computers.
entry AL character to output to screen
return unknown
note 1) Documented by Digital Research's DOS Reference as provided with the
DEC Rainbow
2) If ANSI.SYS is installed, character output is filtered through it.
3) Works on the IBM PC and compatibles, Wang PC, HP-150 and Vectra, DEC
Rainbow, NEC APC, Texas Instruments PC and others
4) This interrupt is called from the DOS's output routines if output is
going to a device rather than a file, and the device driver's attribute
word has bit 3 (04h) set to "1".
5) This call has been tested with MSDOS 2.11, PCDOS 2.1, PCDOS 3.1, PCDOS
3.2, and PCDOS 3.3.
6) Used in IBMBIO.COM as a vector to int 10, function 0Eh (write TTY)
followed by an IRET.
Interrupt 2Ah Microsoft Networks - Session Layer Interrupt
* (not documented by Microsoft)
entry AH 00h check to see if network BIOS installed
return AH <> 0 if installed
01h execute NETBIOS request
02h set net printer mode
03h get shared-device status (check direct I/O)
AL 00h
DS:SI pointer to ASCIIZ disk device name
return CF 0 if allowed
04h execute NETBIOS
AL 0 for error retry
1 for no retry
ES:BX pointer to network control block
return AX 0 for no error
AH 1 if error
AL error code
05h get network resource information
AL 00h
return AX reserved
BX number of network names
CX number of commands
DX number of sessions
06h Network Print-stream Control
note NETBIOS 1.10
20h unknown
note AL=01h intercepted by DESQview 2.0
80h Begin DOS Critical Section
AL 1 to 6
81h End DOS Critical Section
AL 1 to 6
82h Server Hook
return unknown
note called by the int 21h function dispatcher
in DOS 3.10+ for function 0 and functions
greater than 0Ch except 59h
84h keyboard busy loop
note similar to DOS's int 28h
Interrupt 2Bh (not documented by Microsoft)
* Unknown - Internal Routine for DOS (IRET)
Interrupt 2Ch (not documented by Microsoft)
* Unknown - Internal Routine for DOS (IRET)
Interrupt 2Dh (not documented by Microsoft)
* Unknown - Internal Routine for DOS (IRET)
Interrupt 2Eh (undocumented by Microsoft) (DOS 2.0+)
* Internal Routine for DOS (Alternate EXEC)
This interrupt passes a command line addressed by DS:SI to COMMAND.COM. The
command line must be formatted just like the unformatted parameter area of a
Program Segment Prefix. That is, the first byte must be a count of characters,
and the second and subsequent bytes must be a command line with parameters,
terminated by a carriage return character.
When executed, int 2Eh will reload the transient part of the command
interpreter if it is not currently in memory. If called from a program that
was called from a batch file, it will abort the batch file. If executed from a
program which has been spawned by the EXEC function, it will abort the whole
chain and probably lock up the computer. Int 2Eh also destroys all registers
including the stack pointer.
Int 2Eh is called from the transient portion of the program to reset the DOS
PSP pointers using the above Functions #81 & #80, and then reenters the
resident program.
When called with a valid command line, the command will be carried out by
COMMAND.COM just as though you had typed it in at the DOS prompt. Note that the
count does not include the carriage return. This is an elegant way to perform a
SET from an application program against the master environment block for
example.
entry DS:SI pointer to an ASCIIZ command line in the form:
count byte
ASCII string
carriage return
null byte
note 1) Destroys all registers including stack pointer
2) Seems to work OK in both DOS 2.x and 3.x
3) It is reportedly not used by DOS.
4) As far as known, int 2Eh is not used by DOS 3.1, although it was called
by COMMAND.COM of PCDOS 3.0, so it appears to be in 3.1 only for the
sake of compatibility.
Interrupt 2Fh Multiplex Interrupt
Interrupt 2Fh is the multiplex interrupt. A general interface is defined
between two processes. It is up to the specific application using interrupt
2Fh to define specific functions and parameters.
This interrupt is becoming more commonly used as the availible interrupt 21
functions are getting to be in short supply. Int 2Fh doesn't require any
support from DOS itself for it to be used in application programs. It's not
handled by DOS, but by the programs themselves.
Every multiplex interrupt handler is assigned a specific multiplex number.
The multiplex number is specified in the AH register; the AH value tells which
program your request is directed toward. The specific function that the handler
is to perform is placed in the AL register. Other parameters are places in the
other registers as needed. The handlers are chained into the 2Fh interrupt
vector and the multiplex number is checked to see if any other application is
using the same multiplex number. There is no predefined method for assigning a
multiplex number to a handler. You must just pick one. To avoid a conflict if
two applications choose the same multiplex number, the multiplex numbers used by
an application should be patchable. In order to check for a previous
installation of the current application, you can search memory for a unique
string included in your program. If the value you wanted in AH is taken but
you don't find the string, then another application has grabbed that location.
Int 2Fh was not documented under DOS 2.x. There is no reason not to use int 2Fh
as the multiplex interrupt in DOS 2.x. The only problem is that DOS 2.x does not
initialize the int 2Fh vector, so when you try to chain to it like you are
supposed to, it will crash. If your program checks the vector for being zero
and initializes it itself or doesn't chain in that case, it will work for you
n 2.x just the same as 3.x.
Function 01h PRINT.COM
Register AH identifies which program is to handle the interrupt.
Values 00h-7Fh are reserved for DOS, not that anyone cares much.
Values 0C0h-0FFh are reserved for applications.
Register AL contains the function code if used
entry AH 01h
AL 00h PRINT Get Installed State
This call must be defined by all int 2Fh handlers. It
is used by the caller of the handler to determine if
the handler is present. On entry, AL=0. On return, AL
contains the installed state as follows:
return AL 0FFh installed
01h not installed, not OK to install
00h not installed, OK to install
01h PRINT Submit File
DS:DX pointer to submit packet
format byte level
dword pointer to ASCIIZ filename
return CF set if error
AX error code
note 1) A submit packet contains the level (BYTE) and a pointer
to the ASCIIZ string (DWORD in offset:segment form).
The ASCIIZ string must contain the drive, path, and
filename of the file you want to print. The filename
cannot contain global filename characters.
return CF set if error
AX error code
02h PRINT Cancel File
On entry, AL=2 and DS:DX points to the ASCIIZ string for
the print file you want to cancel. Global filename
characters are allowed in the filename.
DS:DX pointer to ASCIIZ file name to cancel (wildcards OK)
return CF set if error
AX error code
03h PRINT remove all files
return CF set if error
AX error code
04h PRINT hold queue/get status
This call holds the jobs in the print queue so that you
can scan the queue. Issuing any other code releases the
jobs. On entry, AL=4. On return, DX contains the error
count. DS:SI points to the print queue. The print queue
consists of a series of filename entries. Each entry is
64 bytes long. The first entry in the queue is the file
currently being printed. The end of the queue is marked
by the entry having a null as the first character.
return DX error count
DS:SI pointer to print queue (null-string terminated
list of 64-byte ASCIIZ filenames)
CF set if error
AX error code
01h function invalid
02h file not found
03h path not found
04h too many open files
05h access denied
08h queue full
09h spooler busy
0Ch name too long
0Fh drive invalid
05h PRINT restart queue
return CF set if error
AX error code
Function 05h DOS 3.x critical error handler
entry AH 05h
AL 00h installation check
return AL 00h not installed, OK to install
01h not installed, can't install
0FFh installed
note This set of functions allows a user program to
partially or completely override the default
critical error handler in COMMAND.COM
AL 01h handle error - nonzero error code in AL
return CF clear
ES:DI pointer to ASCIIZ error message
CF set use default error handler
AL (?)
Function 06h ASSIGN
entry AH 06h
00h installation check
return AH <> 0 if installed
01h get memory segment
return ES segment of ASSIGN work area
Function 10h SHARE
entry AH 10h
AL 00h installation check
return AL 00h not installed, OK to install
01h not installed, not OK to install
0FFh installed
Function 11h Multiplex - network redirection
entry AH 11h
AL 00h installation check
return AL 00h not installed, OK to install
01h not installed, not OK to install
0FFh installed
01h-05h unknown
06h close remote file
07h-09h unknown
0Ah unknown
stack word (?)
return CF set on error
0Bh unknown
stack word (?)
return CF set on error(?)
0Ch unknown
0Dh unknown
0Eh unknown
stack word (?)
return (?)
0Fh-16h unknown
17h unknown
stack word (?)
return (?)
18h unknown
stack word (?)
return (?)
19h-1Dh unknown
1Eh do redirection
stack word function to execute
return CF set on error
1Fh printer setup
stack word function(?)
return CF set on error(?)
20h-25h unknown
stack word (?)
26h unknown
Function 12h multiplex, DOS 3.x internal services
entry AH 12h
AL 00h installation check
return AL 0FFh for compatibility with other
int 2Fh functions
01h close file (?)
stack word value - unknown
return BX unknown
CX unknown
ES:DI pointer to unknown value
note Can be called only from within DOS
02h get interrupt address
stack word vector number
return ES:BX pointer to interrupt vector
stack unchanged
03h get DOS data segment
return DS segment of IBMDOS.COM file
04h normalize path separator
stack word character to normalize
return AL normalized character (forward slash
turned to backslash)
stack unchanged
05h output character
stack word character to output
return stack unchanged
note Can be called only from within DOS
06h invoke critical error
return AL 0-3 for Abort, Retry, Ignore, Fail
note Can be called only from within DOS
07h move disk buffer (?)
DS:DI pointer to disk buffer
return buffer moved to end of buffer list
note Can be called only from within DOS
08h decrement word
ES:DI pointer to word to decrement
return AX new value of word
note Word pointed to by ES:DI decremented,
skipping zero
09h unknown
DS:DI pointer to disk buffer(?)
return (?)
note Can be called only from within DOS
0Ah unknown
note Can be called only from within DOS
0Bh unknown
ES:DI pointer to system file table entry(?)
return AX (?)
note Can be called only from within DOS
0Ch unknown
note Can be called only from within DOS
0Dh get date and time
return AX current date in packed format
DX current time in packed format
note Can be called only from within DOS
0Eh do something to all disk buffers (?)
return DS:DI pointer to first disk buffer
note can be called only from within DOS
0Fh unknown
DS:DI pointer to (?)
return DS:DI pointer to (?)
note 1) Can be called only from within DOS
2) Calls on function 1207h
10h find dirty/clean(?) buffer
DS:DI pointer to first disk buffer
return DS:DI pointer to first disk buffer which has
(?) flag clear
ZF clear if found
set if not found
11h normalize ASCIIZ filename
DS:SI pointer to ASCIIZ filename to normalize
ES:DI pointer to buffer for normalized filename
return destination buffer filled with uppercase
filename, with slashes turned to backslashes
12h get length of ASCIIZ string
ES:DI pointer to ASCIIZ string
return CX length of string
13h uppercase character
stack word character to convert to uppercase
return AL uppercase character
stack unchanged
14h compare far pointers
DS:SI first pointer
ES:DI second pointer
return ZF set if pointers are equal
ZF clear if not equal
15h unknown
DS:DI pointer to disk buffer
stack word (?)
return stack unchanged
note Can be called only from within DOS
16h get address of system FCB
BX system file table entry number
return ES:DI pointer to system file table entry
17h set default drive (?)
stack word drive (0=A:, 1=B:, etc)
return DS:SI pointer to drive data block for
specified drive
stack unchanged
note Can be called only from within DOS
18h get something (?)
return DS:SI pointer to (?)
19h unknown
stack word drive (0=default, 1=A:, etc)
return (?)
stack unchanged
note 1) Can be called only from within DOS
2) Calls function 1217h
1Ah get file's drive
DS:SI pointer to filename
return AL drive
(0=default, 1=A:, etc, 0FFh=invalid)
1Bh set something (?)
CL unknown
return AL (?)
note Can be called only from within DOS
1Ch checksum memory
DS:SI pointer to start of memory to checksum
CX number of bytes
DX initial checksum
return DX checksum
note Can be called only from within DOS
1Dh unknown
DS:SI pointer to (?)
CX (?)
DX (?)
return AX (?)
CX (?)
DX (?)
1Eh compare filenames
DS:SI pointer to first ASCIIZ filename
ES:DI pointer to second ASCIIZ filename
return ZF set if filenames equivalent
clear if not
1Fh build drive info block
stack word drive letter
return ES:DI pointer to drive info block
(will be overwritten by next call)
stack unchanged
note Can be called only from within DOS
20h get system file table number
BX file handle
return CF set on error, error code in AL
AL 06h (invalid file handle)
CF clear if successful
byte ES:[DI] = system file table entry
number for file handle
21h unknown
DS:SI pointer to (?)
return (?)
note Can be called only from within DOS
22h unknown
SS:SI pointer to (?)
return nothing(?)
note Can be called only from within DOS
23h check if character device (?)
return DS:SI pointer to device driver with
same name as (?)
note Can be called only from within DOS
24h delay
return after delay of (?) ms
note Can be called only from within DOS
25h get length of ASCIIZ string
DS:SI pointer to ASCIIZ string
return CX length of string
Function 43h Microsoft Extended Memory Specification (XMS)
Function 5453h TesSeRact Standard for Ram-Resident Program Communication
Function 64h SCRNSAV2.COM
entry AH 64h
AL 00h installation check
return AL 00h not installed
0FFh installed
note SCRNSAV2.COM is a screen saver for PS/2's with VGA by Alan Ballard
Function 7Ah Novell NetWare
entry AH 7Ah
AL 00h installation check
note 1) Returns address of entry point for IPX and SPX
2) Parameters are listed under int 21
Function 087h APPEND
entry AH 087h
AL 00h APPEND installation check
return AH <> 0 if installed
01h APPEND - unknown
02h APPEND - version check
Function 088h Microsoft Networks
entry AH 088h
AL 00h network program installation check
return AH <> 0 if installed
BX installed component flags (test in this order!)
bit 6 server
bit 2 messenger
bit 7 receiver
bit 3 redirector
01h unknown
02h unknown
03h get current POST address
return ES:BX POST address
04h set new POST address
ES:BX new POST address
09h network version check
Function 0AAh VIDCLOCK.COM
entry AH 0AAh
AL 00h installation check
return AL 00h not installed
0FFh installed
note VIDCLOCK.COM is a memory-resident clock by Thomas G. Hanlin III
Function 0BBh Network Functions
entry AH 0BBh
AL 00h net command installation check
01h, 02h unknown
03h get server POST address
04h get server POST address
Function 0F7h AUTOPARK.COM (PD TSR hard disk parking utility)
entry AH 0F7h
AL 00h installation check
return AL 00h not installed
0FFh installed
note AUTOPARK is a TSR HD parker by Alan D. Jones
01h set parking delay
BX:CX 32 bit count of 55ms timer ticks
MSDOS 2Fh functions 01h (PRINT), 02h (ASSIGN), 10h (SHARE):
return AX Error
Codes Description
01h invalid function number
02h file not found
03h path not found
04h too many open files
05h access denied
06h invalid handle
08h queue full
09h busy
0Ch name too long
0Fh invalid drive was specified
CF clear (0) if OK
set (1) if error - error returned in AX
note 1) The multiplex numbers AH=0h through AH=7Fh are reserved for DOS.
Applications should use multiplex numbers 80h through 0FFh.
2) When in the chain for int 2Fh, if your code calls DOS or if you execute
with interrupts enabled, your code must be reentrant/recursive.
3) Important! In versions of DOS prior to 3.0, the int 2Fh vector was
initialized to zero rather than being pointed into the DOS service area.
You must initialize this vector manually under DOS 2.x.
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ Miscellaneous Interrupts - in numerical order ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
Interrupt 30h (not a vector!) far jump instruction for CP/M-style calls
Interrupt 31h Unknown
note The CALL 5 entry point does a FAR jump to here
Interrupt 32h Unknown
Interrupt 33h Used by Microsoft Mouse Driver
Function Calls
Function Requests
00h Reset Driver and Read Status
entry AH 00h
return AH status
0 hardware/driver not installed
-1 hardware/driver installed
BX number of buttons
-1 two buttons
0 other than two
3 Mouse Systems mouse
01h Show Mouse Cursor
entry AH 01h
return unknown
02h Hide Mouse Cursor
entry AH 02h
return unknown
note multiple calls to hide the cursor will require multiple calls
to function 01h to unhide it.
03h Return Position and Button Status
entry AH 03h
return BX button status
bit 0 left button pressed if 1
bit 1 right button pressed if 1
bit 2 middle button pressed if 1 (Mouse Systems mouse)
CX column
DX row
04h Position Mouse Cursor
entry AH 04h
CX column
DX row
return unknown
05h Return Button Press Data
entry AH 05h
BX button
0 left
1 right
2 middle (Mouse Systems mouse)
return AH button states
bit 0 left button pressed if 1
bit 1 right button pressed if 1
bit 2 middle button pressed if 1 (Mouse Systems mouse)
BX no. of times specified button pressed since last call
CX column at time specified button was last pressed
DX row at time specified button was last pressed
06h Return Button Release Data
entry AH 06h
BX button
0 left
1 right
2 middle (Mouse Systems mouse)
return AH button states
bit 0 left button pressed if 1
bit 1 right button pressed if 1
bit 2 middle button pressed if 1 (Mouse Systems mouse)
BX no. of times specified button released since last call
CX column at time specified button was last released
DX row at time specified button was last released
07h Define Horizontal Cursor Range
entry AH 0007h
CX minimum column
DX maximum column
return unknown
08h Define Vertical Cursor Range
entry AH 08h
CX minimum row
DX maximum row
return unknown
09h Define Graphics Cursor
entry AH 09h
BX column of cursor hot spot in bitmap (-16 to 16)
CX row of cursor hot spot (-16 to 16)
ES:DX pointer to bitmap
16 words screen mask
16 words cursor mask
return unknown
note Each word defines the sixteen pixels of a row, low bit
rightmost
0Ah Define Text Cursor
entry AH 0Ah
BX hardware/software text cursor
00h software
CX screen mask
DX cursor mask
01h hardware
CX start scan line
DX end scan line
return unknown
note When the software cursor is selected, the char/attribute data
at the current screen position is ANDed with the screen mask
and the with the cursor mask
0Bh Read Motion Counters
entry AH 0Bh
return CX number of mickeys mouse moved horiz. since last call
DX number of mickeys mouse moved vertically
note 1) A mickey is the smallest increment the mouse can sense.
Positive values indicate up/right
0Ch Define Interrupt Subroutine Parameters
entry AH 0Ch
CX call mask bit
bit 0 call if mouse moves
bit 1 call if left button pressed
bit 2 call if left button released
bit 3 call if right button pressed
bit 4 call if right button released
bit 5 call if middle button pressed (Mouse Systems)
bit 6 call if middle button released (Mouse Systems)
ES:DX address of FAR routine
return unknown
note when the subroutine is called, it is passed these values:
AH condition mask (same bit assignments as call mask)
BX button state
CX cursor column
DX cursor row
DI horizontal mickey count
SI vertical mickey count
0Dh Light Pen Emulation On
entry AH 0Dh
return unknown
0Eh Light Pen Emulation Off
entry AH 0Eh
return unknown
0Fh Define Mickey/Pixel Ratio
entry AH 0Fh
CX number of mickeys per 8 pixels horizontally
DX number of mickeys per 8 pixels vertically
return unknown
10h Define Screen Region for Updating
entry AH 10h
CX,DX X,Y coordinates of upper left corner
SI,DI X,Y coordinates of lower right corner
return unknown
note Mouse cursor is hidden during updating, and needs to be
explicitly turned on again
11h not documented by Microsoft
12h Set Large Graphics Cursor Block
AH 12h
BH cursor width in words
CH rows in cursor
BL horizontal hot spot (-16 to 16)
CL vertical hot spot (-16 to 16)
ES:DX pointer to bit map of screen and cursor maps
return AH -1 if successful
note PC Mouse. Not documented by Microsoft
13h Define Double-Speed Threshold
entry AH 13h
DX threshold speed in mickeys/second,
0 = default of 64/second
return unknown
note If speed exceeds threshold, the cursor's on-screen motion
is doubled
14h Exchange Interrupt Subroutines
entry AH 14h
return unknown
15h Return Drive Storage Requirements
entry AH 15h
return BX size of buffer needed to store driver state
16h Save Driver State
entry AH 16h
ES:DX pointer to buffer
return unknown
17h Restore Driver State
entry AH 17h
ES:DX pointer to buffer containing saved state
return unknown
18h-1Ch not documented by Microsoft; unknown
1Dh Define Display Page Number
entry AH 1Dh
1Eh Return Display Page Number
entry AH 1Eh
return unknown
42h PCMouse - Get MSmouse Storage Requirements
AH 42h
return AX 0FFFFh successful
BX buffer size in bytes for functions 50h and 52h
00h MSmouse not installed
42h functions 42h, 50h, and 52h not supported
52h PCMouse - Save MSmouse State
entry AH 50h
BX buffer size
ES:DX pointer to buffer
return AX 0FFFFh if successful
52h PCMouse - restore MSmouse state
entry AH 52h
BX buffer size
ES:DX pointer to buffer
return AX 0FFFFh if successful
Int 33: In addition, the following functions are appended to BIOS int 10h and
implemented as the EGA Register Interface Library:
0F0h read one register
0F1h write one register
0F2h read consecutive register range
0F3h write consecutive register range
0F4h read non-consecutive register set
0F5h write non-consecutive register set
0F6h revert to default register values
0F7h define default register values
0FAh get driver status
Interrupt 34h Turbo C/Microsoft languages - Floating Point emulation
This interrupt emulates opcode 0D8h
Interrupt 35h Turbo C/Microsoft languages - Floating Point emulation
This interrupt emulates opcode 0D9h
Interrupt 36h Turbo C/Microsoft languages - Floating Point emulation
This interrupt emulates opcode 0DAh
Interrupt 37h Turbo C/Microsoft languages - Floating Point emulation
This interrupt emulates opcode 0DBh
Interrupt 38h Turbo C/Microsoft languages - Floating Point emulation
This interrupt emulates opcode 0DCh
Interrupt 39h Turbo C/Microsoft languages - Floating Point emulation
This interrupt emulates opcode 0DDh
Interrupt 3Ah Turbo C/Microsoft languages - Floating Point emulation
This interrupt emulates opcode 0DEh
Interrupt 3Bh Turbo C/Microsoft languages - Floating Point emulation
This interrupt emulates opcode 0DFh
Interrupt 3Ch Turbo C/Microsoft languages - Floating Point emulation
This int emulates instructions with an ES segment override
Interrupt 3Dh Turbo C/Microsoft languages - Floating Point emulation
This interrupt emulates a standalone FWAIT instruction
Interrupt 3Eh Turbo C/Microsoft languages - Floating Point emulation
Interrupt 3Fh Overlay manager interrupt (Microsoft LINK.EXE)
Default overlay interrupt; may be changed with LINK switch
Interrupt 40h Hard Disk BIOS
Pointer to disk BIOS entry when a hard disk controller is
installed. The BIOS routines use int 30h to revector the
diskette handler (original int 13h) here so int 40 may be used
for hard disk control
Interrupt 41h Hard Disk Parameters (XT,AT,XT2,XT286,PS except ESDI disks)
Pointer to first Hard Disk Parameter Block, normally located
in the controller card's ROM. This table may be copied to RAM
and changed, and this pointer revectored to the new table.
note 1) format of parameter table is:
dw cylinders
db heads
dw starting reduced write current cylinder (XT only, 0 for others)
db maximum ECC burst length
db control byte
bits 0-2 drive option (XT only, 0 for others)
bit 3 set if more than 8 heads
bit 4 always 0
bit 5 set if manufacturer's defect map on max cylinder+1
bit 6 disable ECC retries
bit 7 disable access retries
db standard timeout (XT only, 0 for others)
db formatting timeout (XT only, 0 for others)
db timeout for checking drive (XT only, 0 for others)
dw landing zone (AT, PS/2)
db sectors/track (AT, PS/2)
db 0
2) normally vectored to ROM table when system is initialized.
Interrupt 42h Pointer to screen BIOS entry (EGA, VGA, PS/2)
Relocated (by EGA, etc.) video handler (original int 10h).
Revectors int 10 calls to EGA BIOS.
Interrupt 43h Pointer to EGA graphics character table. The POST initializes
this vector pointing to the default table located in the EGA
ROM BIOS. (PC-2 and up). Not initialized if EGA not present.
This vector was referred to (mistakenly) as the Video
Parameters table in the original EGA BIOS listings.
Interrupt 44h Pointer to graphics character table. This table contains the
(0:0110h) dot patterns for the first 128 characters in video modes 4,5,
and 6, and all 256 characters in all additional graphics modes.
Not initialized if EGA not present.
2) EGA/VGA/CONV/PS - EGA/PCjr fonts, characters 00h to 7Fh
3) Novell NetWare - High-Level Language API
4) This interrupt is not used by some EGA cards.
Interrupt 45h Reserved by IBM (not initialized)
Interrupt 46h Pointer to second hard disk, parameter block (AT, XT/286, PS/2)
(see int 41h) (except ESDI hard disks) (not initialized unless
specific user software calls for it)
Interrupt 47h Reserved by IBM (not initialized)
Interrupt 48h Cordless Keyboard Translation (PCjr, XT [never delivered])
(0:0120h) This vector points to code to translate the cordless keyboard
scancodes into normal 83-key values. The translated scancodes
are then passed to int 9. (not initialized on PC or AT)
Interrupt 49h Non-keyboard Scan Code Translation Table Address (PCjr)
(0:0124h) This interrupt is used for operation of non-keyboard devices
on the PCjr, such as the Keystronic Numeric Keypad.
This interrupt has the address of a table used to translate
non-keyboard scancodes (greater than 85 excepting 255). This
interrupt can be revectored by a user application. IBM
recommends that the default table be stored at the beginning
of an application that required revectoring this interrupt,
and that the default table be restored when the application
terminates. (not initialized on PC or AT)
The PCjr BIOS can interpret scancodes other than those
generated by the keyboard to allow for expansion. The keyboard
generates scancodes from 01h to 055h, including 0FFh. Any
scancodes above 55h (56h through 7Eh for make codes and 0D6h
through 0FEh for break codes) are processed in the following
manner:
1) if the incoming make code falls within the range of the
translate table whose address is pointed to by int 49h, it
is translated into the corresponding scancode. Any incoming
break codes above 0D5h are ignored.
2) if the new translated scancode ius less and 56h, it is
processed by the BIOS as a keyboard scancode and the same
data is placed in the BIOS keyboard buffer.
3) if the translated scancode is higher than 55h or the
incoming scancode is outside the range of the translate
table, 40h is added creating a new extended scancode. The
extended scancode is placed in the BIOS keyboard buffer with
the character code of 00h (NUL). This utilitizes the range
of 96h through 0BEh for scancodes 56h through 7Eh.
The default translate-table maps scancodes 56h through 6Ah to
existing keyboard values. Codes 6Bh theough 0BEh are mapped (by
adding 40h) to extended codes 0ABh through 0FEh since they are
outside the range of the default translate table.
The format of the translate table is:
0 length - the number of nonkeyboard scancodes that are
mapped within the table (from 1 to n)
1 to n word high byte 00h (NUL) byte scancode with low order
byte representing the scancode mapped values relative
to their input values within the range of 56h through
7Eh
With this layout, all keyboard scancodes can be intercepted
through int 9h and and nonkeyboard scancodes can be intercepted
through int 48h.
Interrupt 4Ah Real-Time Clock Alarm (Convertible, PS/2)
(not initialized on PC or AT)
Invoked by BIOS when real-time clock alarm occurs
Interrupt 4Bh Reserved by IBM (not initialized)
Interrupt 4Ch Reserved by IBM (not initialized)
Interrupt 4Dh Reserved by IBM (not initialized)
Interrupt 4Eh Reserved by IBM (not initialized)
Used instead of int 13h for disk I/O on TI Professional PC
Interrupt 4Fh Reserved by IBM (not initialized)
Interrupt 50-57 IRQ0-IRQ7 relocated by DesQview
(normally not initialized)
Interrupt 58h Reserved by IBM (not initialized)
Interrupt 59h Reserved by IBM (not initialized)
GSS Computer Graphics Interface (GSS*CGI)
DS:DX Pointer to block of 5 array pointers
return CF 0
AX return code
CF 1
AX error code
note 1) Int 59 is the means by which GSS*CGI language bindings
communicate with GSS*CGI device drivers and the GSS*CGI
device driver controller.
2) Also used by the IBM Graphic Development Toolkit
Interrupt 5Ah Reserved by IBM (not initialized)
Interrupt 5Bh Reserved by IBM (not initialized)
Interrupt 5Ah Cluster Adapter BIOS entry address
(normally not initialized)
Interrupt 5Bh Reserved by IBM (not initialized) (cluster adapter?)
Interrupt 5Ch NETBIOS interface entry port
ES:BX pointer to network control block
return AL error code (0 if none)
note 1) When the NETBIOS is installed, interrupts 13 and 17 are interrupted by
the NETBIOS; interrupt 18 is moved to int 86 and one of int 2 or 3 is
used by NETBIOS. Also, NETBIOS extends the int 15 function 90 and 91h
functions (scheduler functions)
2) Normally not initialized.
3) TOPS network card uses DMA 1, 3 or none.
Interrupt 5Dh Reserved by IBM (not initialized)
Interrupt 5Eh Reserved by IBM (not initialized)
Interrupt 5Fh Reserved by IBM (not initialized)
Interrupt 60h-67h User Program Interrupts (availible for general use)
Various major programs make standardized use of this group
of interrupts. Details of common use follows
Interrupt 60h 10-Net Network
entry AH 11h Lock and Wait
AL drive number or 0
DX number of seconds to wait
ES:SI Ethernet address or 0
DS:BX pointer to 31-byte ASCIIZ semaphore name
return AL status
0 successful
1 timeout
2 server not responding
3 invalid semaphore name
4 semaphore list is full
5 invalid drive ID
6 invalid Ethernet address
7 not logged in
8 write to network failed
9 semaphore already logged for this CPU
entry AH 12h Lock
AL drive number or 0 for default
ES:SI Ethernet address or 0
DS:BX pointer to 31-byte ASCIIZ semaphore name
return AL status (see function 11h)
1 semaphore currently logged
note Unlike function 11h, this function returns immediately
entry AH 13h Unlock
AL drive number or 0
ES:SI Ethernet address or 0
DS:BX pointer to 31-byte ASCIIZ semaphore name
return AL status (see function 11h)
1 semaphore not logged
Interrupt 67h Used by Lotus-Intel-Microsoft Expanded Memory Specification
user and Ashton-Tate/Quadram/AST Enhanced Expanded Memory
specification (See Chapter 10)
Interrupt 68h Not Used (not initialized)
Interrupt 69h Not Used (not initialized)
Interrupt 6Ah Not Used (not initialized)
Interrupt 6Bh Not Used (not initialized)
Interrupt 6Ch System Resume Vector (Convertible) (not initialized on PC)
DOS 3.2 Realtime Clock update
Interrupt 6Dh Not Used (not initialized)
Interrupt 6Eh Not Used (not initialized)
Interrupt 6Fh Novell NetWare - PCOX API (3270 PC terminal interface)
Interrupt 6Fh 10-Net Network API
entry AH 00h Login
DS:DX login record
8 bytes user name
8 bytes password
12 bytes name of super-station
return CL security level
AX status
0000h good login
0FF01h no response from superstation
0FF02h network error
0FF03h invalid password
0FF04h no local buffer
0FF05h superstation not available
0FF06h node already logged in
0FF07h login not valid from this node
0FF08h node ID already in use
01h Logoff
return CX number of files closed
AX status
0000h successful
0FF08h superstation ID not already logged in
02h Status of node
DS:DX pointer to 512-byte record
8 bytes user name (0 if none)
byte station type
0 workstation
1 superstation
4 logged into multiple superstations
24 bytes list of superstations logged into more than one
superstation
12 bytes node ID
word message count for this station (send for user
node, receive for superstations)
for superstations only:
word drives allocated (bit 0=A:, bit 1=B:,...)
byte user service flag
bit 4: SUBMIT is on
3: mail waiting for node
2: calendar waiting for you
1: news waiting for you
0: mail waiting for you
byte printers allocated (bit 0=LPT1,...)
byte number of unprinted spool files
byte number of opened files
byte number of logged on files
byte primary drive (1=A:)
byte reserved
n bytes list of logged on node IDs (each 12 bytes, max
38 IDs)
return CF set on error
AX error code
0FF01h no response from node
0FF02h network error
0FF04h no local buffer
0FF16h invalid node ID
03h Get Address of Configuration Table
return ES:BX pointer to record (actually starts at [BX-25])
word count of dropped Send6F
word buffer start address
word comm driver base address
word send/receive retry count
byte number of 550ms loops
word UFH address
word CDIR address
word LTAB address
word SFH address
word FTAB address
word RLTAB address
word SMI address
word NTAB address
ES:BX pointer to word address of first CT_DRV
byte number of DRV entries
8 bytes login name
12 bytes node ID
6 bytes node address
byte flag
byte CT_CFLG
bit 1: sound bell
bit 0: CHAT permit
byte CT_PSFLG
bit 5: PRINT permit
bit 4: KB initiated
bit 3: CHAT called FOXPTRM
bit 2: SUBMIT active
bit 1: SUBMIT received
bit 0: SUBMIT permit
byte reserved
word receive message count
word send message count
word retry count
word failed count
word driver errors
word dropped responses/CHATs
9 bytes list ID/NTAB address (3 entries-LPT1-3?)
6 bytes AUX ID/NTAB address (2 entries-COM1-2?)
byte active CB channel
byte received 6F messages on queue
9 bytes activity counters for channels 1-9
04h Send
DS:BX pointer to record
12 bytes receiving node's ID
word length of data at DX
DS:DX pointer to data (max 1024 bytes)
return CF set on error
AX error code
0FF01h timeout
0FF02h network error
0FF04h no local buffer
0FF16h invalid parameter (bad length)
05h Receive
CX number of seconds before timeout
DS:DX pointer to receive buffer
12 bytes sending node's ID
word length of message
n bytes message (maximum 1024 bytes)
return CF set on error
AX error code
0FF01h timeout
0FF18h sent message has been dropped
06h Unknown
07h Lock Handle
BX file handle
CX:DX starting offset in file
SI record length
return CF set on error
AX error code
0FF01h timeout
02h file not found
0FF17h record locked by another user
08h Unlock Handle
BX file handle
AL mode
0 unlock all
1 unlock record at CX:DX
return CF set on error
AX error code
02h file not found
0Bh Lock Semaphore, Return Immediately
AL drive number or 0
ES:SI Ethernet address or 0
DS:BX pointer to 31-byte ASCIIZ semaphore name
return AL status
0 successful
1 semaphore currently locked
2 server not responding
3 invalid semaphore name
4 semaphore list is full
5 invalid drive ID
6 invalid Ethernet address
7 not logged in
8 write to network failed
9 semaphore already logged in this CPU
0Ch unlock semaphore
AL drive number or 0
ES:SI Ethernet address or 0
DS:BX pointer to 31-byte ASCIIZ semaphore name
return AL status (see AH=0Bh)
1 semaphore not locked
0Dh Who
CX length of data
DS:DX pointer to array of records to be filled
12 bytes node ID
byte flag (1=workstation, 2=superstation)
return CL number of records returned (responding stations)
0Eh spool/print
DS:DX pointer to record
word 0 initiate spool
1 abort print
2 close spool
3 delete spool
4 print
5 get report info
11 bytes file name
byte notification
bit 6: do ID page
bit 5: no form feed
bit 3: notify at print completion
bit 2: notify at print start and reply?
bit 1: notify at print start
bit 0: no notification
byte days to keep (0FFh=forever)
byte device (1=LPT1)
word length of following data area
n bytes $SCNT records returned if code in first word
is 05h
return CF set on error
AX error code
0FF16h invalid parameter
0FF17h device not mounted
0FF18h already spooling to named device
11h Lock FCB
AL mode
0 sequential
1 random
2 random block
DS:DX pointer to FCB
return CF set on error
AX 02h file not found
0FF01h timeout
0FF17h record locked by another user
12h Unlock FCB
AL mode
0 sequential
1 random
2 random block
DS:DX pointer to FCB
return CF set on error
AX 02h file not found
Interrupt 70h IRQ 8, Real Time Clock Interrupt (AT, XT/286, PS/2)
Interrupt 71h IRQ 9, Redirected to IRQ 8 (AT, XT/286, PS/2)
LAN Adapter 1 (rerouted to int 0Ah [IRQ2] by BIOS)
Interrupt 72h IRQ 10 (AT, XT/286, PS/2) Reserved
Interrupt 73h IRQ 11 (AT, XT/286, PS/2) Reserved
Interrupt 74h IRQ 12 Mouse Interrupt (PS/2)
Interrupt 75h IRQ 13, Coprocessor Error, BIOS Redirect to int 2 (NMI) (AT)
Interrupt 76h IRQ 14, Hard Disk Controller (AT, XT/286, PS/2)
Interrupt 77h IRQ 15 (AT, XT/286, PS/2) Reserved
Interrupt 78h Not Used
Interrupt 79h Not Used
Interrupt 7Ah Novell NetWare - LOW-LEVEL API
Interrupt 7Bh-7Eh Not Used
Interrupt 7Fh unknown
Used by second copy of COMMAND set with SHELL=
Not used by COMMAND /C at DOS prompt
Interrupt 80h-85h Reserved by BASIC
note interrupts 80h through ECh are apparently unused and not initialized.
Interrupt 86h Relocated by NETBIOS int 18
Interrupt 86h-0F0h Used by BASIC when BASIC interpreter is running
Intrerrupt 0E0h CP/M-86 function calls
Interrupt 0E4h Logitech Modula-2 v2.0 MONITOR
entry AX 05h monitor entry
06h monitor exit
BX priority
Interrupt 0F0h unknown
Used by secondary copy of COMMAND when SHELL= set
Not used by COMMAND /C at DOS prompt
Interrupts 0F1h-0FFh (absolute addresses 3C4-3FF)
Location of Interprocess Communications Area
Interrupt 0F8h Set Shell Interrupt (OEM)
Set OEM handler for int 21h calls from 0F9h through 0FFh
entry AH 0F8h
DS:DX pointer to handler for Functions 0F9h thru 0FFh
note 1) To reset these calls, pass DS and DX with 0FFFFh. DOS is set up to
allow ONE handler for all 7 of these calls. Any call to these handlers
will result in the carry bit being set and AX will contain 1 if they are
not initialized. The handling routine is passed all registers just as
the user set them. The OEM handler routine should be exited through an
IRET.
2) 10 ms interval timer (Tandy?)
Interrupt 0F9h First of 8 SHELL service codes, reserved for OEM shell (WINDOW);
use like HP Vectra user interface?
Interrupt 0FAh USART ready (RS-232C)
Interrupt 0FBh USART RS ready (keyboard)
Interrupt 0FCh Unknown
Interrupt 0FDh reserved for user interrupt
Interrupt 0FEh AT/XT286/PS50+ - destroyed by return from protected mode
Interrupt 0FFh AT/XT286/PS50+ - destroyed by return from protected mode
** Programmer's Technical Reference for MSDOS and the IBM PC **
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ Shareware Version, 06/16/91 ³
³ Please Register Your Copy ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
Copyright (c) 1987, 1991 Dave Williams
USA copyright TXG 392-616 ALL RIGHTS RESERVED
ISBN 1-878830-02-3 (disk-based text)
C H A P T E R S E V E N
DOS FILE STRUCTURE
FILE MANAGEMENT FUNCTIONSÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Use DOS function calls to create, open, close, read, write, rename, find, and
erase files. There are two sets of function calls that DOS provides for support
of file management. They are:
* File Control Block function calls (0Fh-24h)
* Handle function calls (39h-69h)
Handle function calls are easier to use and are more powerful than FCB calls.
Microsoft recommends that the handle function calls be used when writing new
programs. DOS 3.0 up have been curtailing use of FCB function calls; it is
possible that future versions of DOS may not support FCB function calls.
The following table compares the use of FCB calls to Handle function calls:
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ FCB Calls ³ Handle Calls ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ Access files in current ³ Access files in ANY directory ³
³ directory only. ³ ³
³ ³ ³
³ Requires the application ³ Does not require use of an FCB. ³
³ program to maintain a file ³ Requires a string with the drive, ³
³ control block to open, ³ path, and filename to open, create, ³
³ create, rename or delete ³ rename, or delete a file. For file ³
³ a file. For I/O requests, ³ I/O requests, the application program ³
³ the application program ³ must maintain a 16 bit file handle ³
³ also needs an FCB ³ that is supplied by DOS. ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
The only reason an application should use FCB function calls is to maintain
the ability to run under DOS 1.x. To to this, the program may use only function
calls 00h-2Eh. Though the FCB function calls are frowned upon, many of the
introductory assembly language programming texts use the FCB calls as examples.
FCB FUNCTION CALLS ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
FCB function calls require the use of one File Control Block per open file,
which is maintained by the application program and DOS. The application program
supplies a pointer to the FCB and fills in ther appropriate fields required by
the specific function call. An FCB function call can perform file management on
any valid drive, but only in the current logged directory. By using the current
block, current record, and record length fields of the FCB, you can perform
sequential I/O by using the sequential read or write function calls. Random I/O
can be performed by filling in the random record and record length fields.
Several possible uses of FCB type calls are considered programming errors and
should not be done under any circumstances to avoid problems with file sharing
and compatibility with later versions of DOS.
Some errors are:
1) If program uses the same FCB structure to access more than one open file. By
opening a file using an FCB, doing I/O, and then replacing the filename field
in the file control block with a new filename, a program can open a second
file using the same FCB. This is invalid because DOS writes control info-
rmation about the file into the reserved fields of the FCB. If the program
then replaces the filename field with the original filename and then tries to
perform I/O on this file, DOS may become confused because the control info-
rmation has been changed. An FCB should never be used to open a second file
without closing the one that is currently open. If more than one File Control
Block is to be open concurrently, separate FCBs should be used.
2) A program should never try to use the reserved fields in the FCB, as the
function of the fields changes with different versions of DOS.
3) A delete or a rename on a file that is currently open is considered an error
and should not be attempted by an application program.
It is also good programming practice to close all files when I/O is done. This
avoids potential file sharing problems that require a limit on the number of
files concurrently open using FCB function calls.
HANDLE FUNCTION CALLSÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
The recommended method of file management is by using the extended "handle"
set of function calls. These calls are not restricted to the current directory.
Also, the handle calls allow the application program to define the type of
access that other processes can have concurrently with the same file if the file
is being shared.
To create or open a file, the application supplies a pointer to an ASCIIZ
string giving the name and location of the file. The ASCIIZ string contains an
optional drive letter, optional path, mandatory file specification, and a
terminal byte of 00h. The following is an example of an ASCIIZ string:
format [drive][path] filename.ext,0
DB "A:\path\filename.ext",0
If the file is being created, the application program also supplies the
attribute of the file. This is a set of values that defines the file read
only, hidden, system, directory, or volume label.
If the file is being opened, the program can define the sharing and access
modes that the file is opened in. The access mode informs DOS what operations
your program will perform on this file (read-only, write-only, or read/write)
The sharing mode controls the type of operations other processes may perform
concurrently on the file. A program can also control if a child process inherits
the open files of the parent. The sharing mode has meaning only if file sharing
is loaded when the file is opened.
To rename or delete a file, the appplication program simply needs to provide
a pointer to the ASCIIZ string containing the name and location of the file
and another string with the new name if the file is being renamed.
The open or create function calls return a 16-bit value referred to as the
file handle. To do any I/O to a file, the program uses the handle to reference
the file. Once a file is opened, a program no longer needs to maintain the
ASCIIZ string pointing to the file, nor is there any need to stay in the same
directory. DOS keeps track of the location of the file regardless of what
directory is current.
Sequential I/O can be performed using the handle read (3Fh) or write (40h)
function calls. The offset in the file that IO is performed to is automatically
moved to the end of what was just read or written. If random I/O is desired, the
LSEEK (42h) function call can be used to set the offset into the file where I/O
is to be performed.
SPECIAL FILE HANDLESÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
DOS reserves five special file handles for use by itself and applications
programs. They are:
ÚÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ 0000h ³ STDIN ³ standard input device (input can be redirected) ³
³ 0001h ³ STDOUT ³ standard output device (output can be redirected) ³
³ 0002h ³ STDERR ³ standard error output device (output cannot be redirected) ³
³ 0004h ³ STDAUX ³ standard auxiliary device ³
³ 0005h ³ STDPRN ³ standard printer device ³
ÀÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
These handles are predefined by DOS and can be used by an application program.
They do not need to be opened by a program, although a program can close these
handles. STDIN should be treated as a read-only file, and STDOUT and STDERR
should be treated as write-only files. STDIN and STDOUT can be redirected. All
handles inherited by a process can be redirected, but not at the command line.
These handles are very useful for doing I/O to and from the console device.
For example, you could read input from the keyboard using the read (3Fh)
function call and file handle 0000h (STDIN), and write output to the console
screen with the write function call (40h) and file handle 0001h (STDOUT). If
you wanted an output that could not be redirected, you could output it using
file handle 0002h (STDERR). This is very useful for error messages that must
be seen by a user.
File handles 0003h (STDAUX) and 0004h (STDPRN) can be both read from and
written to. STDAUX is typically a serial device and STDPRN is usually a parallel
device.
ASCII and BINARY MODEÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
I/O to files is done in binary mode. This means that the data is read or
written without modification. However, DOS can also read or write to devices in
ASCII mode. In ASCII mode, DOS does some string processing and modification to
the characters read and written. The predefined handles are in ASCII mode when
initialized by DOS. All other file handles that don't refer to devices are in
binary mode. A program, can use the IOCTL (44h) function call to set the mode
that I/O is to a device. The predefined file handles are all devices, so the
mode can be changed from ASCII to binary via IOCTL. Regular file handles that
are not devices are always in binary mode and cannot be changed to ASCII mode.
The ASCII/BINARY bit was called "raw" in DOS 2.x, but it is called ASCII/BINARY
in DOS 3.x.
The predefined file handles STDIN (0000h) and STDOUT (0001h) and STDERR
(0002h) are all duplicate handles. If the IOCTL function call is used to change
the mode of any of these three handles, the mode of all three handles is
changed. For example, if IOCTL was used to change STDOUT to binary mode, then
STDIN and STDERR would also be changed to binary mode.
FILE I/O IN BINARY (RAW) MODEÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
The following is true when a file is read in binary mode:
1) The characters ^S (scroll lock), ^P (print screen), ^C (control break) are
not checked for during the read. Therefore, no printer echo occurs if ^S or
^P are read.
2) There is no echo to STDOUT (0001h).
3) Read the number of specified bytes and returns immediately when the last
byte is received or the end of file reached.
4) Allows no editing of the ine input using the function keys if the input is
from STDIN (0000h).
The following is true when a file is written to in binary mode:
1) The characters ^S (scroll lock), ^P (print screen), ^C (control break) are
not checked for during the write. Therefore, no printer echo occurs.
2) There is no echo to STDOUT (0001h).
3) The exact number of bytes specified are written.
4) Does not caret (^) control characters. For example, ctrl-D is sent out as
byte 04h instead of the two bytes ^ and D.
5) Does not expand tabs into spaces.
FILE I/O IN ASCII (COOKED) MODEÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
The following is true when a file is read in ASCII mode:
1) Checks for the characters ^C,^S, and ^P.
2) Returns as many characters as there are in the device input buffer, or the
number of characters requested, whichever is less. If the number of
characters requested was less than the number of characters in the device
buffer, then the next read will address the remaining characters in the
buffer.
3) If there are no more bytes remaining in the device input buffer, read a
line (terminated by ^M) into the buffer. This line may be edited with the
function keys. The characters returned terminated with a sequence of 0Dh,
0Ah (^M,^J) if the number of characters requested is sufficient to include
them. For example, if 5 characters were requested, and only 3 were entered
before the carriage return (0Dh or ^M) was presented to DOS from the console
device, then the 3 characters entered and 0Dh and 0Ah would be returned.
However, if 5 characters were requested and 7 were entered before the
carriage return, only the first 5 characters would be returned. No 0Dh,0Ah
sequence would be returned in this case. If less than the number of
characters requested are entered when the carriage return is received, the
characters received and 0Dh,0Ah would be returned. The reason the 0Ah
(linefeed or ^J) is added to the returned characters is to make the devices
look like text files.
4) If a 1Ah (^Z) is found, the input is terminated at that point. No 0Dh,0Ah
(CR,LF) sequence is added to the string.
5) Echoing is performed.
6) Tabs are expanded.
The following is true when a file is written to in ASCII mode:
1) The characters ^S,^P,and ^C are checked for during the write operation.
2) Expands tabs to 8-character boundaries and fills with spaces (20h).
3) Carets control characters, for example, ^D is written as two bytes, ^ and D.
4) Bytes are output until the number specified is output or a ^Z is
encountered. The number actually output is returned to the user.
NUMBER OF OPEN FILES ALLOWEDÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
The number of files that can be open concurrently is restricted by DOS. This
number is determined by how the file is opened or created (FCB or handle
function call) and the number specified by the FCBS and FILES commands in the
CONFIG.SYS file. The number of files allowed open by FCB function calls and the
number of files that can be opened by handle type calls are independent of one
another.
RESTRICTIONS ON FCB USAGEÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
If file sharing is not loaded using the SHARE command, there are no
restrictions on the nuumber of files concurrently open using FCB function calls.
However, when file sharing is loaded, the maximum number of FCBs open is set
by the the FCBS command in the CONFIG.SYS file.
The FCBS command has two values you can specify, 'm' and 'n'. The value for
'm' specifies the number of files that can be opened by FCBs, and the value 'n'
specifies the number of FCBs that are protected from being closed.
When the maximum number of FCB opens is exceeded, DOS automatically closes the
least recently used file. Any attempt to access this file results in an int 24h
critical error message "FCB not availible". If this occurs while an application
program is running, the value specified for 'm' in the FCBS command should be
increased.
When DOS determines the least recently used file to close, it does not include
the first 'n' files opened, therefore the first 'n' files are protected from
being closed.
RESTRICTIONS ON HANDLE USAGEÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
The number of files that can be open simultaneously by all processes is
determined by the FILES command in the CONFIG.SYS file. The number of files a
single process can open depends on the value specified for the FILES command. If
FILES is greater than or equal to 20, a single process can open 20 files. If
FILES is less than 20, the process can open less than 20 files. This value
includes three predefined handles: STDIN, STDOUT, and STDERR. This means only
17 additional handles can be added. DOS 3.3 includes a function to use more than
20 files per application.
ALLOCATING SPACE TO A FILEÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Files are not nescessarily written sequentially on a disk. Space is allocated
as needed and the next location availible on the disk is allocated as space for
the next file being written. Therefore, if considerable file generation has
taken place, newly created files will not be written in sequential sectors.
However, due to the mapping (chaining) of file space via the File Allocation
Table (FAT) and the function calls availible, any file may be used in either a
sequential or random manner.
Space is allocated in increments called clusters. Cluster size varies
according to the media type. An application program should not concern itself
with the way that DOS allocates space to a file. The size of a cluster is only
important in that it determines the smallest amount of space that can be
allocated to a file. A disk is considered full when all clusters have been
allocated to files.
MSDOS / PCDOS DIFFERENCESÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
There is a problem of compatibility between MS-DOS and IBM PC-DOS having to
do with FCB Open and Create. The IBM 1.0, 1.1, and 2.0 documentation of OPEN
(call 0Fh) contains the following statement:
"The current block field (FCB bytes C-D) is set to zero [when an FCB is
opened]."
This statement is NOT true of MS-DOS 1.25 or MS-DOS 2.00. The difference is
intentional, and the reason is CP/M 1.4 compatibility. Zeroing that field is
not CP/M compatible. Some CP/M programs will not run when machine translated if
that field is zeroed. The reason it is zeroed in the IBM versions is that IBM
specifically requested that it be zeroed. This is the reason for the complaints
from some vendors about the fact that IBM MultiPlan will not run under MS-DOS.
It is probably the reason that some other IBM programs don't run under MS-DOS.
NOTE: Do what all MS/PC-DOS systems programs do: Set every single FCB field you
want to use regardless of what the documentation says is initialized.
.COM FILE STRUCTUREÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
The COM file structure was designed for DOS 1.0 and maximum compatibility
with programs ported from the CP/M operating system. COM files normally
comprise one segment only.
.EXE FILE STRUCTUREÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
The EXE file is the native mode for DOS. EXE files may make use of multiple
segments for code, stack, and data. The design of the EXE file reflects the
segmented design of the Intel 80x86 CPU architecture. EXE files may be as
large as availible memory and may make references to specific segment addresses.
The EXE files produced by the Linker program consist of two parts, control and
relocation information and the load module itself.
The control and relocation information, which is described below, is at the
beginning of the file in an area known as the header. The load module
immediately follows the header. The load module begins in the memory image of
the module contructed by the Linker.
When you are loading a file with the name *.EXE, DOS does NOT assume that it
is an EXE format file. It looks at the first two bytes for a signature telling
it that it is an EXE file. If it has the proper signature, then the load
proceeds. Otherwise, it presumes the file to be a .COM format file.
If the file has the EXE signature, then the internal consistency is checked.
Pre-2.0 versions of MSDOS did not check the signature byte for EXE files.
The .EXE format can support programs larger than 64K. It does this by
allowing separate segments to be defined for code, data, and the stack, each
of which can be up to 64K long. Programs in EXE format may contain explicit
references to segment addresses. A header in the EXE file has information for
DOS to resolve these references.
The .EXE header is formatted as follows:
ÚÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ Offset ³ C O N T E N T S ³
ÃÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 00h ³ 4Dh ³ This is the Linker's signature to mark the file as a valid ³
ÃÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄ´ .EXE file (The ASCII letters M and Z, for Mark Zbikowski, ³
³ 01h ³ 5Ah ³ one of the major designers of DOS at Microsoft) ³
ÃÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 02h-03h ³ Length of the image mod 512 (remainder after dividing the load ³
³ ³ module image size by 512) ³
ÃÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 04h-05h ³ Size of the file in 512 byte pages including the header. ³
ÃÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 06h-07h ³ Number of relocation table items following the header. ³
ÃÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 08h-09h ³ Size of the header in 16 byte increments (paragraphs). This is ³
³ ³ used to locate the beginning of the load module in the file. ³
ÃÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 0Ah-0Bh ³ Minimum number of 16 byte paragraphs required above the end of ³
³ ³ the loaded program. ³
ÃÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 0Ch-0Dh ³ Maximum number of 16 byte paragraphs required above the end of ³
³ ³ the loaded program. If the minimum and maximum number of ³
³ ³ paragraphs are both zero, the program will be loaded as high in ³
³ ³ memory as possible. ³
ÃÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 0Eh-0Fh ³ Displacement in paragraphs of stack segment within load module. ³
³ ³ This size must be adjusted by relocation. ³
ÃÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 10h-11h ³ Offset to be in SP register when the module is given control. ³
ÃÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 12h-13h ³ Word Checksum - negative sum of all the words in the file, ³
³ ³ ignoring overflow. ³
ÃÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 14h-15h ³ Offset to be in the IP register when the module is given control. ³
ÃÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 16h-17h ³ Displacement in paragraphs of code segment within load module. ³
³ ³ This size must be adjusted by relocation. ³
ÃÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 18h-19h ³ Displacement in bytes of the first relocation item in the file. ³
ÃÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 1Ah-1Bh ³ Overlay number (0 for the resident part of the program) ³
ÀÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
THE RELOCATION TABLEÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
The word at 18h locates the first entry in the relocation table. The
relocation table is made up of a variable number of relocation items. The number
of items is contained at offset 06-07. The relocation item contains two fields
- a 2 byte offset value, followed by a 2 byte segment value. These two fields
represent the displacement into the load module before the module is given
control. The process is called relocation and is accomplished as follows:
1. The formatted part of the header is read into memory. Its size is 1Bh.
2. A portion of memory is allocated depending on the size of the load module
and the allocation numbers in offsets 0Ah-0Ch and 0Ch-0Dh. DOS always
tries to allocate 0FFFFh paragraphs. Since this call will always fail,
the function returns the amount of free memory. If this block is larger
than the minimum specified at offset 0Ah and the loaded program size,
DOS will allocate the size specified at offset 0Ch or the largest free
memory space, whichever is less.
3. A Program Segment Prefix is built following the resident portion of the
program that is performing the load operation.
4. The formatted part of the header is read into memory (its size is at
offset 08h)
5. The load module size is determined by subtracting the header size from the
file size. Offsets 04h and 08h can be used for this calculation. The
actual size is downward adjusted based on the contents of offsets 02-03.
Note that all files created by the Linker programs prior to version 1.10
always placed a value of 4 at this location, regardless of the actual
program size. Therefore, Microsoft recommends that this field be ignored if
it contains a value of 4. Based on the setting of the high/low loader switch,
an appropriate segment is determined for loading the load module. This
segment is called the start segment.
6. The load module is read into memory beginning at the start segment. The
relocation table is an ordered list of relocation items. The first relocation
item is the one that has the lowest offset in the file.
7. The relocation table items are read into a work area one or more at a time.
8. Each relocation table item segment value is added to the start segment value.
The calculated segment, in conjunction with the relocation item offset value,
points to a word in the load module to which is added the start segment
value. The result is placed back into the word in the load module.
9. Once all the relocation items have been processed, the SS and SP registers
are set from the values in the header and the start segment value is added
to SS. The ES and DS registers are set to the segment address of the program
segment prefix. The start segment value is added to the header CS register
value. The result, along with the header IP value, is used to give the
module control.
"NEW" .EXE FORMAT (Microsoft Windows and OS/2)ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
The "old" EXE format is documented here. The "new" EXE format puts more
information into the header section and is currently used in applications that
run under Microsoft Windows. The linker that creates these files comes with the
Microsoft Windows Software Development Kit and is called LINK4. If you try to
run a Windows-linked program under DOS, you will get the error message "This
program requires Microsoft Windows".
PIF Files
PIF stands for "Program Information File". The PIF format was developed by
IBM for use with TopView, its multitasking manager. Microsoft also uses PIF
files to pass information regarding the amount of memory and type of I/O a
program running under Microsoft Windows requires.
The actual internal format of the PIF files is documented in the IBM TopView
Programmers' ToolKit.
STANDRD FILE CONTROL BLOCKÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
The standard file control block is defined as follows, with offsets in hex:
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ F I L E C O N T R O L B L O C K ³
ÃÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ Bytes ³ Function ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 0 ³ 1 byte Drive number. For example: ³
³ ³ Before open: 00h = default drive ³
³ ³ 01h = drive A: ³
³ ³ 02h = drive B: etc. ³
³ ³ After open: 00h = drive C: ³
³ ³ 01h = drive A: ³
³ ³ 02h = drive B: etc. ³
³ ³ An 0 is replaced by the actual drive number during open. ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 1-8 ³ 8 bytes Filename, left justified with blanks. If a reserved device ³
³ ³ name is placed here (such as PRN) do not include the optional colon. ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 9-B ³ 3 bytes Filename extension, left justified with trailing blanks. ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ C-D ³ 2 bytes Current block # relative to start of file, starting with 0 ³
³ ³ (set to 0 by the open function call). A block consists of 128 ³
³ ³ records, each of the size specified in the logical record size field.³
³ ³ The current block number is used with the current record field ³
³ ³ (below) for sequential reads and writes. ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ E-F ³ 2 bytes Logical record size in bytes. Set to 80h by OPEN function ³
³ ³ If this is not correct, you must set the value because DOS uses it ³
³ ³ to determine the proper locations in the file for all disk reads and ³
³ ³ writes. ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 10-13 ³ 4 bytes File size in bytes. In this field, the first word is the ³
³ ³ low-order part of the size. ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 14-15 ³ 2 bytes Date file was created or last updated. mm/dd/yy are mapped ³
³ ³ as follows: ³
³ ³ 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ³
³ ³ y y y y y y y m m m m d d d d d ³
³ ³ where: mm is 1-12 ³
³ ³ dd is 1-31 ³
³ ³ yy is 0-119 (1980-2099) ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 16-17 ³ 2 bytes time file was created or last updated. ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ ³ These bytes contain the time when the file was created or last ³
³ ³ updated. The time is mapped in the bits as follows: ³
³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³
³ ³ B Y T E 16h ³ B Y T E 17h ³ ³
³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³
³ ³ F E D C B A 9 8 ³ 7 6 5 4 3 2 1 0 ³ ³
³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³
³ ³ H H H H H ³ M M M M M M ³ D D D D D ³ ³
³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³
³ ³ binary # hrs 0-23 ³ binary # minutes 0-59 ³ bin. # 2-sec incr ³ ³
³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ³
³ ³ note: The time is stored with the least significant byte first. ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 18-19 ³ 2 bytes Reserved for DOS. ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 20 ³1 byte Current relative record number (0-127) within the current ³
³ ³ block. This field and the Current Block field at offset 0Ch make up ³
³ ³ the record pointer. This field is not initialized by the OPEN ³
³ ³ function call. You must set this field before doing sequential read- ³
³ ³ write operations to the diskette. ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 21-25 ³ 4 bytes Relative Record. Points to the currently selected record, ³
³ ³ counting from the beginning of the file starting with 0. This field ³
³ ³ is not initialized by the OPEN system call. You must set this field ³
³ ³ before doing a random read or write to the file. ³
³ ³ If the record size is less than 64 bytes, both words are used. ³
³ ³ Otherwise, only the first 3 bytes are used. Note that if you use the ³
³ ³ File Control Block at 5Ch in the program segment, the last byte of ³
³ ³ the FCB overlaps the first byte of the unformatted parameter area. ³
ÀÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
note 1) An unopened FCB consists of the FCB prefix (if used), drive number, and
filename.ext properly filled in. An open FCB is one in which the
remaining fields have been filled in by the CREAT or OPEN function
calls.
2) Bytes 0-5 and 32-36 must be set by the user program. Bytes 16-31 are set
by DOS and must not be changed by user programs.
3) All word fields are stored with the least significant byte first. For
example, a record length of 128 is stored as 80h at offset 14, and 00h
at offset 15.
EXTENDED FILE CONTROL BLOCKÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
The extended file control block is used to create or search for files in the
disk directory that have special attributes.
It adds a 7 byte prefix to the FCB, formatted as follows:
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ E X T E N D E D F I L E C O N T R O L B L O C K ³
ÃÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ Bytes ³ Function ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 0 ³ Flag byte containing 0FFh to indicate an extended FCB. ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 1-6 ³ Reserved ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 6-7 ³ Attribute byte. Refer to function call 11h (search first) for ³
³ ³ details on using the attribute bits during directory searches. This ³
³ ³ function is present to allow applications to define their own files ³
³ ³ as hidden (and thereby excluded from normal directory searches) and ³
³ ³ to allow selective directory searches. ³
ÀÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
Any reference in the DOS function calls to an FCB, whether opened or unopened,
may use either a normal or extended FCB. If you are using an extended FCB, the
appropriate register should be set to the first byte of the prefix, rather than
the drive-number field.
Common practice is to refer to the extended FCB as a negative offset from the
first byte of a standard File Control Block.
** Programmer's Technical Reference for MSDOS and the IBM PC **
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ Shareware Version, 06/17/91 ³
³ Please Register Your Copy ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
Copyright (c) 1987, 1991 Dave Williams
USA copyright TXG 392-616 ALL RIGHTS RESERVED
ISBN 1-878830-02-3 (disk-based text)
C H A P T E R E I G H T
DOS DISK INFORMATION
THE DOS AREAÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
All disks and diskettes formatted by DOS are created with a sector size of 512
bytes. The DOS area (entire area for a diskette, DOS partition for hard disks)
is formatted as follows:
partition table - variable size (hard disk only)
boot record - 1 sector
first copy of the FAT - variable size
second copy of the FAT - same size as first copy
root directory - variable size
data area - variable depending on disk size
The following sections describe each of the allocated areas:
THE BOOT RECORDÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
The boot record resides on track 0, sector 1, side 0 of every diskette
formatted by the DOS FORMAT program. For hard disks the boot record resides on
the first sector of the DOS partition. It is put on all disks to provide an
error message if you try to start up with a nonsystem disk in drive A:. If the
disk is a system disk, the boot record contains a JMP instruction pointing to
the first byte of the operating system.
If the device is IBM compatible, it must be true that the first sector of the
first FAT is located at the same sector for all possible media. This is
because the FAT sector is read before the media is actually determined.
The information relating to the BPB for a particular media is kept in the boot
sector for the media. In particular, the format of the boot sector is:
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ D O S B O O T R E C O R D ³
ÃÄÄÄÂÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³00h³3 bytes³ JMP to executable code. For DOS 2.x, 3 byte near jump (0E9h). ³
³ ³ ³ For DOS 3.x, 2 byte near jump (0EBh) followed by a NOP (90h) ³
ÃÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³03h³8 bytes³ optional OEM name and version (such as IBM 2.1) ³
ÃÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³0Bh³2 bytes³ bytes per sector ³
ÃÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³0Dh³ byte ³ ³ sectors per allocation unit (must be a power of 2) ³
ÃÄÄÄÅÄÄÄÄÄÄÄ´ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³0Eh³2 bytes³ B ³ reserved sectors (starting at logical sector 0) ³
³ ³ ³ ³ 01 for 1.x-3.31, 02 for 4.0+ ³
ÃÄÄÄÅÄÄÄÄÄÄÄ´ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³10h³ byte ³ ³ number of FATs ³
ÃÄÄÄÅÄÄÄÄÄÄÄ´ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³11h³2 bytes³ ³ maximum number of root directory entries ³
ÃÄÄÄÅÄÄÄÄÄÄÄ´ P ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³13h³2 bytes³ ³ number of sectors in logical image (total number of ³
³ ³ ³ ³ sectors in media, including boot sector directories, etc.)³
³ ³ ³ ³ If logical disk size is geater than 32Mb, this value is 0 ³
³ ³ ³ ³ and the actual size is reported at offset 26h (DOS 4.0+) ³
ÃÄÄÄÅÄÄÄÄÄÄÄ´ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³15h³ byte ³ B ³ media descriptor byte ³
ÃÄÄÄÅÄÄÄÄÄÄÄ´ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³16h³2 bytes³ ³ number of sectors occupied by a single FAT ³
ÃÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³18h³2 bytes³ sectors per track ³
ÃÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³1Ah³2 bytes³ number of heads ³
ÃÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³1Ch³2 bytes³ # of hidden sectors (sectors before this volume) (1st part) ³
ÀÄÄÄÁÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ EXTENDED BOOT RECORD (DOS 4.0+) ³
ÚÄÄÄÂÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³1Eh³2 bytes³ # of hidden sectors (sectors before this volume) (2nd part) ³
ÃÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³20h³4 bytes³ # sectors in this disk (see offset 13h, if 0) ³
ÃÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³24h³2 bytes³ physical drive number (max 2 for DOS 4, max 8 for DOS 5) ³
ÃÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³26h³ byte ³ extended boot record signature (29h) ³
ÃÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³27h³4 bytes³ volume serial number (assigned with a random function) ³
ÃÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³2Bh³11 byte³ volume label ³
ÃÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³36h³7 bytes³ file system ID (FAT12 ), (FAT16 ) etc. ("reserved") ³
ÀÄÄÄÁÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
The three words at the end return information about the media. The number of
heads is useful for supporting different multihead drives that have the same
storage capacity but a different number of surfaces. The number of hidden
sectors is useful for drive partitioning schemes.
DOS 3.2 uses a table called the BIOS Parameter Block (BPB) to determine if a
disk has a valid File Allocation Table. The BPB is located in the first sector
of a floppy disk. Although the BPB is supposed to be on every formatted floppy
disk, some earlier versions of DOS did not create a BPB and instead assumed that
the FAT begins at the second sector of the disk and that the first FAT byte
(Media Descriptor Byte) describes the disk format.
DOS 3.2 reads in the whole of the BPB and tries to use it - although,
strangely enough, it seems as if DOS is prepared to cope with a BPB that is
more or less totally blank (it seems to ignore the descriptor byte and treat it
as a DSDD 9-sector disk).
DOS 3.2 determines if a disk has a valid boot sector by examining the first
byte of logical sector 0. If that byte it a jump instruction E9h, DOS 3.2
assumes the rest of the sector is a valid boot sector with a BPB. If the first
byte is not E9h DOS 3.2 behaves like previous versions, assumes the boot sector
is invalid and uses the first byte of the FAT to determine the media type.
If the first byte on the disk happens to be E9h, but the disk does not have a
BPB, DOS 3.2 will return a disk error message.
The real problems occur if some of the BPB data is valid and some isn't.
Apparently some OEMs have assumed that DOS would continue to ignore the
formatting data on the disk, and have failed to write much there during FORMAT
except the media descriptor byte (or, worse, have allowed random junk to be
written there). While this error is understandable, and perhaps even
forgiveable, it remains their problem, not IBMs, since the BPB area has always
been documented as containing the format information that IBM DOS 3.2 now
requires to be there.
THE DOS FILE ALLOCATION TABLE (FAT)ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
The File Allocation Table, or FAT, has three pain purposes:
1) to mark bad sectors on the media
2) to determine which sectors are free for use
3) to determine the physical location(s) of a file on the media.
DOS uses one of four different schemes for defining the File Allocation Table:
1) the 12-bit FAT, for DOS 1.x, 2.x, all floppies, and small hard disks
2) the 16-bit FAT, for DOS 3.x+ hard disks from 16.8 to 32Mb
3) the 32-bit FAT used by Compaq DOS 3.31 and others
4) the 32-bit FAT used by DOS 4.0 over-32Mb logical drives
This section explains how DOS uses the FAT to convert the clusters of a file
into logical sector numbers. We recommend that system utilities use the DOS
handle calls rather than interpreting the FAT.
The FAT is used by DOS to allocate disk space for files, one cluster at a time.
In DOS 4.0, clusters are referred to as "allocation units." It means the same
things; the smallest logical portion of a drive.
The FAT consists of a 12 bit entry (1.5 bytes) for each cluster on the disk or
a 16 bit (2 bytes) entry when a hard disk has more than 20740 sectors as is the
case with fixed disks larger than 10Mb.
The first two FAT entries map a portion of the directory; these FAT entries
contain indicators of the size and format of the disk. The FAT can be in a 12
or 16 bit format. DOS determines whether a disk has a 12 or 16 bit FAT by
looking at the total number of allocation units on a disk. For all diskettes
and hard disks with DOS partitions less than 20,740 sectors, the FAT uses a 12
bit value to map a cluster. For larger partitions, DOS uses a 16 bit value.
The second, third, and fourth bit applicable for 16 bit FAT bytes always
contains 0FFFFh. The first byte is used as follows:
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ M E D I A D E S C R I P T O R B Y T E ³
ÃÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³hex value ³ meaning ³ normally used ³
ÃÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ F0 ³ double sided 18 sector diskette ³ PS/2 1.44 meg DSHD ³
ÃÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ F8 ³ hard disk ³ bootable hard disk at C:800 ³
ÃÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ F9 ³ double sided 15 sector diskette ³ AT 1.2 meg DSHD ³
³ ³ double sided 9 sector diskette ³ Convertible 720k DSQD ³
ÃÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ FA ³ IBM Displaywriter System disk ³ 287k ³
ÃÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ FB ³ IBM Displaywriter System disk ³ 1 meg ³
ÃÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ FC ³ single sided 9 sector diskette ³ DOS 2.0, 180k SSDD ³
ÃÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ FD ³ double sided 9 sector diskette ³ DOS 2.0, 360k DSDD ³
ÃÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ FE ³ single sided 8 sector diskette ³ DOS 1.0, 160k SSDD ³
ÃÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ FF ³ double sided 8 sector diskette ³ DOS 1.1, 320k SSDD ³
ÃÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
³for 8 inch diskettes: ³
ÃÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ FD ³ double sided 26 sector diskette ³ IBM 3740 format DSSD ³
ÃÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ FE ³ single sided 26 sector diskette ³ IBM 3740 format SSSD ³
³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ ³ double sided 8 sector diskette ³ IBM 3740 format DSDD ³
ÀÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
The third FAT entry begins mapping the data area (cluster 002).
NOTE: These values are provided as a reference. Therefore, programs should not
make use of these values.
Each entry contains a hexadecimal character (or 4 for 16 bit FATs). ()
indicates the high order four bit value in the case of 16 bit FAT entries.
They can be:
(0)000h if the cluster is unused and availible
(0F)FF8h - (0F)FFFh to indicate the last cluster of a file
(X)XXXh any other hexadecimal numbers that are the cluster number
of the next cluster in the file. The cluster number is the
first cluster in the file that is kept in the file's
directory entry.
The values (0F)FF0h - (0F)FF7h are used to indicate reserved clusters.
(0F)FF7h indicates a bad cluster if it is not part of the allocation chain.
(0F)FF8h - (0F)FFFh are used as end of file markers.
The file allocation table always occupies the sector or sectors immediately
following the boot record. If the FAT is larger than 1 sector, the sectors
occupy consecutive sector numbers. Two copies of the FAT are written, one
following the other, for integrity. The FAT is read into one of the DOS buffers
whenever needed (open, allocate more space, etc).
USE OF THE 12 BIT FILE ALLOCATION TABLEÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Obtain the starting cluster of the file from the directory entry.
Now, to locate each subsequent sector of the file:
1. Multiply the cluster number just used by 1.5 (each FAT entry is 1.5
bytes long).
2. The whole part of the product is offset into the FAT, pointing to the entry
that maps the cluster just used. That entry contains the cluster number of
the next cluster in the file.
3. Use a MOV instruction to move the word at the calculated FAT into a register.
4. If the last cluster used was an even number, keep the low order 12 bits of
the register, otherwise, keep the high order 12 bits.
5. If the resultant 12 bits are (0FF8h-0FFFh) no more clusters are in the file.
Otherwise, the next 12 bits contain the cluster number of the next cluster in
the file.
To convert the cluster to a logical sector number (relative sector, such as
that used by int 25h and 26h and DEBUG):
1. Subtract 2 from the cluster number
2. Multiply the result by the number of sectors per cluster.
3. Add the logical sector number of the beginning of the data area.
12-bit FAT if DOS partition is smaller than 32,680 sectors (16.340 MB).
USE OF THE 16 BIT FILE ALLOCATION TABLEÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Obtain the starting cluster of the file from the directory entry. Now to
locate each subsequent cluster of the file:
1. Multiply the cluster number used by 2 (each FAT entry is 2 bytes long).
2. Use the MOV word instruction to move the word at the calculated FAT offset
into a register.
3. If the resultant 16 bits are (0FF8h-0FFFFh) no more clusters are in the
file. Otherwise, the 16 bits contain the cluster number of the next cluster
in the file.
Compaq DOS makes availible a new disk type (6) with 32 bit partition values,
allowing 512 megabytes per hard disk (Compaq DOS 3.3.1)
DOS DISK DIRECTORYÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
The FORMAT command initially builds the root directory for all disks. Its
location (logical sector number) and the maximum number of entries are
availible through the device driver interfaces.
Since directories other than the root directory are actually files, there is
no limit to the number of entries that they may contain.
All directory entries are 32 bytes long, and are in the following format:
ÚÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
³ BYTES ³ DISK DIRECTORY ENTRY
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
³ 0-7 ³ 8 bytes filename
ÀÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
³ The first byte of the filename indicates the file status.
³ The file status byte can contain the following values:
ÃÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
³ 00h ³ Directory entry has never been used. This is used to limit
³ ³ the length of directory searches, for performance reasons.
³ 05h ³ Indicates that the first character of the filename actually
³ ³ has an 0EDh character.
³ 0E5h ³ Filename has been used but the file has been erased.
³ 2Eh ³ This entry is for a directory. If the second byte is also
³ ³ 2Eh, the cluster field contains the cluster number of this
³ ³ directory's parent directory. (0000h if the parent directory
³ ³ is the root directory).
ÃÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
³ Any other character is the first character of a filename. Filenames
³ are left-aligned and if nescessary padded with blanks.
ÚÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
³ 8-A ³ 3 bytes filename extension if any
ÀÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
³ Three characters, left-aligned and padded with blanks if nescessary.
³ If there is no file extension, this field contains all blanks
ÚÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
³ B ³ 1 byte file attributes
ÀÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
³ The attribute byte is mapped as follows:
ÃÄÄÄÄÄÂÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
³ hex ³bit³ meaning
ÃÄÄÄÄÄÅÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
³ 00h ³ ³ (no bits set) normal; can be read or written w/o restriction
³ 01h ³ 0 ³ file is marked read-only. An attempt to open the file for
³ ³ ³ output using function call 3Dh will fail and an error code
³ ³ ³ will be returned. This value can be used with other values
³ ³ ³ below.
³ 02h ³ 1 ³ indicates a hidden file. The file is excluded from normal
³ ³ ³ directory searches.
³ 04h ³ 2 ³ indicates a system file. This file is excluded from normal
³ ³ ³ directory searches.
³ 08h ³ 3 ³ indicates that the entry contains the volume label in the
³ ³ ³ first 11 bytes. The entry has no other usable information
³ ³ ³ and may exist only in the root directory.
³ 10h ³ 4 ³ indicates that the file is a subdirectory
³ 20h ³ 5 ³ indicates an archive bit. This bit is set on whenever the
³ ³ ³ file is written to and closed. Used by BACKUP and RESTORE.
³ ³ 6 ³ reserved
³ ³ 7 ³ reserved
ÃÄÄÄÄÄÁÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
³ Bits 6 and 7 are reserved, and must be 0. They may be used in OS/2.
³ note: Attributes 08h and 10h cannot be changed using int21/43h.
³
³ The system files IBMBIO.COM and IBMDOS.COM (or customized equivalent)
³ are marked as read-only, hidden, and system files. Files can be
³ marked hidden when they are created. Also, the read-only, hidden,
³ system and archive attributes may be changed with int21/43h.
ÚÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
³ 0C-15 ³ 10 bytes reserved by DOS; value unknown
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
³ 16-17 ³ 2 bytes file timestamp
ÀÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
³ These bytes contain the time when the file was created or last
³ updated. The time is mapped in the bits as follows:
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ B Y T E 16h ³ B Y T E 17h ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ F E D C B A 9 8 ³ 7 6 5 4 3 2 1 0 ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ H H H H H ³ M M M M M M ³ D D D D D ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ binary # hrs 0-23 ³ binary # minutes 0-59 ³ bin. # 2-sec incr ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
³ note: The time is stored with the least significant byte first.
ÚÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
³ 18-19 ³ 2 bytes file datestamp
ÀÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
³ This area contains the date when the file was created or last
³ updated. The mm/dd/yy are mapped in the bits as follows:
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ B Y T E 18h ³ B Y T E 19h ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ F E D C B A 9 8 ³ 7 6 5 4 3 2 1 0 ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ Y Y Y Y Y Y Y ³ M M M M ³ D D D D D ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 0-119 (1980-2099) ³ 1-12 ³ 1-31 ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
³ note: The time is stored with the least significant byte first.
ÚÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
³ 1A-1B ³ 2 bytes first file cluster number
ÀÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
³ * (reserved in DOS 2, documented in DOS 3+)
³ This area contains the starting cluster number of the first cluster
³ in the file. The first cluster for data space on all fixed disks and
³ floppy disks is always cluster 002. The cluster number is stored
³ with the least significant byte first.
ÚÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
³ 1C-1F ³ 4 bytes filesize
ÀÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
³ This area contains the file size in bytes. The first word contains
³ the low order part of the size. Both words are stored with the least
³ significant byte first.
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
THE DATA AREAÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Allocation of space for a file (in the data area) is done only when needed
(it is not preallocated). The space is allocated one cluser (unit allocation)
at a time. A cluster is always one or more consecutive sector numbers, and all
of the clusters in a file are "chained" together in the FAT.
The clusters are arranged on disk to minimize head movement for multisided
media. All of the space on a track (or cylinder) is allocated before moving
on to the next track. This is accomplished by using the sequential sector
numbers on the lowest-numbered head, then all the sector numbers on the next
head, and so on until all sectors of all heads of the track are used. Then the
next sector used will be sector 1 of head 0 on the next track.
An interesting innovation that was introduced in MS-DOS 3.0: disk space that
is freed by erasing a file is not re-used immediately, unlike earlier versions
of DOS. Instead, free space is obtained from the area not yet used during the
current session, until all of it is used up. Only then will space that is freed
during the current session be re-used.
This feature minimizes fragmentation of files, since never-before-used space
is always contiguous. However, once any space has been freed by deleting a file,
that advantage vanishes at the next system boot. The feature also greatly
simplifies un-erasing files, provided that the need to do an un-erase is found
during the same session and also provided that the file occupies contiguous
clusters.
However, when one is using programs which make extensive use of temporary
files, each of which may be created and erased many times during a session,
the feature becomes a nuisance; it forces the permanent files to move farther
and farther into the inner tracks of the disk, thus increasing rather than
decreasing the amount of fragmentation which occurs.
The feature is implemented in DOS by means of a single 16-bit "last cluster
used" (LCU) pointer for each physical disk drive; this pointer is a part of
the physical drive table maintained by DOS. At boot time, the LCU pointer is
zeroed. Each time another cluster is obtained from the free-space pool (the
FAT), its number is written into the LCU pointer. Each time a fresh cluster
is required, the FAT is searched to locate a free one; in older versions of
DOS this search always began at Cluster 0000, but in 3.x it begins at the
cluster pointed to by the LCU pointer.
For hard disks, the size of the file allocation table and directory are
determined when FORMAT initializes it and are based on the size of the DOS
partition.
Files in the data area are not nescessarily written sequentially on the first.
The data area space is allocated one cluster at a time, skipping over clusters
already allocated. The first free cluster found is the next cluster allocated,
regardless of its physical location on the disk. This permits the most efficient
utilization of disk space because clusters freed by erasing files can be
allocated for new files. Refer back to the description of the DOS FAT in this
chapter for more information.
SSDD single sided, double density (160-180k) 5¬
DSDD double sided, double density (320-360k) 5¬
DSQD double sided, quad density (720k) 5¬, 3«
DSHD double sided, high density (1.2-1.44M) 5¬, 3«
Much of the trouble with AT 1.2 meg drives has been through the inadverdent
use of quad density disks in the high density drives. The high density disks
use a higher-coercivity media than the quads, and quads are not completely
reliable as 1.2M. Make sure you have the correct disk for your application.
HARD DISK LAYOUTÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
The DOS hard disk routines perform the following services:
1) Allow multiple operating systems to utilize the hard disk without the need
to backup and restore files when changing operating systems.
2) Allow a user-selected operating system to be started from the hard disk.
I) In order to share the hard disk among operating systems, the disk may be
logically divided into 1 to 4 partitions. The space within a given
partition is contiguous, and can be dedicated to a specific operating
system. Each operating system may "own" only one partition in DOS versions
2.0 through 3.2. PCDOS 3.3 introduced the "Extended DOS Partition" which
allows multiple DOS partitions on the same hard disk. The FDISK.COM (or
similar program from other DOS vendors) utility allows the user to select
the number, type, and size of each partition. The partition information is
kept in a partition table that is embedded in the master fixed disk boot
record on the first sector of the disk. The format of this table varies
from version to version of DOS.
II) An operating system must consider its partition to be the entire disk,
and must ensure that its functions and utilities do not access other
partitions on the disk.
III) Each partition may contain a boot record on its first sector, and any
other programs or data that you choose - including a copy of an operating
system. For example, the DOS FORMAT command may be used to format and
place a copy of DOS in the DOS partition in the same manner that a
diskette is formatted. With the FDISK utility, you may designate a
partition as "active" (bootable). The master hard disk boot record causes
that partition's boot record to receive control when the system is started
or reset. Additional disk partitions could be FORTH, UNIX, Pick, CP/M-86,
or the UCSD p-System.
SYSTEM INITIALIZATIONÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
The boot sequence is as follows:
1. System initialization first attempts to load an operating system from
diskette drive A. If the drive is not ready or a read error occurs, it then
attempts to read a master hard disk boot record on the first sector of the
first hard disk in the system. If unsuccessful, or if no hard disk is
present, it invokes ROM BASIC in an IBM PC or displays a disk error
message on most compatibles.
2. If initialization is successful, the master hard disk boot record is given
control and it examines the partition table embedded within it. If one of
the entries indicates an active (bootable) partition, its boot record is
read from the partition's first sector and given control.
3. If none of the partitions is bootable, ROM BASIC is invoked on an IBM PC or
a disk error on most compatibles.
4. If any of the boot indicators are invalid, or if more than one indicator is
marked as bootable, the message INVALID PARTITION TABLE is displayed and the
system stops.
5. If the partition's boot record cannot be successfully read within five
retries due to read errors, the message ERROR LOADING OPERATING SYSTEM
appears and the system stops.
6. If the partition's boot record does not contain a valid "signature", the
message MISSING OPERATING SYSTEM appears, and the system stops.
NOTE: When changing the size or location of any partition, you must ensure that
all existing data on the disk has been backed up. The partitioning program
will destroy the data on the disk.
System programmers designing a utility to initialize/manage a hard disk must
provide the following functions at a minimum:
1. Write the master disk boot record/partition table to the disk's first
sector to initialize it.
2. Perform partitioning of the disk-that is, create or update the partition
table information (all fields for the partition) when the user wishes
to create a partition. This may be limited to creating a partition for only
one type of operating systewm, but must allow repartitoning the entire disk,
or adding a partition without interfering with existing partitions (user's
choice).
3. Provide a means for marking a user-specified partition as bootable and
resetting the bootable indicator bytes for all other partitions at the same
time.
4. Such utilities should not change or move any partition information that
belongs to another operating system.
BOOT RECORD/PARTITION TABLEÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
A boot record must be written on the first sector of all hard disks, and
must contain the following:
1. Code to load and give control to the boot record for one of four possible
operating systems.
2. A partition table at the end of the boot record. Each table entry is 16
bytes long, and contains the starting and ending cylinder, sector, and head
for each of four possible partitions, as well as the number of sectors
preceding the partition and the number of sectors occupied by the partition.
The "boot indicator" byte is used by the boot record to determine if one of
the partitions contains a loadable operating system. FDISK initialization
utilities mark a user-selected partition as "bootable" by placing a value
of 80h in the corresponding partition's boot indicator (setting all other
partitions' indicators to 0 at the same time). The presence of the 80h tells
the standard boot routine to load the sector whose location is contained in
the following three bytes. That sector is the actual boot record for the
selected operating system, and it is responsible for the remainder of the
system's loading process (as it is from the diskette). All boot records are
loaded at absolute address 0:7C00.
The partition table with its offsets into the boot record is:
(except for Wyse DOS 3.2 with 32 bit allocation table, and DOS 3.3-up)
ÚÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄ¿
³Offset³Partit'n³ Purpose ³ ³ Head ³ Sector ³ Cylinder ³
ÃÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄ´
³ 1BEh ³ part 1 ³ begin ³ boot ind ³ H ³ S ³ cyl ³
ÃÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄ´
³ 1C2h ³ ³ end ³ syst ind ³ H ³ S ³ cyl ³
ÃÄÄÄÄÄÄ´ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄ´
³ 1C6h ³ ³ relative sector ³ low word ³ high word ³
ÃÄÄÄÄÄÄ´ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 1CAh ³ ³ # sectors ³ low word ³ high word ³
ÃÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄ´
³ 1CEh ³ part 2 ³ begin ³ boot ind ³ H ³ S ³ cyl ³
ÃÄÄÄÄÄÄ´ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄ´
³ 1D2h ³ ³ end ³ syst ind ³ H ³ S ³ cyl ³
ÃÄÄÄÄÄÄ´ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄ´
³ 1D6h ³ ³ relative sector ³ low word ³ high word ³
ÃÄÄÄÄÄÄ´ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 1DAh ³ ³ # sectors ³ low word ³ high word ³
ÃÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄ´
³ 1DEh ³ part 3 ³ begin ³ boot ind ³ H ³ S ³ cyl ³
ÃÄÄÄÄÄÄ´ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄ´
³ 1E2h ³ ³ end ³ syst ind ³ H ³ S ³ cyl ³
ÃÄÄÄÄÄÄ´ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄ´
³ 1E6h ³ ³ relative sector ³ low word ³ high word ³
ÃÄÄÄÄÄÄ´ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 1EAh ³ ³ # sectors ³ low word ³ high word ³
ÃÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄ´
³ 1EEh ³ part 4 ³ begin ³ boot ind ³ H ³ S ³ cyl ³
ÃÄÄÄÄÄÄ´ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄ´
³ 1F2h ³ ³ end ³ syst ind ³ H ³ S ³ cyl ³
ÃÄÄÄÄÄÄ´ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄ´
³ 1F6h ³ ³ relative sector ³ low word ³ high word ³
ÃÄÄÄÄÄÄ´ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 1FAh ³ ³ # sectors ³ low word ³ high word ³
ÃÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
³ 1FEh ³ signature ³ hex 55 ³ hex AA ³
ÀÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÙ
Boot indicator (boot ind): The boot indicator byte must contain 0 for a non-
bootable partition or 80h for a bootable partition. Only one partition can be
marked as bootable at a time.
System Indicator (sys ind): The sys ind field contains an indicator of the
operating system that "owns" the partition. IBM PC-DOS can only "own" one
partition, though some versions of MSDOS allow all four partitions to be used
by DOS.
The system indicators are:
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ System Indicator (sys ind) ³
ÃÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 00h ³ unknown or unspecified ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 01h ³ DOS 12 bit FAT (DOS 2.x all and 3.x under 10 Mb) ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 04h ³ DOS 16 bit FAT (DOS 3.x+. Not recognized by 2.x) ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 0DBh ³ DRI Concurrent DOS ³
ÃÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ 0F2h ³ 2nd DOS partition, some 3.2 and all 3.3 ³
ÀÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
There are bytes for XENIX, and other operating systems. Some manufacturers
(such as Zenith, Wyse, and Tandon) diddle with these system bytes to implement
more than one DOS partition per disk.
Cylinder (CYL) and Sector (S): The 1 byte fields labelled CYL contain the low
order 8 bits of the cylinder number - the high order 2 bits are in the high
order 2 bits of the sector (S) field. This corresponds with the ROM BIOS
interrupt 13h (disk I/O) requirements, to allow for a 10 bit cylinder number.
The fields are ordered in such a manner that only two MOV instructions are
required to properly set up the DX and CX registers for a ROM BIOS call to
load the appropriate boot record (hard disk booting is only possible from the
first hard disk in the system, where a BIOS drive number of 80h corresponds
to the boot indicator byte).
All partitions are allocated in cylinder multiples and begin on sector 1,
head 0, with the exception that the partition that is allocated at the beginning
of the disk starts at sector 2, to account for the hard disk's master boot
record.
Relative Sector (rel sect): The number of sectors preceding each partition
on the disk is kept in the 4 byte field labelled "rel sect". This value is
obtained by counting the sectors beginning with cylinder 0, sector 1, head 0
of the disk, and incrementing the sector, head, and then track values up to
the beginning of the partition. This, if the disk has 17 sectors per track and
4 heads, and the second partition begins at cylinder 1, sector 1, head 0,and
the partition's starting relative sector is 68 (decimal) - there were 17
sectors on each of 4 heads on 1 track allocated ahead of it. The field is stored
with the least significant word first.
Number of sectors (#sects): The number of sectors allocated to the partition
is kept in the "# of sects" field. This is a 4 byte field stored least
significant word first.
Signature: The last 2 bytes of the boot record (55AAh) are used as a signature
to identify a valid boot record. Both this record and the partition boot record
are required to contain the signature at offset 1FEh.
HARD DISK TECHNICAL INFORMATIONÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Western Digital's hard disk installation manuals make the claim that MSDOS
can support only 2 hard drives. This is entirely false, and their purpose for
making the claim is unclear. DOS merely performs a function call pointed at
the hard disk driver, which is normally in one of three locations; a ROM at
absolute address C:800, the main BIOS ROM if the machine is an AT, or a device
driver installed through the CONFIG.SYS file. Two hard disk controller cards
can normally not reside in the same machine due to lack of interrupt
arbitration. Perstor's ARLL controller and some cards marketed by Novell can
coexist with other controllers. Perstor's technical department has had four
controllers and eight hard disks in the same IBM XT functioning concurrently.
A valid hard disk has a boot record arranged in the following manner:
DB drive ; 0 or 80h (80h marks a bootable, active partition)
DB head1 ; starting heads
DW trksec1 ; starting track/sector (CX value for INT 13)
DB system ; see below
DB head2 ; ending head
DW trksec2 ; ending track/sector
DD sector1 ; absolute # of starting sector
DD sector2 ; absolute # of last sector
The master disk boot record invokes ROM BASIC if no indicator byte reflects a
bootable system.
When a partition's boot record is given control, it is passed its partition
table entry address in the DS:SI registers.
DETERMINING FIXED DISK ALLOCATIONÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
DOS determines disk allocation using the following formula:
D * BPD
TS - RS - ÄÄÄÄÄÄÄÄÄÄÄ
BPS
SPF = ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
BPS * SPC
CF + ÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
BPC
where:
TS total sectors on disk
RS the number of sectrs at the beginning of the disk that are reserved
for the boot record. DOS reserves 1 sector.
D The number of directory entries in the root directory.
BPD the number of bytes per directory entry. This is always 32.
BPS the number of bytes per logical sector. Typically 512, but you can
specify a different number with VDISK.
CF The number of FATS per disk. Usually 2. VDISK is 1.
SPF the number of sectors per FAT. Maximum 64.
SPC The number of sectors per allocation unit.
BPC the number of bytes per FAT entry. BPC is 1.5 for 12 bit FATs.
2 for 16 bit FATS.
To calculate the minimum partition size that will force a 16-bit FAT:
CYL = (max clusters * 8)/(HEADS * SPT)
where:
CYL number of cylinders on the disk
max clusters 4092 (maximum number of clusters for a 12 bit FAT)
HEADS number of heads on the hard disk
SPT sectors per track (normally 17 on MFM)
DOS 2.0 uses a "first fit" algorithm when allocating file space on the hard
disk. Each time an application requests disk space, it will scan from the
beginning of the FAT until it finds a contiguous piece of storage large enough
for the file.
DOS 3.0 keeps a pointer into the disk space, and begins its search from the
point it last left off. This pointer is lost when the system is rebooted.
This is called the "next fit" algorithm. It is faster than the first fit and
helps minimize fragmentation.
In either case, if the FCB function calls are used instead of the handle
function calls, the file will be broken into pieces starting with the first
availible space on the disk.
** Programmer's Technical Reference for MSDOS and the IBM PC **
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ Shareware Version, 06/17/91 ³
³ Please Register Your Copy ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
Copyright (c) 1987, 1991 Dave Williams
USA copyright TXG 392-616 ALL RIGHTS RESERVED
ISBN 1-878830-02-3 (disk-based text)
The rest of the chapters aren't included in this shareware demonstration
package. Since the complete manual takes almost a megabyte archived,
something had to give somewhere.
Here's a sample of what you're missing:
DOS 5 information (mainly in registered chapter 4, some in 5)
(Chapters 1 and 2 are complete)
CHAPTER 3 The IBM ROM BIOS
Calling the ROM BIOS .................................................. 3**1
Interrupt 10h Video Services ......................................... 3**2
Interrupt 11h Equipment Check ........................................ 3**3
Interrupt 12h Memory Size ............................................ 3**4
Interrupt 13h Disk Functions ......................................... 3**5
Interrupt 14h Initialize and Access Serial Port ...................... 3**6
FOSSIL Drivers ......................................... 3**7
Interrupt 15h Cassette I/O ........................................... 3**8
Interrupt 16h Keyboard I/O ........................................... 3**9
Interrupt 17h Printer ................................................ 3**10
Interrupt 18h ROM BASIC .............................................. 3**11
Interrupt 19h Bootstrap Loader ....................................... 3**12
Interrupt 1Ah Time of Day ............................................ 3**13
Interrupt 1Bh Control-Break .......................................... 3**14
Interrupt 1Ch Timer Tick ............................................. 3**15
Interrupt 1Dh Vector of Video Initialization Parameters .............. 3**16
Interrupt 1Eh Vector of Diskette Controller Parameters ............... 3**17
Interrupt 1Fh Ptr to Graphics Character Extensions (Graphics Set 2) .. 3**18
CHAPTER 4 DOS Function Requests
General Programming Guides ............................................ 4**1
DOS Registers ......................................................... 4**2
DOS Stacks ............................................................ 4**3
DOS Interrupts ........................................................ 4**4
Interrupt 20h (Terminate) ............................................. 4**5
DOS Services (quick list) ............................................. 4**6
Calling the DOS Services .............................................. 4**7
Version Specific Information .......................................... 4**8
Compatibility Problems With DOS 4.0+ .................................. 4**9
PCjr Cartridge Support ................................................ 4**10
eDOS 4.0 .............................................................. 4**11
DOS Services in Detail ................................................ 4**12
CHAPTER 5 Interrupts 22h through 0FFh
Interrupt 22h Terminate Address ..................................... 5**1
Interrupt 23h Ctrl-Break Exit Address ............................... 5**2
Interrupt 24h Critical Error Handler ................................ 5**3
Interrupt 25h Absolute Disk Read .................................... 5**4
Interrupt 26h Absolute Disk Write ................................... 5**5
Interrupt 27h Terminate And Stay Resident ........................... 5**6
Interrupt 28h (not documented by Microsoft) ......................... 5**7
Interrupt 29h (not documented by Microsoft) ......................... 5**8
Interrupt 2Ah Microsoft Networks - Session Layer Interrupt .......... 5**9
Interrupt 2Bh Unknown ............................................... 5**10
Interrupt 2Ch Unknown ............................................... 5**11
Interrupt 2Dh Unknown ............................................... 5**12
Interrupt 2Eh Alternate EXEC (DOS 2.0+) ............................. 5**13
Interrupt 2Fh Multiplex Interrupt ................................... 5**14
Interrupt 30h FAR jump instruction for CP/M-style calls ............. 5**15
Interrupt 31h Unknown ............................................... 5**16
Interrupt 32h Unknown ............................................... 5**17
Interrupt 33h Used by Microsoft Mouse Driver Function Calls ......... 5**18
Interrupt 34h Turbo C/Microsoft languages - Floating Point emulation 5**19
Interrupt 35h Turbo C/Microsoft languages - Floating Point emulation 5**20
Interrupt 36h Turbo C/Microsoft languages - Floating Point emulation 5**21
Interrupt 37h Turbo C/Microsoft languages - Floating Point emulation 5**22
Interrupt 38h Turbo C/Microsoft languages - Floating Point emulation 5**23
Interrupt 39h Turbo C/Microsoft languages - Floating Point emulation 5**24
Interrupt 3Ah Turbo C/Microsoft languages - Floating Point emulation 5**25
Interrupt 3Bh Turbo C/Microsoft languages - Floating Point emulation 5**26
Interrupt 3Ch Turbo C/Microsoft languages - Floating Point emulation 5**27
Interrupt 3Dh Turbo C/Microsoft languages - Floating Point emulation 5**28
Interrupt 3Eh Turbo C/Microsoft languages - Floating Point emulation 5**29
Interrupt 3Fh Overlay Manager Interrupt (Microsoft LINK.EXE) ........ 5**30
Interrupt 40h Hard Disk BIOS ........................................ 5**31
Interrupt 41h Hard Disk Parameters .................................. 5**32
Interrupt 42h Pointer to screen BIOS entry .......................... 5**33
Interrupt 43h Pointer to EGA Graphics Character Table ............... 5**34
Interrupt 44h Pointer to graphics character table ................... 5**35
Interrupt 45h Reserved by IBM (not initialized) .................... 5**36
Interrupt 46h Pointer to second hard disk parameter block ........... 5**37
Interrupt 47h Reserved by IBM (not initialized) .................... 5**38
Interrupt 48h Cordless Keyboard Translation ......................... 5**39
Interrupt 49h Non-keyboard Scan Code Translation Table Address (PCjr) 5**40
Interrupt 4Ah Real-Time Clock Alarm (Convertible, PS/2) ............. 5**41
Interrupt 4Bh Reserved by IBM (not initialized) .................... 5**42
Interrupt 4Ch Reserved by IBM (not initialized) .................... 5**43
Interrupt 4Dh Reserved by IBM (not initialized) .................... 5**44
Interrupt 4Eh Reserved by IBM (not initialized) .................... 5**45
Interrupt 4Fh Reserved by IBM (not initialized) .................... 5**46
Interrupt 50-57 IRQ0-IRQ7 Relocation .................................. 5**47
Interrupt 58h Reserved by IBM (not initialized) .................... 5**48
Interrupt 59h Reserved by IBM (not initialized) .................... 5**49
Interrupt 5Ah Reserved by IBM (not initialized) ................... 5**50
Interrupt 5Bh Reserved by IBM (not initialized) .................... 5**51
Interrupt 5Ah Cluster Adapter BIOS entry address .................... 5**52
Interrupt 5Bh Reserved by IBM (not initialized) .................... 5**53
Interrupt 5Ch NETBIOS interface entry port, TOPS .................... 5**54
Interrupt 5Dh Reserved by IBM (not initialized) .................... 5**55
Interrupt 5Eh Reserved by IBM (not initialized) .................... 5**56
Interrupt 5Fh Reserved by IBM (not initialized) .................... 5**57
Interrupt 60h-67h User Program Interrupts ............................ 5**58
Interrupt 60h Network OS Interface .................................. 5**59
Interrupt 67h Expanded Memory Board Driver Interrupt ................ 5**60
Interrupt 68h Not Used (not initialized) ........................... 5**61
Interrupt 69h Not Used (not initialized) ........................... 5**62
Interrupt 6Ah Not Used (not initialized) ........................... 5**63
Interrupt 6Bh Not Used (not initialized) ........................... 5**64
Interrupt 6Ch System Resume Vector (Convertible) .................... 5**65
Interrupt 6Dh Not Used (not initialized) ........................... 5**66
Interrupt 6Eh Not Used (not initialized) ........................... 5**67
Interrupt 6Fh 10-Net API............................................. 5**68
Interrupt 70h IRQ 8, Real Time Clock Interrupt (AT, XT/286, PS/2) ... 5**69
Interrupt 71h IRQ 9, Redirected to IRQ 8 (AT, XT/286, PS/2) ......... 5**70
Interrupt 72h IRQ 10 (AT, XT/286, PS/2) Reserved .................. 5**71
Interrupt 73h IRQ 11 (AT, XT/286, PS/2) Reserved .................. 5**72
Interrupt 74h IRQ 12 Mouse Interrupt (PS/2) ........................ 5**73
Interrupt 75h IRQ 13, Coprocessor Error (AT) ........................ 5**74
Interrupt 76h IRQ 14, Hard Disk Controller (AT, XT/286, PS/2) ....... 5**75
Interrupt 77h IRQ 15 (AT, XT/286, PS/2) Reserved ................... 5**76
Interrupt 78h Not Used .............................................. 5**77
Interrupt 79h Not Used .............................................. 5**78
Interrupt 7Ah Reserved .............................................. 5**79
Interrupt 7Bh-7Eh Not Used by IBM .................................... 5**80
Interrupt 7Ch REXX-PC API ........................................... 5**81
Interrupt 7Fh IBM 8514/A Graphics Adapter API ....................... 5**82
Interrupt 80h-85h Reserved by BASIC .................................. 5**83
Interrupt 86h Int 18 when relocated by NETBIOS ...................... 5**84
Interrupt 86h-0F0h Used by BASIC when BASIC interpreter is running ... 5**85
Interrupt 0A4h Right Hand Man API .................................... 5**86
Interrupt 0D4h PC-MOS/386 API ........................................ 5**87
Interrupt 0E0h Digital Research CP/M-86 function calls ............... 5**88
Interrupt 0E1h PC Cluster Disk Server Information .................... 5**89
Interrupt 0E2h PC Cluster Program .................................... 5**90
Interrupt 0E4h Logitech Modula-2 v2.0 Monitor Entry ................ 5**91
Interrupt 0E5h Not Used .............................................. 5**92
Interrupt 0E6h Not Used .............................................. 5**93
Interrupt 0E7h Not Used .............................................. 5**94
Interrupt 0E8h Not Used .............................................. 5**95
Interrupt 0E9h Not Used .............................................. 5**96
Interrupt 0EAh Not Used .............................................. 5**97
Interrupt 0EBh Not Used .............................................. 5**98
Interrupt 0ECh Not Used .............................................. 5**99
Interrupt 0EDh Not Used ............................................. 5**100
Interrupt 0EEh Not Used ............................................. 5**101
Interrupt 0EFh GEM interface (Digital Research) ..................... 5**102
Interrupt 0F0h unknown .............................................. 5**103
Interrupts 0F1h-0FFh (absolute addresses 3C4h-3FFh) ................. 5**104
Interrupt 0F4h Not Used ............ ................................ 5**105
Interrupt 0F5h Not Used ............ ................................ 5**106
Interrupt 0F8h Set Shell Interrupt (OEM) ............................ 5**107
Interrupt 0F9h Reserved ............................................. 5**108
Interrupt 0FAh USART ready (RS-232C) ................................ 5**109
Interrupt 0FBh USART RS ready (keyboard) ............................ 5**110
Interrupt 0FCh Unknown ...............................................5**111
Interrupt 0FDh reserved for user interrupt .......................... 5**112
Interrupt 0FEh reserved by IBM ...................................... 5**113
Interrupt 0FFh reserved by IBM ...................................... 5**114
CHAPTER 6 DOS Control Blocks and Work Areas
DOS Address Space ..................................................... 6**1
Storage Blocks ........................................................ 6**2
Disk Transfer Area (DTA) .............................................. 6**3
Program Segment Prefix ................................................ 6**4
Memory Control Blocks ................................................. 6**5
DOS Program Segment ................................................... 6**6
CHAPTER 7 DOS File Information
File Management Functions ............................................. 7**1
FCB Function Calls .................................................... 7**2
Handle Function Calls ................................................. 7**3
Special File Handles .................................................. 7**4
Raw and Cooked File I/O ............................................... 7**5
Number of Open Files Allowed ......................................... 7**6
Restrictions on FCB Usage ............................................. 7**7
Restrictions on Handle usage .......................................... 7**8
Allocating Space to a File ............................................ 7**9
MSDOS / PCDOS Differences ............................................. 7**10
.COM File Structure ................................................... 7**11
.EXE File Structure ................................................... 7**12
The Relocation Table .................................................. 7**13
"NEW" .EXE Format (Microsoft Windows and OS/2) ........................ 7**14
Standard File Control Block ........................................... 7**15
Extended File Control Block ........................................... 7**16
Disk Transfer Area .................................................... 7**17
CHAPTER 8 DOS Disk Information
The DOS Area .......................................................... 8**1
The Boot Record ....................................................... 8**2
DOS File Allocation Table (FAT) ....................................... 8**3
Media Descriptor Byte ......................................... 8**4
12 Bit FATs ................................................... 8**5
16 Bit FATs ................................................... 8**6
32 Bit FATs ................................................... 8**7
DOS Disk Directory .................................................... 8**8
The Data Area ......................................................... 8**9
Floppy Disk Types ..................................................... 8**10
Hard Disk Layout ...................................................... 8**11
System Initialization ................................................. 8**12
Boot Record/Partition Table ........................................... 8**13
Hard Disk Technical Information ....................................... 8**14
Determining Hard Disk File Allocation ................................. 8**15
BIOS Disk Functions ................................................... 8**16
CHAPTER 9 Device Drivers
CHAPTER 10 Lotus/Intel/Microsoft Expanded Memory Specification
History ............................................................... 10**1
Uses of Expanded Memory ............................................... 10**2
DOS and Expanded Memory ............................................... 10**3
Different Memory Types ................................................ 10**4
AST/Quadram/Ashton-Tate Enhanced EMM .................................. 10**5
EMS Address Space Map ................................................. 10**6
Writing Programs That Use Expanded Memory ............................. 10**7
Page Frames ........................................................... 10**8
Calling the Manager ................................................... 10**9
Detecting EMS ......................................................... 10**10
Terminate and Stay Resident (TSR) Program Cooperation ................. 10**11
Expanded Memory Services Quick List ................................... 10**12
Expanded Memory Services .............................................. 10**13
LIM 3.2 Specification ......................................... 10**14
LIM 4.0 Specification ......................................... 10**15
AQA EEMS 3.2 Specification .................................... 10**16
VCPI API 1.0 .................................................. 10**17
Expanded Memory Manager Error Codes ................................... 10**18
CHAPTER 11 Conversion Between Operating Systems
Overview .............................................................. 11**1
Special Considerations ................................................ 11**2
Example Operating Systems ............................................. 11**3
Atari ST .............................................................. 11**4
CP/M .................................................................. 11**5
MacOS ................................................................. 11**6
AmigaDOS .............................................................. 11**7
OS/2 .................................................................. 11**8
UNIX .................................................................. 11**9
CHAPTER 12 Microsoft Windows API
Overview .............................................................. 12**1
Programming Windows ................................................... 12**2
Versions .............................................................. 12**3
Functions ............................................................. 12**4
Error Codes ........................................................... 12**5
CHAPTER 13 Network APIs
FTP Driver - PC/TCP Packet Driver Specification ....................... 13**1
10-Net Network ........................................................ 13**2
LANtastic LANOS API ................................................... 13**3
Novell NetWare 2.11 API ............................................... 13**4
APPC/PC ............................................................... 13**5
CHAPTER 14 Mouse Programming
General Information ................................................... 14**1
Register Usage ........................................................ 14**2
Interrupt 33h Function Requests ....................................... 14**3
Interrupt 10h Function Requests ....................................... 14**4
CHAPTER 15 Register-Level Programming
8555 Peripheral Interface ............................................. 15**1
8259 Interrupt Controller ............................................. 15**2
AT CMOS RAM Configuration ............................................. 15**3
CHAPTER 16 Video Programming
Quick List of BIOS Interrupt 10h Functions ............................ 16**1
BIOS Interrupt 10h Functions in Detail ................................ 16**2
CHAPTER 17 Multitasking Shells
Introduction .......................................................... 17**1
Programming Practices ................................................. 17**2
TopView/DesQview API (interrupt 15h, "System Services" interface) ..... 17**3
TopView/DesQview API (interrupt 16h, "BIOS Video" interface) .......... 17**4
CHAPTER 18 Viruses and Trojan Horses
MISCSTUF Miscellaneous Stuff
AFTERWRD Afterword
A P P E N D I C E S
APPENDIX 1 Keyboard scan code chart
APPENDIX 2 ASCII character chart
APPENDIX 3 IBM PC character set
APPENDIX 4 IBM PC error code listing
APPENDIX 5 Addresses of various manufacturers
| grouped by product - monitors, keyboards, etc.
APPENDIX 6 Hard disk information
| formatting information for hundreds of hard disks
APPENDIX 7 Floppy and Tape Devices
APPENDIX 8 Pinouts of various connectors on the IBM PC
| need the pinout for an external floppy for your laptop?
| For a parallel loopback tester? An IBM printer cable?
| All these and more
APPENDIX 9 Sizes of various drivers installed in CONFIG.SYS
APPENDIX 10 Common modem instruction sets
APPENDIX 11 Glossary of computer terminology
APPENDIX 12 Various busses used in MSDOS machines
APPENDIX 13 Common filename extensions
APPENDIX 14 Clock speeds of various expansion cards
APPENDIX 15 Header formats used by various archive utilities
APPENDIX 16 Miscellaneous Hardware Information
APPENDIX 17 HP LaserJet Setup Codes
APPENDIX 18 ANSI.SYS
APPENDIX 19 DEC VT100 Escape Sequences
APPENDIX 20 Various Paint Program Formats
APPENDIX 21 Some Commonly Used Hot-Keys
APPENDIX 22 Sound Blaster API
APPENDIX 23 French-Canadian accented character chart
** Programmer's Technical Reference for MSDOS and the IBM PC **
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ Shareware Version, 06/17/91 ³
³ Please Register Your Copy ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
Copyright (c) 1987, 1991 Dave Williams
USA copyright TXG 392-616 ALL RIGHTS RESERVED
ISBN 1-878830-02-3 (disk-based text)
Additional Readings...
I don't have and haven't seen most of this stuff, but I've come across
mentions of it. This list is purely FYI...
IBM's literature guide lists the following manuals:
Hardware Technical References:
PS/2 Model 25 $31.50 75X1055
PS/2 Model 30 $82.50 68X2201
PS/2 Model 30/286 $26.75 01F0237
PC $33.00 6322507 (the original)
PC/AT $115.00 6280070
supplement for AT/339 $54.50 6280099 (enhanced 8mHz)
XT/286 $55.00 68X2210
XT and Portable $54.50 6280089
Convertible $82.50 6280648
PCjr $38.50 1502293 (availability varies)
PS/2 Hardware Interface $137.00 68X2330
(Micro Channel docs)
PS/2 BIOS Interface $137.00 68X2341 (no source code listing)
Advanced BIOS Interface $50 68X2288
DOS 3.3 Technical Ref. $93.00 6280059 (no reference for 4.0)
DOS 4.0 Command Ref. $31.50 6280253 (commands only)
8514/A Developer's Guide $26.75 68X2279
There is supposed to be a DOS 4.0 Technical Reference, but there's no name or
part number listed in the official IBM literature. You might check with your
local IBM retailer. (hah!)
DOS 4.0 Technical Ref. $--.-- 6280254 (not listed in catalog)
IBM NetBIOS Application
Development Guide (API) $49.25 68X2270 (not listed in catalog)
address:
IBM Technical Directory 800-426-7282
PO Box 2009 414-633-8108
Racine WI 53404-3336 BC, Canada 112-800-465-1234
Canada 800-465-1234
catalogs are free
Zenith Data Systems' "MS-DOS version 2 Programmer's Utility" comes with MASM,
a version of the MS-DOS Programmer's Reference from Microsoft, the assembly
language source for Zenith's ANSI.SYS driver, an editor, an assortment of
filters and utilities, and the source listing for the "device dependent"
portion of MS-DOS for the Z-151.
"Document Content Architecture: Revisable - Form - Text Reference"
IBM Document SC23-0758-1
IGES (International Graphics Exchange Specification) 3.0 documentation,
Global Engineering Documents (800) 854-7179. Part number NBSIR 86-3359, NBS.
ISBN 0-672-22027-X "Interfacing To the IBM Personal Computer" by
Lewis C. Eggebrecht, Howard W Sams & Co., Indianapolis, IN.
Intel Application Note AP-133, "Getting Started with the Numeric Data
Processor," by Bill Rash. February 1981.
Intel iAPX 286 Programmer's Reference Manual, including the iAPX 286
Numeric Supplement, Intel part no. 210498-003. Has some reasonably useful
example codes in section 4, including ASCII to binary and vice versa on
pages 4-7 to 4-14 and trig functions on 4-18 to 4-23. The programming
style in these examples is rather bizarre but they are better than nothing.
Intel 80387 Programmer's Reference Manual, Intel part no. 231917-001.
Various example listings on pages 7-7 to 7-17, including ASCII to binary
and binary to ASCII conversions and raising a number to a power. No trig
routines in this manual because the 80387 has built-in FSIN, FCOS, and FSINCOS
instructions and generalized FPTAN and FPATAN instructions that make
subroutines unnecessary.
Hercules sells a graphics library for the Herc board called GRAPHX for $50.
DoD Trusted Computer System Evaluation Criteria (popularly known as "The
Orange Book) GPO Stock No 008-000-00461-7 Cost $6.00
Information Interchange Standards:
ANSI X 3.15-1976 (FIPS 16-1)
Bit Sequencing In Serial-By-Bit Data Transmission.
ANSI X3.16-1976 (FIPS 17-1)
Character Structure and Parity-Sense, Serial-By-Bit.
ANSI X3.25-1976 (FIPS 18-1)
Character Structure and Parity-Sense, Parallel-By-Bit.
ANSI X3.4-1977 (FIPS 1-1)
Code for Information Interchange
ANSI X3.41-1974 (FIPS 35)
Code Extension Techniques for Use With 7-Bit Coded Characters.
ANSI X3.64-1979 (FIPS 86)
Additional Controls for Use With...
ANSI X3.32-1973 (FIPS 1)
Graphic Representation of the Control Characters.
ANSI X3.78-1981
Representation of Vertical Carriage positoning Characters.
ANSI X3.42-1975
Representation of numeric values in Character Strings.
ANSI X3.98-1983
Page Image Format (PIF), Text, for Information Systems.
ANSI X3.28-1976
Procedure for the Use of Communications Control Characters.
ANSI X3.66-1979 (FIPS 71)
Advanced Data Communications Control Procedures (ADCCP)
Data Encryption Standards:
ANSI-X3.92-1981
Data Encryption Algorithm
ANSI-X3.105-1983
Data Link Encryption
ANSI-X3.106-1983
Modes of Operation of Data Encryption Algorithm
Serial Interface Standards:
RS-232-C Aug 1969 (June 1981)
Interface Between Data Terminal Equipment (DTE) and
Data Communications Equipment (DCE)
Bulletin #9 May 1971 (Application Notes)
...reviews methods of operation...service and trans-
mission facility characteristics...
Bulletin #12 Nov 1977 (Application Notes)
Interconnection Between RS-449 and RS-232-C ...
Bulletin #14 Mar 1982 (Application Notes)
Loop Test Circuits Not Defined in RS-232-C
RS-336-A Mar 1979
Interface Between DTE and Automatic Calling Equipment
RS-449 Nov 1977
RS-449-1 Addendum 1 Feb 1980
General Purpose 37- and 9-Position Interface for DTE
and Data Circuit-Terminating Equipment (DCE)...
Standards Groups:
AFIP (Federal Information Processing Standards)
Office of Technical Information and Publications
National Bureau of Standards
Washington, D.C. 20234
ANSI American National Standards Institute, Inc.
1430 Broadway
New York, New York 10018
BELL ??
EIA Electronic Industries Association
2001 Eye Street
Washington, D.C. 20006
CCITT ??
ISO International Standards Organization
(available through ANSI)
Coding and Information Theory by Richard W. Hamming (Prentice-Hall, 1980)
Error Correcting Codes by W. Wesley Peterson (MIT Press and Wiley, 1961)
Handbook of Software & Hardware Interfacing for IBM PCs
Jefferey P. Royer
1987 by Prentice-Hall, Inc. (Osborne-McGraw-Hill)
Englewood Cliffs, NJ 07632
ISBN 0-13-381831-4 hardware and expansion card design and interfacing
The C Programmer's Guide to NetBios, W. David Schwaderer, Howard W Sams &
Company, ISBN 0-672-22638-3 $24.95.
Computer Networks - Andrew S. Tanenbaum,Prentice Hall, ISBN 0-13-162959-X
Local Area Networks - Thomas W.Madron - Wiley, ISBN 0-471-85989-3
Netware APIs: There are many API packages available from Novell. Some of them:
Value-Added Process API $10.00 part number 420-10361-001
Netware Enhancements Package (security APIs, Queue Management, Accounting
Services) $15.00 part number 420-010316-110
Peer to Peer Comm. $15.00 part # 421-10070-001
Message Handling Service Interface $15.00 part # 420-10360-001
Novell API Reference Manual vols 1 & 2 $25.00 each part #s 452-760041-001
and 452-760042-001
C language Novell API Reference $250.00 part # 452-760043-001
Programmer's Guide $49.00 part # 420-000089-001
NetWare Technical Journal, 650 South Clark, Chicago, IL 60605-9960, pub. four
times a year for $50.00/yr.
SCSI specification: $25 from the American National Standards Institute,
1430 Broadway, New York, NY 10018, (212) 642-4900.
SCSI-2 X3T9.2 committee working documents, CAM committee documents, and the
most current draft of the SCSI-2 specification are available for downloading
from the SCSI BBS at (316) 636-8700 (300, 1200, or 2400 bps; 24 hours).
A paper copy of the SCSI-2 draft specification is available for $60 from
Global Engineering Documents 2805 McGaw Ave., Irvine, CA 92714,
(800) 854-7179 or (714) 261-1455.
SMB protocol (used by Microsoft in MS-Net and Lan Manager) "IBM Personal
Computer Seminar Proceedings", Volume 2, Number 8-1, G320-9310-00.
Security (DES, etc): NCSC's VENDOR'S GUIDE (dark green book [part of the
Rainbow series of books]). Write to: National Security Agency, ATTN: S613,
Ft. George Meade, MD 20755-6000, or call (301) 688-6581.
Programmer's Guide to PC & PS/2 Video Systems
Richard Wilton
Microsoft Press 1987
ISBN 1-55615-103-9
Logitech Mouse Tech. Ref. and Programmer's Guide v2.0, $25 (415)795-0801
Comments
Post a Comment