Re: A83: Reading keyboard port
[Prev][Next][Index][Thread]
Re: A83: Reading keyboard port
Well, it is relatively simple to query the keypad port. The keypad hardware
port is 1. here is somesimple sample code to poll the keypad port.
for a more detailed look on this look in ASM Guru, under the tutorial Direct
Input, this method is EXACTLY the same for both Ti-83 and Ti-83+.
NOTE that this only returns a keycode if the key is pressed at the time of
the poll, it does not have a buffer, and does not tell you if a key was
pressed since the last poll.
getkeyloop:
ld a,0FFh
out (1),a ;Sending 255 to the keypad port resets+reinitializes it
ld a,KeyGroup ; replace KeyGroup with a valid group number, find these in
ASM Guru
out (1),a ; Enable that group+disable the others
in a,(6) ; poll the keypad
cp Keycode1 ; Compare for a keycode
jp z,Key1dostuff ; If key keycode1 was pressed jp
... test for you other keys ...
cp Keycode4 ; Compare again for another key
jp z,Key2dostuff ; IF key keycode2 was pressed jp
jr getkeyloop ; if no key was pressed this is executed and loop starts
again
>From: "Dale Watson" <merlin@cinternet.net>
>Reply-To: assembly-83@lists.ticalc.org
>To: <assembly-83@lists.ticalc.org>
>Subject: A83: Reading keyboard port
>Date: Thu, 18 Jan 2001 01:34:51 -0500
>
>Hello,
>
>I am new to assembly programming, but have been able to use B_Call GetKey
>to get a character typed into the calculator. But, this waits for a ckey
>to be pressed. Is there a way to query the keyboard port to see if a key
>has been pressed, so that my code can keep executing in a loop until input
>arrives?
>
>Regards,
>
>Scot Watson
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.