www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/05/26/11:30:27

From: "Anthony Appleyard" <MCLSSAA2 AT fs2 DOT mt DOT umist DOT ac DOT uk>
Organization: Materials Science Centre
To: DJGPP AT delorie DOT com
Date: Tue, 26 May 1998 16:29:41 GMT
Subject: reading keystrokes by interrupt
Message-ID: <1D083C34183@fs2.mt.umist.ac.uk>

Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> wrote on the relative merits of "AX=0x0700;
call interrupt 0x21; if AL==0, repeat and it is a special character"
(hereinafter A) versus "AH = 0x10 or 0x11, Int 0x16" (hereinafter B) to read
keystrokes. I have quickly compared their results; I get the impression that:-

  For ordinary keystroke X (including high-order characters) :
    A returns AL = X.
    B returns AH = the scan code of the key, AL = X.

  For special keystroke X:-
    A returns AL = 0 and on the next call AL = X.
    B returns AH = X, AL = 0 or 224 (i.e. 0xe0).

  The ordinary keystroke 0 does not occur.

  The ordinary keystroke 224:-
    If produced by typing `224' on the right keypad while holding the ALT key
down: A returns AL = 224; B returns AH = 0, AL = 224
    If some strange continental keyboard has a key combination set to produce
224 as an accented national character: I suppose that A would return it as AL
= 224; B would return it as AH < 58, AL = 224.

  Alt-fullstop presents: in A as AL = 5; in B as AH = 52, AL = 0. The fullstop
key's scan code is 52 (I think). I suspect that A's value `5' commemorates an
old mistype somewhere in Microsoft's source forms.

  If any of 0123456789/*-+. are returned by B with AH > 57, they were produced
by the right keypad.

- Raw text -


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