System BIOS Functions and Operation



This section takes a look at the various functions that the BIOS 
performs, and discusses some of its characteristics. In addition 
to what is discussed in the sections below, the BIOS's other 
main responsibilities include booting the system , and providing 
the BIOS setup program that allows you to change BIOS parameters.


The BIOS Program

In order for any computer to function, it must have software to 
run on it. All that a processor--or any hardware for that 
matter--knows how to do is to follow instructions . The software 
is that collection of instructions, as described in this part of 
the Introduction . All regular programs that you run on your PC 
are stored permanently on your hard disk , and are loaded into 
your system memory  (RAM) when you need to use them. From the 
memory, the processor can access the instructions coded into the 
program and run them, which lets you do your work.

When you first turn on your PC, the processor is "raring to go", 
but it needs some instructions to execute. However, since you 
just turned on the machine, your system memory is empty; there 
are no programs to run. To make sure that the BIOS program is 
always available to the processor, even when it is first turned 
on, it is "hard-wired" into a read-only-memory (ROM) chip that 
is placed on your motherboard.

A uniform standard was created between the makers of processors 
and the makers of BIOS programs, so that the processor would 
always look in the same place in memory to find the start of the 
BIOS program. The processor gets its first instructions from this 
location, and the BIOS program begins executing. The BIOS program 
then begins the system boot sequence  which calls other programs, 
gets your operating system loaded, and your PC up and running.

The BIOS program is always located in a special reserved memory 
area, the upper 64K of the first megabyte of system memory 
(addresses F000h to FFFFh). Some BIOSes use more than this 
64K area.


Other PC BIOSes

Although most people don't realize it, there are in fact several 
different BIOSes in your PC. When people say "the BIOS" they are 
of course referring to the main system BIOS. However there are 
also BIOSes to control peripherals that you put into your 
machine. Your video card has its own BIOS (in most cases) that 
contains hardware-driving instructions for displaying video 
information. Hard disks and other peripherals can contain their 
own BIOS instructions as well. Many SCSI host adapters for 
example have their own BIOS.


The BIOS and the Software Layer Model

As mentioned in many other places, one of the key factors in the 
success of the PC platform is the combination of a huge choice 
of hardware and software options, and at the same time 
compatibility between many different types of hardware and 
software. Backwards compatibility is particularly key; nobody 
wants to have to throw out their old software when hardware 
changes, and companies that have tried to ignore this have often 
suffered the consequences (e.g., the MCA bus ).

Have you ever marveled at how most of the applications that ran 
on your AT-class machine in 1985 will still run on your Pentium 
today? This, despite radically different processors, system 
buses, memory, in fact, all the hardware is different, and the 
operating system is as well. I personally have many applications 
that I run still today that are 12 years old or more. How is 
this possible?

The key to this universality is the use of multiple software 
layers. Let's consider the use of a program like Microsoft Word 
6.0, running on Windows 3.x. In a simplified view, when you run 
this application, you are actually employing four main software 
layers: Word 6.0 is the application; it runs on Windows; Windows 
runs on top of DOS and DOS runs on top of the system BIOS. The 
BIOS interfaces with the hardware. This table shows the various 
layers, from lowest to highest. The operating system and 
application can (and often are) composed themselves of 
multiple layers:

Layer #	Layer
0	Hardware
1	System BIOS
2	Operating System
3	Application

Each of these layers contributes to compatibility in an essential 
way: it talks to the level below it using a standard interface. 
In order for Word 6.0 to work in Windows, it must follow certain 
rules set forth by the designers of Windows. Windows must follow 
rules set forth by the creators of DOS. And DOS must use a 
standardized way of talking to the system BIOS. Each layer 
provides an abstraction model to the software that runs on it, by 
providing to the layer above it a set of services and functions 
that the layer above it can use. Word 6.0 doesn't worry about the 
hardware or DOS much at all; it simply calls Windows functions 
and lets Windows worry about DOS. Windows talks to DOS using DOS 
functions, etc. (This is somewhat simplified because in some 
cases the layers aren't this cleanly separated).

By using these standards, it makes it possible to mix and match 
various layers, as long as the programmers follow the rules. If 
you want to update your DOS version, Windows will still work as 
long as the new DOS version provides the same standard interface 
that the old one did; it can provide new functions, but not take 
away any of the old ones. Similarly, Word 6.0 will work on 
Windows 95 because Windows 95 provides the same facilities to 
Word that Windows 3.x did. This is how compatibility is 
maintained across changes to operating systems.

What does all this have to do with the BIOS? :^) The BIOS is 
actually the pillar that supports all of this, because it 
provides the standard interface that DOS uses (or whatever the 
operating system is). The system hardware itself is the "mess at 
the bottom of the pile" that we are trying to have to avoid 
dealing with. In some ways, the most amazing part of all of this 
is that DOS itself will run on so many different machines. The 
BIOS is what makes this possible. Instead of DOS having to talk 
directly to the hardware, of which there are many, many 
possibilities. It talks to the BIOS, which is what is customized 
to the hardware. The BIOS hides the hardware from the operating 
system so it doesn't have to worry about it, by providing 
standardized services to the operating system.

As alluded to above, programs do not always have to follow this 
model exactly. It is possible for a DOS program to bypass DOS and 
the BIOS functions, and interface directly with the hardware. 
This is done normally for performance reasons; games do it most 
often. The problem is that this breaks the compatibility model; 
now the software does have to figure out what hardware it is 
using, and this makes these types of programs much less portable 
and compatible than ones that "play by the rules".


BIOS Services and Software Interrupts

The BIOS provides various software routines (subprograms) that 
can be called by higher-level software such as DOS, Windows, or 
their applications, to perform different tasks. Virtually every 
task that involves accessing the system hardware has 
traditionally been controlled using one or more of the BIOS 
programs (although many newer operating systems now bypass the 
BIOS for improved performance). This includes actions like 
reading and writing from the hard disk, processing information 
received from devices, etc.

BIOS services are accessed using software interrupts, which are 
similar to the hardware interrupts except that they are 
generated inside the processor by programs instead of being 
generated outside the processor by hardware devices. One thing 
that this use of interrupts does is to allow access to the BIOS 
without knowing where in memory each routine is located.

Normally, to call a software routine you need to know its 
address. With interrupts, a table called an interrupt vector 
table is used that bypasses this problem. When the system is 
started up, the BIOS puts addresses into this table that 
represent where its routines are located for each interrupt it 
responds to. Then, when DOS or an application wants to use a 
BIOS routine, it generates a software interrupt. The system 
processes the interrupt, looks up the value in the table, and 
jumps to the BIOS routine automatically. DOS itself and 
application programs can also use this interrupt vector table. 
Hard disk access and control is, in particular, an important part 
of the BIOS's role in the PC. For a full discussion of hard disk 
BIOS issues, see here .


BIOS Feature "Magic Dates"

There are several important BIOS features or capabilities that 
have been introduced over the last few years. The only reliable 
way to ensure that your BIOS supports these is to check your BIOS 
or motherboard manual, or contact the manufacturer or dealer. 
However, there are some rules of thumb relating the BIOS date 
that you can use to give you an idea of whether or not a given 
machine is likely to support a given feature.

Here are the most common BIOS features and the approximate date 
that they were introduced. Obviously these are just rules of 
thumb; don't take all of this as definitive. It is fairly safe 
to say that if the BIOS date is more than a year earlier than a 
magic date, the feature almost certainly is not supported, and 
if it is more than a year after the date, it almost certainly 
is supported:

Geometry Translation for IDE/ATA Hard Drives Over 504 MB: The 
magic date for this feature is around July 1994. 
Plug and Play Specification: Support for PnP was introduced 
around mid-year in 1995. (I'm not 100% sure on this one.) 
Year 2000 Compliance: For AMI BIOSes, the magic date is July 15, 
1995. For Award BIOSes the situation seems more complex. Check 
out the Year 2000 web site <http://www.year2000.com>. Large 
IDE/ATA Hard Drives Over 2 GB: Support for very large hard drives 
seems to have begun with BIOSes dated in January 1996. 

See the section on hard disk BIOS barriers for more information 
on BIOS hard disk size limitations.
