CS401 IDEA SOL BY SOME ONE
Interrupts are asynchronous and unpredictable. Asynchronous means that the interrupts occur, independent of the working of the processor, i.e. independent of the instruction currently executing. Synchronous events are those that occur side by side with another activity. Interrupts must be asynchronous as they are generated by the external world which is unaware of the happenings inside the processor.
True interrupts that occur in real time are asynchronous with the execution. Also it is unpredictable at which time an interrupt will come. The two concepts of being unpredictable and asynchronous are overlapping .Unpredictable means the time at which an interrupt will come cannot be predicted, while asynchronous means that the interrupt has nothing to do with the currently executing instruction and the current state of the processor. Hardware interrupts are the real interrupts generated by the external world as discussed above. Software interrupts on the contrary are not generated from outside the processor. They just provide
an extended far call mechanism. Far call allows us to jump anywhere in the whole megabyte of memory. To return from the target we place both the segment and offset on the stack. Software interrupts show a similar behavior. Hardware interrupts , the third category that we will refer to simply as interrupts, are program control interruption based on an external hardware event (external to the CPU). These interrupts generally have nothing at all to do with the instructions currently executing; instead, some event, such as pressing a key on the keyboard or a time out on a timer chip, informs the CPU that a device needs some attention. The CPU interrupts the currently executing program, services the device, and then returns control back to the program. hardware interrupts are generally asynchronous , meaning they can occur at any time and rarely do they occur at the same spot in a program. An interrupt is an asynchronous procedure call the CPU generates in response to an external hardware signal. However there is a single pin outside the processor called the INT pin that is used by external hardware to generate interrupts. There are many external devices that need the processor’s attention like the keyboard, hard disk, floppy disk, sound card. All of them need real time interrupts at some point in their operation. when the printer is busy printing we cannot send it more data. As soon as it gets free from the previous job it interrupts the processor to inform that it is free now. There are many other examples where the processor needs to be informed of an external event. If the processor actively monitors all devices instead of being automatically interrupted then it there won’t be any time to do meaningful work.
Read the following lines of code. It will read the mask register from port 0×21 and then
set the 2nd bit in the register. As soon as it is written back to port 0×21; Keyboard will be
disabled that is connected to IRQ1.
in al, 0×21 ; read interrupt mask register
or al, 2 ; set bit for IRQ1
out 0×21, al ; write back mask register
Take out line 2 i.e.
or al, 2
modify it to solve the following parts
1. set bit to disable IRQ7
or al, 128
2. set bit to disable IRQ0
or al, 1
3. set bit to disable IRQ5
or al, 32
4. enable IRQ1, IRQ2, IRQ7 and disable the rest.
and al, 0 // first enable all to get desired result
or al, 121 // disable IRQ0, IRQ3, IRQ4, IRQ5, IRQ6
5. enable all IRQs
and al, 0