Variable Name Format
z80 » Variables
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*.
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.
|$0b||TI86 system use|
|$0d||Standard Graph Database|
|$0e||Polar Graph Database|
|$0f||Parametric Graph Database|
|$10||Differential Equation Graph Database|
|$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|
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
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
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