Various calc-dependent and AMS-dependent pseudo-constants
This header file contains a set of various pseudo-constants (i.e. macros defined to
look and work like constants), dedicated to increase compatibility between the TI-89 and
TI-92 Plus and between AMS versions. These "constants" have different values on the
TI-89 and TI-92 Plus (or on AMS 1.xx and AMS 2.xx). Using these pseudo-constants,
you can, for example, perform keyboard reading and graphic calculations in a more sophisticated way,
check the AMS version and perform some AMS-dependent actions (although this is not recommended
if not really necessary), etc.
The following table shows all defined pseudo-constants.
A lot of them are known from DoorsOS, but they are defined here to work in both "nostub"
and "Doors" mode.
Note: All of these pseudo-constants are in fact macros. Although they expand to relatively small code (in "Doors" mode they are mainly implemented as RAM calls and managed by kernel), it is recommended to store a pseudo-constant in an ordinary variable if you use it a lot of times in the program (especially in "nostub" mode), and to use this variable instead. For example, if you use the KEY_LEFT pseudo-constant too often, it is recommended to define
int key_left = KEY_LEFT;
somewhere at the beginning of the program, and to use
if (key == key_left) ...
instead of
if (key == KEY_LEFT) ...
Such indirection will save memory, but note that this is necessary only if you use
the same pseudo-constant a lot in the program (say, more than 5 times).
There is yet another note. Pseudo-Constants work as constants in nearly all cases, but
they are not really constants, so they can not be used in case labels
inside switch statements, i.e. the following is not legal:
switch (ngetchx ())
{
case KEY_LEFT:
...
case KEY_RIGHT:
...
...
}
Instead, use if...else constructions:
key = ngetchx ();
if (key == KEY_LEFT)
{
...
}
else if (key == KEY_RIGHT)
{
...
}
...
The pseudo-constants really become constants if you compile only for one
calculator model. For example, if you define USE_TI89 and nothing
else, CALCULATOR will have the value 0,
and all other pseudo-constants will be optimized into single values.
Or, if you define MIN_AMS to be 200,
AMS_1xx will always be false.
A macro to construct a pseudo-constant from calculator-based values.
PSEUDO_CONST_CALC is a macro used by
PSEUDO_CONST_SCREEN and
PSEUDO_CONST_KBD. Most of the time,
you should not use it directly, but use these two macros instead.
It takes several values for the different calculators that TIGCC can
currently compile code for, and returns one of them based on the calculator
that the program currently uses.
The values must be plain positive integers up to 65535 (0xFFFF) in decimal
or hexadecimal notation, otherwise this macro may fail in some cases.
Uses of this macro may be optimized by defining
OPTIMIZE_CALC_CONSTS.
See also: PSEUDO_CONST_SCREEN, PSEUDO_CONST_KBD
A macro to construct a pseudo-constant from keyboard-based values.
PSEUDO_CONST_KBD takes several values for different keyboard layouts, and
returns one of them based on the keyboard that the program currently uses.
The values must be plain positive integers up to 65535 (0xFFFF) in decimal
or hexadecimal notation, otherwise this macro may fail in some cases.
Currently, there are two different keyboard layouts: The TI-89 keyboard,
which looks like a normal calculator keyboard with extra keys, and the
TI-92/TI-92+/V200 keyboard, which has a QWERTY layout.
The two parameters specify the values to use whichever keyboard layout is
encountered, which means that the number of parameters may increase as new
hardware becomes available. If you want to use this macro in your
application, you must decide for yourself whether this feature is desirable:
On the one hand, it can prevent your code from being compiled in future
releases of TIGCC; on the other hand, you can easily port your programs to
new hardware just by fixing all of the compile-time errors.
See also: PSEUDO_CONST_CALC, PSEUDO_CONST_SCREEN
A macro to construct a pseudo-constant from screen-based values.
PSEUDO_CONST_SCREEN takes several values for different types of screens, and
returns one of them based on the screen that the program currently uses.
The values must be plain positive integers up to 65535 (0xFFFF) in decimal
or hexadecimal notation, otherwise this macro may fail in some cases.
Currently, there are two types of screens: The TI-89 LCD with a size of
160x100 pixels, and the TI-92/TI-92+/V200 LCD with a size of 240x128 pixels.
The two parameters specify the values to use whichever screen type is
encountered, which means that the number of parameters may increase as new
hardware becomes available. If you want to use this macro in your
application, you must decide for yourself whether this feature is desirable:
On the one hand, it can prevent your code from being compiled in future
releases of TIGCC; on the other hand, you can easily port your programs to
new hardware just by fixing all of the compile-time errors.
See also: PSEUDO_CONST_CALC, PSEUDO_CONST_KBD
TRUE on AMS 1.xx, FALSE on AMS 2.xx and AMS 3.xx.
This pseudo-constant is in fact defined globally, in default.h.
TRUE on AMS 2.xx, FALSE on AMS 1.xx and AMS 3.xx.
This pseudo-constant is in fact defined globally, in default.h.
TRUE on AMS 3.xx, FALSE on AMS 1.xx and AMS 2.xx.
This pseudo-constant is in fact defined globally, in default.h.
Describes the calculator model.
This pseudo-constant is 0 on the TI-89, 1 on the TI-92 Plus, and 3 on the V200.
Describes the hardware version.
This pseudo-constant is 1 on a HW1 calculator and 2 on a HW2 calculator. It reads the value of the gateArray field in the HARDWARE_PARM_BLOCK structure returned by FL_getHardwareParmBlock.
The number added to the key code if the Diamond key is pressed with it (see ngetchx).
Key code for the down arrow key (see ngetchx).
Key code for simultaneous pressing of the down and left arrow keys (see ngetchx).
Key code for the left arrow key (see ngetchx).
The key code for Diamond+ON (see ngetchx).
Key code for the right arrow key (see ngetchx).
The number added to the key code if the Shift key is pressed with it (see ngetchx).
Key code for the up arrow key (see ngetchx).
Key code for simultaneous pressing on up and right arrow keys (see ngetchx).
Height of the screen in pixels.
This value is 100 on the TI-89, and 128 on the TI-92 Plus and V200.
Number of bytes in the visible part of a screen line.
This value is 20 on the TI-89, and 30 on the TI-92 Plus and V200.
Width of the screen in pixels.
This value is 160 on the TI-89, and 240 on the TI-92 Plus and V200.
Base address of the ROM (0x200000 on TI-89 or V200, 0x400000 on TI-92 Plus, 0x800000 on TI-89 Titanium).
A pseudo-constant pair for the '0' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the '1' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the '2' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the '3' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the '4' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the '5' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the '6' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the '7' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the '8' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the '9' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the '2nd' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'A' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the Alpha key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'APPS' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'B' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the backspace key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'C' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'CATALOG' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'CLEAR' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the ',' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'COS' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'D' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the Diamond key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the '/' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the '.' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the down arrow key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'E' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'EE' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the first 'ENTER' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the second 'ENTER' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'ENTER' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the '=' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'ESC' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'F1' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'F2' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'F3' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'F4' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'F5' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'F6' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'F7' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'F8' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'F' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'G' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'H' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the Hand key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'HOME' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'I' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'J' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'K' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'L' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the left arrow key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'LN' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'M' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the '-' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'MODE' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the '*' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'N' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the negation key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A constant which means that a specific key does not exist.
This constant is used whenever a specific key only exists on one calculator.
A pseudo-constant pair for the 'O' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'P' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the ')' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the '(' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the '+' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the '^' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'Q' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'R' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the right arrow key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'S' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the Shift key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'SIN' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the space key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the Store key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'T' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'TAN' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'q' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'U' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the up arrow key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'V' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'W' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the '|' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'X' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'Y' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
A pseudo-constant pair for the 'Z' key.
This pseudo-constant pair defines the location of a specific key in the keyboard matrix used in _keytest.
TRUE on a classic TI-89 (i.e. a TI-89 which is not a TI-89 Titanium), FALSE otherwise.
See also: TI89
TRUE on a TI-89 Titanium, FALSE otherwise.
See also: TI89
TRUE on a TI-89, FALSE otherwise.
See also: TI89_CLASSIC, TI89_TITANIUM
TRUE on TI-92 Plus, FALSE otherwise.
Number of entries in the TIOS jump table.
This pseudo-constant may also be used to determine the AMS version:
TRUE on V200, FALSE otherwise.