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

0 Members and 1 Guest are viewing this topic.

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 #45 on: October 07, 2010, 07:52:29 pm »
Well, you don't want to overwrite other stuff, which might happen :P

IIRC there's a b_call(insertMem) or something like that. Dunno how it works, though.

Also, you could create a new var each time it updates, then delete the old one. Might be slow, but probably not that slow.

But the most secure way to edit stuff that I know of is probably to make a var that's sufficiently large to begin with :P




Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: Finding / listing programs
« Reply #46 on: October 08, 2010, 10:15:42 am »
another question: is there any way to allocate more room for a variable you have accessed? so if i wanted to add a line onto a program, could i do it in axe by simply changing the size bytes of the variable in the VAT?

The only way I can think of is to do this:

Assume an arbitrary program, prgmA

Code: [Select]
"prgmA"->Str1
"appvATemp"->Str2
GetCalc(Str1)->P
{P-2}r->L
GetCalc(Str2,L)->V
Copy(P,V,L)
DelVar P
[# of bytes to add]->A
GetCalc(Str1,L+A)->P
Copy(V,P,L)
Return
.This should result in the same program, but with A zero data bytes added to it
« Last Edit: October 08, 2010, 10:16:53 am by ACagliano »

Offline Aichi

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 290
  • Rating: +76/-3
    • View Profile
    • Devrays
Re: Finding / listing programs
« Reply #47 on: October 16, 2010, 04:29:47 pm »
Could anyone tell me how to move the pointer back by one entry in the VAT?

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 #48 on: October 16, 2010, 10:22:51 pm »
It's kinda weird since each VAT entry is a different size, but to go to the next VAT entry (backwards), here's what you do. I haven't tested it yet, but it should work.

If A is the VAT pointer pointing at the first byte of the current entry, first subtract 6 to get to NL (the byte that tells you the length of the name of the VAT entry):
Code: (Axe) [Select]
:.A is currently at the first byte of the VAT entry
:A-6→A

Then subtract the value stored there, which should move you to the end of the VAT entry:
Code: (Axe) [Select]
:.A points to a value that tells you how long the rest of the VAT entry is
:A-{A}→A

Then subtract one more to get to the first byte of the next entry:
Code: (Axe) [Select]
:.A is at the end of the VAT entry
:A-1→A

To put it together:
Code: (Axe) [Select]
:A-6→A-{A}-1→A

For more info, here's a page that tells you how the VAT basically works.
« Last Edit: October 16, 2010, 10:23:23 pm by Deep Thought »




Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Finding / listing programs
« Reply #49 on: October 16, 2010, 11:34:32 pm »
It's kinda weird since each VAT entry is a different size, but to go to the next VAT entry (backwards), here's what you do. I haven't tested it yet, but it should work.

If A is the VAT pointer pointing at the first byte of the current entry, first subtract 6 to get to NL (the byte that tells you the length of the name of the VAT entry):
Code: (Axe) [Select]
:.A is currently at the first byte of the VAT entry
:A-6→A

Then subtract the value stored there, which should move you to the end of the VAT entry:
Code: (Axe) [Select]
:.A points to a value that tells you how long the rest of the VAT entry is
:A-{A}→A

Then subtract one more to get to the first byte of the next entry:
Code: (Axe) [Select]
:.A is at the end of the VAT entry
:A-1→A

To put it together:
Code: (Axe) [Select]
:A-6→A-{A}-1→A

For more info, here's a page that tells you how the VAT basically works.

Umm, I don't think that would work... That's just another way of doing what Quigibo's code that goes to the next entry does.
« Last Edit: October 16, 2010, 11:36:19 pm by Runer112 »

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 #50 on: October 16, 2010, 11:56:46 pm »
Like a linked list, it is impossible to transverse the list backwards.  You would have to start at the beginning again and then iterate through the list until you get to the N-1th item.  Generally this is pretty fast though unless you have over 9000 items on your list.  That's how the calculator "scrolls up" on your program list*.

*kind of becasue it also has to sort alphabetically.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Finding / listing programs
« Reply #51 on: October 17, 2010, 12:05:12 am »
Like a linked list, it is impossible to transverse the list backwards.  You would have to start at the beginning again and then iterate through the list until you get to the N-1th item.  Generally this is pretty fast though unless you have over 9000 items on your list.  That's how the calculator "scrolls up" on your program list*.

*kind of becasue it also has to sort alphabetically.

Oh really? I beg to differ:

Code: [Select]
.Get Previous Entry
.Returns 1 if start of VAT or 0 otherwise
Lbl VPV
P+1→P
While {P+1→P}≥8+({P+2}≤ᴇ40)
End
P+6→P={ᴇ9830}
Return
       
Code: (Explanation of what the hell I'm doing) [Select]



Skip the first byte in case it's the F# byte for a list or a DCS folder #
Keep advancing until {P+1→P} is a valid NL and {P+2} is a valid DAH
Optimized version of Repeat {P+1→P}≤8 and {P+2}≥ᴇ40
Move forward 6 bytes to start of entry and signal if at start of VAT

Unless some cretin (possibly the same one who left the CPU in Mode 2) messed with the VAT so a name besides L1-L6 contains a byte with a value of less than or equal to 8 in it, this should work. (Can someone please verify my belief that DAH will always greater than or equal to 0x40?)



*Pats self on back for doing something even Quigibo thought was impossible*


EDIT: Will also correctly deal with DCS folders!
« Last Edit: October 17, 2010, 06:48:45 am by Runer112 »

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 #52 on: October 17, 2010, 04:09:05 am »
What about pictures, strings, and lists?  Those have a E00-E09 byte built into their name and could incorrectly be read as a valid NL.  I'm not saying its impossible to do, I'm saying its impossible to do and have it work correctly in every possible situation.  I'm sure someone could have some kind of hacked variable or something that would break your system.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Finding / listing programs
« Reply #53 on: October 17, 2010, 06:26:27 am »
What about pictures, strings, and lists?  Those have a E00-E09 byte built into their name and could incorrectly be read as a valid NL.  I'm not saying its impossible to do, I'm saying its impossible to do and have it work correctly in every possible situation.  I'm sure someone could have some kind of hacked variable or something that would break your system.

Well I know pictures are stored in the other section of the VAT, and although I'm not sure about strings, I believe they are also stored in the other section. However, lists are in the section we're concerned with, which is the point of the {P+2} check. If the name is a two-byte token for L1-L6 and {P} is detected as the byte in the token less than or equal to 8 (the byte of the name found earlier in RAM), then {P+2} will always be NL, which can never be greater than or equal to 0x40. If {P} is the NL byte, though, then {P+2} will be DAH, which is always greater than or equal to 0x40, so this will be positively identified.

And yes, if someone has hacked, invalid VAT entries, that could potentially break my system, but there's really no reason that should ever happen. Unless they were mucking around with the VAT themself, in which case it's their fault anyways if VAT reading code fails.


EDIT: Speaking of hacked VAT entries, I just remembered that DCS makes programs called "%FLDn" to handle its folders, where n can be any byte, so could be less than or equal to 8. However, this would be avoided in the initial skip over the first byte, which I originally had only in case it was a formula byte for a list. Now it looks like the skip performs double duty ;)
« Last Edit: October 17, 2010, 06:52:15 am by Runer112 »

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 #54 on: October 18, 2010, 06:39:54 pm »
Umm, I don't think that would work... That's just another way of doing what Quigibo's code that goes to the next entry does.

Whoops, sorry. I read "back" as in going backwards in mem :-\




Offline Binder News

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 785
  • Rating: +46/-3
  • Zombie of Tomorrow
    • View Profile
Re: Finding / listing programs
« Reply #55 on: October 26, 2010, 04:16:36 pm »
Hi everyone! This is my first post as this is the topic that finally made me join the community.
Anyways, I spent a while looking through the list of b_calls and their documentation in the Ti 83+ SDK System Routine documentation, and noticed 2 very interesting routines. On pages 381-384, the routines FindAlphaUp, and FindAlphDn can be found. They are (I think) the routines the OS uses to search the vat. It can search partial names, all types, and some other stuff. I would think making axioms or just putting the commands into Axe itself would be the best way of searching the VAT. (I've been wanting this for a while).

EDIT: No, I am not an ASM programmer so I cannot do it myself. I am just good at finding information.
« Last Edit: October 26, 2010, 04:29:17 pm by Binder News »
Spoiler For userbars:







Hacker-in-training!   Z80 Assembly Programmer     Axe Programmer
C++ H4X0R             Java Coder                           I <3 Python!

Perdidisti ludum     Cerebrum non habes

"We are humans first, no matter what."
"Fame is a vapor, popularity an accident, and riches take wings. Only one thing endures, and that is character."
Spoiler For Test Results:





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 #56 on: October 26, 2010, 06:04:32 pm »
That's a cool idea.  I think it's possible, and it sure has the possibility of making the code smaller. :)  Great idea! ;D

* ZTrumpet welcomes Binder News to Omnimaga. :D

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 #57 on: October 26, 2010, 11:45:54 pm »
Hey Binder News, welcome to the forums :)

(For a short second I thought you were a bot, due to the "News" part of the nickname, until I saw you had an avatar and a calculator post ;D)

Offline Binder News

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 785
  • Rating: +46/-3
  • Zombie of Tomorrow
    • View Profile
Re: Finding / listing programs
« Reply #58 on: October 27, 2010, 09:40:10 am »
Yup, my good old trusty 84+, used so much that the cover won't even stay on anymore. Anyways, I would really like it if you (DJ) would mention my previous post to Quigibo. I really don't think it could be to hard to implement a ROM call. You could use the identity token with 2 arguments. The first argument would be the (partial) name of the var to search for. The second would be what to return (pointer, name of object found, etc.). 1 could be name and 2 could be pointer. Something like that.
Spoiler For userbars:







Hacker-in-training!   Z80 Assembly Programmer     Axe Programmer
C++ H4X0R             Java Coder                           I <3 Python!

Perdidisti ludum     Cerebrum non habes

"We are humans first, no matter what."
"Fame is a vapor, popularity an accident, and riches take wings. Only one thing endures, and that is character."
Spoiler For Test Results:





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 #59 on: October 27, 2010, 02:36:29 pm »
Well you would probably need to ask in the Features Wishlist topic, as he will see it faster there. However he is busy so he might still take a while to respond.