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.
Offset: -14 - -7 -6 -5 -4 -3 -2 -1 0
Item: name name length page addr high addr low version reserved type
I need to get the darn thing off of my calc first. Linking issues.
: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
:.Get Next Entry
:.Returns 1 if End of Vat or 0 otherwise
:Lbl VX
:P-{P-6}-6->P>={E982E}r
:Return
:.Get Pointer to current entry data
:Lbl VD
:{P-4}r
:Return
:.Get Pointer to current name length
:Lbl VNL
:{P-6}
:Return
: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
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?
"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
:.A is currently at the first byte of the VAT entry
:A-6→A
:.A points to a value that tells you how long the rest of the VAT entry is
:A-{A}→A
:.A is at the end of the VAT entry
:A-1→A
:A-6→A-{A}-1→A
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.
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.
Code: [Select] .Get Previous Entry | Code: (Explanation of what the hell I'm doing) [Select]
|
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.
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.
Vat(P)
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>
Those programs are stored as actual programs in the VAT, but a normal user can't see them.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.
Disp i
is it the [2nd][.] 'i'?# and ! are the last entry and the current entry, respectively. %FLD programs are DoorsCS folders.
what is this for in the example:Yep, it displays a newlineCode: [Select]Disp i
is it the [2nd][.] 'i'?
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.
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
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
;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