Author Topic: Finding / listing programs  (Read 25336 times)

0 Members and 1 Guest are viewing this topic.

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: Finding / listing programs
« Reply #15 on: September 28, 2010, 04:50:16 pm »
First, to find a program, you have to start at the VAT. The VAT is the variable allocation table and it starts at (ProgPtr). It then works it's way backwards through memory. It ends at (PTemp). The VAT entry for a program looks like this.
Code: [Select]
Offset:     -14 - -7            -6          -5          -4               -3          -2             -1         0
Item:          name         name length     page      addr high       addr low     version       reserved    type

Where type is 05 for a program and 06 for a protected program. Reserved is always 0. Version changes, but 1 is usually normal. The address low and high are where you can find the program. Page is the flash page, or 0 if in ram. The name length is how many characters and in the name and the name is name.

Then when you follow out that address to a location in ram, you are given the start of the program. The first two bytes are the size bytes. Then the program data. Then the next program in ram. There is nothing ending the program. There is also nothing marking the program aside from it's size bytes, which don't look any different than normal bytes.

And that is the VAT.

Edit:
   Formatting that table.
« Last Edit: September 28, 2010, 04:53:11 pm by thepenguin77 »
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Finding / listing programs
« Reply #16 on: September 28, 2010, 08:30:16 pm »
ProgPtr is at E9830
PTemp is at E982E

You can use the numbers at these addresses to scan the VAT. ;D

Offline Broseph Radson

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 295
  • Rating: +20/-1
  • Its 0x1A4 somewhere
    • View Profile
Re: Finding / listing programs
« Reply #17 on: September 28, 2010, 09:07:07 pm »
Ossim! now i just have to learn how to do that in axe.

Also, i have no assembly experience, and no time to learn it :'(

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Finding / listing programs
« Reply #18 on: September 28, 2010, 09:36:09 pm »
Yeah, knowing a bit of ASM helps a lot, especially with vars :P




Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Finding / listing programs
« Reply #19 on: September 28, 2010, 11:55:43 pm »
Are the memory addresses the same between every single OSes, though?

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Finding / listing programs
« Reply #20 on: September 29, 2010, 01:13:01 am »
Those addresses ZTrumpet posted are constant over every single OS.  NOTE however that while these locations are constant, the VAT moves around in memory, having no specific location or size.  It makes it even worse that each element isnt even a constant size.  Those addresses ZTrumpet posted are actually locations of a *pointer* to different locations of the VAT.  SO using those locations you can find the VAT and step through it, but it is very tedious and can get ugly pretty quickly.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Finding / listing programs
« Reply #21 on: September 29, 2010, 01:25:41 am »
Ah ok thanks for the info. I think I'll have to stay away from external level stuff, personally, unless someone wrote a routine to handle them easily.

SirCmpwn

  • Guest
Re: Finding / listing programs
« Reply #22 on: September 29, 2010, 08:27:02 am »
Guys, I have a routine that will parse the VAT and store it all into L1 as strings and information, so you can more easily show the data.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Finding / listing programs
« Reply #23 on: September 29, 2010, 12:15:45 pm »
Cool! Could you post it? It might be useful to some people :)

SirCmpwn

  • Guest
Re: Finding / listing programs
« Reply #24 on: September 29, 2010, 06:08:42 pm »
I need to get the darn thing off of my calc first.  Linking issues.

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Finding / listing programs
« Reply #25 on: September 29, 2010, 09:24:45 pm »
/\yeah, i get those, too. one out of twenty tries works >:{[

im very excited to see how you did this and subsequently steal your code =D

SirCmpwn

  • Guest
Re: Finding / listing programs
« Reply #26 on: September 29, 2010, 11:44:53 pm »
Well, one day, I thought to myself, "Drew, I think Axe should be able to list files."  I then spent an hour with CalcSys and came out with my routine.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Finding / listing programs
« Reply #27 on: September 30, 2010, 12:18:20 am »
Nice. Sometimes we mess around with random stuff and we suddently discover something amazing. An example is when I was drawing checkered patterns as sprites and was attempting at converting ROL3 tilemapper to Omnicalc (which failed). Seeing how incredibly fast Omnicalc was at displaying a sprite (even a 96x62 one) I thought: WOW! I just discovered how to create grayscale with Omnicalc for BASIC games! This is where Reuben Quest came to birth...

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Finding / listing programs
« Reply #28 on: September 30, 2010, 12:21:38 am »
I need to get the darn thing off of my calc first.  Linking issues.

Hate it when that happens x.x Hope you can get it up. It'd be pretty useful :)




Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Finding / listing programs
« Reply #29 on: September 30, 2010, 12:33:30 am »
It would be something very similar to this, I haven't tested it yet.  Maybe I'll test it and then edit this post with an example that uses this.


:.Initialize Vat pointer (using P as pointer)
:Lbl VI
:{E9830}r->P
:Return
:
:.Get Next Entry
:.Returns 1 if End of Vat or 0 otherwise

:Lbl VNX
:P-{P-6}-7->P>={E982E}r
:Return
:
:.Get current entry type
:Lbl VT
:{P}
:Return
:
:.Get Pointer to current entry data
:Lbl VD
:{P-4}rr
:Return
:
:.Get archive status (0 is RAM, non-zero is archive)
:Lbl VA
:{P-5}
:Return
:
:.Get Pointer to current name length
:Lbl VNL
:{P-6}
:Return
:
:.Get Pointer to current entry name (backwards)
:Lbl VN
:P-7
:Return


EDIT: Okay, fixed it up.  Here is an example program using this library that displays a list of all the programs on your calculator.  File type '5' is the type for programs by the way.

Code: [Select]
:sub(VI)
:
:Lbl L
:If sub(VT)=5
:  For(A,1,sub(VNL))
:    Disp {sub(VN)-A+1}>Char
:  End
:  Disp i
:End
:If sub(VNX)
:  Goto L
:End
:Return
« Last Edit: September 30, 2010, 01:04:19 am by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!