EasyManua.ls Logo

Texas Instruments TI-83-Plus - Page 75

Texas Instruments TI-83-Plus
188 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 2: TI-83 Plus Specific Information 65
TI-83 Plus Developer Guide Third Release May 28, 2002
Example one: This example will use the Z80 halt instruction to enter into low power
mode, and upon waking up, will check:
if a key had been pressed,
check for the É key being pressed,
turn off the run indicator while waiting for a key, and
disable APD while waiting and re-enable it after.
anykey:
RES indicOnly,(IY+indicFlags) ; make sure keys are
; scanned
B_CALL RunIndicOff ; turn off run indicator
RES onInterrupt,(IY+onFlags) ; reset On key flag
RES apdAble,(IY+apdFlags) ; turn off APD
anykeylp:
EI ; turn on interrupts
HALT ; low power state
BIT onInterrupt,(IY+onFLags) ; On key pressed
JR NZ,foundkey ; return if yes
;
CALL GetCSC ; local routine to look
; for scan code
OR A ; if non zero then have
; a scan code
JR Z,anykeylp ; jump if no scan code
; present
foundkey:
SET apdAble,(IY+apdFlags) ; turn on APD
RES onInterrupt,(IY+onFlags) ; reset On key flag
RET
;
GetCSC:
LD HL,kbdScanCode
DI ; interrupts off
LD A,(HL) ; get possible scan code
LD (HL),0 ; clear out for next
; scan
RES kbdSCR,(IY+kbdFlags) ; needed for system
; key scan to work
EI ; interrupts on
RET

Table of Contents

Other manuals for Texas Instruments TI-83-Plus

Related product manuals