| |||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||
Interrupt types 0 to 1Fh are known as BIOS interrupts. This is because most of these service routines are BIOS routines residing in the ROM. Interrupt Types 0-7Interrupt types 0-7 are reserved by Intel, with types 0-4 being predefined. IBM uses type 5 for print screen. Types 6 and 7 are not used.Interrupt 0 -- Divide OverflowA type 0 interrupt is generated when a DIV or IDIV operation produces an overflow. This occurs when the quotient can not fit in the destination register. The interrupt 0 routine displays the message "DIVIDE OVERFLOW" and returns control to DOS.Interrupt 1 -- Single StepSingle-stepping is a useful debugging tool to observe the behavior of a program instruction by instruction. A type 1 interrupt is generated when the Trap Flag (TF) is set. The ISR for a type 1 interrupt can be used to display relevant information about the state of the program. For example, the contents of all registers can be displayed. To end single-stepping, the TF should be cleared. Note that there are dedicated instructions for setting and clearing the TF.Interrupt 2 -- Non-Maskable InterruptInterrupt 2 is the hardware interrupt that cannot be masked out by clearing the TF. The IBM PC uses this interrupt to signal memory and I/O parity errors that indicate bad chips.Interrupt 3 -- BreakpointThe INT 3 instruction is the only single-byte interrupt instruction (opcode: CCh); other interrupt instructions are two-byte instructions. Inserting a breakpoint in a program involves replacing the program code byte by CCh while saving the program byte for later restoration to remove the breakpoint. Inserting breakpoints is used by program debuggers.Interrupt 4 -- OverflowA type 4 interrupt is generated by the instruction INTO (interrupt if overflow) when the OF is set. Programmers may write their own routines to handle unexpected overflows. Note that executing the instruction INT 4 will invoke the ISR for this interrupt type unconditionally while INTO invokes it conditionally on the OF. INTO is not used normally as the overflow condition is usually detected and processed using the instructions JO and JNO.Interrupt 5 -- Print ScreenThe BIOS interrupt 5 routine sends the video screen information to the printer. An INT 5 instruction is generated by the keyboard interrupt routine (interrupt type 9) when the PrtSC (print screen) key is pressed.Interrupt Types 8h-FhThe 8086 has only one pin, INTR pin, for maskable hardware interrupt signals. To allow more devices to interrupt the 8086, IBM uses an interrupt controller, the Intel 8259 Programmable Interrupt Controller chip, which can interface up to eight devices. Interrupt types 8h-Fh are generated by hardware devices connected to the 8259 chip. The original version of the PC uses only interrupts 8, 9, and Eh.Interrupt 8 -- TimerThe IBM PC contains a timer circuit that generates an interrupt once every 54.92 milliseconds (about 18.2 times per second). The BIOS interrupt 8 routine services the timer circuit. It uses the timer signals (ticks) to keep track of the time of the day.Interrupt 9 -- KeyboardThe interrupt 9 is generated by the keyboard each time a key is pressed or released. The BIOS interrupt 9 routine reads a scan code and stores it in the keyboard buffer. In addition, it also identifies special key combinations such ctrl-break. The keyboard buffer has the capacity to store up to 15 keys. When the buffer is full, pressing a key causes the BIOS to beep, indicating that the key stroke is lost.The keyboard controller supplies the key identity by means of a scan code. The scan code of a key is simply an identification number given to the key based on its location in the keyboard. The scan code has no relation to the ASCII code. The interrupt 9 routine receives the scan code and generates the equivalent ASCII code, if there is one. Both the scan code and the ASCII code are placed in the keyboard buffer. Interrupt E -- Diskette ErrorThe BIOS interrupt Eh handles diskette errors.Interrupt Types 10h-1FhThe interrupt routines 10h-1Fh can be called by application programs to perform various I/O operations and status checking.Interrupt 10h -- VideoThe BIOS interrupt 10h routine is the video driver. Associated with each I/O device. There is a device controller or I/O controller that acts as a hardware interface between the processor and the I/O device. The device controller performs many of the low-level tasks specific to the I/O device. This allows the CPU to interact with the device at higher level. For each device controller, there is a software interface that provides a clean interface to access the device. This software interface is called the device driver.Interrupt 11h -- Equipment CheckThe BIOS interrupt 11h routine returns the equipment configuration of the particular PC. The return code is placed in register AX.Interrupt 12h -- Memory SizeThe BIOS interrupt 12h routine returns in register AX the amount of conventional memory a computer has. Conventional memory refers to memory circuits with addresses below 640 KByte. The unit for the return value is in Kbytes.Interrupt 13h -- Disk I/OThe BIOS interrupt 13h routine is the disk driver. It allows application programs to do disk I/O.Interrupt 14h -- CommunicationsThe BIOS interrupt 14h routine is the communications driver that interacts with the serial ports.Interrupt 15h -- CassetteThis interrupt was used by the original PC for cassette interface.Interrupt 16h -- Keyboard I/OThe BIOS interrupt 16h routine is the keyboard driver. BIOS provides keyboard service routines under INT 16H. We list here some examples.To read a character from the keyboard, function 0 in AH is used as follows:
This BIOS function can be used to read a character from the keyboard. If the keyboard buffer is empty, it waits for a character to be entered. The value returned in AL determines if the key represents an ASCII character or an extended key character. In both cases, the scan code is placed in the AH register and the ASCII and scan codes are removed from the keyboard buffer. To check if the keyboard buffer is empty or not, we can use function 1 as follows:
Function 2 can be used to check keyboard status with regard to shift and toggle keys.
The following table indicates the bit assignment for shift and toggle keys. A bit with a value of 1 indicates the presence of a condition.
Interrupt 17h -- Printer I/OThe BIOS interrupt 17h routine is the printer driver. The routine supports three functions: 0-2.
For all functions the status is returned in AH. The following table shows the meaning of the bits returned in AH:
Next, we show an example for printing character 0 on the printer. Because printers contain buffers for data, the 0 will not be printed until a carriage return or line feed character is sent.
Interrupt 18h -- BASICThe BIOS interrupt 18h routine transfers control to ROM BASIC.Interrupt 19h -- BootstrapThe BIOS interrupt 19h routine reboots the system.Interrupt 1Ah -- Time of DayThe BIOS interrupt 1Ah routine allows a program to get and set the timer tick count.Interrupt 1Bh -- Ctrl BreakThis interrupt is called by the INT 9 routine when the Ctrl-break key is pressed. The BIOS interrupt 1Bh routine contains only an IRET instruction. Users may write their own routine to handle the Ctrl-break key.Interrupt 1Ch -- Timer TickInterrupt 1Ch is called by the INT 8 routine each time the timer circuit interrupts. The BIOS interrupt 1Ch routine contains only an IRET instruction. Users may write their own service routine to perform timing operations.Interrupts 1Dh-1FhThese interrupt vectors point to data instead of instructions. The interrupt 1Dh, 1Eh, and 1Fh point to video initialization parameters, diskette parameters, and video graphics characters, respectively.
|