I believe this requires programming of the keyboard controller, or reading portsdirectly. The language is Turbo Pascal 4,5 of 5.5, but examples in C or assembler are also welcome. Using the intr() function is no problem.
Greetings
wsi...@eutrc3.UUCP
To have this work properly, the main loop of your program needs to be
a keyboard scanning routine. This can be done very easily in Turbo Pascal,
accomplished with a routine such as:
FUNCTION InKey : CHAR;
BEGIN
Port[$60] := $00; { set "no delay" repeat }
WHILE NOT (KeyPressed) DO
;
InKey := ReadKey
END;
This is all you need. Repeats will be handled as expected: upon they next
call, they are still in the buffer, and will be able to read immediately read
from this function.
A few things to note: setting the repeat delay above may not work on
XT class machines. I don't have access to an XT, but I have seen this used in
one of Borland's OOP demonstration programs included with version 5.5 of TP.
You'll have to experiment to determine if this is a portable usage. It makes
no real difference to the program, but a faster repeat is indispensable, in my
opinion. Note too that ReadKey returns zero if an extended key has been
pressed. If you're using InKey as an expression in the case, check for zero
and read the buffer again, i.e.:
ch := InKey;
CASE ch OF
0: ch := ReadKey; { get extended key }
...
...
END;
Keyboard reading is easily accomplished using Turbo's own built in
function and really does not require any external interference unless you are
preforming actions based upon control keys being pressed (i.e. if ALT is
touched, the status line may display another set of functions, etc, etc.)
--
D. Chadwick Gibbons (ch...@csd4.csd.uwm.edu)