Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
26 May, 2013, 09:51:41 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: [1]   Go Down
  Print  
Author Topic: VAT tutorial -  (Read 1048 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
squidgetx
Food.
Coder Of Tomorrow
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Today at 07:05:13
Date Registered: 30 May, 2010, 19:54:18
Location: eating somewhere
Posts: 1838


Topic starter
Total Post Ratings: +478

View Profile
« on: 20 February, 2011, 22:19:54 »
+5

Let's write another tutorial (I'm just in the mood today) Anyway, this'll talk about the VAT, specifically, the symbol table of the calculator where programs, appvars, and protected programs are found. Ever wonder how Axe displays a list of all the Axe programs on your calculator? Well, read on!

1. What is the VAT? (By VAT, I actually mean program table, even though that's not really what VAT means)
The VAT is a chunk of user RAM that keeps track of every program/prot prog and appvar in your calc. If you notice, when you delete a program in archive, you still free up some RAM; that program's table entry is erased.

Every entry in the VAT is backwards (annoying), and structured in the following manner:

1
2
3
4
5
==============================================
| -(n+6)    -6    -5   -4    -3    -2  -1  0 |
==============================================
| VarName  N.Len Page DadrH DadrL Ver  T2  T |
==============================================
Now for an explanation of each part:
T: Sort of important but not really: the first five bits are used to identify which object type the variable is. We'll get into this later.
T2: Completely useless to us. Ignore.
Ver: Tells the OS whether or not it can be sent across certain OSs. Ignore.
DadrL: More important: Tells us the low byte of the address of this object.
DadrH: The high byte
Page: What flash page? If in RAM, it'll equal 0.
N. Len: How long is the name
And from here, we have the name of the object (backwards)

Now, the location of the VAT is always changing. Fortunately the calculator stores it for us at address $9830. The address of the end of the VAT is stored in $982E.

Here's a code example on how to set up a loop that goes through the VAT, one entry at a time...

1
2
3
4
5
6
7
8
{e9830}^^r->E     //set up
While E>{e982E}^^r  //While we're in the VAT
For(F,0,14)        //Copy backwards to L1. For some reason I couldn't get Copy()r to work...
{E-F}->{F+L1}
End
...stuff. Now you have your VAT entry sitting in L1...do what you want with it.
E-{L1+6}-7->E    //Increment the pointer "position" appropriately. Every entry is a different length, depending on the name length.
End

Now, you can use the value of {L1+3}r+2 as a pointer to the object without even needing a GetCalc statement. This even works with file pointers as well, storing {L1+3}r+2 to {oY1}r and {L1+5} to {oY1+2} allows you to use Y1 normally as well.
Logged

Read my webcomic! | My SoundCloud
Projects:

Check out the demo now!- Current progress: battle engine and stuff
Proud author of: Cuberunner | SpaceDash | The Psyche | XXEdit | AxeSynth | StickNinja | Gravity Guy | Embers:Phoenix | Zombie Gun
Axe: Need help optimizing?
User of Axe | zStart | TokenIDE | CalcGS | MirageOS
FinaleTI
Believe in the pony that believes in you!
Coder Of Tomorrow
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: 03 May, 2013, 16:35:01
Date Registered: 04 June, 2010, 00:34:27
Location: Alteria
Posts: 1818


Total Post Ratings: +118

View Profile WWW
« Reply #1 on: 20 February, 2011, 22:24:48 »
0

Nice.

One thing I wanted to say was that the T2 byte actually has some use. DoorsCS uses it to determine what folder a program is in.
Logged





So, yeah, I have a blog now. Nothing special, just your average ghost town.

Spoiler for Projects:
Spoiler for Pokemon TI:
Map engine is going to be redone from scratch, since I was lacking in organization last time. With a project as big as Pokemon, planning and organization is key, so that will probably be the brunt of the work done on this project for the time being.

Spoiler for Nostalgia:
Being worked on. Nothing really new to put here, but it's being worked on.

Spoiler for Finale's Super Insane Tunnel Pack of Doom:
I will be combining Blur and Collision Course into a single gamepack.

Spoiler for Nostalgia Origins: Sky's Story:
Currently on hold. I am unsure of whether this will remain DCS7 Hybrid BASIC or if it will use Batlib, Grammer or perhaps Axe.
This may see more progress once a demo of Nostalgia is released.
DJ Omnimaga
Retired Omnimaga founder (Site issues must be PM'ed to Netham45, Eeems, Shmibs, Deep Thought and AngelFish, not me.)
Editor
LV15 Omnimagician (Next: --)
*
Offline Offline

Gender: Male
Last Login: Today at 07:37:00
Date Registered: 25 August, 2008, 07:00:21
Location: Québec (Canada)
Posts: 50238


Total Post Ratings: +2615

View Profile WWW
« Reply #2 on: 22 February, 2011, 06:52:01 »
0

Nice, should be useful to some people eventually. Cheesy
Logged

Retired 83+ coder, Omnimaga/TIMGUL founder. Now doing power metal music (formerly did electronica)

Follow me on Bandcamp|Facebook|Reverbnation|Youtube|Twitter|Myspace
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.171 seconds with 30 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.