All computers do one thing very well…they follow instructions. Each instruction has a length and an address. The instruction pointer contains the address of the next instruction to be executed, and as soon as it has begun execution, the IP is incremented by the length of that instruction, thereby pointing to the next one, and so on. Some instructions can modify this address, and are called ‘branch’ instructions because they cause the computer to branch to a different piece of the program. This sequence of events will occur until something comes along that causes the computer to break away – which is called an ‘interrupt’.
The architecture of the computer will determine the type and number of interrupts that are recognized. Interrupts essentially cause the computer to save off the current instruction pointer (and associated flags, registers, etc.) and replace it with another address that will execute a completely different program. That program might be another ‘task’ (which is how multi-tasking is performed), might be an operating system routine (such as a DOS or BIOS interrupt), might be some recovery or termination code (such as a system error routine to dump addresses), or might be some routine that interfaces with a piece of hardware. In addition, interrupts can be classed as ‘maskable’ (can be ignored) or ‘non-maskable’ (must be acted upon immediately). It is possible that a maskable interrupt could be pre-empted by another interrupt if it is not acted upon quickly enough.
The Interrupt Vector Table
The interrupt table is a list of addresses which contain the information about which routine gets executed when that interrupt has been recognized, and is officially known as the Interrupt Vector Table. There is a special set of signal lines to the CPU which signal when an interrupt has been requested. The CPU checks the opcode and type, determines whether it should honor the interrupt immediately (or wait for a more convenient time), and then locates the address of the routine to be executed if it determines that the interrupt should be taken. The address is basically the interrupt number multiplied by 4. This is because each address is 4-bytes long, and the vector table begins at address ‘0’. The table is 256 entries long, or 1024 bytes (0400 in hex).
When the system is first initialized (boot up), the Interrupt Vector Table is initialized. Many of these routines are pre-defined by the architecture of the machine, but a few are reserved, and therefore can be used by hardware and software manufacturers. These ‘user defined’ interrupts are loaded immediately after the nucleus or kernel is loaded, and before any application level programs are loaded. For this reason, any device or software requiring an interrupt cannot be made active without rebooting the machine and initializing it’s interrupt address.
IRQsWhen people speak of IRQs, they are referring to hardware interrupt requests. In the IBM PC there are 16 such interrupts defined, which are all maskable interrupts named IRQ0 through IRQ15. These interrupts reside at entries 8 through 15, and 112 through 119. If these numbers were translated to hex (08h – 0Fh and 70h – 77h), they would yield the interrupt type code, and multiplying by 4 would give the actual location in memory of the address of the corresponding routine to execute.
Some hardware IRQs are pre-determined, such as the system timer (IRQ0), Keyboard controller (IRQ1), floppy controller (IRQ6), real-time clock (IRQ8) and Math Co-processor (IRQ13). Most others are ‘user’ determined, either via hardware (with jumpers), through software (such as installable drivers) with firmware (Plug’N Play devices). The IRQs that are usually available for add-on devices are IRQ 5, 7, 9, 10, 11 and 12. Today, the generally accepted IRQ assignments are: modem (IRQ5), printer (IRQ7), Sound Card (IRQ9/IRQ10), Video Card (IRQ11) and PS/2 mouse (IRQ12). While not written in stone, IRQ3 and IRQ4 are usually reserved for serial ports, while IRQ14 and IRQ15 are used for the IDE controllers (primary and secondary).
For the most part IRQs cannot be shared. The only exception to this is where two devices can use the exact same interrupt routine (such as serial devices), and do not have to operate at the same time. If this rule is violated, either one (or both) devices will not work, the machine will lock up, or in the most extreme situation the system will not even complete the boot up routines.
As it turns out, Plug’N Play is one of the most frustrating issues we have encountered in hardware configuration. The intention was to have the hardware and the operating system ‘negotiate’ for an available IRQ. The theory was that most people did not understand IRQs, and so the more intelligent engineers would handle this difficult situation ‘under the covers’. Well, it hasn’t quite worked out that way. Most PnP devices no longer have jumpers to override the ‘firmware’ IRQ assignments, and the PnP operating systems (like Win95), don’t use configurable drivers. The result is multiple devices trying to use the same IRQ – especially sound cards and modems. Fortunately, there are still several ways to assign IRQs for yourself.
The best method for manually assigning IRQs (if available) is through the BIOS. Many of the more recent BIOS programs have a menu selection which allows you to avoid any Plug’N Play assignments for specific IRQs. They will typically have a list of all 16 IRQs, with the default setting as ‘No/ICU’, which means that it is *not* reserved, and can be assigned by the Interrupt Controller Utility. The other option is ‘Legacy ISA’, which means that the system is to reserve this IRQ for use by non-PnP (or Legacy) devices.
Windows95 also allows the re-assignment of IRQs through the Device Manager. By opening the Control Panel and selecting the System icon, you will be presented with a screen with a Device Manager tab on the top. When you select this tab, you will be presented with a list of all the defined device types (such as ‘display controller’, ‘sound cards’, ‘modems’, etc.), with the highest level device being labeled ‘Computer’. If you highlight this device, and click on ‘Properties’, you will be presented with a list of every IRQ that is currently in use – including any duplicates. If you see a ‘!’ (exclamation point) next to any IRQ number, this means that either the IRQ is in use by another device, or the Win95 driver which assigns this IRQ has not been loaded properly.
Next to each of the other device types will usually be a ‘+’, which means there are devices defined under this type. If you click on the ‘+’, these devices will be displayed. By highlighting the device you wish to view/configure, and clicking on the ‘Properties’ button, you will be presented with another screen. Usually there will be a ‘Resources’ tab, that will show the IRQ and port address for the device (port addresses will be discussed in a future article). Some devices will let you highlight the IRQ number and change it, while others will not. If the check box labeled ‘manually configure’ is not grayed out, you can check it, and then change the IRQ number that way. Beware, however, that using this method may hamper the automatic configuration of any new PnP devices you install. If that box is grayed out, you cannot change the IRQ through Win95 and must use the BIOS method described above.
Once you have made these changes, you will need to reboot the machine so that the correct addresses can be loaded, and the device can be made available to the system. Occasionally you will need to perform this routine several times before you get everything configured properly. Sometimes, however, the mix of hardware simply will not allow everything to be installed together. When this happens, your only choices are to do without one (or more) of the components, or use some ‘IRQ saving’ techninques (which usually means buying different hardware, unfortunately).
There are a few things that can be done to reduce the number of IRQs that are required. If you don’t need both on board serial ports, you can disable one or both of them and free up IRQ3 and/or IRQ4. On the other hand, you might attach an external modem and utilize COM2, making IRQ5 available for another device. By the same token, you might use a PS/2 mouse connector (if available for your motherboard), and free up COM1 for attaching a scanner or other external serial device.
A little more expensive solution is to plug in a SCSI adapter, and connect SCSI devices, such as hard drives and scanners. If you disable the onboard IDE controllers, you can then use IRQ14 and IRQ15 for something else. Since SCSI controllers can attach up to 15 devices, yet only take one IRQ, you have much more device ‘real estate’ available to you. One final option that may soon be more widely available is the use of USB devices, which may include keyboards, mice and other low-throughput devices.
With a little understanding of how IRQs work, and some judicious use of the techniques mentioned here, you should be able to overcome just about any IRQ problems you may encounter. Until the architecture of the PC is completely revamped (which means scrapping our current operating systems, hardware, etc. – so don’t hold your breath), we will be stuck with the limited number of IRQs currently available. It is possible that a few more might be squeezed out of the architecture, but not very likely. The most probable long term solution will be the development of fast serial devices on Firewire (IEEE 1394) connections, such as hard drives, tape drives, monitors, scanners, modems, etc.
Be the first to discuss this article!