_GetKey Codes
This is a quick reference for you to look up what the call _getkey
returns. _Getkey
waits for a keypress and stores that key press
into a
. It handles user input for increasing contrast and breaking programs.
It is not very useful for breaking out of assembly programs because it doesn't
always work. Once _getkey
is done, it has changed a, de
,
and hl
from what they were originally.
All of these keys are defined in the include
file ti86asm.inc
contained in
includes.zip. If you
include ti86asm.inc
in your source file, you will be able to reference these keys by these
names. This chart is really unnecessary except for a quick reference for spellings
and group associations.
There are several repeated key codes, such as kLeft
. It is on three
of these four tables. The TI86 treats it the same for each of these
cases. If you were to have the [ALPHA] key hit (so we're in the Alpha Function)
and were to hit [Left], the scancode $02
would be returned by
_getkey
. If you were to have hit [2nd],[ALPHA] instead of
[ALPHA], it would have returned $02
also. These both mean the
same thing to TI-OS.
Some keys that aren't clearly defined by their equate name are as follows:
kChs
is [(-)] (the negate sign), kNext
is [MORE],
kBOL
means that the user wants to go to the beginning of
the line, kEOL
means that the user wants to go to
the end of the line, and kInv
is the reciprocal key above [EE].
You can download the program keytest.asm to see which key codes are returned for which keys instead of just looking at these charts. It's easier to use the program to find the keycodes for a key which you know where it is on the keypad compared to looking it up on these tables.
When you're in a program such as Rascall,
you can scroll through the programs by hitting the arrow keys one at a time, or you
can hold the arrow keys down to make it scroll through the choices real fast. This
is called Key Repeat. _Getkey
monitors if a key is being held
down and returns that keycode as soon as the routine is called instead of polling
for key presses all over again. _Getkey
does this by checking the
status of the Key Press port (Port 1)
to what it was last time _getkey
was called. If it is the same,
it will return the same keycode that it got before. This, however, can
be disrupted when you use other ports, like to change ROM
pages.
Here's an example of how to use _getkey
to find out when [ENTER] was
pressed. Remember that _getkey
won't return to your program until
a key is pressed, any key, including [ON].
key_check_loop: call _getkey ;wait for a keypress cp kEnter ;is a=kEnter jr z,enter_was_pressed ;it was...jump somewhere jr key_check_loop ;it wasn't...repeat
Primary Functions | |||||||
kRight | $01 |   | kStore | $16 |   | kSin | $60 |
kLeft | $02 |   | kComma | $18 |   | kCos | $62 |
kUp | $03 |   | kChs | $1a |   | kTan | $64 |
kDown | $04 |   | kDecPnt | $1b |   | kSquare | $66 |
kEnter | $06 |   | k0 | $1c |   | kLn | $68 |
kExit | $07 |   | k1 | $1d |   | kLog | $6a |
kClear | $08 |   | k2 | $1e |   | kCustom | $73 |
kDel | $09 |   | k3 | $1f |   | kStat | $80 |
kNext | $0b |   | k4 | $20 |   | kGrMenu | $81 |
kAdd | $0c |   | k5 | $21 |   | kPrgm | $83 |
kSub | $0d |   | k6 | $22 |   | kF1 | $c2 |
kMul | $0e |   | k7 | $23 |   | kF2 | $c3 |
kDiv | $0f |   | k8 | $24 |   | kF3 | $c4 |
kExpon | $10 |   | k9 | $25 |   | kF4 | $c5 |
kLParen | $11 |   | kEE | $26 |   | kF5 | $c6 |
kRParen | $12 |   | kVarX | $5c |   |   |   |
Secondary Functions | |||||||
kBOL | $87 |   | kSqrt | $67 |   | kList | $7a |
kEOL | $88 |   | kExp | $69 |   | kVector | $7b |
kUp | $03 |   | kALog | $6b |   | kConst | $7c |
kDown | $04 |   | kMath | $6c |   | kMatrix | $7d |
kColon | $05 |   | kCplx | $6d |   | kPoly | $7e |
kIns | $0a |   | kString | $6e |   | kSimult | $7f |
kLBrack | $13 |   | kTest | $6f |   | kCalcu | $84 |
kRBrack | $14 |   | kConv | $70 |   | kSolver | $85 |
kRecall | $17 |   | kChar | $71 |   | kTable | $86 |
kAng | $19 |   | kBase | $72 |   | kF6 | $c7 |
kAns | $5d |   | kVars | $74 |   | kF7 | $c8 |
kPi | $5e |   | kCatalog | $75 |   | kF8 | $c9 |
kInv | $5f |   | kQuit | $76 |   | kF9 | $ca |
kASin | $61 |   | kLastEnt | $77 |   | kF10 | $cb |
kACos | $63 |   | kLinkIO | $78 |   | kMode | $82 |
kTan | $65 |   | kMem | $79 |   |   |   |
Alpha Functions | |||||||
kRight | $01 |   | kF3 | $c4 |   | kCapM | $34 |
kLeft | $02 |   | kF4 | $c5 |   | kCapN | $35 |
kUp | $03 |   | kF5 | $c6 |   | kCapO | $36 |
kDown | $04 |   | kSpace | $27 |   | kCapP | $37 |
kEnter | $06 |   | kCapA | $28 |   | kCapQ | $38 |
kExit | $07 |   | kCapB | $29 |   | kCapR | $39 |
kClear | $08 |   | kCapC | $2a |   | kCapS | $3a |
kDel | $09 |   | kCapD | $2b |   | kCapT | $3b |
kNext | $0b |   | kCapE | $2c |   | kCapU | $3c |
kVarX | $5c |   | kCapF | $2d |   | kCapV | $3d |
kCustom | $73 |   | kCapG | $2e |   | kCapW | $3e |
kStat | $80 |   | kCapH | $2f |   | kCapX | $3f |
kGrMenu | $81 |   | kCapI | $30 |   | kCapY | $40 |
kPrgm | $83 |   | kCapJ | $31 |   | kCapZ | $41 |
kF1 | $c2 |   | kCapK | $32 |   | kEqual | $15 |
kF2 | $c3 |   | kCapL | $33 |   |   |   |
Secondary-Alpha Functions | |||||||
kRight | $01 |   | kF3 | $c4 |   | km | $4e |
kLeft | $02 |   | kF4 | $c5 |   | kn | $4f |
kUp | $03 |   | kF5 | $c6 |   | ko | $50 |
kDown | $04 |   | kSpace | $27 |   | kp | $51 |
kEnter | $06 |   | ka | $42 |   | kq | $52 |
kExit | $07 |   | kb | $43 |   | kr | $53 |
kClear | $08 |   | kc | $44 |   | ks | $54 |
kDel | $09 |   | kd | $45 |   | kt | $55 |
kNext | $0b |   | ke | $46 |   | ku | $56 |
kVarX | $5c |   | kf | $47 |   | kv | $57 |
kCustom | $73 |   | kg | $48 |   | kw | $58 |
kStat | $80 |   | kh | $49 |   | kx | $59 |
kGrMenu | $81 |   | ki | $4a |   | ky | $5a |
kPrgm | $83 |   | kj | $4b |   | kz | $5b |
kF1 | $c2 |   | kk | $4c |   | kEqual | $15 |
kF2 | $c3 |   | kl | $4d |   |   |   |
More from z80 » Intermediate
All the Flags // Debugging // Down-Left Bug // _GetKey Codes // Logical Operators // Memory, ROM, RAM, and Safe Areas // Miscellaneous Instructions // PC and SP // Random Numbers // TI's ROM Calls // Restart Commands // Simulated 16-bit Addition // The Stack // Tables and Arrays // Text Display // Variables