0 Members and 1 Guest are viewing this topic.
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"->Str2GetCalc(Str1)->P{P-2}r->LGetCalc(Str2,L)->VCopy(P,V,L)DelVar P[# of bytes to add]->AGetCalc(Str1,L+A)->PCopy(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→AThen 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}→AThen 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→ATo put it together:Code: (Axe) [Select]:A-6→A-{A}-1→AFor more info, here'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.
.Get Previous Entry.Returns 1 if start of VAT or 0 otherwiseLbl VPVP+1→PWhile {P+1→P}≥8+({P+2}≤ᴇ40)EndP+6→P={ᴇ9830}Return
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 DAHOptimized version of Repeat {P+1→P}≤8 and {P+2}≥ᴇ40Move forward 6 bytes to start of entry and signal if at start of VAT
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.