Re: A83: _getkey calls
[Prev][Next][Index][Thread]
Re: A83: _getkey calls
>If I use the following snippet:
>
>Getkey:
> call _getkey
>
>Will a keypress that is a numberic integer (0-9) register AS 0-9, or will it
>be the hex code for those keys?
>I am really hoping for just ints...but somehow I doubt it.
>Wes
This is how you use _getkey:
Reading Keypresses on the TI-83
There are two ways to read keypresses on the TI-83.
1) Poll for keypresses using a software loop that is waiting for
a keypress. To do this use the ASM routine "_getky".
This is exactly the same functionality that is available
in the TI-83 programming language instruction "getKey".
;---------------------------------------------------------------
; _GetKy - get row/column code of the last key pressed on the keyboard.
;
; Row/column code is a two- or three-digit decimal
; code for the last key pressed on the keyboard.
; The first one or two digits is a number from 1 to 10
; indicating the row number, the last digit is a
; number from 1 to 6 indicating the column number
; of the key. Code 0 means no key has been pressed
; since the last call to _GetKy. The [ON] key does
; not have a row/column code.
;
; output: OP2 := row/column code ( fp value)
; refer to the TI-83 manual for "getKey"
; key code diagram.
;---------------------------------------------------------------
A major disadvantage of using this method is that the TI-83
will
execute at full speed and waste battery life.
This method should be used only if you need to infrequently
look for a keypress.
2) Use the TI-83 system keypress routine. This routine will
enter low power mode and wait for a keypress or for APD time to
expire. This routine's output is also different; it returns
actual keypresses and not key locations on the keyboard. This
routine will return different key codes if 2nd or alpha is
pending.
Since handling an APD condition is not a trivial task without
documentation available, set this flag using this routine :
runindiconly,(iy+indicflags)
This allows the run indicator to run, but APD does not.
;---------------------------------------------------------------
; _getkey - get a keyboard token. Halt until one becomes (low power)
; available. Automatic power-down counter is turned on
; until a valid key has been received.
; This routine also handles:
; 1. [2nd] and [Alpha] shift keys.
; 2. Contrast settings.
;
; output: a = key or 00 if ON key was pressed.
;---------------------------------------------------------------
note : some 2nd and alpha functions are treated the same as
1st functions ont the TI-83.
ex : left arrow & alpha left arrow are treated as just
left arrow by the TI-83 system, but seperate
keycode is returned for each. The tables below
show the TI-83 usage of the keypress, you can interpret
1st, 2nd, and alpha presses however you choose.
The key codes are available from:
http://www.ti.com/calc/docs/83asmkey.htm
From,
Wesley Moore
______________________________
Email: moore.w@patash.com.au