CS401 - Short Notes Chapter 9
CS401 - Short Notes Chapter 9
CS401 - Short Notes Chapter 9
COM
CS401-ASSEMBLY LANGUAGE AND PROGRAMMING
CS401 CHAPTER NO 9 (LECTURE 24-27)
PREPARED BY: HTTPS://SUPERSTARWEBTECH.BLOGSPOT.COM/
• IRQ 0 is derived by a timer device. The timer device keeps generating interrupts with a
specified frequency.
• IRQ 1 is derived by the keyboard when generates an interrupt when a key is pressed or
released.
• IRQ 2 is the cascading interrupt connected to the output of the second 8451 in the
machine.
• IRQ 3 is connected to serial port COM 2.
• IRQ 4 is connected to serial port COM 1.
• IRQ 5 is used by the sound card or the network card or the modem.
• IRQ 6 is used by the floppy disk drive.
• IRQ 7 is used by the parallel port.
IRQ conflict:
An IRQ conflict means that two devices in the system want to use the same IRQ line.
Mapping:
Each IRQ is mapped to a specific interrupt in the system. This is called the IRQ to INT mapping.
IRQ 0 to IRQ 7 are consecutively mapped on interrupts 8 to F. This mapping is done by the PIC
and not the processor.
SUPERSTARWEBTECH.BLOGSPOT.COM
CS401-ASSEMBLY LANGUAGE AND PROGRAMMING
CS401 CHAPTER NO 9 (LECTURE 24-27)
PREPARED BY: HTTPS://SUPERSTARWEBTECH.BLOGSPOT.COM/
End of Interrupt:
At the end of servicing the interrupt the handler should inform the PIC that it is completed so
that lower priority interrupts can be sent from the PIC. This signal is called an End of Interrupt
(EOI) signal and is sent through the I/O ports of the interrupt controller.
Every interrupt handler invoked because of an IRQ must signal an EOI otherwise lower priority
interrupts will remain disabled.
I/O PORTS
For communicating with peripheral devices, the processor uses I/O ports. There are only two
operations with the external world possible, read or write.
We have the IN and OUT instructions to read or write from the peripheral address space.
When MOV is given the processor selects the memory address space, when IN is given the
processor selects the peripheral address space.
IN and OUT instructions
The IN and OUT instructions have a byte form and a word form but the byte form is almost
always used. The source register in OUT and destination register in IN is AL or AX depending on
which form is used.
The port number can be directly given in the instruction if it fits in a byte otherwise it has to
be given in the DX register. Port numbers for specific devices are fixed by the IBM standard.
For example: 20 and 21 are for PIC, 60 to 64 for Keyboard, 378 for the parallel port etc.
A few examples of IN and OUT are below:
in al, 0x21
mov dx, 0x378
in al, dx
out 0x21, al
mov dx, 0x378
out dx, al
PIC Ports
Programmable interrupt controller has two ports 20 and 21. Port 20 is the control port while
port 21 is the interrupt mask register which can be used for selectively enabling or disabling
interrupts.
SUPERSTARWEBTECH.BLOGSPOT.COM
CS401-ASSEMBLY LANGUAGE AND PROGRAMMING
CS401 CHAPTER NO 9 (LECTURE 24-27)
PREPARED BY: HTTPS://SUPERSTARWEBTECH.BLOGSPOT.COM/
• The data pins from pin 2 to pin 9 that take data from the processor to the device.
• Pin 10, the ACK pin, is normally used by the printer to acknowledge the receipt of data
and show the willingness to receive more data. Signaling this pin generates IRQ 7 if
enabled in the PIC and in the parallel port controller.
• Pin 18-25 are ground and must be connected to the external circuit ground to provide
the common reference point otherwise they won’t understand each other voltage
levels.
This is the external view of the parallel port. The processor cannot see these pins. The
processor uses the I/O ports of the parallel port controller.
The first parallel port LPT1 has ports designated from 378 to 37A. The first port 378 is the data
port. If we use the OUT instruction on this port, 1 bit result in a 5V signal on the corresponding
pin and a 0 bits result in a 0V signal on the corresponding pin.
Port 37A is the control port. Our interest is with bit 4 of this port which enables the IRQ 7
triggering by the ACK pin.