🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc.programmer
Article #1075

Re: HELP: Keyboard Interrupt 09H

#1075
From: MORTEN KNUDSEN
Date: Mon, 12 Oct 1992 16:52
50 lines
2872 bytes
In article <1992Oct9.154103.18137@sol.ctr.columbia.edu> jerry@connection.prospect.com (Jerry Shekhel) writes:
>From: jerry@connection.prospect.com (Jerry Shekhel)
>Subject: HELP: Keyboard Interrupt 09H
>Date: Fri, 9 Oct 1992 15:41:03 GMT
>Hello out there.  I'm creating a VGA game, and I need precise keyboard
>control, so the kbhit()/getch() functions are insufficient.  I need to know
>when keys are pressed and released.  I managed to do this by intercepting the
>keyboard hardware interrupt:
>
>		...
>		old_handler = getvect(0x09);
>		setvect(0x09, my_handler);
>		...
>
>My keyboard handler marks the key as "pressed" or "released" and passes
>control to the BIOS handler:
>
>		BYTE key_map[128];
>
>		void interrupt my_handler(void)
>		{
>		    BYTE scan;
>
>		    scan = inportb(0x60);
>		    key_map[scan & 0x7f] = scan & 0x80;
>
>		    old_handler();
>		}
>
>This works, but the problem is that since I'm not using the BIOS to read the
>keystrokes (I'm just reading the key_map[] array), the BIOS buffers them up
>and starts clicking the speaker when the buffer overflows.  Needless to say,
>when I'm holding keys down, this click turns into a "drumroll" and slows down
>my game.  I tried removing the call to old_handler(), but then everything
>stopped working, as if the interrupt itself was no longer being generated.
>
>Can someone help me with this problem?  Thanks in advance.
>--
>+-------------------+-----------------------+--------------------------------+
>| Jerry J. Shekhel  | Molecular Simulations | Time just fades the pages      |
>| Drummers do it... | Inc.  Waltham, MA USA | in my book of memories.        |
>|    ... In rhythm! |     (617) 890-2888    |              -- Guns N' Roses  |
>+-------------------+-----------------------+--------------------------------+
>|           ...! [ princeton mit-eddie bu sunne ] !polygen!jerry             |
>|                            jerry@polygen.com                               |
>+----------------------------------------------------------------------------+

Have you sent a end-of-interrupt to the PIC? If you don't do this, the
PIC will not generate interrupts with less or equal priority than
the keyboard.
Technical Details
Message-ID: <mortenk.27.718908739@dhhalden.no>
Path: arc1-ca.pugleaf.net!sparky!uunet!know!hri.com!spool.mu.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!ira.uka.de!math.fu-berlin.de!news.netmbx.de!Germany.EU.net!mcsun!sunic!aun.uninett.no!nuug!dhhalden.no!pc161.dhhalden.no!mortenk
References: <1992Oct9.154103.18137@sol.ctr.columbia.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!know!hri.com!spool.mu.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!ira.uka.de!math.fu-berlin.de!news.netmbx.de!Germany.EU.net!mcsun!sunic!aun.uninett.no!nuug!dhhalden.no!pc161.dhhalden.no!mortenk
From: mortenk@dhhalden.no (MORTEN KNUDSEN)
Newsgroups: comp.sys.ibm.pc.programmer,alt.msdos.programmer
Subject: Re: HELP: Keyboard Interrupt 09H
Message-ID: <mortenk.27.718908739@dhhalden.no>
Date: 12 Oct 92 16:52:19 GMT
References: <1992Oct9.154103.18137@sol.ctr.columbia.edu>
Sender: news@dhhalden.no (Network News User)
Organization: Ostfold College
Lines: 50
Nntp-Posting-Host: pc161