Variable Name Format
The names of variables, as you've probably already discovered, can only be 8 letters long. When we use the OP_ Registers, we usually only use OP1 for names and variable manipulation. Remember that the OP_ Registers are 11 bytes long. The first byte is used for the type, the second byte is used for the length of the name (Length Indexed String), and the remaining bytes are used for the name. I haven't really talked much about Length Indexed Strings. Most strings are Zero Terminated which is easier to do, but some are Length Indexed. See the Text Printing Section for more details. Here's an example of both:
.db "stupid",0 ;zero terminated .db 6,"stupid" ;length indexed (six letters long)
Most of the variable manipulation uses the variables length indexed. That makes them easier to use for tables and arrays, but don't worry about that just yet. Here's a diagram of what the OP1 register would look like with a TI86 Program called "Stupid" stored in it. The first row is the hexadecimal and the next is the TI86 character equivalent of the hexadecimal*.
Spot** | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
Hex | $12 | $06 | $53 | $74 | $75 | $70 | $69 | $64 | $00 | $00 | $00 |
ASCII | | | S | t | u | p | i | d | | | |
The last three bytes of OP1 are not used in this case. That's because the TI86 already knows how long the string is because it is length indexed so it doesn't even have to go any further. I just put those last bytes as $00 because it really doesn't matter what they are set at, the TI86 doesn't even look at them.
The first byte (spot 0...OP1) is called the Type Byte. This is where
the TI86 stores what kind of variable this is. In this case it is a Program
which has a value of $12
. Below is a chart with the other values for
all the other kinds of variables.
* A '' means that I can't find a way to represent this character. It also means that this is not important in ASCII, it's important in hexadecimal only, kinda.
** The first spot (0) is at the address OP1+0 (or just OP1), the second spot is at the address OP1+1, the third spot is at the address OP1+2, etc. You should get the picture. The last byte (or the 11th byte) is in spot 10.
Type | Type Name |
$00 | Real Number |
$01 | Complex Number |
$02 | Real Vector |
$03 | Complex Vector |
$04 | Real List |
$05 | Complex List |
$06 | Real Matrix |
$07 | Complex Matrix |
$08 | Real Constant |
$09 | Complex Constant |
$0a | Equation |
$0b | TI86 system use |
$0c | String |
$0d | Standard Graph Database |
$0e | Polar Graph Database |
$0f | Parametric Graph Database |
$10 | Differential Equation Graph Database |
$11 | Picture |
$12 | Program |
$13 | Conversion Factor |
$14 to $1f | TI86 system use |
Want some examples?
Spot | 1st Hex | 1st ASCII | 2nd Hex | 2nd ASCII | 3rd Hex | 3rd ASCII | 4th Hex | 4th ASCII | 5th Hex | 5th ASCII |
0 | $0c | | $12 | | $00 | | $0a | | $04 | |
1 | $04 | | $06 | | $03 | | $08 | | $05 | |
2 | $4a | J | $53 | S | $48 | H | $41 | A | $78 | x |
3 | $69 | i | $74 | t | $69 | i | $73 | s | $53 | S |
4 | $6d | m | $75 | u | $74 | t | $73 | s | $74 | t |
5 | $69 | i | $70 | p | $00 | | $65 | e | $61 | a |
6 | $00 | | $69 | i | $00 | | $6d | m | $74 | t |
7 | $00 | | $64 | d | $00 | | $6d | b | $00 | |
8 | $00 | | $00 | | $00 | | $6c | l | $00 | |
9 | $00 | | $00 | | $00 | | $65 | e | $00 | |
10 | $00 | | $00 | | $00 | | $00 | | $00 | |
A '' means the character is not the same on the computer as on the TI86.
The 1st variable is a String named Jimi
, the 2nd variable is a Program
named Stupid
, the 3rd variable is a Real Number named Hit
, the 4th
variable is an Equation named Assemble
, and the 5th variable is the
standard normal Real List xStat
.
More from z80 » Variables
Absolute Addressing // Binary Coded Decimal // Creating Variables // External Levels // _FindSym // Messing with Variable Data // OP Math // TI-OS Variable Manipulation // Variable Name Format // VAT Searches