Article View: comp.os.msdos.programmer
Article #5659Re: I/O and Intel 8259A
From: James G. Baker
Date: Sun, 07 Apr 1991 19:29
Date: Sun, 07 Apr 1991 19:29
47 lines
2409 bytes
2409 bytes
In article <16410@chaph.usc.edu> syau@aludra.usc.edu (Shu-Jye Syau) writes:
>Hi :
> My problem is how can I get the interrupt number ?
> I use TC 2.0 , setvect(intno,int_vect) .
>
> The data inport address is 0x0394 .
> Please help !!!!!
The INTERRUPT NUMBER refered to is really the software interrupt level. The
8259 is programmed by the BIOS initialization routines to place the external
hardware interrupt table to start at location 0020 hex. Each table entry
has the IP and CS for your interrupt service routine, so it is 4 bytes
each.
You need to determine what interrupt line your device is using. For example,
a serial port might use IRQ4 which is level 12 (add 8 to irq#); the vector
is located at location 30hex (12*4). On a XT, IRQ2 is unused, but on an AT,
this line is used by the cascade 8259 to allow for 8 more IRQ lines, so
things get tricky. The setvect() makes life much easier.
If you use level 2, then
setvect( 2, my_isr() );
would change the 8086 NMI vector, which would not be a good thing, instead:
setvect( 10, my_isr() );
Also, its not a bad idea to disable() and enable() around this critical section
of messing with the interrupt table. And, you might want to save the old
entry and restore the table after you finish.
As you write your my_isr(), be sure to handle the very important issues
such as the End-Of-Interrupt (EOI) command that must be sent to the
8259 to allow more interrupts to be processed. It is here, within my_isr()
that you would read from 0x0394.
As mentioned, the AT redirects IRQ2 to IRQ9 without you knowing it, but
you have to deal with two EOI's for both the 8259s. Similar story with
a PS/2.
Good luck...
--
BAKER,JAMES G - Undergraduate Lab Instructor, School of Electrical Engineering
____ _ _ Georgia Institute of Technology, Atlanta Georgia, 30332
| | _ |_) uucp: ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!jgb
(_|. |_). |_). Internet: jgb@prism.gatech.edu
Technical Details
Message-ID:
<25754@hydra.gatech.EDU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!wuarchive!rex!uflorida!gatech!prism!jgbReferences:
<16410@chaph.usc.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!wuarchive!rex!uflorida!gatech!prism!jgb From: jgb@prism.gatech.EDU (James G. Baker) Newsgroups: comp.os.msdos.programmer Subject: Re: I/O and Intel 8259A Message-ID: <25754@hydra.gatech.EDU> Date: 7 Apr 91 19:29:17 GMT References: <16410@chaph.usc.edu> Organization: Georgia Institute of Technology Lines: 47