Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: scottywz on September 30, 2010, 11:38:02 pm

Title: Custom lists
Post by: scottywz on September 30, 2010, 11:38:02 pm
I'm trying to save a return code to a one element list with a custom name in a subroutine that's called right before exiting.  Simply using GetCalc("LAVLIB",1) doesn't seem to do anything, so I've been manually coding the token name (thanks to the 83+ SDK docs).  [01]"LAVLIB" (coded using Data() and the transpose symbol with a null byte at the end) screws up the symbol table and crashes the calculator, but [015D]"AVLIB" works--the first time. Then I get "ERR:SYNTAX".

Deleting it first didn't seem to work until I added an extra null byte to the end, and even then it acts weird:  it works the first time, then ERR:SYNTAX (but the list got deleted), and then it works again, then it just saves 0 to the only element (even though the correct value, 2, is displayed).

But what's really strange is starting the 4th time(?), as I run it over and over, the free RAM displayed in the Memory menu goes UP, even with the same result, but the list gives an ERR:MEMORY when I try to open it.  Calcsys shows a size of 2080.

This is the code that I'm using:
Code: [Select]
Lbl RET
 Disp r1>Dec
 [015D]->Str0RV
 "AVLIB"
 [00]
 DelVar Srt0RV
 [015D]->Str1RV
 "AVLIB"
 GetCalc(Str1RV,1)->Z
 If Z
  r1->float{Z}
 End
Return

I tried adding the extra null byte when I made the new list and the first time that will work (as in the List menu loads right), but the second time the List menu looks like this:
Code: [Select]
NAMES OPS MATH
1:L1
2:
3:!



and then it's not too hard to do a RAM clear :)

Is this an Axe bug or my error?
Title: Re: Custom lists
Post by: ztrumpet on September 30, 2010, 11:41:58 pm
This is what Asm in 28 days has to say about how lists are structured:
Quote
Lists
Spelled with object type (ListObj or CListObj), followed by token tVarLst, and either:
    * A list name token and a null. or
    * Up to five tokens and a null.

OP1     +1     +2     +3     +4     +5     +6     +7     +8     
RealObj     tVarLst     tL1     $00     ??     ??     ??     ??     ??     List L1
CListObj     tVarLst     tD     tI     tS     tT     $00     ??     ??     Complex list LDIST

I hope you can get the code working soon. :)  Good luck! ;D
Welcome to Omnimaga, by the way. :)
Title: Re: Custom lists
Post by: scottywz on October 01, 2010, 12:34:59 am
Well the SDK docs said the same thing and my code seems to be using the format correctly (save for the extra null when deleting the variable).  Tried removing the extra null and the variable won't delete.

I hope you can get the code working soon. :)  Good luck! ;D
Welcome to Omnimaga, by the way. :)
Thank you! :)

Edit:  Using L1 ([015D0000]) works twice without a syntax error, then starts writing the wrong value, and then a memory error after around 6-8 times, just like the custom name.
Title: Re: Custom lists
Post by: Runer112 on October 01, 2010, 08:37:56 am
Enjoy :)

Code: [Select]
Lbl RET
 Disp r₁►Dec
 [015D]→Str1RV
 "AVLIB"
 [00]
 If GetCalc(Str1RV,9)→Z
  1→{Z-2}ʳ
  r₁→float{Z}
 End
Return
Title: Re: Custom lists
Post by: DJ Omnimaga on October 01, 2010, 09:36:07 am
Oh hi and welcome here scottywz. :)

I'll need to study this code for a bit I think because I don't get most parts of it, especially what [015D]->Str1RV is for.
Title: Re: Custom lists
Post by: scottywz on October 01, 2010, 11:13:55 am
Thanks Runer12, that worked.

[015D] is ListObj and the list token because Axe Parser won't insert ListObj otherwise (this wasn't in the documentation I think), and typing the list token didn't work.  Str1RV ended up being redundant because I was trying different things trying to get it to work.
Title: Re: Custom lists
Post by: DJ Omnimaga on October 01, 2010, 05:17:12 pm
Ah ok. I noticed that certain tokens in particular won't get parsed correctly in Axe. For example, I typed the Omnimaga logo made of the greek calculator characters a while ago and used Disp, and after parsing, when I tried the program, certain did not show up properly. I think it had to do with the fact some were 2-byte tokens, though.