Board index » delphi » "port[$20] := $20"

"port[$20] := $20"

Could some one please tell me what this comand does:

    "port[$20] := $20"

I am writing a tsr that hooks several interupts.  The template i am
writing it from has that command in, if i don't include it, the
program crashes.  I havent been able to find any info lying
around....so any ideas anyone???

--

                                          -Richard Griffiths
                                           richard.griffi...@zetnet.co.uk

 

Re:"port[$20] := $20"


Quote
In article <4ettog$...@irk.zetnet.co.uk> richard.griffi...@zetnet.co.uk (Richard Griffiths) writes:
>Could some one please tell me what this comand does:
>    "port[$20] := $20"
>I am writing a tsr that hooks several interupts.  The template i am
>writing it from has that command in, if i don't include it, the
>program crashes.  I havent been able to find any info lying
>around....so any ideas anyone???

It tells the Interrupt Controller to exit interrupt processing.  It should
only be used if your procedure is the last on the interrupt chain (doesn't
call its old handler).  Generally, if you write a TSR, you should NOT need to
include this.  When you chain your interrupts properly, the old handler or
something down the chain should do this.  I'm a bit surprised that you said
it crashes if you leave it out.  I've written interrupt handlers that don't
have this, and they work fine.  Are you chaining the old interrupt handler?

If you could contact me by e-mail, I'd like to see your source that doesn't
work if you leave this out.

Ralf Brown's interrupt list has tech info on the PIC along with other port
addresses.  You may want to look at that.  Check your local SimTel site.

Quote
>--
>                                          -Richard Griffiths
>                                           richard.griffi...@zetnet.co.uk

--
Scott F. Earnest             |0100100001000001010010010100110000100000|
sc...@whiplash.res.cmu.edu   |0100010101010010010010010101001100100001|
Head Pope, Non-Extant Temple of Afrodite, Goddess of Funky 70's Hairdos -><-
      YOU'VE BEEN LIED TO:  Possession is only one tenth of the law.
                The other nine tenths is really STUPIDITY!

Re:"port[$20] := $20"


sc...@whiplash.res.cmu.edu (Scott F. Earnest) wrote:

Quote
>In article <4ettog$...@irk.zetnet.co.uk> richard.griffi...@zetnet.co.uk (Richard Griffiths) writes:

>>Could some one please tell me what this comand does:

>>    "port[$20] := $20"

>>I am writing a tsr that hooks several interupts.  The template i am
>>writing it from has that command in, if i don't include it, the
>>program crashes.  I havent been able to find any info lying
>>around....so any ideas anyone???

>It tells the Interrupt Controller to exit interrupt processing.  It should
>only be used if your procedure is the last on the interrupt chain (doesn't
>call its old handler).  Generally, if you write a TSR, you should NOT need to
>include this.

More specifically, $20 is the 'NON-SPECIFIC-EOI-COMMAND' which must be
written to the 8259 PIC (programmable interrupt comtroller) chip (or it's
VLSI equivalent), usually just before returning from an ISR. If you are
using one of the cascaded interrupts (9 through 15), you also have to
send one to the PIC at Port $A0. The command resets a bit in the ISR (in
service register) of the PIC so that further interrupts will be
recognised.

While normally it's true that calling the original interrupt handler will
take care of this for such things as the timer interrupts, I have lots of
cases where the IRQ level, say 3, has been assigned to something like a
parallel I/O board, not COM2 and so calling the original handler would be
pointless.

Regards,
P.Scott Harris

Re:"port[$20] := $20"


On 04 Feb 96 (20:45), richard.griffi...@zetnet.co.uk wrote:

Quote
> Could some one please tell me what this comand does:

>     "port[$20] := $20"

> I am writing a tsr that hooks several interupts.  The template i am
> writing it from has that command in, if i don't include it, the
> program crashes.  I havent been able to find any info lying
> around....so any ideas anyone???

The program does not crash - it's just the system which stops reacting
to the user's input. The port[$20] := $20 tells the PIC (Peripheral Interrupt
Controller) that your interrupt handler has finished it's work. This is
important because the PIC uses different priorities for the different
interrupt sources. If an interrupt is processed, it may only be interrupted
by an IRQ of a higher priority. So you have to tell the PIC when your
interrupt handler finished, then it will re-enable lower-priority interrupts
again.

Stephan

-------------------------------------------------------------------------
 Stephan A. Maciej   step...@maciej.muc.de   http://www.muc.de/~stephanm
       <<< Bug is a registered trademark of Microsoft Corp. >>>
-------------------------------------------------------------------------

Re:"port[$20] := $20"


HYa... All,

Friday February 02 1996 21:45, Richard Griffiths wrote to All:

 RG> Could some one please tell me what this comand does:

 RG>     "port[$20] := $20"

 RG> I am writing a tsr that hooks several interupts.  The template i am
 RG> writing it from has that command in, if i don't include it, the
 RG> program crashes.  I havent been able to find any info lying
 RG> around....so any ideas anyone???
It tells the CPU that the Interrupt it has issued has been completed an it can
go on and do other stuff

Zya nxt time.... Delta Ray

                       ###############################
                       # #############  ###########  #
                       # ### ##### ###  ###   ##### R#
                       # ### ####  ### ####   ### #  #
                       # ### ####  ### ####   ### # A#
                       # ### ####  ### ####   ### #  #
                       # ### ####  ### ####   ### # Y#
                       # ##################   ### #  #
                       ############################# #
                       # ########################### #
                       # # DELTA....@QUAZAR.IDN.NL # #
                       # # # ################### # # #
                       #                             #

... SENILE.COM found...Out of Memory...
--
| Standard disclaimer: The views of this user are strictly his own.

Re:"port[$20] := $20"


Quote
Delta....@60-1000-107-0.idn.nl (Delta Ray) wrote:
>HYa... All,
>Friday February 02 1996 21:45, Richard Griffiths wrote to All:
> RG> Could some one please tell me what this comand does:
> RG>     "port[$20] := $20"
> RG> I am writing a tsr that hooks several interupts.  The template i am
> RG> writing it from has that command in, if i don't include it, the
> RG> program crashes.  I havent been able to find any info lying
> RG> around....so any ideas anyone???
>It tells the CPU that the Interrupt it has issued has been completed an it can
>go on and do other stuff
>Zya nxt time.... Delta Ray
>                       ###############################
>                       # #############  ###########  #
>                       # ### ##### ###  ###   ##### R#
>                       # ### ####  ### ####   ### #  #
>                       # ### ####  ### ####   ### # A#
>                       # ### ####  ### ####   ### #  #
>                       # ### ####  ### ####   ### # Y#
>                       # ##################   ### #  #
>                       ############################# #
>                       # ########################### #
>                       # # DELTA....@QUAZAR.IDN.NL # #
>                       # # # ################### # # #
>                       #                             #
>... SENILE.COM found...Out of Memory...
>--
>| Standard disclaimer: The views of this user are strictly his own.

Well it's very simple, this command tells the PIC
(programmable interrupt controller) that it may send a new interrupt
Normally you put this command as the last in your interrupt service
routine.  If you don't include this command, there never be a
new interrupt

Erwin Beckers
Development Engineer

Inter...@tss.nl

Other Threads