| _rowread | Function* (tigcc.a)

kbd.h

unsigned short _rowread (unsigned short row);

Low-level keyboard reading.

_rowread is a function for low-level keyboard reading. It is implemented for simultaneous reading of more than one key (useful in games), or for reading keys when interrupts are disabled (useful if you want to avoid displaying status line indicators, which are displayed from Auto-Int 1).
Setting a bit in row masks the corresponding row of the keyboard from being read, so if row is zero, all rows are read at the same time. Take a look at _rowread_inverted as well. In the result, all bits (cols) corresponding to keys which are being held down are set. See below for some examples.
Here is a table which describes how the keyboard matrix is organized on both the TI-89 and TI-92 Plus:
TI-89:

| C o l u m n

R
o
w

| Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0
Bit 0 | alpha | Diamnd | Shift | 2nd | Right | Down | Left | Up
Bit 1 | F5 | CLEAR | ^ | / | * | - | + | ENTER
Bit 2 | F4 | BckSpc | T | , | 9 | 6 | 3 | (-)
Bit 3 | F3 | CATLG | Z | ) | 8 | 5 | 2 | .
Bit 4 | F2 | MODE | Y | ( | 7 | 4 | 1 | 0
Bit 5 | F1 | HOME | X | = | | | EE | STO | APPS
Bit 6 |  |  |  |  |  |  |  | ESC

TI-92 Plus:

| C o l u m n

R
o
w

| Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0
Bit 0 | Down | Right | Up | Left | Hand | Shift | Diamnd | 2nd
Bit 1 | 3 | 2 | 1 | F8 | W | S | Z |
Bit 2 | 6 | 5 | 4 | F3 | E | D | X |
Bit 3 | 9 | 8 | 7 | F7 | R | F | C | STO
Bit 4 | , | ) | ( | F2 | T | G | V | Space
Bit 5 | TAN | COS | SIN | F6 | Y | H | B | /
Bit 6 | P | ENTER2 | LN | F1 | U | J | N | ^
Bit 7 | * | APPS | CLEAR | F5 | I | K | M | =
Bit 8 |  | ESC | MODE | + | O | L | q | BckSpc
Bit 9 | (-) | . | 0 | F4 | Q | A | ENTER1 | -

Note for TI-92+: ENTER1 is on the alphabetic and numeric keypads. ENTER2 is next to the cursor pad.
You can use binary numbers as implemented in TIGCC v0.91 (or higher) to mask out the rows you need. Note, however, that this is not recommended since programs written this way will not be compatible with other C dialects and previous versions of TIGCC.
Instead, you can make use of the fact that a value where only bit i is set equals 1<<i.
Use the bitwise NOT operator ('~') to invert the value.
These four expressions all check whether '9' on the TI-89 or 'E' on the TI-92+ is held down. In fact, they are all equal:

    _rowread(~((short)(1<<2))) & (1<<3)
    _rowread(~0b100) & 0b1000
    _rowread(~0x4) & 0x8
    _rowread(0xFFFB) & 0x8

But generally it is much easier to use the _keytest macro instead.
Because of the way the TI-89 and TI-92+'s keyboard is wired, if you hold down three keys that form the corners of a rectangle, the calculator will think you are also holding down the key at the fourth corner. The ON key is special. It is not part of the keyboard matrix and therefore cannot be read with _rowread. It triggers a special interrupt instead.
Note: It is recommended to redirect Auto-Int 1 and 5 while reading the keyboard using _rowread, because keyboard reading routines implemented in these two interrupts may interfere with _rowread if an interrupt occurs just while _rowread is executing. See DUMMY_HANDLER from intr.h for information on how to do this.
About the internal implementation: _rowread sends row to the I/O port 0x600018 (keyboard row mask), waits a while to allow the I/O to recover, then returns the byte read from 0x60001B (inverted for easier testing in C programs).

Used by: _keytest, _keytest_optimized, _rowread_internal, _rowread_inverted

See also: _rowread_internal, _rowread_inverted, _keytest