Join us on Discord!
You can help CodeWalrus stay online by donating here.

I need help with Axe Parser [Can I Axe you a question?]

Started by CKH4, January 06, 2015, 09:49:36 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

alexgt

Would the appVar still hold the data you gave it even after you did GetCalc("appVarTEST",20)->A where the appVar already exists !?
  • Calculators owned: Ti-84+, Ti-Nspire, Hp Prime, Broken HP Prime, HP 48SX

CKH4

I believe so but I really have no idea. A should just be a pointer to that appvar if I'm not mistaken.
  • Calculators owned: TI-83+, TI-84+


Snektron

Try it :) though you can simply test if it exists with

!If GetCalc("appVarTEST")->A           .Test if "appVarTEST" exists. It will ut the pointer in A, and x->A returns A, so if A is zero
  GetCalc("appVarTEST",20)->A       .It creates "appVarTEST" and punts the pointer in A
End

With this code the pointer will always be in A, whether it exists or not :)
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


alexgt

Ahh ok, I was asking because I wanted to save data with Jarvis and I didn't know if it was like a buffer where it cleared it all like this:
Buffer(20)->A
Thanks :)
  • Calculators owned: Ti-84+, Ti-Nspire, Hp Prime, Broken HP Prime, HP 48SX

CKH4

How do I get the hex from an 8x8 sprite on the screen?
  • Calculators owned: TI-83+, TI-84+


Snektron

oh that'll be interesting... since you need to copy every pixel seperately to a 8 byte data section...
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


CKH4

My initial thought would be to use pt-get and then read off the binary to convert to hex.
  • Calculators owned: TI-83+, TI-84+


Snektron

Yeah it would be easier if axe had a bit-shift function :/ ...
Wait it has one, just multiply it with 2...

ok i've done some research and i've come up with this little routine:

Lbl GetSprite
  For(r4,r2,r2+7)
    For(r5,r1,r1+7)
     {r3}*2+pxl-Test(r5,r4)->{r3}
    End
    r3++
  End
Return

now you can use it like this:

GetSprite(x coord, y coord, data address to copy to)

i've used r4 and r5 as data storage so it won't violate random variables :)
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Duke "Tape" Eiyeron

bit-shift function? *2, *4, *8... They're hevaily optimized.
  • Calculators owned: A lot.

Snektron

  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


alexgt

How can you store values past 65535 in Axe? This is for a calculator I plan to put on Jarvis if that helps :)
  • Calculators owned: Ti-84+, Ti-Nspire, Hp Prime, Broken HP Prime, HP 48SX

Snektron

#71
Well, that's a problem: you can't.
this is because the z80 (processor in your calculator) can only handle 16 bit values - and 2^16 is 65536...
"Well, how does the OS handle math then? i can clearly enter values like '100000000' and such?" you might ask.
The TI os uses floating point math which is softwarematically implemented - basically the basic parser.
im not entirely sure why axe doesn't have this, but it's most likely because it wants to use the least amount of BCALL's as possible.
(BCALL's are asm subroutines created by TI. The problem is they are often slow and make axe programs less portable (though they are not really
portable, i mean you can't just put axe asm on KnightOS or something.))
now if you want, i can create a quick axiom that allows you to run string in basic, or you can even make it yourself with the Run Axiom like this:

.assuming the expression is in L1, terminated with a zero
DelVar "prgmπ" .some name that isnt creatable by the editor, so it wont delete programs created by the user
GetCalc("prgmπ", length(L1))->P
Copy(L1, P, length(P))
Run("prgmπ")
DelVar "prgmπ"  . delete it to keep the ram clean

IIRC you can also use tmp instead of prgm, but i don't really know if that works. Also note that this is untested code
Also note that every code will work, even things like "for(I,0,10):Disp I:End:Pause". The result will be
put in ans and an error will be displayed like a normal basic error, but i after that it will continue execution of your axe code (it wont jump to the OS)
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


alexgt

Cool I can use that but for ease of use you could develop an Axiom for later use but no rush I can use the RUN Axiom. Thanks :).
  • Calculators owned: Ti-84+, Ti-Nspire, Hp Prime, Broken HP Prime, HP 48SX

Snektron

Well if i made an axiom it would basically be the same thing.
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


CKH4

#74
Quote from: Cumred_Snektron on March 26, 2015, 02:51:52 PM
Yeah it would be easier if axe had a bit-shift function :/ ...
Wait it has one, just multiply it with 2...

ok i've done some research and i've come up with this little routine:

Lbl GetSprite
  For(r4,r2,r2+7)
    For(r5,r1,r1+7)
     {r3}*2+pxl-Test(r5,r4)->{r3}
    End
    r3++
  End
Return

now you can use it like this:

GetSprite(x coord, y coord, data address to copy to)

i've used r4 and r5 as data storage so it won't violate random variables :)
I can't get this to work. What variable will the binary be stored to? The hex in A ( the variable that I'm using ) just counts up by 8 in hex.
  • Calculators owned: TI-83+, TI-84+


Powered by EzPortal