Phil Storrs PC Hardware book

The PC and Interrupts

We are all confronted with interruptions from time to time. Some are pleasant, some are unpleasant and some are neutral. You can ignore some interruptions, for example a telephone or doorbell ringing, some must not be ignored, such as getting a flat tire on the freeway - you must deal with them as soon as possible. The alternative to a system with Interrupts is to use Polling, a system where we must look at each device periodically to see if our services are required. Imagine having a telephone without a bell, you would have to lift the receiver regularly to see if anyone was on the line.

Whatever their cause, interrupts are essentially requests for attention. In the same way, peripherals in a computer system can request the attention of the processor. The event that makes a microprocessor stop executing one routine to perform some other routine to service a request, is called an INTERRUPT.

Interrupts increase the overall efficiency of a computer system, because the external devices request the attention of the processor as needed. If a system had no interrupts, the processor would have to POLL every device in the system periodically, to see if any of them required attention. Many of the standard I/O provisions of the PC computer generate interrupts when they need the processor to process data being received by, or being sent by, those interfaces.

The processor can process two kinds of interrupts, those it can ignore and those it must service as soon as they occur. Interrupts can be generated by the interfaces to DEVICES, such as disk drives and the parallel or serial ports, or internally, by interrupt-generating machine code INSTRUCTIONS.

Types of Interrupts.

The 8086 family of microprocessors can recognise 256 different interrupts, each with a unique TYPE CODE (number) that identifies it to the microprocessor. The processor uses this type code (a number between 0 hex and FF hex) to point to a location in an INTERRUPT VECTOR TABLE. This table is stored in the first 1024 bytes of the memory space, starting at address 00000 hex, (0000:0000 hex in Segment and Offset format).

The Interrupt Vector Table

The INTERRUPT VECTOR TABLE points to the locations of the INTERRUPT ROUTINES that carry out the functions associated with the interrupts. As the old 8086/8088 processors had a total memory space of one Meg. byte, these vectors must point to 20 bit address - this requires the use of SEGMENT and OFFSET address format and hence, each vector is FOUR BYTES long.

The Interrupt Vector Table is in the first 1024 bytes of the processors address-able memory space. The POST routines in the BIOS set up an Interrupt Vector Table at the time of boot-up with the addresses of the routines supplied by the code in the BIOS ROM and DOS and our Application programs add there vectors to this table as they are loaded.

HARDWARE INTERRUPT REQUEST'S - the IRQ's

DOS computers make extensive use of Interrupts to provide basic services to Devices and to DOS and Application programs. The Hardware interrupts are provided by 8259 interrupt controller chips. These chips have eight prioritized IRQ inputs and they alert the processor of an interrupt via it's own single IRQ input line. The 8259 chip expands the processors single IRQ input.

The original IBM XT computer had one 8259 device and this provided eight IRQ inputs. The first two of these IRQ lines is wired to functions on the system board and the rest are available on the Bus Connector for use by external devices.

8 bit bus computers (8086/8088 based XT type)

	IRQ 	Used for
	0	RAM REFRESH & CLOCK TICK
	1	KEYBOARD INTERFACE
	2	EGA VIDEO (some interface cards have the option of using an IRQ) 
	3	COM2 (also COM4)
	4	COM1 (also COM3)
	5	HARD DISK (PC/XT type computer only)
	6	FLOPPY DISK
	7	PARALLEL PRINTER PORT LPT 1

ISA Bus (and MCA, EISA) computers (286, 386 and 486 based computers)

The AT computer added a second 8259 device and this provided a further seven IRQ inputs. The second device is cascaded into one of the inputs (IRQ2) on the first device and the Bus connector for the IRQ2 input is wired to IRQ9 on the second 8259 chip.

	IRQ	 Used for
	0	System timer
	1	Keyboard Interface
	2	Cascade for second IRQ controller - BUS connection is to IRQ 9.
	3	Serial port, COM2 (may also be COM4)
	4	Serial Port COM1 (may also be COM3)
	5	Parallel Port  LPT2, also the default for many Sound Cards (note 1)
	6	Floppy Disk Drive Interface
	7	Parallel Port LPT1 (note 2)
	8	Real Time Clock (RTC) 
	9	Available (some Video Display Interface cards have the option of using this IRQ)
	10	Available  (note 3)
	11	Available  (note 3)
	12	PS/2 - type mouse port (most modern system boards have a PS/2 mouse port fitted)
	13	Coprocessor 
	14	Primary IDE/ATA adaptor 
	15	Secondary IDE/ATA adaptor

Note 1:- As very few systems have a second Parallel Port fitted, and a Parallel Port does not usually need it's IRQ, it is usually safe to assign IRQ 5 to a Sound Card or a Network Interface card. Along with IRQ10, this is a common default for Sound Cards.
Note 2:- A Parallel Port does not usually need it's IRQ, so IRQ7 can be used for other uses (note 3).
Note 3:- These IRQ lines can be used for:

Note 4:- Four EIDE interfaces are provided for by the latest PC hardware specifications, and these are configured as follows:-
Tertiary IDE adaptor at I/O address 01E8 to 01EF and using IRQ 11 or 12
Quaternary adaptor at I/O address 0168 to 016F and using IRQ 10 or 11
Some sound cards have a built-in IDE Interface configured as the Tertiary adaptor.

Software Interrupts

Many of the basic I/O services required in a computer system are provided by Software Interrupts. All a programer has to do to make use of them is to put the appropriate values in some registers and then call the Interrupt Routine with an INT instruction.

Examine the list of Interrupts in the table and pick out the Hardware and Software Interrupts.

The list of standard Interrupt assignments Back to the opening index Book two index


Copyright © Phil. Storr, last updated 26th December 1998