www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/03/23/05:51:27

From: "A.Appleyard" <A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk>
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Date: Thu, 23 Mar 1995 08:54:29 GMT
Subject: Re: How to intercept the Keyboard interruption?

sarda_jea AT lsi DOT supelec DOT fr wrote:-

> Hello, I need your advice on how to use the keyboard. I am making a game
> which needs, I think, the interception of the keyboard interruption (mainly
> to know the state of the UP, DOWN, LEFT and RIGHT arrows). The problem is
> that I don't know how the interruptions exactly work in protected mode. If
> somebody has already done some procedures that can intercept the keyboard,
> it would be kind to send me the sources. If anybody knows how I can do
> without using interrupts, please tell me. Jean-Philippe.

Call interrupt 0x21:-
ah=01h	al:=char read from stdin. Echo it on screen.
        Special keys as 0, call again to read key. If ctrl-C, calls int23h
ah=02h	send char dl to stdout. Obey ctrl chars if stdout == screen
ah=06h dl<255	as ah=02h
ah=06h dl=255	as ah=01h, but don't wait; zero flag = 0 or 1 if/if_not char
                      there
ah=07h	as ah=01h but don't display and don't test for ctrl-C
ah=08h	as ah=01h but don't display

Here are the keyboard scan codes of all the PC special keystrokes:-
enum {
alt_0=129,
alt_1=120,
alt_2=121,
alt_3=122,
alt_4=123,
alt_5=124,
alt_6=125,
alt_7=126,
alt_8=127,
alt_9=128,
alt_A=30,
alt_B=48,
alt_C=46,
alt_D=32,
alt_E=18,
alt_F=33,
alt_G=34,
alt_H=35,
alt_I=23,
alt_J=36,
alt_K=37,
alt_L=38,
alt_M=50,
alt_N=49,
alt_O=24,
alt_P=25,
alt_Q=16,
alt_R=19,
alt_S=31,
alt_T=20,
alt_U=22,
alt_V=47,
alt_W=17,
alt_X=45,
alt_Y=21,
alt_Z=44,
alt_apostr=40,
alt_bksp=14,
alt_comma=51,
alt_del=163,
alt_downarrow=160,
alt_end=159,
alt_equals=131,
alt_esc=1,
alt_f1=104,
alt_f2=105,
alt_f3=106,
alt_f4=107,
alt_f5=108,
alt_f6=109,
alt_f7=110,
alt_f8=111,
alt_f9=112,
alt_f10=113,
alt_f11=139,
alt_f12=140,
alt_fullstop=5,
alt_grave=41,
alt_home=151,
alt_insert=162,
alt_leftarrow=155,
alt_leftsq=26,
alt_minus=130,
alt_padminus=74,
alt_padplus=78,
alt_padslash=164,
alt_padstar=55,
alt_pagedown=161,
alt_pageup=153,
alt_ret=28,
alt_rightarrow=157,
alt_rightsq=27,
alt_semicolon=39,
alt_sharp=43,
alt_slash=53,
alt_tab=165,
alt_uparrow=152,
ctrl_2=3,
ctrl_del=147,
ctrl_downarrow=145,
ctrl_end=117,
ctrl_f1=94,
ctrl_f2=95,
ctrl_f3=96,
ctrl_f4=97,
ctrl_f5=98,
ctrl_f6=99,
ctrl_f7=100,
ctrl_f8=101,
ctrl_f9=102,
ctrl_f10=103,
ctrl_f11=137,
ctrl_f12=138,
ctrl_home=119,
ctrl_insert=146,
ctrl_leftarrow=115,
ctrl_pad5=143,
ctrl_padminus=142,
ctrl_padplus=144,
ctrl_padslash=149,
ctrl_padstar=150,
ctrl_pagedown=118,
ctrl_pageup=132,
ctrl_rightarrow=116,
ctrl_tab=148,
ctrl_uparrow=141,
del=83,
downarrow=80,
end=79,
f1=59,
f2=60,
f3=61,
f4=62,
f5=63,
f6=64,
f7=65,
f8=66,
f9=67,
f10=68,
f11=133,
f12=134,
home=71,
ins=82,
leftarrow=75,
pad5=76,
pagedown=81,
pageup=73,
rightarrow=77,
sh_f1=84,
sh_f2=85,
sh_f3=86,
sh_f4=87,
sh_f5=88,
sh_f6=89,
sh_f7=90,
sh_f8=91,
sh_f9=92,
sh_tab=15,
sh_f10=93,
sh_f11=135,
sh_f12=136,
uparrow=72};

- Raw text -


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