🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.msdos.programmer
Article #113

Re: Stealing INT 09h

#113
From: Scott C. Sadow
Date: Tue, 28 Jul 1992 13:26
99 lines
4178 bytes
In article <1992Jul26.131309.11896@miavx1.acs.muohio.edu>, sjmadsen@miavx1.acs.muohio.edu (Steve Madsen) writes:
>
>        I'm interested in writing a keyboard handler by going through INT 09. 
>The only problem is that I have just about no idea how to do this.  It's all
>part of a "bigger picture."  In the end, I'd like to be able to have a separate
>text screen for each task running in a program, and be able to switch between
>these tasks (and their text screens) by pressing Alt-Tab, much like MS Windows.
>
>        If what I've seen here on the net is correct, the keyboard scan code
>will appear at Port[$60].  (Pascal notation, here.)  If it's possible, I'd like
>to write the handler so that the Alt-Tab combination is the only one I deal
>with.  If the built in handler can handle the keypress, I'd love to just pass
>it through to that code instead.  Is this possible?
>
>        Finally, is there any way I can take the Alt-Tab keypress, assign it an
>unused Pascal "extended keycode" and stuff it in the buffer?  This would be the
>ideal solution, as it would allow me to support any other keypresses that
>Pascal doesn't currently support, should I need them in the future.
>
>        What might make this chore even easier would be if someone has a
>Pascal-ready handler already written and would like to refer me to a copy.. :)
>
>        Any help would be greatly appreciated!
>
>-- 
>Steve Madsen
>Miami University  Oxford, OH
>Internet: sjmadsen@miavx1.acs.muohio.edu


For most AT class machines (80286 and above) there is an interrupt for
intercepting keystrokes. There is another interrupt (INT 15/AH=C0h) that
indicates if this interrupt is supported. (Documentation on these 3
interrupts extracted from Ralf Brown's Interrupt List). For this
interrupt, trap the TAB key, then look to see if the SHIFT key is down.
(There is a BIOS interrupt to get the SHIFT, ALT, CTRL, etc states. For a
TSR, I would use the actual BIOS address, 40:??, to check the SHIFT state)


INT 15 - OS HOOK - KEYBOARD INTERCEPT (AT model 3x9,XT2,XT286,CONV,PS)
   AH = 4Fh
   AL = hardware scan code
   CF set
Return: CF set
      AL = hardware scan code
   CF clear
      scan code should be ignored
Note: called by INT 9 handler to translate scan codes; the INT 09 code does
     not examine the scan code it reads from the keyboard until after
     this function returns.  This permits software to rearrange the
     keyboard; for example, swapping the CapsLock and Control keys, or
     turning the right Shift key into Enter.



(Information on this interrupt was shortened to just what was needed for
this post. Refer to the full interrupt list for more info)

INT 15 - SYSTEM - GET CONFIGURATION (XT after 1/10/86,AT mdl 3x9,CONV,XT286,PS)
   AH = C0h
Return: CF set if BIOS doesn't support call
   CF clear on success
       ES:BX -> ROM table (see below)
   AH = status
       00h successful
       86h unsupported function

Format of ROM configuration table:
Offset   Size  Description
   (stuff deleted)
 05h  BYTE  feature byte 1:
      bit 4 = INT 15/AH=4Fh called upon INT 9h
   (stuff deleted)



There is also a "SYSRQ" key that you can use that generates its own
interrupt. (The SYSRQ key is usually ALT-Print Screen)

INT 15 - OS HOOK - SysRq KEY ACTIVITY (AT,PS)
   AH = 85h
   AL = 00h SysRq key pressed
      = 01h SysRq key released
   CF clear
Return: CF clear if successful
       AH = 00h
   CF set on error
       AH = status (see AH=84h)
Notes:   called by keyboard decode routine
   the default handler simply returns successfully; programs which wish
     to monitor the SysRq key must hook this call


Hope this helps...


   Scott C. Sadow
   scott@mycro.UUCP
   ...gatech!nanovx!mycro!scott
Technical Details
Message-ID: <1992Jul28.092657@mycro.UUCP>
Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!usc!sol.ctr.columbia.edu!emory!wa4mei!nanovx!mycro!scott
References: <1992Jul26.131309.11896@miavx1.acs.muohio.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!usc!sol.ctr.columbia.edu!emory!wa4mei!nanovx!mycro!scott
From: scott@mycro.UUCP (Scott C. Sadow)
Newsgroups: alt.msdos.programmer,comp.lang.pascal
Subject: Re: Stealing INT 09h
Message-ID: <1992Jul28.092657@mycro.UUCP>
Date: 28 Jul 92 13:26:57 GMT
References: <1992Jul26.131309.11896@miavx1.acs.muohio.edu>
Lines: 99