A82: Re: need info on VAT


[Prev][Next][Index][Thread]

A82: Re: need info on VAT



You should start by reading 82-var.txt by Dines Justesen, which I have attached to this e-mail. It contains information on all the TI-82 variables and how they are stored in memory.

-Kouri
http://kouri.cjb.net
http://void.calc.org


----- Original Message ----- 
From: "Roger Levy" <trip_n_save@hotmail.com>
To: <assembly-82@lists.ticalc.org>
Sent: Thursday, November 09, 2000 13:03
Subject: A82: need info on VAT


> 
> hi, can someone give me a few pointers on how to use the ti-82 vat and how 
> to create and locate variables in assembly?
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
> 
> Share information about yourself, create your own public profile at 
> http://profiles.msn.com.
> 
> 
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
  82-VAR.TXT          A Programmer's Guide to the TI-82        Version 0.4
           Copyright (c) 1999 Mattias Lindqvist & Dines Justesen
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------

This document tries to explaine how the TI82 system is build up. Suggestions,
additions and corrections are very welcome, mail me at the address below. You
can always find the latest version of this document at my homepage.

Dines Justesen 
email: c958362@student.dtu.dk 
www  : http://www.student.dtu.dk/~c958362

Memory layout
-------------

The memory layout of the TI82 is something like what is shown below.

      +--------------------------+ 0000
      |        ROM page 0        |
      |--------------------------| 4000
      |         ROM page         |
      |--------------------------| 8000
      |      System memory       |
      |--------------------------| 8D24
      |        User memory       |
      |             |            |
      |             V            |
      |                          |
      |             ^            |
      |             |            |
      |         Temp VAT ?       | (vars starting with '$')
      |             ^            |
      |             |            |
      |        Program VAT       |
      |             ^            |
      |             |            |
      |            VAT           |
      |--------------------------| FE6E
      |          Stack           |
      |__________________________| FFFF

Types of variables
------------------

The list below contains the numbers of the types of data used on the TI82.

Type:             Number:
-------------------------
Real              00
List              01
Matrix            02
Y-Var             03
Program           05
Protected program 06
Pic               07
GDB               08
?                 09 (prgm like name)
?                 0A (uses token name)
WINDW             0B -
ZSTO              0C  |
TABLE             0D  | Link only
LCD               0E  |
Backup            0F -

Format of variables:
--------------------

Real:

The real variables are 9 bytes long on the TI82. The bytes are used as shown
below.

      +------+-----+----+----+----+----+----+----+----+
      | Sign | Exp | D1 | D2 | D3 | D4 | D5 | D6 | D7 |
      +------+-----+----+----+----+----+----+----+----+

The MSB of the sign bytes holds the sign, 0 for positive and 1 for negative.
The lower 4 bits are often used to store the type of the variable. Exp holds
the exponent of the number, 80 for 00 more for positive and less for negative.
D1 to D7 are the digits of the numbers in packed BCD. Using the notation -123
would be written as:

      80 82 12 30 00 00 00 00 00

List:

The first two bytes contains the number of reals in the list. After that the
data is stored as one real after another.

Matrix:

The first byte holds the number of elements in each row, the second the
number of elements in a coloum. The first real is (1,1) the next (1,2) and
the last is the value in the lower right corner.

The TI82 tokens
---------------

Some variables on the varialbes on the TI82 has a token which tells the system
which var it is. A list of some of the common tokens is shown below.

Matrix
  MA = 5C 00
  MB = 5C 01
  MC = 5C 02
  MD = 5C 03
  ME = 5C 04
Lists
  L1 = 5D 00
  L2 = 5D 01
  L3 = 5D 02
  L4 = 5D 03
  L5 = 5D 04
Y-Var
  Y1 = 5E 10 All func. have bit 4 set
  Y2 = 5E 11
  Y3 = 5E 12
  Y4 = 5E 13
  Y5 = 5E 14
  Y6 = 5E 15
  Y7 = 5E 16
  Y8 = 5E 17
  Y9 = 5E 18
  Y0 = 5E 19
  Xt1 = 5E 20 All param. have bit 5 set
  Yt1 = 5E 21
  Xt2 = 5E 22
  Yt2 = 5E 23
  Xt3 = 5E 24
  Yt3 = 5E 25
  Xt4 = 5E 26
  Yt4 = 5E 27
  Xt5 = 5E 28
  Yt5 = 5E 29
  Xt6 = 5E 2A
  Yt6 = 5E 2B
  r1 = 5E 40 All polar. have bit 6 set
  r2 = 5E 41
  r3 = 5E 42
  r4 = 5E 43
  r5 = 5E 44
  r6 = 5E 45
  Un = 5E 80 All seq. have bit 7 set
  Vn = 5E 81
Prog????? 5F single byte ?
Pic
  Pic1 = 60 00
  Pic2 = 60 01
  Pic3 = 60 02
  Pic4 = 60 03
  Pic5 = 60 04
  Pic6 = 60 05

GDB
  GDB1 = 61 00
  GDB2 = 61 01
  GDB3 = 61 02
  GDB4 = 61 03
  GDB5 = 61 04
  GDB6 = 61 05

Besides the tokens above some of the other tokens are used by the system.
All the tokens used on the TI82 are the same as the one used on the TI83
(except for a few which is listed below), so for a complete list of tokens
look at TI's documentation on the TI83.

Tokens used on the TI83 which is not used on the TI82 :

 26,2C,AA,BB,EB,GFMT+16,GFMT+17,GFMT+18

Tokens which does not mean the same thing on the TI82:

 22     : solve(
 GFMT+5 : time

The tokens for all of the stat/range system vars has been found at their
location in the RAM has been documented. The tokens used are the same as on
the TI83, but unlike the list there all the values are known. In future
versions of this document the list of system vars mioght be included.

The VAT
-------

On the TI82 the VAT has been split into three different parts, which uses
different formats for storing data. The top most part holds all types of
variables except programs. The next part holds information on programs. The
last part holds ?ANS?. As on the TI85 all data in the VAT is stored backwards.

The format of the top most part is shown below.

       +------+------+------+--------+--------+------+
       | Type | Adr1 | Adr2 | Token1 | Token2 | Zero |
       +------+------+------+--------+--------+------+

The type byte holds the type of veriable discreibed. Adr1 and Adr2 holds the
adress of the first byte of data (including the length). Token1 and Token2
holds the variables token. The last byte is almost always zero, but not
always. The function of the last byte is not known.

The next part of the Vat uses the format shown below.

       +------+------+------+---------+---------+
       | Type | Adr1 | Adr2 | NLength | Name . .|
       +------+------+------+---------+---------+

As before Type hols the type of variable and Adr1 and Adr2 holds the address.
Nlength holds the length of the name in bytes. After that comes the name.

The 4 MSB of the types (for both kinds of VAT) is sometimes used to store
data, which means that they are not allways zero. Therefore these bits should
be masked out befor the type is used. When these functions are used for Y-Vars
they are are used to tell what kind of graphs they affect (see the tokens
section for details). This makes it easier to use the "smart" graph function.

The TI82 keys
-------------

Depending on how the key presses are read the TI82 uses different numbers
for the keys. One possible way of reading keypresses is reading the port
directly, see 82-PORTS.TXT for more information. Besides this the ROM
contains two function which can be used. The key layout for these functions
is shown in the tables below.

The table below lists the scan code returned by the TI82 function placed at
1D4.
+-------------+-------------+-------------+
| 00 NO KEY   | 16 TAN      | 28 x,T,theta|
| 01 DOWN     | 17 VARS     | 29 ON *     |
| 02 LEFT     | 19 .        | 2A STO>     |
| 03 RIGTH    | 1A 2        | 2B LN       |
| 04 UP       | 1B 5        | 2C LOG      |
| 09 ENTER    | 1C 8        | 2D X^2      |
| 0A +        | 1D (        | 2E X^-1     |
| 0B -        | 1E COS      | 2F MATH     |
| 0C *        | 1F PRGM     | 30 ALPHA    |
| 0D /        | 20 STAT     | 31 GRAPH    |
| 0E ^        | 21 0        | 32 TRACE    |
| 0F CLEAR    | 22 1        | 33 ZOOM     |
| 11 (-)      | 23 4        | 34 WINDOW   |
| 12 3        | 24 7        | 35 Y=       |
| 13 6        | 25 ,        | 36 2nd      |
| 14 9        | 26 SIN      | 37 MODE     |
| 15 )        | 27 MATRIX   | 38 DEL      |
+-------------+-------------+-------------+
* The ON-handler gets to this first !

Another way of reading keypresses is the function at 393E. This function
will wait for a keypress, and take care of 2nd/ALPHA,constrast change and
APD. The function does not returns until a key has been pressed, while it
is waiting for a key it goes into low power mode. If the user presses
2nd-ON the calc is turned off, and when it is turned on it goes to the
homescreen, recalling whatever was located in the textmem.

Normal function
---------------
+-------------+-------------+-------------+-------------+
| RIGTH     1 | STAT     55 | )       135 | 7       150 |
| LEFT      2 | GRAPH    69 | STO>    139 | 8       151 |
| UP        3 | MODE     70 | ,       140 | 9       152 |
| DOWN      4 | WINDOW   73 | (-)     141 | x,T,the 181 |
| ENTER     5 | Y=       74 | .       142 | X^-1    183 |
| CLEAR     6 | TRACE    93 | 0       143 | SIN     184 |
| DEL       7 | +       129 | 1       144 | COS     186 |
| PRGM     45 | -       130 | 2       145 | TAN     188 |
| ZOOM     46 | *       131 | 3       146 | X^2     190 |
| MATH     49 | /       132 | 4       147 | LN      192 |
| VARS     52 | ^       133 | 5       148 | LOG     194 |
| MATRIX   54 | (       134 | 6       149 |             |
+-------------+-------------+-------------+-------------+

2nd function
------------
+-------------+-------------+-------------+-------------+
| RIGTH    12 | STAT     58 | )       238 | 7       253 |
| LEFT     11 | GRAPH    75 | STO>      9 | 8       252 |
| UP          | MODE     64 | ,       153 | 9       251 |
| DOWN        | WINDOW   76 | (-)     198 | x,T,the  65 |
| ENTER    10 | Y=       48 | .       199 | X^-1    244 |
| CLEAR     6 | TRACE    59 | 0       143 | SIN     185 |
| DEL       8 | +        53 | 1       245 | COS     187 |
| PRGM     47 | -       137 | 2       246 | TAN     189 |
| ZOOM     46 | *       136 | 3       247 | X^2     191 |
| MATH     50 | /       132 | 4       248 | LN      193 |
| VARS     56 | ^       182 | 5       249 | LOG     195 |
| MATRIX   57 | (       237 | 6       250 |             |
+-------------+-------------+-------------+-------------+

Alpha function
--------------
+-------------+-------------+-------------+-------------+
| RIGTH     1 | STAT     55 | )       166 | 7       169 |
| LEFT      2 | GRAPH    69 | STO>    178 | 8       170 |
| UP        3 | MODE     70 | ,       164 | 9       171 |
| DOWN      4 | WINDOW   73 | (-)     203 | x,T,the 181 |
| ENTER     5 | Y=       74 | .       142 | X^-1    158 |
| CLEAR     6 | TRACE    93 | 0       154 | SIN     159 |
| DEL       7 | +       204 | 1       179 | COS     160 |
| PRGM    157 | -       177 | 2       180 | TAN     161 |
| ZOOM     46 | *       172 | 3       205 | X^2     163 |
| MATH    155 | /       167 | 4       174 | LN      173 |
| VARS     52 | ^       162 | 5       175 | LOG     168 |
| MATRIX  156 | (       165 | 6       176 |             |
+-------------+-------------+-------------+-------------+

The following paragraph contains a list of keys and the numbers returned by
the GetKey function. The number listed is the number returned by the function.
the key field indicates which key was pressed and function indicates which
function it has (based on 2nd and alpha flags).

  # Key       Function
--------------------
  1 RIGTH     RIGTH
  2 LEFT      LEFT
  3 UP        UP
  4 DOWN      DOWN
  5 ENTER     ENTER
  6 CLEAR     CLEAR
  7 DEL       DEL
  8 DEL       INS
  9 STO>      RCL
 10 ENTER     ENTRY
 11 LEFT      BOL
 12 RIGTH     EOL
 45 PRGM      PRGM
 46 ZOOM      ZOOM
 47 PRGM      DRAW
 48 Y=        STAT PLOT
 49 MATH      MATH
 50 MATH      TEST
 52 VARS      VARS
 53 +         MEM
 54 MATRIX    MATRIX
 55 STAT      STAT
 56 VARS      Y-VARS
 57 MATRIX    ANGLE
 58 STAT      LIST
 59 TRACE     CALC
 64 MODE      QUIT
 65 x,T,theta LINK
 69 GRAPH     GRAPH
 70 MODE      MODE
 73 WINDOW    WINDOW
 74 Y=        Y=
 75 GRAPH     TABLE
 76 WINDOW    TblSet
 93 TRACE     TRACE
129 +         +
130 -         -
131 *         *
132 /         /
133 ^         ^
134 (         (
135 )         )
136 *         [
137 -         ]
139 STO>      STO>
140 ,         ,
141 (-)       (-)
142 .         .
143 0         0
144 1         1
145 2         2
146 3         3
147 4         4
148 5         5
149 6         6
150 7         7
151 8         8
152 9         9
153 ,         EE
154 0         ;
155 MATH      A
156 MATRIX    B
157 PRGM      C
158 X^-1      D
159 SIN       E
160 COS       F
161 TAN       G
162 ^         H
163 X^2       I
164 ,         J
165 (         K
166 )         L
167 /         M
168 LOG       N
169 7         O
170 8         P
171 9         Q
172 *         R
173 LN        S
174 4         T
175 5         U
176 6         V
177 -         W
178 STO>      X
179 1         Y
180 2         Z
181 x,T,theta x,T,theta
182 ^         Pi
183 X^-1      X^-1
184 SIN       SIN
185 SIN       SIN^-1
186 COS       COS
187 COS       COS^-1
188 TAN       TAN
189 TAN       TAN^-1
190 X^2       X^2
191 X^2       SQRT
192 LN        LN
193 LN        e^X
194 LOG       LOG
195 LOG       10^X
198 (-)       ANS
199 .         :
203 (-)       ?
204 +         "
205 3         THETA
237 (         {
238 )         }
244 X^-1      ABS
245 1         L1
246 2         L2
247 3         L3
248 4         L4
249 5         L5
250 6         L6
251 9         n
252 8         Vn-1
253 7         Un-1



References: