On the systems running on DOS based platform, certain i/o services are provided by hardware and the operating system. These services are called ROM-BIOS services and DOS services and are the form of interrupts.
Need for Interrupt: Interrupts are particularly useful when interfacing I/O devices, that provide or require data at relatively low data transfer rate.
Types of Interrupts: There are two types of Interrupts in 8086. They are:
(i)Hardware Interrupts and
(i) Hardware Interrupts (External Interrupts). 8086 microprocessors support hardware interrupts through:
INTR and NMI
Ex: NMI, INTR.
(ii) Software Interrupts (Internal Interrupts and Instructions) .Software interrupts are caused by the instructions inserted in the application program. These can be caused by:
Ex: INT n;(Software Instructions)
Control is provided;through:
The figure: below shows the interrupt structure of the 8086 microprocessor based system.
Figure: Interrupt structure
There can be a number of reasons for the interrupt, but the common cause is a request from some devices which need attention of the CPU. So interrupts, are program control interruption based on an External hardware event (External to the CPU) which generally have nothing at All to do with the instructions currently executing; instead, informs the CPU that a device needs some attention. Whenever such External event occurs, the CPU interrupts the currently executing program, services the device, and then returns control back to the program. The CPU provide these services to External device by executing a program called interrupt service routine (ISR).The interrupt can be from hardware initiated interrupt which require CPU attention or software interrupt is a call to a subroutine located in the operating system, Usually the input-output routine. 8086 system working operating under DOS environment support upto 256 interrupts numbered from 00h to FFh (0 to 255);
In the following text we will be interested in the software interrupt, which are initiated by INT n instruction from the application program. The number n identifies the interrupt number which requests the services of DOS or BIOS. The lower 1K memory contain the interrupt vector table (IVT) having 256 entries each of 4 bytes long. This 4 byte entry in lower 1k memory is nothing but the vector address of each interrupt service routing. This address will be loaded in CS:IP before calling the service routine. The execution of the program then starts from this new address which is the address of the interrupt service routine. At the end of the service routine is the RET instruction which causes a return from the interrupt back in the main program.
Under each interrupt, there are a number of services. In this chapter we will restrict to few important KB, Display, file and printer services under interrupt number 10h, 16h, 21h. These services are assigned service number. The procedure to call any service is to load the service number generally in register AH, any attribute in some Specific registers and then calling a particular interrupt under which that service number fall. Some of the important services are listed in the following tables:
Using DOS interrupts
There are nine DOS interrupt services and they are listed in Figure 5. Five of them, interrupts 20h, 25h through 27h and 2fh are “true” DOS interrupt services, each one having a Specifically-defined task associated with it.
|32||20||Program terminate: come to normal ending|
|33||21||Function-call umbrella interrupt|
|36||24||Critical error-handler address|
|37||25||Absolute Disk read|
|38||26||Absolute Disk write|
|47||2F||Print SPool control (DOS-3 versions only)|
Using BIOS Procedures
System I/O procedures are called with the INT instruction (Section 2). The advantage to calling procedures using this instruction is that the programmer need not know the absolute address of the procedure being called or how to link the procedures into the calling program. All you have to know is the interrupt TYPE for the procedure and the format for the parameter(s) that have to be passed to the procedure.
There are twelve BIOS interrupts in All, falling into five groups (Figure 4). For example with INT 10h you can access the video Display services. This interrupt includes 20 subroutines. Obviously, one of the INT 10h parameters is a data value indicating which one of the twenty subroutines is required. In this case, the AH Register is loaded with the number of the subroutine. In addition, the AL, BX, CX and DX registers are used to provide the parameters for this subroutines.
|Dec||Hex||PeripherAL Devices Services|
|22||16||Standard keyboard services|
Equipment Status Services
|26||1A||Time and date services
|24||18||Activate ROM-BASIC language|
|25||19||Activate bootstrap start-up routine|