Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: Broseph Radson on September 27, 2010, 11:53:32 am

Title: Finding / listing programs
Post by: Broseph Radson on September 27, 2010, 11:53:32 am
Would this be possible? Would i need to find the location of the programs then point a Text( or Output( to the names? our could Axe just put a list of the programs into a string in 8 char blocks?

EDIT: Ill check on this tomorrow. Wont have computer access till tomorrow morning.
Title: Re: Finding / listing programs
Post by: Builderboy on September 27, 2010, 01:46:20 pm
I actually wrote a program that does exaclty this in Axe, I wrote it as part of my Optimizer program.  I'll see if i can get the source code up in a sec
Title: Re: Finding / listing programs
Post by: SirCmpwn on September 27, 2010, 06:43:24 pm
Yeah, I have a routine, I'll post it as soon as I can get it off my calc.  It gets a list of programs as well as information about each, including archived state and such.
Title: Re: Finding / listing programs
Post by: jnesselr on September 27, 2010, 08:33:29 pm
How exactly is this done?
Title: Re: Finding / listing programs
Post by: nemo on September 27, 2010, 08:38:28 pm
i'm guessing there's an address in ram that begins where all the programs are stored, and then the first few bytes of the program indicate the size of said program, whether it's archived etc. then program name/data. so to get all the names, you would have a loop reading off the program name, copy it to a safe ram area, then skip ahead [size of program] bytes to the next program.
Title: Re: Finding / listing programs
Post by: Runer112 on September 27, 2010, 10:03:00 pm
i'm guessing there's an address in ram that begins where all the programs are stored, and then the first few bytes of the program indicate the size of said program, whether it's archived etc. then program name/data. so to get all the names, you would have a loop reading off the program name, copy it to a safe ram area, then skip ahead [size of program] bytes to the next program.

I believe their programs may read from the VAT (Variable Allocation Table), which contains information about every data structure on the calculator, whether it's a variable, list, program, app, etc.
Title: Re: Finding / listing programs
Post by: Broseph Radson on September 28, 2010, 08:46:40 am
If you dont already have it, you should get CalcSys. It has a built-in hex editor, and it lets you view the program VAT and go directly to a program's address in the Hex Editor.

If you can figure out what any of the information means, theres 10 bytes of data, then the name of the program, then more data. So, for example, I have a program called "A." It starts at 7BC0 and the name begins (and ends, since its only 1 byte) at 7BCB.

Calcsys: http://www.ticalc.org/archives/files/fileinfo/97/9781.html (http://www.ticalc.org/archives/files/fileinfo/97/9781.html)
Title: Re: Finding / listing programs
Post by: DJ Omnimaga on September 28, 2010, 11:50:34 am
How does the program start and end looks like into memory? Is it always the same? If so, I guess it might not be too hard to detect.
Title: Re: Finding / listing programs
Post by: Broseph Radson on September 28, 2010, 12:03:02 pm
They seem to all start with FC, but idk what they end with. I guess that all depends on the size of the program, so if the programs are all together with no data between them, you should be able to find an FC, skip ahead 10 bytes for the name, then (assuming they are all together) skip ahead the number of bytes in the program -10 -the length of the name, and be at another program, and so on, or simply skip to the next FC (assuming its only at the beginning and not anywhere else in the program)

Also, quick modify is awesome.

Title: Re: Finding / listing programs
Post by: DJ Omnimaga on September 28, 2010, 12:04:38 pm
Oh thanks. Are programs the only thing that can start with FC? I wonder if they end with 0?
Title: Re: Finding / listing programs
Post by: Broseph Radson on September 28, 2010, 12:14:42 pm
Well it seems that symbols also start with FC, but the 3rd and 4th bytes of programs seems to always be 00 05

Edit: 3rd byte changes. 4th byte seems to stay 05 in all programs

EDIT: and again, im wrong. That also changes.

Ill be back later. Class is almost over
Title: Re: Finding / listing programs
Post by: DJ Omnimaga on September 28, 2010, 12:31:57 pm
Darn, that seems a bit more complicated than I think x.x

I'll have to study WikiTI for a bit, I think, if I can manage to find info on 8xp file structure there. Otherwise, I guess maybe one of the advanced ASM programmers like BrandonW, Thepenguin77 or Calc84maniac might know into in-depth details on 8xp BASIC file structure.
Title: Re: Finding / listing programs
Post by: Builderboy on September 28, 2010, 03:20:28 pm
They don't end with anything specific actually.  There is a length byte somewhere in the VAT entry for a program that tells you how long the name is, and you can calculate where it ends from there.
Title: Re: Finding / listing programs
Post by: DJ Omnimaga on September 28, 2010, 03:44:01 pm
Oh ok, but what about the entire program lenght?
Title: Re: Finding / listing programs
Post by: Builderboy on September 28, 2010, 04:28:48 pm
Oh gotcha, the program i believe is just started with the length in 2 bytes, followed by the program data and thats it, nothing at the end.
Title: Re: Finding / listing programs
Post by: thepenguin77 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.
Title: Re: Finding / listing programs
Post by: ztrumpet 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
Title: Re: Finding / listing programs
Post by: Broseph Radson 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 :'(
Title: Re: Finding / listing programs
Post by: Deep Toaster on September 28, 2010, 09:36:09 pm
Yeah, knowing a bit of ASM helps a lot, especially with vars :P
Title: Re: Finding / listing programs
Post by: DJ Omnimaga on September 28, 2010, 11:55:43 pm
Are the memory addresses the same between every single OSes, though?
Title: Re: Finding / listing programs
Post by: Builderboy 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.
Title: Re: Finding / listing programs
Post by: DJ Omnimaga 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.
Title: Re: Finding / listing programs
Post by: SirCmpwn 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.
Title: Re: Finding / listing programs
Post by: DJ Omnimaga on September 29, 2010, 12:15:45 pm
Cool! Could you post it? It might be useful to some people :)
Title: Re: Finding / listing programs
Post by: SirCmpwn on September 29, 2010, 06:08:42 pm
I need to get the darn thing off of my calc first.  Linking issues.
Title: Re: Finding / listing programs
Post by: shmibs 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
Title: Re: Finding / listing programs
Post by: SirCmpwn 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.
Title: Re: Finding / listing programs
Post by: DJ Omnimaga 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...
Title: Re: Finding / listing programs
Post by: Deep Toaster 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 :)
Title: Re: Finding / listing programs
Post by: Quigibo 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
Title: Re: Finding / listing programs
Post by: calc84maniac on September 30, 2010, 12:41:19 am
A few things I noticed:

:.Get Next Entry
:.Returns 1 if End of Vat or 0 otherwise

:Lbl VX
:P-{P-6}-6->P>={E982E}r
:Return

Should this be <=? (I actually think a simple = might suffice though)

Quote
:.Get Pointer to current entry data
:Lbl VD
:{P-4}r
:Return

I think this should be {P-4}rr, since it is stored backwards.

Quote
:.Get Pointer to current name length
:Lbl VNL
:{P-6}
:Return

This actually returns the length itself, not the pointer.
Title: Re: Finding / listing programs
Post by: DJ Omnimaga on September 30, 2010, 12:56:15 am
An example would be good. This could definitively become useful :)
Title: Re: Finding / listing programs
Post by: Broseph Radson on September 30, 2010, 09:01:29 am
Awesome thanks Quigibo! This works perfectly. I just tested it and had no errors :)
 EDIT: This is what i did:

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
:
:Lbl VI
:{E9830}r->P
:Return
:
:Lbl VNX
:P-{P-6}-7->P>={E982E}r
:Return
:
:Lbl VT
:{P}
:Return
:
:Lbl VD
:{P-4}rr
:Return
:
:Lbl VA
:{P-5}
:Return
:
:Lbl VNL
:{P-6}
:Return
:
:Lbl VN
:P-7
:Return

And it worked perfectly.

Also, since when is the 2nd+8 key "appv?" Has it always been the appvar key?
I just noticed this lol

EDIT2: Ok thats cool. It only does "appv" if you have an Axe header :D
Title: Re: Finding / listing programs
Post by: DJ Omnimaga on September 30, 2010, 09:16:26 am
Yeah that "v" token was changed to "appv" because there is already another lowercase "v" token available when lowercases are enabled. I wonder why TI used two different tokens for the exact same symbol x.x.

The new token names were implemented in version 0.3.0 I think. I was not a big fan of them at first because I thought QUigibo would just plain rename every existing commands, confusing those who have been used to the old syntax for a while, but finally only 3 or 4 old commands were renamed and all new tokens names added later were used only for new Axe commands/symbols/modifiers, so for now, the only issue I had was finding some in the CATALOG menu because they no longer show in alphabetical order.
Title: Re: Finding / listing programs
Post by: Broseph Radson on September 30, 2010, 09:17:49 am
Yeah i also noticed that with an Axe header, the lowercase "u" token is "var" and the lowercase "w" token is "grp"

Ossim!
Title: Re: Finding / listing programs
Post by: DJ Omnimaga on September 30, 2010, 09:32:20 am
Yeah those were changed a bit later. It is mostly for readability, as using w for group prefixes for example would confuse people and make it hard to remember the syntax. In fact, weird syntax and cryptic names are something that turns me off from z80 assembly source x.x
Title: Re: Finding / listing programs
Post by: Broseph Radson on September 30, 2010, 09:34:50 am
Well that is pretty darn cool
Title: Re: Finding / listing programs
Post by: DJ Omnimaga on September 30, 2010, 05:18:09 pm
Yeah. At first I did not realize this could be possible, but then I remembered the Français APP that translated all calc menus in French. For brand new commands, since whenever there's an Axe header at the top of the program the new tokens are enabled, it makes code much easier to read. RectI() looks MUCH more like a rectangle drawing command than rref(), for example.
Title: Re: Finding / listing programs
Post by: SirCmpwn on September 30, 2010, 05:18:55 pm
Nice, Quigibo!
Title: Re: Finding / listing programs
Post by: ztrumpet on September 30, 2010, 07:13:02 pm
Nice job! ;D
I can't wait for that example. :)
Title: Re: Finding / listing programs
Post by: Quigibo on September 30, 2010, 10:35:41 pm
The example was already edited in :)
Title: Re: Finding / listing programs
Post by: ztrumpet on October 01, 2010, 05:48:51 pm
Ah, I see. :) * ZTrumpet feeds himself to the lobster

The example looks cool. :D  Thanks.
Title: Re: Finding / listing programs
Post by: nemo on October 06, 2010, 07:06:53 pm
i have a question with quigibo's routine. how do you retrieve the length of the data of a vat entry? subtracting two pointers to the vat entries themselves doesn't work, and neither does subtracting the pointers to their data. suggestions?
Title: Re: Finding / listing programs
Post by: Deep Toaster on October 06, 2010, 07:13:17 pm
The "pointer to the data" in the VAT entry actually points to the two bytes containing the size of the data. Just store that as a two-byte number.
Title: Re: Finding / listing programs
Post by: nemo on October 07, 2010, 07:49:17 pm
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?
Title: Re: Finding / listing programs
Post by: Deep Toaster 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
Title: Re: Finding / listing programs
Post by: ACagliano 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
Title: Re: Finding / listing programs
Post by: Aichi on October 16, 2010, 04:29:47 pm
Could anyone tell me how to move the pointer back by one entry in the VAT?
Title: Re: Finding / listing programs
Post by: Deep Toaster 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 (http://future_history.freehostia.com/Files/Resources/ASM/ASMin28Days/lesson/day21.html)'s a page that tells you how the VAT basically works.
Title: Re: Finding / listing programs
Post by: Runer112 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 (http://future_history.freehostia.com/Files/Resources/ASM/ASMin28Days/lesson/day21.html)'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.
Title: Re: Finding / listing programs
Post by: Quigibo 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.
Title: Re: Finding / listing programs
Post by: Runer112 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!
Title: Re: Finding / listing programs
Post by: Quigibo 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.
Title: Re: Finding / listing programs
Post by: Runer112 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 ;)
Title: Re: Finding / listing programs
Post by: Deep Toaster 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 :-\
Title: Re: Finding / listing programs
Post by: Binder News 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.
Title: Re: Finding / listing programs
Post by: ztrumpet 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
Title: Re: Finding / listing programs
Post by: DJ Omnimaga 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)
Title: Re: Finding / listing programs
Post by: Binder News 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.
Title: Re: Finding / listing programs
Post by: DJ Omnimaga 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.
Title: Re: Finding / listing programs
Post by: Binder News on October 27, 2010, 07:58:08 pm
I shall post a link there to this topic so that the progress of this idea can easily be viewed.
Title: Re: Finding / listing programs
Post by: DJ Omnimaga on October 27, 2010, 11:27:44 pm
On an-off-topic note, is the Hexpic program in your signature an updated version of the one that comes with Axe Parser? (It was written in TI-BASIC)
Title: Re: Finding / listing programs
Post by: Binder News on October 28, 2010, 09:27:24 am
Yes it is. It is written in Axe, and so is much faster. WARNING: If it cannot access Str1, it can crash. I have made some updates, but just haven't uploaded them yet.
Title: Re: Finding / listing programs
Post by: DJ Omnimaga on October 28, 2010, 06:30:02 pm
Ah cool, maybe it could eventually be included with Axe?
Title: Re: Finding / listing programs
Post by: Quigibo on October 29, 2010, 12:35:16 am
I don't like using the alphabetical sorting BCALLs.  I used to use them in early versions of Axe and it made the list populate extremely slowly when there are a lot of programs on the calculator becasue it has to sort the entire VAT up to the n-th item for each call you make.  What Axe does now is sort the entire VAT only once when the program starts and then pass through the list sequentially.  The actual code to move to the next entry is about the same size as the BCALL anyway so I might as well just go with a faster solution.

After thinking about it for a while, I realized the entire scanner could be a single routine:

Code: [Select]
Vat(P)

Takes one argument:
If the argument is zero, it returns a pointer to the first entry in the vat.
If the argument is a pointer, returns the next vat entry after the pointer.
If there are no more entries after the pointer, returns 0 (end of VAT).

Not sure if a command like this would actually be that useful though, its still confusing to read the entry since they have backwards names and a specific order of the byte fields.  I'd rather not have to add 5 other commands to read all the fields either, it seems more like something a library routine should do instead of a built-in feature.
Title: Re: Finding / listing programs
Post by: Binder News on October 29, 2010, 02:07:06 pm
That's why I said you should use the bcall. If someone really wants to use it, they can. Otherwise, they don't. I was fooling around a little with ASM last night at 11pm and I think it wouldn't be too hard to do. (I just don't know how yet). Anyways, Axioms are temporarily disabled, remember?

Finally, you are absolutely welcome to include my version of Hexpic with Axe. (I would like some credit, but you don't have to). The current version (which I will upload later) has full inversion and horizontal and vertical shifts, as well as the other stuff. It does not let you load, but oh, well.

EDIT: New Hexpic uploaded. See my signature.
Title: Re: Finding / listing programs
Post by: DJ Omnimaga on October 29, 2010, 08:46:26 pm
Well, it's Quigibo application, so he is free to add whatever function he wants, really. If other people also want this added, maybe he will eventually add it or someone will write an ASM hex code to use it in the Routines topic.

I will try your hexpic later.
Title: Re: Finding / listing programs
Post by: AngelFish on November 30, 2010, 01:15:22 pm
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.

<snip>


Quigibo, are you sure that {E9830} is the start of the VAT? That routine is returning all of the correct programs, but also a few programs that don't exist such as #, %FLDn, and %FLDu.
Title: Re: Finding / listing programs
Post by: JosJuice on November 30, 2010, 01:19:54 pm
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.

<snip>


Quigibo, are you sure that {E9830} is the start of the VAT? That routine is returning all of the correct programs, but also a few programs that don't exist such as #, %FLDn, and %FLDu.

Those programs are stored as actual programs in the VAT, but a normal user can't see them.
Title: Re: Finding / listing programs
Post by: AngelFish on November 30, 2010, 01:20:38 pm
What are they, then? OS programs?
Title: Re: Finding / listing programs
Post by: calc84maniac on November 30, 2010, 01:32:48 pm
# and ! are the last entry and the current entry, respectively. %FLD programs are DoorsCS folders.
Title: Re: Finding / listing programs
Post by: aeTIos on November 30, 2010, 01:38:48 pm
what is this for in the example:

Code: [Select]
Disp i
is it the [2nd][.] 'i'?
Title: Re: Finding / listing programs
Post by: AngelFish on November 30, 2010, 01:41:15 pm
# and ! are the last entry and the current entry, respectively. %FLD programs are DoorsCS folders.

Oh...
Title: Re: Finding / listing programs
Post by: calc84maniac on November 30, 2010, 01:41:19 pm
what is this for in the example:

Code: [Select]
Disp i
is it the [2nd][.] 'i'?

Yep, it displays a newline
Title: Re: Finding / listing programs
Post by: aeTIos on November 30, 2010, 01:42:08 pm
ah, okay
I knew it displayed a newline, though, but i didnt know what token it was
Title: Re: Finding / listing programs
Post by: nemo on November 30, 2010, 04:16:09 pm
by the way qwerty, don't archive # or !. not a good idea. lost my archive by doing that.
Title: Re: Finding / listing programs
Post by: AngelFish on November 30, 2010, 06:34:47 pm
I wasn't planning on it, but good to know.
Title: Re: Finding / listing programs
Post by: DJ Omnimaga on December 01, 2010, 05:01:09 am
by the way qwerty, don't archive # or !. not a good idea. lost my archive by doing that.
I suspect that this might have been something like that that was involved in Illusiat 2002 incident. Mirage most likely messed up and when I pressed keys it archived one of those x.x.

Hiding them also causes issues, although not as bad as archiving them.
Title: Re: Finding / listing programs
Post by: ACagliano on August 31, 2011, 05:20:23 pm
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


I'm trying to do these in z80. Is this right so far?

Code: [Select]
GetCurrentNameLength: ;length in a
ld bc, 6
sbc hl, bc
ld a, (hl)
pop hl         ;hl was pushed as the start of the current entry.
ret

GetCurrentName: ;name in AppBackupScreen
ld bc, 6
sbc hl, bc
ld a, (hl)
dec hl
ld de, AppBackupScreen
NameLoop:
ld (de), (hl)
inc de
dec hl
dec a
jr nz, NameLoop
ld (hl), 0
Title: Re: Finding / listing programs
Post by: Quigibo on August 31, 2011, 07:47:59 pm
This thread is really out of date.  Axe now comes with the Memkit Axiom (z80 source included, you should check that out) which handles all this stuff for you.

As far as your assembly; ld (de),(hl) is not a real instruction.  You're going to have to use the 'a' register as an intermediate; ld a,(hl) \ ld (de),a which means your loop counter will have to change as well, you can use b for that which gives a you the djnz optimization as well.  But yeah, here's the current routine for copying the name in Memkit:

Code: [Select]
;Input: hl = Pointer to vat entry
;       de = Pointer to string buffer
GetName:
 ld    bc,-6
 add   hl,bc
 ld    b,(hl)
 ex    de,hl
Loop:
 dec   de
 ld    a,(de)
 ld    (hl),a
 inc   hl
 djnz  Loop
 ld    (hl),b
 ret