delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/23/18:45:38

Xref: news2.mv.net alt.msdos.programmer:13727 comp.os.msdos.djgpp:6329 comp.os.msdos.programmer:26888
From: jim AT curved-logic DOT com (James Shaw)
Newsgroups: alt.msdos.programmer,comp.os.msdos.programmer,comp.os.msdos.djgpp
Subject: Re: An key board handler ISR question.
Date: Tue, 23 Jul 1996 18:08:31 GMT
Organization: Zippo
Lines: 36
Message-ID: <31f513dc.34649065@snews2.zippo.com>
References: <4t2krp$8jp AT lion DOT cs DOT latrobe DOT edu DOT au>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

boylesgj AT lion DOT cs DOT latrobe DOT edu DOT au (Gregary J Boyles) wrote:

>Could any one tell me if there is any reason why this key board handler may
>fail. It is based on some info from Game Programmer's Encyclopedia but there
>was not enough info for me to be absolutely sure that this will work.

looks reasonable, see additions in code below.


>void interrupt KeyBoardISR(...)
In watcom (flat model protected mode) this is
void __interrupt __far KeyboardISR()


>  // Read the key's scan code from the keyboard port.
>  ScanCode=inportb(KeyBoardPort);

 if (ScanCode & 0x80)
{
	// key up message
	ScanCode &= 0x7f;
}
else
{
	// key down message
}

>  // Acknowledge the interrupt.
>  outportb(AckPort,AckValue);

I don't usually do this 'til I'm just about to exit the interrupt so I
don't get interrupted again.
However, others may think differently on this one :)

Jim
PS. You are patching into interrupt 0x9 aren't you :)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019