66 Chapter 2: TI-83 Plus Specific Information
TI-83 Plus Developer Guide Third Release May 28, 2002
Example two: This example will stay in a loop and make calls to read key, which will
return:
– Z = 1 if no key found, Z = 0 if a key is detected,
– ACC = scan code of key, 0 = É key
– run indicator will be running, and
– allow APD.
ex_2:
B_CALL RunIndicOn ; turn on run indicator
SET apdAble,(IY+apdFlags) ; turn on APD
KeyLoop:
RES onInterrupt,(IY+onFLags) ; reset On key flag
;
; this part of the loop could be modifying the screen with
; animation of some kind, or doing other work while waiting for a key to
; be input.
;
CALL readKey ; see if key pressed
JR Z,KeyLoop ; jump if no key found
;
; here we have a key press, ACC = scan code,0=onkey
;
OR A ; is it the on key ?
JP Z,Handle_On_Key ; jump if yes
;
CP skEnter ; enter key scan code ?
JP Z,Handle_Enter_key
;
; check for rest of keys that matter . . .
;
;
;
readkey:
RES indicOnly,(IY+indicFlags) ; make sure keys are
; scanned
EI ; turn on interrupts
CALL GetCSC ; local routine to look
; for scan code
BIT onInterrupt,(IY+onFlags) ; On key pressed
JR Z,notOnkey
;
LD A,0 ; scan code for on key,
;Z=0from test
RET
notOnkey:
OR A ; any scan code found
RET ;Z=1ifnokey, else
;Z=0