ROM Hardware

Read-only memory (ROM) is a type of memory that can permanently or semipermanently hold data. It is called read-only because it is either impossible or difficult to write to. ROM is also often called nonvolatile memory because any data stored in ROM remains even if the power is turned off.

As such, ROM is an ideal place to put the PC's startup instructions—that is, the software that boots the system (the BIOS). Note that ROM and RAM are not opposites, as some people seem to believe. In fact, ROM is technically a subset of the system's RAM.

In other words, a portion of the system's random access memory address space is mapped into one or more ROM chips. This is necessary to contain the software that enables the PC to boot up; otherwise, the processor would have no program in memory to execute when it is powered on.

For example, when a PC is turned on, the processor automatically jumps to address FFFF0h, expecting to find instructions to tell the processor what to do. This location is exactly 16 bytes from the end of the first megabyte of RAM space, as well as the end of the ROM itself.

If this location were mapped into regular RAM chips, any data stored there would have disappeared when the power was previously turned off, and the processor would subsequently find no instructions to run the next time the power was turned on.

By placing a ROM chip at this address, a system startup program can be permanently loaded into the ROM and will be available every time the system is turned on. Normally, the system ROM starts at address E0000h or F0000h, which is 128KB or 64KB prior to the end of the first megabyte.

Because the ROM chip usually is up to 128KB in size, the ROM programs are allowed to occupy the entire last 128KB of the first megabyte, including the critical FFFF0h startup instruction address, which is located 16 bytes from the end of the BIOS space.

Some motherboard ROM chips are larger, up to 256KB or 512KB in size. The additional code in these is configured to act as a video card ROM (addresses C0000h–C7FFFh) on motherboards with built-in video and might even contain additional ROM drivers configured anywhere from C8000h to DFFFFh to support additional onboard devices, such as SCSI or network adapters.

Some think it is strange that the PC would start executing BIOS instructions 16 bytes from the end of the ROM, but this design was intentional. All the ROM programmer has to do is place a JMP (jump) instruction at that address that instructs the processor to jump to the actual beginning of the ROM—in most cases, close to F0000h—which is about 64KB earlier in the memory map.

It's like deciding to read every book starting 16 pages from the end and then having all book publishers agree to place an instruction there to jump back the necessary number of pages to get to page 1. By setting the startup location in this way, Intel enabled the ROM to grow to be any size, all the while keeping it at the upper end of addresses in the first megabyte of the memory address space.

The main ROM BIOS is contained in a ROM chip on the motherboard, but adapter cards with ROMs contain auxiliary BIOS routines and drivers needed by the particular card, especially for those cards that must be active early in the boot process, such as video cards.

Cards that don't need drivers active during boot (such as sound cards) typically don't have a ROM because those drivers can be loaded from the hard disk later in the boot process.

Because the BIOS is the main portion of the code stored in ROM, we often call the ROM the ROM BIOS. In older PCs, the motherboard ROM BIOS could consist of up to five or six total chips, but most PCs have required only a single chip for many years now.

Adapter card ROMs, such as those used for video, SCSI, add-on IDE cards, and network cards for diskless workstations, are automatically scanned and read by the motherboard ROM during the early part of the boot process, during the POST.

The motherboard ROM scans a special area of RAM reserved for adapter ROMs (addresses C0000–DFFFFh) looking for 55AAh signature bytes that indicates the start of a ROM. All adapter ROMs must start with 55AAh; otherwise, the motherboard won't recognize them.

The third byte indicates the size of the ROM in 512-byte units called paragraphs, and the fourth byte is the actual start of the driver programs. The size byte is used by the motherboard ROM for testing purposes. The motherboard ROM adds all the bytes in the ROM and divides the sum by the number of bytes.

The result should produce a remainder of 100h. Thus, when creating a ROM for an adapter, the programmer typically uses a "fill" byte at the end to get the checksum to come out right. Using this checksum, the motherboard tests each adapter ROM during the POST and flags any that appear to have been corrupted.

The motherboard BIOS automatically runs the programs in any adapter ROMs it finds during the scan. You see this in most systems when you turn on your system, and during the POST you see the video card BIOS initialize and announce its presence.