| |||||||||
| |||||||||
Input and Output in 8086 Assembly Language:Each microprocessor provides instructions for Input and Output (I/O) with the devices attached to it, such as the keyboard and the screen. The 8086 provides the instructions IN for input and OUT for output. These instructions are a bit complicated to use, so we usually use the operating system to do I/O for us instead. In 8086 assembly language, operating system subprograms are called by a software interrupt mechanism. An interrupt signals to the processor to suspend its current activity and to pass control to an interrupt service program. A software interrupt is an interrupt generated by a program. The 8086 INT instruction generates such software interrupts. For I/O and some other operations, the interrupt number used is 21h. Thus, the instruction INT 21h transfers control to the operating system, to a subprogram that handles I/O operations. This subprogram handles a variety of I/O operations by calling appropriate subprograms. This means that a specific I/O operation must be indicated. The I/O operation to be carried out is specified in the AH register. An interrupt call has the following syntax: MOV AH, nn ; nn = specific function number INT XX ; XX = interrupt number |