Subject: What is in the low memory BIOS area on a PC?
Date: 09/13/97
BIOS Low-Memory Data Area (0040:0000)
Format of BIOS Data Segment at segment 40h:
{items in curly braces not documented by IBM}
Offset Size Description
00h WORD Base I/O address of 1st serial I/O port, zero if none
02h WORD Base I/O address of 2nd serial I/O port, zero if none
O4h WORD Base I/O address of 3rd serial I/O port, zero if none
06h WORD Base I/O address of 4th serial I/O port, zero if none
Note: Above fields filled in turn by POST as it finds serial
ports. POST never leaves gaps. DOS and BIOS serial device
numbers may be redefined by re-assigning these fields.
08h WORD Base I/O address of 1st parallel I/O port, zero if none
0Ah WORD Base I/O address of 2nd parallel I/O port, zero if none
0Ch WORD Base I/O address of 3rd parallel I/O port, zero if none
0Eh WORD [non-PS] Base I/O address of 4th parallel port, 0 if none
[PS] Segment of Extended BIOS Data Segment
Note: Above fields filled in turn by POST as it finds
parallel ports. POST never leaves gaps. DOS and BIOS
parallel device numbers may de redefined by re-assigning
these fields.
10h WORD Installed hardware:
bits 15-14: number of parallel devices
bit 13: [Conv] Internal modem
bit 12: reserved
bits 11- 9: number of serial devices
bit 8: reserved
bits 7- 6: number of diskette drives minus one
bits 5- 4: Initial video mode:
00b = EGA,VGA,PGA
01b = 40 x 25 color
10b = 80 x 25 color
11b = 80 x 25 mono
bit 3: reserved
bit 2: [PS] =1 if pointing device
[non-PS] reserved
bit 1: =1 if math co-processor
bit 0: =1 if diskette available for boot
12h BYTE [Conv] POST status
[AT] {Manufacturing test initialisation flags}
13h WORD Base memory size in kbytes (0-640)
15h BYTE [AT] {Manufacturing test scratch pad}
16h BYTE [AT] {Manufacturing test scratch pad}
[PS/2 Mod 30] BIOS control flags
17h BYTE Keyboard status flags 1:
bit 7 =1 INSert active
bit 6 =1 Caps Lock active
bit 5 =1 Num Lock active
bit 4 =1 Scroll Lock active
bit 3 =1 either Alt pressed
bit 2 =1 either Ctrl pressed
bit 1 =1 Left Shift pressed
bit 0 =1 Right Shift pressed
18h BYTE Keyboard status flags 2:
bit 7 =1 INSert pressed
bit 6 =1 Caps Lock pressed
bit 5 =1 Num Lock pressed
bit 4 =1 Scroll Lock pressed
bit 3 =1 Pause state active
bit 2 =1 Sys Req pressed
bit 1 =1 Left Alt pressed
bit 0 =1 Left Ctrl pressed
19h BYTE Keyboard: Alt-nnn keypad workspace
1Ah WORD Keyboard: ptr to next character in keyboard buffer
1Ch WORD Keyboard: ptr to first free slot in keyboard buffer
1Eh 16 WORDS Keyboard circular buffer (but see 80h, 82h for override)
3Eh BYTE Diskette recalibrate status:
bit 7 =1 Diskette hardware interrupt occurred
bits 6-4 reserved
bit 3 =1 Recalibrate diskette 3
bit 2 =1 Recalibrate diskette 2
bit 1 =1 Recalibrate diskette 1
bit 0 =1 Recalibrate diskette 0
3Fh BYTE Diskette motor status:
bit 7 =1 current operation is write or format
=0 current operation is read or verify
bit 6 reserved
bits 5-4 diskette drive number selected (0-3)
bit 3 =1 diskette 3 motor on
bit 2 =1 diskette 2 motor on
bit 1 =1 diskette 1 motor on
bit 0 =1 diskette 0 motor on
40h BYTE Diskette motor turn-off time-out count
41h BYTE Diskette last operation status (0 = OK)
bit 7 =1 drive not ready
bit 6 =1 seek error
bit 5 =1 general controller failure
bits 4-0:
00h no error
01h invalid request
02h address mark not found
03h write-protect error
04h sector not found
06h diskette change line active
08h DMA overrun
09h DMA across 64k boundary
0Ch media type unknown
10h CRC error on read
42h 7 BYTES Diskette/Fixed disk status/command bytes
49h BYTE Video current mode
4Ah WORD Video columns on screen
4Ch WORD Video page (regen buffer) size in bytes
4Eh WORD Video current page start address in regen buffer
50h 16 BYTES Video cursor position (col, row) for eight pages, 0 based
60h WORD Video cursor type, 6845 compatible, hi=startline,
lo=endline
62h BYTE Video current page number
63h WORD Video CRT controller base address: color=03D4h, mono=03B4h
65h BYTE Video current setting of mode select register 03D8h/03B8h
66h BYTE Video current setting of CGA palette register 03D9h
67h DWORD POST real mode re-entry point after certain resets
6Bh BYTE POST last unexpected interrupt
6Ch DWORD Timer ticks since midnight
70h BYTE Timer overflow, non-zero if has counted past midnight
71h BYTE Ctrl-Break flag: bit 7=1
72h WORD POST reset flag:
= 1234h if to bypass memory test (warm boot)
= 4321h [PS/2 MCA only] if to preserve memory
= 5678h [Conv] system suspended
= 9ABCh [Conv] manufacturing test mode
= ABCDh [Conv] POST loop mode
= 64h Burn-in mode
74h BYTE Fixed disk last operation status: {except ESDI drives}
00h no error
01h invalid function request
02h address mark not found
03h write protect error
04h sector not found
05h reset failed
07h drive parameter activity failed
08h DMA overrun
09h DMA data boundary error
0Ah bad sector flag detected
0Bh bad track detected
0Dh invalid number of sectors for Format
0Eh control data address mark detected
0Fh DMA arbitration level out of range
10h uncorrectable ECC or CRC error
11h ECC corrected data error
20h general controller failed
40h seek failed
80h time out
AAh drive not ready
BBh undefined error
CCh write fault on selected drive
E0h status error/error register is zero
FFh sense failed
75h BYTE Fixed disk: number of fixed disk drives
76h BYTE Fixed disk: control byte {IBM document only for XT}
77h BYTE Fixed disk: I/O port offset {IBM document only for XT}
78h 4 BYTES Parallel devices 1-4 time-out counters [PS: only 1-3]
7Ch 4 BYTES Serial devices 1-4 time-out counters
80h WORD Keyboard buffer start as offset from seg 40h
(normally 1Eh)
82h WORD Keyboard buffer end+1 as offset from seg 40h
(normally 3Eh)
[XT BIOS dated 11/08/82 ends here]
84h BYTE Video EGA/MCGA/VGA rows on screen minus one
85h WORD Video EGA/MCGA/VGA character height in scan-lines
87h BYTE Video EGA/VGA control: [MCGA: =00h]
bit 7: =1 if not to clear RAM (see INT 10h, AH=00h)
bits 6-5: RAM on adapter = (this field + 1) * 64K
bit 4: reserved
bit 3: =0 if EGA/VGA video system active, =1 if inactive
bit 2: =1 if to wait for display enable (what means this?)
bit 1: =0 for color or ECD monitor, =1 for mono monitor
bit 0: =0 alphanumeric cursor emulation enabled, =1 not.
When enabled, text mode cursor size (INT 10,AH=01h)
settings looking like CGA ones are translated to
equivalent EGA/VGA ones.
88h BYTE Video EGA/VGA switches: [MCGA: reserved]
bits 7-4: power-on state of feature connector bits 3-0
bits 3-0: configuration switches 4-1 (=0 on, =1 off)
Values as read:
0h Pri MDA, Sec EGA+old color display 40 x 25
1h Pri MDA, Sec EGA+old color display 80 x 25
2h Pri MDA, Sec EGA+ECD normal mode (CGA emul)
3h Pri MDA, Sec EGA+ECD enhanced mode
4h Pri CGA 40 x 25, Sec EGA mono display
5h Pri CGA 80 x 25, Sec EGA mono display
6h Pri EGA+old color display 40 x 25, Sec MDA
7h Pri EGA+old color display 80 x 25, Sec MDA
8h Pri EGA+ECD normal mode (CGA emul), Sec MDA
9h Pri EGA+ECD enhanced mode, Sec MDA
Ah Pri EGA mono display, Sec CGA 40 x 25
Bh Pri EGA mono display, Sec CGA 80 x 25
When bit4 of 40h:89h is 0, VGA emulates 350-line EGA if
this byte is x3h or x9h, otherwise emulates 200-line CGA in
400-line double scan. VGA resets this byte to x9h after the
mode set.
89h BYTE Video MCGA/VGA mode-set option control:
bits 7 and 4:
0 0 350-line mode requested
0 1 400-line mode at next mode set
1 0 200-line mode requested
1 1 reserved
Apparently VGA BIOS mode set disregards bit 7 and uses
byte 40h:88h to determine 200/350 selection when bit 4
is zero. Presumably bit 7 is a convenience for other
purposes. Bit 7 is reset to zero after the mode set.
bit 6: =1 if display switching enabled, =0 if disabled
bit 5: reserved
bit 4: [VGA] =1 if to use 400-line mode at next mode set
=0 if to emulate EGA at next mode set
This bit set to 1 after the mode set.
[MCGA] =1 use 400-line mode at next mode set
=0 emulate CGA, digital monitor, 200 lines,
8 x 8 text font at next mode set
Bit unchanged by mode set.
bit 3: =0 if default palette loading enabled at mode set
bit 2: =1 if mono display, =0 if color display
bit 1: =1 if gray scale summing enabled, =0 if disabled
bit 0: [VGA] =1 if VGA active, =0 if not
[MCGA] reserved, zero
8Ah BYTE Video [MCGA/VGA]: index into Display Combination Code
table
8Bh BYTE Diskette media control [not XT]:
bits 7-6: Last data rate set by controller:
00=500kbps, 01=300kbps, 10=250kbps, 11=reserved
bits 5-4: Last diskette drive step rate selected
bits 3-2: {Data rate at start of operation}
bits 1-0: reserved
8Ch BYTE Fixed disk controller status [not XT]
8Dh BYTE Fixed disk controller Error Status [not XT]
8Eh BYTE Fixed disk Interrupt Control [not XT]
8Fh BYTE Diskette controller information [not XT]:
bit 7: reserved
bit 6: =1 drive 1 determined
bit 5: =1 drive 1 is multi-rate, valid if drive determined
bit 4: =1 drive 1 supports 80 tracks, always valid
bit 3: reserved
bit 2: =1 drive 0 determined
bit 1: =1 drive 0 is multi-rate, valid if drive determined
bit 0: =1 drive 0 supports 80 tracks, always valid
90h BYTE Diskette drive 0 media state
91h BYTE Diskette drive 1 media state
bits 7-6: Data rate: 00=500kbps, 01=300kbps, 10=250kbps
bit 5: =1 if double stepping reqd (e.g. 360kB in 1.2MB)
bit 4: =1 if media established
bit 3: reserved
bits 2-0: on exit from BIOS, contain:
000 trying 360kB in 360kB
001 trying 360kB in 1.2MB
010 trying 1.2MB in 1.2MB
011 360kB in 360kB established
100 360kB in 1.2MB established
101 1.2MB in 1.2MB established
110 reserved
111 all other formats/drives
92h BYTE Diskette drive 0 media state at start of operation
93h BYTE Diskette drive 1 media state at start of operation
94h BYTE Diskette drive 0 current track number
95h BYTE Diskette drive 1 current track number
96h BYTE Keyboard status byte 3
bit 7 =1 read-ID in progress
bit 6 =1 last code read was first of two ID codes
bit 5 =1 force Num Lock if read-ID and enhanced keyboard
bit 4 =1 enhanced keyboard installed
bit 3 =1 Right Alt pressed
bit 2 =1 Right Ctrl pressed
bit 1 =1 last code read was E0h
bit 1 =1 last code read was E1h
97h BYTE Keyboard status byte 2
bit 7 =1 keyboard transmit error flag
bit 6 =1 LED update in progress
bit 5 =1 RESEND received from keyboard
bit 4 =1 ACK received from keyboard
bit 3 reserved, must be zero
bit 2 Caps Lock LED
bit 1 Num Lock LED
bit 0 Scroll Lock LED
98h DWORD Timer2: [AT, PS exc Mod 30] ptr to user wait-complete
flag (see INT 15, AX=8300h)
9Ch DWORD Timer2: [AT, PS exc Mod 30] user wait count in
microseconds
A0h BYTE Timer2: [AT, PS exc Mod 30] Wait active flag:
bit 7 =1 wait time elapsed
bits 6-1 reserved
bit 0 =1 INT 15h, AH=86h has occurred
A1h 7 BYTES reserved for network adapters (oh really?)
A4h DWORD [PS/2 Mod 30] Saved Fixed Disk Interrupt Vector
A8h DWORD Video: EGA/MCGA/VGA ptr to Video Save Ptr Table
ACh-AFh reserved
B0h DWORD ptr to 3363 Optical disk driver or BIOS entry point.
When 3363 BIOS present, the signature "OPTIC ",00h occurs 3
bytes beyond this entry point.
When 3363 BIOS and 3363 File System Driver present, the
signature "FILE SYSTEM DRIVER",00h occurs 3 bytes beyond
this entry point.
B4h WORD reserved
B6h 3 BYTES reserved for POST?
B9h 7 BYTES ???
C0h 14 BYTES reserved
CEh WORD count of days since last boot?
D0h-EFh reserved
F0h-FFh reserved for user
100h BYTE Print Screen Status byte