Omnimaga
Calculator Community => Major Community Projects => The Axe Parser Project => Topic started by: aeTIos on December 09, 2010, 03:29:35 pm
-
Hi, its not about making sources for Axe, but about making programs with Axe.
I know how to create a program:
GetCalc("prgmAAAA",1000)->P
But how do I fill it with tokens???
NOTE: something like
"Disp"->{P}
does not work :/
anyone help me out???
Thanks!
btw it is for a program in the very future for ppl that dont know how to program to let them easy make programs, and just for my knowledge (and others too)
Edit:
I found that this works a little:
{8} (or any value between 0 and 65535) ->{P}
I guess it has something to do with RAM addresses?
-
this table (http://tibasicdev.wikidot.com/one-byte-tokens) will help you greatly.
Copy([656667686970717273747576777879808182838485868788899091],P,26)
^should copy the alphabet into whatever's at P.
-
Yay, nice!
-
oh, or you could do this: TDisp->{P}
-
I suggest when your program is finished, you take the number of bytes you used (as n) and do this n->{P-2}r
I have never had negative effect with this.
-
I suggest when your program is finished, you take the number of bytes you used (as n) and do this n->{P-2}r
I have never had negative effect with this.
That is exceedingly dangerous if your program grows in size from when you first created it, it can overwrite other things in RAM, including your source if you have it unarchived
-
oh crap, nevermind.
I am going off to change some programs.
-
so basically Axe can write to Programs now? :D
yeah, I haven't been following the discussion that much. XD
-
Yeah I am confused, are you trying to create a program editor?
-
oh, or you could do this: TDisp->{P}
Yep, for tokens just use T.
You can store an array of tokens to use, like
Data(TIf ,TThen,TElse,TFor(,TWhile ,TRepeat ...
Might be hard to use, though.
-
That works? That would be cool if it did. It makes it easier to store tokens without having to grab the hex value if it works.
-
I believe it works, and its pretty useful :D I have been using Hex equivalents in programs like my optimizer and my small font editor x.x and its a pain
-
so basically Axe can write to Programs now? :D
yeah, I haven't been following the discussion that much. XD
I think Axe has been able to write programs as long that it has the getCalc( command
Yeah I am confused, are you trying to create a program editor?
maybe a little bit, but I wanted to know it too, just for Axe knowledge
Edit: how to add quotes in the programs???
-
no, When I asked a long time ago, people said it can read but not write to other programs.
-
oh. nevermind, Axe can handle them now, so be happy! (like me, its my 15th birthday!! :w00t: )
-
oh. nevermind, Axe can handle them now, so be happy! (like me, its my 15th birthday!! :w00t: )
Congratulations, you keep on telling that to everybody xD
-
Happy birthdfay! have a big slice of CAKE: (http://technabob.com/blog/wp-content/uploads/2008/06/f034yq8ff7ihf10medium.jpg)
anyway, so the {^T} is the token prefix? then how would you add something like "A+1->A"?
-
using a string then copy
i want to know how to add quotes ( " [alpha][ +] ) and sto> symbol
-
All the tokens are listed here: http://tibasicdev.wikidot.com/tokens
You'll have to store the hex yourself, though.
-
All the tokens are listed here: http://tibasicdev.wikidot.com/tokens
You'll have to store the hex yourself, though.
I would use this token file:
http://brandonw.net/calcstuff/ti83plus.txt (http://brandonw.net/calcstuff/ti83plus.txt)
-
i wont use a token file :P
in axe, you can store tokens using T(token here)-> {location of token}
so, in case of an quote it woud be T" -> {P+2}
Edit:
yay, finally got a very simple Basic program working!
code:
Getcalc("prgmTEST",20)->P
[suprscrpt] T [/supr]Disp->{P}
[sup]T[/sup]"->{P+1}
"I"->Str1
Copy(Str1,P+2,3)
[sup]T[sup]"->{P+3}
It just displays an I on the homescreen, but it works!!
Yay, i discovered something really cool!! :w00t:
Comments?
Post!
-
Optimized:
GetCalc("prgmTest",4)->P
tDisp->{P
t"->{P+1
"I"->Str1
Copy(Str1,P+2,3
t"->{P+3
[code]
just some brackets + the program is only 4 bytes, not 20 (name excluded)
[/code]
-
Copy(Data(tDisp,t",'I',t")),GetCalc("prgmTEST",4),4)
-
O.O thats a much optimizing, nemo!
-
Lol nice, I didn't knew Getcalc could be used that way. ;D
-
I wouldn't recommend using it that way because the routine can fail. If there were not enough memory to create the program, the pointer would be null and trying to copy data to the zero address would result in a crash.
-
ah, okay. so not copy(A,getcalc(""prgmB",8)
but
Getcalc("prgmB",8)->P
check for enough ram
copy(data to program
am I right??
-
Yeah, something like that. But I'm really only talking about for a 'public' release. The odds of having less than 15ish bytes left on your calculator is probably very rare. Any triple digit of bytes is rare for me at least. If you're just doing this to quickly test out the features or to generate a file like from a map editor then you really don't need the error checking since you're aware of the problem and know how to avoid it. Its only if other people use your program that you would want to check for errors.
-
^thats clear.
is there any way for easier storing tokens into strings??
like
Data(tDisp t")->str1
"I"->str1+2
Data(t")->str1+3
copy(str1,P,length(str1)
does this work?
-
The easiest way *not available until the next version* is to absorb them directly into the program.
Recall that when you have a title screen that takes up the whole screen, you don't want to have to type out the entire 1536 hex characters:
[123ABC...]
Instead, you can absorb an OS picture into the program simply by doing this:
[Pic1]
The same thing applies for tokens. If you want a string of tokens, then instead of doing:
Data(t1,t2,t3,tA,tB,tC,...)
You can do any of these:
[Ans]
[Str1]
[prgmABC]
[appvABC]
And the data will be directly absorbed into the program, depending on where you have your tokens stored (The one with Ans is kinda volatile, I wouldn't recommend that). To find the length of some data of unknown size, you can't use length() because its not necessarily zero terminated, and you shouldn't use it anyway since its a slow routine and you already know the pointers are static. Instead you can just subtract the start from the end of the data pointer.
:[Str1]->Str1
:[]->Str1E
:Copy(Str1,L1,Str1E-Str1)
-
wow thats nice, cant wait until next version!
-
The easiest way *not available until the next version* is to absorb them directly into the program.
Recall that when you have a title screen that takes up the whole screen, you don't want to have to type out the entire 1536 hex characters:
[123ABC...]
Instead, you can absorb an OS picture into the program simply by doing this:
[Pic1]
The same thing applies for tokens. If you want a string of tokens, then instead of doing:
Data(t1,t2,t3,tA,tB,tC,...)
You can do any of these:
[Ans]
[Str1]
[prgmABC]
[appvABC]
And the data will be directly absorbed into the program, depending on where you have your tokens stored (The one with Ans is kinda volatile, I wouldn't recommend that). To find the length of some data of unknown size, you can't use length() because its not necessarily zero terminated, and you shouldn't use it anyway since its a slow routine and you already know the pointers are static. Instead you can just subtract the start from the end of the data pointer.
:[Str1]->Str1
:[]->Str1E
:Copy(Str1,L1,Str1E-Str1)
That will be great in Sprite Editors which give us the HEX code in Str1, we will then absorb it and save it as a program-variable.
-
Does Str1E-Str1 optimize to the actual number of bytes?
-
I was considering doing this a while ago, but I had to delete everything off my calc. Irritating test, and when i got back home my computer crashed and has yet to be fixed, and I had to find number values for everything, and unfortunately no one at my school has Axe :'(
-
Yeah, something like that. But I'm really only talking about for a 'public' release. The odds of having less than 15ish bytes left on your calculator is probably very rare. Any triple digit of bytes is rare for me at least. If you're just doing this to quickly test out the features or to generate a file like from a map editor then you really don't need the error checking since you're aware of the problem and know how to avoid it. Its only if other people use your program that you would want to check for errors.
Ah, right, what if the programmer checks how much RAM is left prior the game execution and exit if it's too low, though?
-
yeah i didn't include error checking because i would hope that people have at least 10 bytes to spare on their calculator. that is neat though, absorbing other variables directly into your program. why are you taking it out next version?