Reading Keypresses on the TI-86; ; version : 10/20/97 ; READING KEYPRESSES ON THE 86 ---------------------------- There are two ways to read keypresses on the TI-86. 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-86 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-86 manual for "getKey" ; key code diagram. ;--------------------------------------------------------------- ; _geyky equ 5371h A major disadvantage of using this method is that the TI-86 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-86 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 routine : indiconly,(iy+indicflags) This allows the run indicator to run, but APD does not. ;--------------------------------------------------------------- ; _getkey - get a keyboard key value. gp into low power mode until ; a key is pressed or APD counter is active and counts down. ; ; This routine also handles: ; 1. [2nd] and [Alpha] shift keys. ; 2. Contrast settings. ; ; output: a = key or 00 if ON key was pressed. ;--------------------------------------------------------------- ; _getkey equ 55AAh note : some 2nd and alpha functions are treated the same as 1st functions ont the TI-86. ex : left arrow & alpha left arrow are treated as just left arrow by the TI-86 system, but seperate keycode is returned for each. The tables below show the TI-86 usage of the keypress, you can interpret 1st, 2nd, alpha and 2nd alpha keys however you choose. KEY CODES: ---------- 1ST FUNCTIONS ------------- kRight equ 001h kStore equ 016h kSin equ 060h kLeft equ 002h kComma equ 018h kCos equ 062h kUp equ 003h kChs equ 01Ah kTan equ 064h kDown equ 004h kDecPnt equ 01Bh kSquare equ 066h kEnter equ 006h k0 equ 01Ch kLn equ 068h kExit equ 007h k1 equ 01Dh kLog equ 06Ah kClear equ 008h k2 equ 01Eh kCustom equ 073h kDel equ 009h k3 equ 01Fh kStat equ 080h kNext equ 00Bh k4 equ 020h kGrMenu equ 081h kAdd equ 00Ch k5 equ 021h kPrgm equ 083h kSub equ 00Dh k6 equ 022h kF1 equ 0C2h kMul equ 00Eh k7 equ 023h kF2 equ 0C3h kDiv equ 00Fh k8 equ 024h kF3 equ 0C4h kExpon equ 010h k9 equ 025h kF4 equ 0C5h kLParen equ 011h kEE equ 026h kF5 equ 0C6h kRParen equ 012h kVarx equ 05Ch 2ND FUNCTIONS ------------- kBOL equ 087h kSqrt equ 067h kList equ 07Ah kEOL equ 088h kExp equ 069h kVector equ 07Bh kUp equ 003h kALog equ 06Bh kConst equ 07Ch kDown equ 004h kMath equ 06Ch kMatrix equ 07Dh kColon equ 005h kCplx equ 06Dh kPoly equ 07Eh kIns equ 00Ah kString equ 06Eh kSimult equ 07Fh kLBrack equ 013h kTest equ 06Fh kCalcu equ 084h kRBrack equ 014h kConv equ 070h kSolver equ 085h kRecall equ 017h kChar equ 071h kTable equ 086h kAng equ 019h kBase equ 072h kF6 equ 0C7h kAns equ 05Dh kVars equ 074h kF7 equ 0C8h kPi equ 05Eh kCatalog equ 075h kF8 equ 0C9h kInv equ 05Fh kQuit equ 076h kF9 equ 0CAh kASin equ 061h kLastEnt equ 077h kF10 equ 0CBh kACos equ 063h kLinkIO equ 078h kMode equ 082h kATan equ 065h kMem equ 079h ALPHA FUNCTIONS: ---------------- kRight equ 001h kF3 equ 0C4h kCapM equ 034h kLeft equ 002h kF4 equ 0C5h kCapN equ 035h kUp equ 003h kF5 equ 0C6h kCapO equ 036h kDown equ 004h kSpace equ 027h kCapP equ 037h kEnter equ 006h kCapA equ 028h kCapQ equ 038h kExit equ 007h kCapB equ 029h kCapR equ 039h kClear equ 008h kCapC equ 02Ah kCapS equ 03Ah kDel equ 009h kCapD equ 02Bh kCapT equ 03Bh kNext equ 00Bh kCapE equ 02Ch kCapU equ 03Ch kVarx equ 05Ch kCapF equ 02Dh kCapV equ 03Dh kCustom equ 073h kCapG equ 02Eh kCapW equ 03Eh kStat equ 080h kCapH equ 02Fh kCapX equ 03Fh kGrMenu equ 081h kCapI equ 030h kCapY equ 040h kPrgm equ 083h kCapJ equ 031h kCapZ equ 041h kF1 equ 0C2h kCapK equ 032h kEqual equ 015h kF2 equ 0C3h kCapL equ 033h 2nd ALPHA FUNCTIONS: ------------------- kRight equ 001h kF3 equ 0C4h km equ 04Eh kLeft equ 002h kF4 equ 0C5h kn equ 04Fh kUp equ 003h kF5 equ 0C6h ko equ 050h kDown equ 004h kSpace equ 027h kp equ 051h kEnter equ 006h ka equ 042h kq equ 052h kExit equ 007h kb equ 043h kr equ 053h kClear equ 008h kc equ 044h ks equ 054h kDel equ 009h kd equ 045h kt equ 055h kNext equ 00Bh ke equ 046h ku equ 056h kVarx equ 05Ch kf equ 047h kv equ 057h kCustom equ 073h kg equ 048h kw equ 058h kStat equ 080h kh equ 049h kx equ 059h kGrMenu equ 081h ki equ 04Ah ky equ 05Ah kPrgm equ 083h kj equ 04Bh kz equ 05Bh kF1 equ 0C2h kk equ 04Ch kEqual equ 015h kF2 equ 0C3h kl equ 04Dh TI-86 Assembly Programming |
(c) Copyright 1998 Texas Instruments Incorporated. All rights reserved.