TECHNICAL REFERENCE SERIES

• System BIOS for IBM® PCs, Compatibles, and EISA Computers, Second Edition

The Complete Guide to ROM-Based System Software

PHOENIX TECHNOLOGIES LTD.

J TT Addison-Wesley Publishing Company, Inc. Reading, Massachusetts Menlo Park, California New York Don Mills, Ontario Wokingham, England Amsterdam Bonn Sydney Singapore Tokyo Madrid San Juan Paris Seoul Milan Mexico City Taipei Table of Contents

Preface xv

1 The ROM BIOS

Overview 1 3 BIOS Service Routines 5 BIOS Device Service Routines 5 Unexpected-Interrupt Handlers 7 Summary: BIOS Services 8

2 XT, ISA, and EISA Hardware

Overview 15 Microprocessor 16 Math Coprocessor 18 XT, ISA, and EISA Buses 19 I/O Devices 23 Timers and Counters 26 Programmable Interrupt Controllers 28 Direct Memory Access 29 EISA Bus Master Support 32 Miscellaneous Additional Logic 34

System BIOS for IBM PCs, Compatibles, and EISA Computers V Table Of Contents, Continued

3 System RAM Data

Overview 35 Interrupt Vector Table 36 BIOS Data Area 39 Extended BIOS Data Area 46

4 CMOS RAM Data

Overview 47 Standard or Extended CMOS RAM Data Definitions 48 EISA CMOS RAM Data 52

5 ROM BIOS Data

Overview 53 Compatibility Segment 54 System Configuration Table 57 Diskette Parameters Table 59 ISA and EISA Fixed Disk Parameters Table 61 XT Fixed Disk Parameters Table 66 Baud Rate Initialization Table 68

6 I/O Ports

Overview 69 I/O Port List 70 Video I/O Port Lists 92

vi System BIOS for IBM PCs, Compatibles, and EISA Computers Table of Contents, Continued

7 Power-On Self Test

Overview 95 Standard Tests and Initializations 97 Initialization of Option ROMs 98 Reentry into POST 100 Error Reporting 101 System Boot Procedure 101

8 Nonmaskable Interrupt Service

Overview 103 NMI Handling 105 NMI Handling in EISA Systems 106 External Math Coprocessor Exceptions 107 INT 02h Nonmaskable Interrupt ISR 108 INT 75h Math Coprocessor Exception ISR 108

9 Keyboard Services

Overview 109 Theory of Operation 110 Character Code Tables 112 INT 09h Keyboard ISR — Translate Scan Code 124 INT 16h Keyboard DSR 127 INT 16h Function 00h — Read Keyboard Input 128 INT 16h Function Olh — Read Keyboard Status 130 INT 16h Function 02h —Return Shift Hag Status 131 INT 16h Function 03h — Set Typematic Rate and Delay 132 INT 16h Function 05h — Store Key Data 133

System BIOS for IBM PCs, Compatibles, and EISA Computers VÜ Table Of Contents, Continued

9 Keyboard Services, confd

INT 16h Function lOh — Read Extended Keyboard Input 134 INT 16h Function llh — Return Extended Keyboard Status 135 INT 16h Function 12h — Return Extended Shift Flags 136

10 Video Service

Overview 137 Theory of Operation 138 Video Modes 142 INT 10h Video DSR 144 INT 10h Function 00h — Set Video Mode 145 INT 10h Function Olh —Set Cursor Type 146 INT 10h Function 02h — Set Cursor Position 148 INT 10h Function 03h — Read Current Cursor Position 149 INT 10h Function 04h — Read Light Pen Position 150 INT 10h Function 05h — Select New Video Page 151 INT 10h Function 06h — Scroll Current Page Up 152 INT 10h Function 07h — Scroll Current Page Down 153 INT 10h Function 08h — Read Character/Attribute from Screen 154 INT 10h Function 09h — Write Character/Attribute to Screen 155 INT 10h Function OAh — Write Character Only to Screen 157 INT 10h Function OBh — Set Color Palette 158 INT 10h Function OCh — Write Pixel 159 INT 10h Function ODh — Read Pixel 160 INT 10h Function OEh — Write Teletype to Active Page 161 INT 10h Function OFh — Return Video Status 163 INT 10h Function 13h — Write String 164

ViH System BIOS for IBM PCs, Compatibles, and EISA Computers Table Of Contents, Continued

11 Diskette Service

Overview 165 Theory of Operation 166 INTOEh Diskette ISR 171 INT 13h Diskette DSR 172 Error Handling 173 INT 13h Function OOh —Reset Diskette System 175 INT 13 Function Olh — Read Diskette Status 176 INT 13h Function 02h —Read Diskette Sectors 177 INT 13h Function 03h —Write Diskette Sectors 178 INT 13h Function 04h —Verify Diskette Sectors 179 INT 13h Function 05h — Format Diskette Track 180 INT 13h Function 08h — Read Drive Parameters 182 INT 13h Function 15h — Read Drive Type 183 INT 13h Function 16h —Detect Media Change 184 INT 13h Function 17h —Set Diskette Type 185 INT 13h Function 18h — Set Media Type for Format 186

12 Fixed Disk Service

Overview 189 Theory of Operation 190 INT 13h Fixed Disk DSR 194 Error Handling 195 INT 13h Function OOh —Reset Fixed DiskSystem 197 INT 13h Function Olh — Read Disk Status 198 INT 13h Function 02h — Read Disk Sectors 199 INT 13h Function 03h —Write Disk Sectors 200 INT 13h Function 04h — Verify Disk Sectors 201 INT 13h Function 05h —Format Disk Cylinder 202

System BIOS for IBM PCs, Compatibles, and EISA Computers ix Table Of Contents, Continued

12 Fixed Disk Service, conf d

INT 13h Function 06h — Format Bad Track 203 INT 13h Function 07h — Format Drive 204 INT 13h Function 08h — Read Drive Parameters 205 INT 13h Function 09h — Initialize Drive Parameters 206 INT 13h Function OAh — Read Long Sector 207 INT 13h Function OBh — Write Long Sector 208 INT 13h Function OCh — Seek to Cylinder 209 INT 13h Function ODh — Alternate Reset Fixed Disk 210 INT 13h Function OEh — Diagnostics 1: Read Test Buffer 211 INT 13h Function OFh — Diagnostics 2: Write Test Buffer 212 INT 13h Function 10h — Test for Drive Ready 213 INT 13h Function llh — Recalibrate Drive 214 INT 13 Functionl2h — Controller RAM Diagnostic 215 INT 13h Function 13h — Controller Drive Diagnostic 216 INT 13h Function 14h — Controller Internal Diagnostic 217 INT 13h Function 15h — Read Disk Type 218

13 Serial Communications Service

Overview 219 Theory of Operation 220 INT 14h Serial Communications DSR 221 Error Handling 222 INT 14h Function 00h — Initialize Serial Adapter 223 INT 14h Function Olh — Send Character 225 INT 14h Function 02h — Receive Character 226 INT 14h Function 03h — Return Serial Port Status 227

X System BIOS for IBM PCs, Compatibles, and EISA Computers Table Of Contents, Continued

14 System Services

Overview 229 INT 15h System Services DSR 231 INT 15h Function 4Fh — Keyboard Intercept 232 INT 15h Function 80h — Device Open 233 INT 15h Function 81h —Device Close 234 INT 15h Function 82h —Program Termination 235 INT 15h Function 83h — Set Event Wait Interval 236 INT 15h Function 84h —Joystick Support 237 INT 15h Function 85h —System Request Key 238 INT 15h Function 86h — Wait 239 INT 15h Function 87h — Move Block 240 INT 15h Function 88h — Read Extended Memory Size 245 INT 15h Function 89h — Switch to 246 ГАТТ 15h Function 90h — Device Busy 248 INT 15h Function 91h — Interrupt Complete 249 INT 15h Function COh — Return System Configuration Parameters Address 250 INT 15h Function Clh — Return Extended BIOS Data Area Segment Address 251 INT 15h Function C2h — Pointing Device Interface 252 INT 15h Function C3h — Fail-Safe Timer Control 260 INT 15h Function D8h — Access EISA System Information 261

15 Parallel Printer Service

Overview 279 Theory of Operation 280 INT 17h Function 00h —Print Character 283

System BIOS for IBM PCs, Compatibles, and EISA Computers Xi Table of Contents, Continued

15 Parallel Printer Service, cont'd

INT 17h Function 01h —Initialize Printer 284 INT 17h Function 02h — Read Printer Status 285

16 Time-of-Day Service

Overview 287 Intel 8254 Programmable Interval Timer 288 Motorola MC146818A Real Time Clock 289 INT lAh Time-of-Day DSR 290 INT 1 Ah Function 00h — Read System Time Counter 291 INT lAh Function 01h —Set System Time Counter 292 INT 1 Ah Function 02h — Read Real-Time Clock Time 293 INT 1 Ah Function 03h — Set Real-Time Clock Time 294 INT 1 Ah Function 04h — Read Real-Time Clock Date 295 INT 1 Ah Function 05h — Set Real-Time Clock Date 296 INT 1 Ah Function 06h — Set Real-Time Clock Alarm 297 INT 1 Ah Function 07h — Reset Real-Time Clock Alarm 298 INT 08h System Timer ISR 299 INT 70h Real-Time Clock ISR 300 INT ICh Timer Tick ISR 301 INT4Ah Alarm ISR 301

17 Single-Function Services

Overview 303 INT 05h Print Screen DSR 304 INT 11h Equipment Check DSR 306

XÜ System BIOS for IBM PCs, Compatibles, and EISA Computers Table Of Contents, Continued

17 Single-Function Services, cont'd

INT 12h Memory Size DSR 307 INT 18h Process Boot Failure DSR 307 INT 19h Bootstrap Loader DSR 308

A ISA/EISA Error Codes and Messages

Introduction 311 IBM BIOS POST and Boot Messages 312 PhoenixBIOS ISA/EISA POST Messages 313 PhoenixBIOS Run-Time Messages 325

В XT BIOS Error Messages

Introduction 327 IBM XT BIOS POST Messages 328 Phoenix XT BIOS POST and Boot Messages 329 Phoenix XT BIOS POST and Boot Messages, Continued 330 Beep Code 331

Phoenix XT BIOS Run-Time Messages 331

Glossary 333

Selected Bibliography 345

Index 351 System BIOS for IBM PCs, Compatibles, and EISA Computers xiii