[comp.lang.pascal] interupt problems

DAVID%UCONNVM.BITNET@cunyvm.cuny.edu ( carl david) (09/20/90)

I am trying to write an interupt handler for interupt 9, the keyboard
interupt, which accepts two keystrokes, swallows the first, and
processes the second.
This means that the code is re-entrant (I think), in that I stay in the
interupt code after the first keystroke, and then at the second one,
re-enter the interupt code again.
The problem is that when I try to chain from my second)
interupt back to the original interupt 9 handler, after doing
"my thing", some stack somewhere
appears to be goofed.
What I would like to know is
1) Where is the stack which is pushed, pulled, popped or otherwise
manipulated, when the interupt happens,
2) what happens to that stack at each interupt, and
3) how can I reset it properly so that I can get back to the standard
interupt handler after processing the second keystroke.
Any help would be greatly appreciated.
I am using TurboPower 4.0 to handle the interupts, etc., although it is
clear that this is not the problem, it is the re-entrancy that is
killing
me.
Thank you in advance for any help.
Carl David
DAVID at UCONNVM(bitnet)

ts@uwasa.fi (Timo Salmi LASK) (09/20/90)

In article <24551@adm.BRL.MIL> DAVID%UCONNVM.BITNET@cunyvm.cuny.edu ( carl david) writes:
>
>I am trying to write an interupt handler for interupt 9, the keyboard
>interupt, which accepts two keystrokes, swallows the first, and
>processes the second.
... much deleted ...

But why interrupt 9, and not 16Hex.  Have you considered the latter. 
You might have better success.  I've used Int 16Hex in my own Turbo
Pascal keyboard routines with good success.  (Or maybe I do not
understand your problem correctly.)

...................................................................
Prof. Timo Salmi        (Moderating at anon. ftp site 128.214.12.3)
School of Business Studies, University of Vaasa, SF-65101, Finland
Internet: ts@chyde.uwasa.fi Funet: gado::salmi Bitnet: salmi@finfun

jc58+@andrew.cmu.edu (Johnny J. Chin) (09/20/90)

First of all why are you using INT 09h?  INT 09h is generated everytime a key
is pressed.

I suggest that you use INT 16h and look into the keyboard buffer for the next
keystroke.  This way the interrupt routine doesn't have to be reenterant.

If you choose to use INT 09h, then I suggest you use a flag of some sort so
that the interrupt routine knows of a previous keystroke situation has occured.
Simply reserve a byte somewhere in your TSR and refer to it in your routine.
NOTE:  The original INT 09h allows for multiple calls to itself (ie. type-ahead
will cause an INT 09h to occur even if the current procedure running is the
interrupt handler for INT 09h).

I strongly suggest that you look into using INT 16h.  Hope this piece of info.
helps you in your program.
      __________                                ___
     /          \                          /   /    /_/ / /\/
    _/  /   /   / Happy Computing ...   __/.  /__  / / / / /
   /     /     /
  /           / 4730 Centre Ave. #412   ARPAnet: Johnny.J.Chin@andrew.cmu.edu
 /  -------  /  Pittsburgh, PA  15213   BITnet:  jc58@andrew
 \__________/   (412) 268-8936          UUCP: ...!harvard!andrew.cmu.edu!jc58
 Computer Dr.
Disclaimer:   The views expressed herein are STRICTLY my own, and not CMU's.