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*.

Spot** 01234 5678910
Hex $12$06$53$74$75 $70$69$64$00$00$00
ASCII Stup id

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.

TypeType Name
$00Real Number
$01Complex Number
$02Real Vector
$03Complex Vector
$04Real List
$05Complex List
$06Real Matrix
$07Complex Matrix
$08Real Constant
$09Complex Constant
$0aEquation
$0bTI86 system use
$0cString
$0dStandard Graph Database
$0ePolar Graph Database
$0fParametric Graph Database
$10Differential Equation Graph Database
$11Picture
$12Program
$13Conversion Factor
$14 to $1fTI86 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 $4aJ$53S$48H$41A$78x
3 $69i$74t$69i$73s$53S
4 $6dm$75u$74t$73s$74t
5 $69i$70p$00$65e$61a
6 $00$69i$00$6dm$74t
7 $00$64d$00$6db$00
8 $00$00$00$6cl$00
9 $00$00$00$65e$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