In article <68gu06$12...@lnews.actcom.co.il>, tsipo...@actcom.co.il (Israel Kehaty) says:
Quote
>Well, I've been trying to use this little thing called Port[$60] in TP7, which
>I don't really know what it means, but I know what it does. So I only know the
>numbers of which a keyboard key is pressed, but hwo can I get the numbers in
>which the key is popped?
I'm not sure, if this is what you wanted, but here goes:
The key-release code differs from the key-pressed by 128. Thus for
example pressing the 'Esc'-key gives 1 and releasing it gives a 129 and
pressing 'A' gives 30 and releasing it gives 158.
With the special keys (arrows etc.) more codes come out. (Sorry, I don't
remember the details) It is relatively easy to write your own
keyboard-interrupt handler to do whatever you want, when a certain
keyboard event occurs. I think this is the best way to use these codes
in e.g. a game.
Be careful, when you debug programs that mess with the keyboard-handler
(or any interrupt for that matter): Save your source-file often (best to
have auto-save ON), expect to have to reboot often and run your application
from the IDE by selecting 'Run' from the menus with the mouse. DO NOT
RUN IT BY PRESSING CTRL+F9! The reason is that your program may
replace the keyboard handler before you have a chance to release
the Ctrl and F9 keys, this will cause TP/BP to behave wierdly, because it
(or DOS) loses track of whether the Ctrl-key is down or not. Naturally I
muffed these things the first time I tried them - if I had a dime for each
thing I learned the hard way... Of course, careful coding will avoid such
problems.
Happy programming!
Jyrki Lahtonen, Ph.D.
Department of Mathematics,
University of Turku,
FIN-20014 Turku, Finland
Note to human e-mailers! To obtain my real e-mail address form the
string consisting of my first name, a period, my family name (names in
lower case) and an at-sign followed by utu.fi