资源说明:Using Interrupts Version 1.0
Disclaimer : While every effort has been made to make sure the information in this document is correct, the author can not be liable
for any damages whatsoever for loss relating to this document. Use this information at your own risk.
Table of Contents
What are Interrupts? Page 2
Interrupts and Intel Architecture Page 3
Hardware Interrupts Page 3
Implementing the Interrupt Service Routine (ISR) Page 5
Using your new Interrupt Service Routine Page 6
The Programmable Interrupt Controller Page 7
IRQ2/IRQ9 Redirection Page 9
Programmable Interrupt Controller's Addresses Page 10
Initialization Command Word 1 (ICW1) Page 11
Initialization Command Word 2 (ICW2) Page 12
Initialization Command Word 3 (ICW3) Page 12
Initialization Command Word 4 (ICW4) Page 14
Operation Control Word 1 (OCW1) Page 15
Operation Control Word 2 (OCW2) Page 16
Operation Control Word 3 (OCW3) Page 17
Using Interrupts http://www.senet.com.au/~cpeacock
Using Interrupts Page 2
What are Interrupts?
When receiving data and change in status from I/O Ports, we have two methods available to
us. We can Poll the port, which involves reading the status of the port at fixed intervals to determine
whether any data has been received or a change of status has occurred. If so, then we can branch to a
routine to service the ports requests.
As you could imagine, polling the port would consume quite some time. Time which could be
used doing other things such refreshing the screen, displaying the time etc. A better alternative would
be to use Interrupts. Here, the processor does your tasks such as refreshing the screen, displaying the
time etc, and when a I/O Port/Device needs attention as a byte has been received or status has
changed, then it sends a Interrupt Request (IRQ) to the processor.
Once the processor receives an Interrupt Request, it finishes its current instruction, places a
few things on the stack, and executes the appropriate Interrupt Service Routine (ISR) which can
remove the byte from the port and place it in a buffer. Once the ISR has finished, the processor returns
to where it left off.
Using this method, the processor doesn't have to waste time, looking to see if your I/O Device
is in need of attention, but rather the device will interrupt the processor when it needs attention.
Interrupts and Intel Architecture
Interrupts do not have to be entirely associated with I/O devices. The 8086 family of
microprocessors provides 256 interrupts, many of these are only for use as software interrupts, which
we do not attempt to explain in this document.
The 8086 series of microprocessors has an Interrupt Vector Table situated at 0000:0000 which
extends for 1024 bytes. The Interrupt Vector table holds the address of the Interrupt Service Routines
(ISR), all four bytes in length. This gives us room for the 256 Interrupt Vectors.
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。