CodeWalrus

Development => Calculators => Calculator News, Coding, Help & Talk => Topic started by: CKH4 on January 06, 2015, 09:49:36 PM

Title: I need help with Axe Parser [Can I Axe you a question?]
Post by: CKH4 on January 06, 2015, 09:49:36 PM
So I'm trying to learn buffers for 8lvl grayscale. I got 4 level working with the main buffer, L1 and L3.

If anyone knows about buffers and stuff I would really appreciate your help.

Edit.
I got laggy 6lvl working on L1 thru L4. Then the calc crashed when I went to exit. (it was wabbitemu so it's all good)
Title: Re: I need help with Axe Parser
Post by: pimathbrainiac on January 06, 2015, 11:55:07 PM
/me points here: http://www.omnimaga.org/ti-z80-calculator-projects/g8lib-8-level-grayscale-lib-for-axe!

As for buffers, they're basically like malloc() in c.
Title: Re: I need help with Axe Parser
Post by: CKH4 on January 07, 2015, 01:44:47 AM
Ok thanks. I'd use that but I'm looking for a solution not based for pictures. I'm just using rect( right now.

Edit.
Is there a reason why it crashes?
Title: Re: I need help with Axe Parser
Post by: CKH4 on January 08, 2015, 03:28:53 PM
Does anyone know how to loop the edges of the screen so that stuff drawn off the screen is shown on the other side?
Title: Re: I need help with Axe Parser
Post by: aetios on January 08, 2015, 03:44:00 PM
That's not supported in Axe. You'll need to write your own routine for this,
Something like this might work:

pt-on(x,y,[sprite])
if x>88
  pt-on(x-96,y,[sprite])
end

Modify the code as needed for the other side of the screen.
Title: Re: I need help with Axe Parser
Post by: CKH4 on January 08, 2015, 03:45:15 PM
Thanks, that's exactly what I'm looking for.
Title: Re: I need help with Axe Parser
Post by: aetios on January 08, 2015, 03:51:34 PM
No problem, glad I could help :D Note that this will slow down slightly when you are drawing on the sides. If you want constant (and precise) performance, you should remove the if condition and draw the extra sprite regardless of whether or not it is on screen, but generally this shouldn't be needed.
Title: Re: I need help with Axe Parser
Post by: CKH4 on January 08, 2015, 05:06:54 PM
I've also noticed that I need a line somewhere else to reset the coordinate.

Edit.
Ugh. I'm doing 4-lvl grayscale as well, so much typing to do.
Title: Re: I need help with Axe Parser
Post by: Snektron on January 08, 2015, 05:26:35 PM
Quote from: CKH4 on January 08, 2015, 05:06:54 PM
Ugh. I'm doing 4-lvl grayscale as well, so much typing to do.
why not use the default 4-lvl grayscale?
Title: Re: I need help with Axe Parser
Post by: CKH4 on January 08, 2015, 05:27:15 PM
How do I do that?
Title: Re: I need help with Axe Parser
Post by: Duke "Tape" Eiyeron on January 08, 2015, 05:28:46 PM
DispGrah^r^r (^r is the radian r)
Title: Re: I need help with Axe Parser
Post by: CKH4 on January 08, 2015, 05:31:12 PM
Ok, but how does that affect screen looping? Also isn't that also only 3lvl? I'm going to try to use for( loops to simplify it for now instead of typing 12 pt-off(.
Title: Re: I need help with Axe Parser
Post by: Snektron on January 08, 2015, 05:35:28 PM

:ClrDraw^rr .clear both buffers
:Pxl-On(x,y) .dark gray
:Pxl-On(x,y)^r .light gray, use both for black
:DispGraph^rr .draw buffers in 4 level grayscale

Title: Re: I need help with Axe Parser
Post by: Duke "Tape" Eiyeron on January 08, 2015, 05:36:02 PM
You have to refresh fastly enough the screen to make the grauscale correct. DisppGraph^r yields a 3-gray render and ^r^r 5)4.
Title: Re: I need help with Axe Parser
Post by: CKH4 on January 08, 2015, 05:45:47 PM
Yeah, I'm using the main buffer, L1 and L2. When I used dispgraph^r^r it was only 3lvl and when I used dispgraph^r it just overlaid them.
Title: Re: I need help with Axe Parser
Post by: Snektron on January 08, 2015, 05:59:44 PM
Error on what command?
EDIT: Oh you removed it...
Scroll along sir... nuffin to see here
Title: Re: I need help with Axe Parser
Post by: TIfanx1999 on January 08, 2015, 11:49:24 PM
It's worth mentioning that even in asm, 8lvl gray doesn't look that great on calc. Some of the grays end up looking really similar. The other problem is that the hardware is inconsistent. Even if you get decent gray on your calc, it might look really bad on someone elses. I'd recommend sticking to 3 or 4 level personally.
Title: Re: I need help with Axe Parser
Post by: Dream of Omnimaga on January 09, 2015, 12:15:05 AM
Plus on the regular 83+ calcs, the contrast is so bad that only about 6 of the shades of gray will be visible at all. If you set the contrast low enough to be able to distinguish dark gray from black, then light gray will become white and vice-versa. It's generally best to stick to 3 or 4 level (4 level being the most supported since sprite design is much easier with it)
Title: Re: I need help with Axe Parser
Post by: Snektron on January 09, 2015, 12:18:34 AM
Actually today i did some experiments with shade()
grayscale and could possibly display a reasonable 6+ level
gray (probably bad for your calc though)
Title: Re: I need help with Axe Parser
Post by: Dream of Omnimaga on January 09, 2015, 01:45:07 AM
Grayscale is not bad for the calc. It just eats batteries faster in some cases (I think it's worse in hybrid BASIC or in older grayscale libs, probably because they are less optimized and more resource-demanding. 6 level would definitively be feasible, although I wonder how sprite data would be stored? How much larger would it get compared to standard 3, 4 and 8 level grayscale sprite data (3-4 uses two layers and 8 three)
Title: Re: I need help with Axe Parser
Post by: CKH4 on January 09, 2015, 02:44:01 AM
I'm considering 8lvl grayscale by displaying different buffers for different lengths of time so that you get faster higher quality grayscale. You'd put stuff that you'd want to display the lightest on the main buffer and darker on each buffer used after. Each buffer would be assigned a numerical value so that you know what buffers to combine to make certain shades of gray. Is this even a possibility? I'll try it tomorrow to see if it works.

I'm taking what I know to make a grayscale pong game, I'll post my progress when I'm done. How do you display a variable as the characters instead of the gibberish?
Title: Re: I need help with Axe Parser
Post by: Hayleia on January 09, 2015, 05:34:49 AM
Quote from: CKH4 on January 09, 2015, 02:44:01 AM
How do you display a variable as the characters instead of the gibberish?
You can read the Commands.html file included in the zip with Axe. You'll see that you need to use ▶Dec.
Title: Re: I need help with Axe Parser
Post by: Snektron on January 09, 2015, 06:35:11 AM
Quote from: Hayleia on January 09, 2015, 05:34:49 AM
Quote from: CKH4 on January 09, 2015, 02:44:01 AM
How do you display a variable as the characters instead of the gibberish?
You can read the Commands.html file included in the zip with Axe. You'll see that you need to use ▶Dec.
▶Char *
Title: Re: I need help with Axe Parser
Post by: CKH4 on January 09, 2015, 12:29:58 PM
Thanks.
Title: Re: I need help with Axe Parser
Post by: Dream of Omnimaga on January 09, 2015, 03:51:41 PM
Quote from: Hayleia on January 09, 2015, 05:34:49 AM
Quote from: CKH4 on January 09, 2015, 02:44:01 AM
How do you display a variable as the characters instead of the gibberish?
You can read the Commands.html file included in the zip with Axe. You'll see that you need to use ▶Dec.
An Hayleia draws near! *.*


But yeah, when you download Axe it comes with full documentation as well as some optimization tricks (although I don't remember if it's up to date). There is also an instruction manual that isn't up to date but still gets the basics done. Otherwise, this list can be helpful http://www.omnimaga.org/axe-language/specific-tutorials-list-%28axe%29/ (assuming the links aren't broken) . I think there was also an Axe commands list available online, but I don't remember the exact URL.

EDIT found it: http://axe.eeems.ca/Commands.html

EDIT: Edit-ninja'd by next two posts x.x

Of course feel free to ask help if you still need any, as some people might know Axe. :)
Title: Re: I need help with Axe Parser
Post by: Snektron on January 09, 2015, 03:53:12 PM
*points to http://axe.eeems.ca/Commands.html*
Title: Re: I need help with Axe Parser
Post by: CKH4 on January 09, 2015, 03:55:14 PM
http://axe.eeems.ca/Commands.html (http://axe.eeems.ca/Commands.html)
I looked but when I used it it didn't seem to work, I finally realized that it was being drawn over by something else.

Edit.
Ugh, you beat me by like 2 seconds.
Also thanks for that tutorial link.
Title: Re: I need help with Axe Parser
Post by: TIfanx1999 on January 09, 2015, 09:49:43 PM
Quote from: CKH4 on January 09, 2015, 02:44:01 AM
I'm considering 8lvl grayscale by displaying different buffers for different lengths of time so that you get faster higher quality grayscale. You'd put stuff that you'd want to display the lightest on the main buffer and darker on each buffer used after. Each buffer would be assigned a numerical value so that you know what buffers to combine to make certain shades of gray. Is this even a possibility? I'll try it tomorrow to see if it works.

I'm taking what I know to make a grayscale pong game, I'll post my progress when I'm done. How do you display a variable as the characters instead of the gibberish?
That's pretty much how grayscale works (on calcs). For 4 level, the "dark buffer" is displayed 2/3 of the time and the light buffer is displayed 1/3 of the time. If a pixel is clear on both buffers it will be clear. If a pixel is on on the light buffer, but off in the dark, you get light gray. If a pixel is off on the light buffer and on in the dark buffer you get dark gray. If a pixel is on in both buffers you get black. Hope that makes sense.

*Edit* Also gonna agree with DJ: 6 level is probably the most you could get away with where you can reasonably tell the difference between shades across most models. Other wise, you lightest gray looks white and a few of your dark grays will be near indistinguishable. I'm not saying 8 hasn't been done, because some people have. If you really want to do 8 I might stick with using it for still pics. It'll also take up a lot of time displaying all the different buffers and you won't have a ton of time to work with for game logic.
Title: Re: I need help with Axe Parser
Post by: CKH4 on January 09, 2015, 09:53:57 PM
Ok thanks, until recently (for a span of 5 days) I used buffers displaying for the same amount of time and the darker the pixel was supposed to be the more buffers I would put it on.

I'm trying to improve builderboys string physics program by making corrective center velocity. I am attempting to make inward velocity when the X coordinate is grater than or less than 48 (the center) and the Y coordinate is more than 42. I have been trying to do this by changing A (x velocity) positive or negative but it doesn't seem to work.
Here is the original code:
.AXE
ClrDraw
48*256->X->I
32*256->Y->J
0->A
0->B

Repeat getKey(15)
X+A->X
Y+B->Y
B+8->B
getKey(3)-getKey(2)*16+A->A
getKey(1)-getKey(4)*16+B->B

If abs(X-I)->[r1]*^[r1]+(abs(Y-J)->[r1]*^[r1])>576
X-I//24->N
Y-J//24->O
A**N+(B**O)*~1->K
If K<<0
K**N*3//2+A->A
K**O*3//2+B->B
End
End

Circle(X/256,Y/256,4
Line(48,32,X/256,Y/256
DispGraphClrDraw

End

Any thoughts on how to do this?
Title: Re: I need help with Axe Parser
Post by: Hayleia on January 09, 2015, 11:47:09 PM
Quote from: Cumred_Snektron on January 09, 2015, 06:35:11 AM
Quote from: Hayleia on January 09, 2015, 05:34:49 AM
You can read the Commands.html file included in the zip with Axe. You'll see that you need to use ▶Dec.
▶Char *
Oops, sorry, I read a bit too fast and assumed we were talking about numbers since that's most usually what you want to display when you don't want to display strings.

Quote from: DJ Omnimaga on January 09, 2015, 03:51:41 PM
An Hayleia draws near! *.*
Lol, I should probably introduce myself by the way, for those who don't know me.
Title: Re: I need help with Axe Parser
Post by: Dream of Omnimaga on January 10, 2015, 04:50:21 AM
Quote from: Hayleia on January 09, 2015, 11:47:09 PM
Quote from: DJ Omnimaga on January 09, 2015, 03:51:41 PM
An Hayleia draws near! *.*
Lol, I should probably introduce myself by the way, for those who don't know me.
Indeed, especially that some people here are from Cemetech, PLanète-Casio or have joined after the site public opening :)
Title: Re: I need help with Axe Parser
Post by: CKH4 on January 11, 2015, 03:47:22 PM
Quote from: CKH4 on January 09, 2015, 09:53:57 PM
I'm trying to improve builderboys string physics program by making corrective center velocity. I am attempting to make inward velocity when the X coordinate is grater than or less than 48 (the center) and the Y coordinate is greater than 31. I have been trying to do this by changing A (x velocity) positive or negative but it doesn't seem to work.
Here is the original code:
.AXE
ClrDraw
48*256->X->I
32*256->Y->J
0->A
0->B

Repeat getKey(15)
X+A->X
Y+B->Y
B+8->B
getKey(3)-getKey(2)*16+A->A
getKey(1)-getKey(4)*16+B->B

If abs(X-I)->[r1]*^[r1]+(abs(Y-J)->[r1]*^[r1])>576
X-I//24->N
Y-J//24->O
A**N+(B**O)*~1->K
If K<<0
K**N*3//2+A->A
K**O*3//2+B->B
End
End

Circle(X/256,Y/256,4
Line(48,32,X/256,Y/256
DispGraphClrDraw

End

Any thoughts on how to do this?
Bump I guess. I also changed some stuff.
Title: Re: I need help with Axe Parser
Post by: CKH4 on January 16, 2015, 04:52:21 PM
Is there a way to make lists in axe?
Title: Re: I need help with Axe Parser
Post by: Snektron on January 16, 2015, 06:17:25 PM
Yes, but it's quite low level.
The variables L1 - L6 are used as free ram and can me used as lists well.
To set/get an element:

0->{L1 + Index}
{L1 + Index}->Var

You can also set 16 bit elements:

0->{Index*2 + L1}^r
{Index*2+L1}^r->Var

Note that the index needs to be multiplied by 2 since 16 bit values need 2 elements (an element is ofcourse 8 bits).

100->N

Lbl Init       .init particles
  For(I,0,N)
    I*6->A
    rand^24576->{L1+A}^r     . start x pos
    rand^16384->{L1+A+2}^r     . start y pos
    rand->{L1+A+4}^r          . start vel, these are 8 bit and stored in L1+A+4 and L1+A+4, but are both set at the same time
  End
Return

Lbl Upd     . update particles
  For(I,0,N)
    I*6->A
    {L1+A}^r+{L1+A+4}-128->{L1+A}^r     . update x pos
    {L1+A+2}^r+{L1+A+5}-128->{L1+A+2}^r     . update y pos
  End
Return

Lbl Rndr     . draw particles
  For(I,0,N)
    I*6->A
    Pxl-On( {L1+A}^r/256, {L1+A+2}^r/256)
  End
Return

I made a simple particle system with these 3 functions to show you
some examples. Note that this code is untested. Also, the particles
do not have any restrictions (they'll fly out of the screen).
Happy coding! :P
Title: Re: I need help with Axe Parser
Post by: CKH4 on January 16, 2015, 06:44:51 PM
Thanks but there is no way that I'll figure that out today. Maybe later. It looks like I'll have to find a different way to accomplish what I need until then.
Title: Re: I need help with Axe Parser
Post by: Snektron on January 16, 2015, 06:50:43 PM
What do you need then? :P
Title: Re: I need help with Axe Parser
Post by: Dream of Omnimaga on January 16, 2015, 06:51:28 PM
One note: Lists in Axe are actually data you store inside RAM areas. FOr example, L6 is the LCD content. If you store something there it doesn't create a variable or BASIC list, it will just change the value at the RAM location you specified and if it's  L6, then even the LCD content will change.

Just making sure that you are aware of that, since internally L1 in Axe works much differently than in TI-BASIC.
Title: Re: I need help with Axe Parser
Post by: CKH4 on January 16, 2015, 06:54:40 PM
I'm trying to make a list of bullet positions but I'm not sure that I want to use a list, maybe just 4 variables to keep the bullet number down.
Title: Re: I need help with Axe Parser
Post by: Hayleia on January 17, 2015, 06:47:19 AM
Quote from: Cumred_Snektron on January 16, 2015, 06:17:25 PM
You can also set 16 bit elements:

0->{L1 + Index*2}^r
{L1 + Index*2}^r->Var

Note that the index needs to be multiplied by 2 since 16 bit values need 2 elements (an element is ofcourse 8 bits).
This will probably not work exactly the way you want. Remember that Axe does operations from left to right without caring about priorities... ;)

Quote from: CKH4 on January 16, 2015, 06:54:40 PM
I'm trying to make a list of bullet positions but I'm not sure that I want to use a list, maybe just 4 variables to keep the bullet number down.
Using 4 variables would just make the code bigger and unmaintanable. You'll probably copy paste your code to work with 4 variables, and when you'll want to add something, you'll forget to put it in all 4 portions.
Plus, using "lists" would teach you how to use something you need here and you'll need later in all of your projects. Just imagine you don't know about loops and instead of doing a loop you paste your code 16 times in a row. That's ridiculous. Instead of doing that, you learn how to use loops. Well, same here, you should learn how to use "lists".
Title: Re: I need help with Axe Parser
Post by: Snektron on January 17, 2015, 10:59:28 AM
Quote from: Hayleia on January 17, 2015, 06:47:19 AM
Quote from: Cumred_Snektron on January 16, 2015, 06:17:25 PM
You can also set 16 bit elements:

0->{L1 + Index*2}^r
{L1 + Index*2}^r->Var

Note that the index needs to be multiplied by 2 since 16 bit values need 2 elements (an element is ofcourse 8 bits).
This will probably not work exactly the way you want. Remember that Axe does operations from left to right without caring about priorities... ;)
Oops :3
Title: Re: I need help with Axe Parser
Post by: CKH4 on March 15, 2015, 04:17:27 PM
I've run into a problem with my custom variable. I have

°GMODELDIST-getKey(54)+getKey(48)->°GMODELDIST

I get error invalid token. What am I doing wrong?
Title: Re: I need help with Axe Parser
Post by: Snektron on March 15, 2015, 04:21:25 PM
Youre adding/substracting values from the address. use

GMODELDIST-getKey(54)+getKey(48)->GMODELDIST
Title: Re: I need help with Axe Parser
Post by: CKH4 on March 15, 2015, 04:23:42 PM
OK thanks.
Title: Re: I need help with Axe Parser
Post by: alexgt on March 19, 2015, 12:34:00 AM
This is a little different from what we have been talking about but how do you make appVars in Axe? Also (this one is silly but necessary) how do you use if statements with multiple conditions like:
If getKey(41) or getKey(15)
or is it:
If (getKey(41)) or (getKey(15))
or maybe:
If getKey(41)??getKey(15)
or could it be:
If (getKey(41))??(getKey(15))
I've tried all and it seems they execute it all the time or not at all   <_<
Title: Re: I need help with Axe Parser
Post by: Snektron on March 19, 2015, 12:39:33 AM
I always use something like if getKey(41)+getKey(15)
Though the on key detect seemed to have some bugs in axe.

As for app vars: Theres an examply in the axe documentary :P (note that appv is a symbol not actually 'a' + 'p' + 'p' + 'v' if u know what i mean)
Title: Re: I need help with Axe Parser
Post by: CKH4 on March 19, 2015, 12:42:12 AM
Does + work? Does that mean that * is for and? And minus is for what?
Title: Re: I need help with Axe Parser
Post by: Duke "Tape" Eiyeron on March 19, 2015, 06:15:56 AM
If you're talking about the dot, cross and square characters for graph plot, they are 16-bit and or and xor. If you're talking about arithmetic operators on your keyboard (+,*,-,/) they are just the equivalent arithmetic operations. Take care of the operation priority that got from left to right whatever the symbol is

In Axe, 2+2*3 will do (2+2)*3 [= 12] and not 2+(2*3) [=8]
Title: Re: I need help with Axe Parser
Post by: Snektron on March 19, 2015, 09:05:16 AM
Quote from: CKH4 on March 19, 2015, 12:42:12 AM
Does + work? Does that mean that * is for and? And minus is for what?
Well, in axe, if the number behind an if statement is 0, it will not execute the code and if its not 0 it will (yeah yeah i know, nothing new). Now, getKey(x) returns either a 0 or 1. If we for instance have "if getKey(41)+getKey(15)" and no key is pressed, it will edsentially be "if 0+0" which is 0 and wont run the code. And if key 41 (on) is pressed, it will look like "if 1+0", which is not 0 and will run the code. And if both of them are pressed "if 1+1", which is not zero so it runs the code.

If you used "*" instead of "+" it would indeed be the equivalent of and :). Though - isnt really a binary operation.
Title: Re: I need help with Axe Parser
Post by: CKH4 on March 19, 2015, 11:19:35 AM
Thanks for the thorough explanation.
Title: Re: I need help with Axe Parser
Post by: alexgt on March 19, 2015, 08:28:10 PM
Many thanks! I know how to do stuff now :)
Title: Re: I need help with Axe Parser
Post by: Snektron on March 19, 2015, 08:36:14 PM
Anytime :)
Title: Re: I need help with Axe Parser
Post by: Duke "Tape" Eiyeron on March 19, 2015, 09:53:12 PM
You're welcome, sirs. Please ask anytime. With some luck you'll get to me quite fast enough. (-_(//));
Title: Re: I need help with Axe Parser
Post by: alexgt on March 19, 2015, 10:52:54 PM
Thanks for that I found that If (getKey(41))+(getKey(15)) But thanks just wanted to put it out there :)
Title: Re: I need help with Axe Parser
Post by: alexgt on March 20, 2015, 01:03:17 AM
Can you use a buffer with a string in Axe like this? Buff(9)->Str1 Thanks!  :)
Title: Re: I need help with Axe Parser
Post by: novenary on March 20, 2015, 07:22:46 AM
There are no "strings" in Axe. The strN tokens are regular pointers, so yes you can.
Title: Re: I need help with Axe Parser
Post by: Duke "Tape" Eiyeron on March 20, 2015, 08:16:09 AM
Beware, this isn't malloc, you can't allocate dynamic data sections like that. Its a static section in your executable, only allocated once at the compilation.
Title: Re: I need help with Axe Parser
Post by: Snektron on March 20, 2015, 09:05:35 AM
If you store it to a StrN token anyway you can use [000000000000000000]-Str1 too, though that's not quite as good :P
Title: Re: I need help with Axe Parser
Post by: alexgt on March 20, 2015, 08:08:17 PM
Thanks for the feed back but I tested it for what I wanted to do which is create a buffer then store letters into it. But that did not work :( thanks for the help though :)
Title: Re: I need help with Axe Parser
Post by: alexgt on March 22, 2015, 03:19:28 PM
How can you make an appVar with Axe?
Title: Re: I need help with Axe Parser
Post by: CKH4 on March 22, 2015, 03:26:00 PM
https://www.omnimaga.org/axe-language/external-vars-tutorial/
This may help.
Title: Re: I need help with Axe Parser
Post by: alexgt on March 22, 2015, 03:34:05 PM
Would the appVar still hold the data you gave it even after you did GetCalc("appVarTEST",20)->A where the appVar already exists !?
Title: Re: I need help with Axe Parser
Post by: CKH4 on March 22, 2015, 03:40:43 PM
I believe so but I really have no idea. A should just be a pointer to that appvar if I'm not mistaken.
Title: Re: I need help with Axe Parser
Post by: Snektron on March 22, 2015, 03:57:23 PM
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 :)
Title: Re: I need help with Axe Parser
Post by: alexgt on March 25, 2015, 12:16:46 AM
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 :)
Title: Re: I need help with Axe Parser
Post by: CKH4 on March 26, 2015, 01:05:30 PM
How do I get the hex from an 8x8 sprite on the screen?
Title: Re: I need help with Axe Parser
Post by: Snektron on March 26, 2015, 01:54:15 PM
oh that'll be interesting... since you need to copy every pixel seperately to a 8 byte data section...
Title: Re: I need help with Axe Parser
Post by: CKH4 on March 26, 2015, 02:33:34 PM
My initial thought would be to use pt-get and then read off the binary to convert to hex.
Title: Re: I need help with Axe Parser
Post by: 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 :)
Title: Re: I need help with Axe Parser
Post by: Duke "Tape" Eiyeron on March 26, 2015, 03:12:53 PM
bit-shift function? *2, *4, *8... They're hevaily optimized.
Title: Re: I need help with Axe Parser
Post by: Snektron on March 26, 2015, 04:05:37 PM
Yeah thats what i used :P
Title: Re: I need help with Axe Parser
Post by: alexgt on March 26, 2015, 08:49:22 PM
How can you store values past 65535 in Axe? This is for a calculator I plan to put on Jarvis if that helps :)
Title: Re: I need help with Axe Parser
Post by: Snektron on March 26, 2015, 09:10:24 PM
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)
Title: Re: I need help with Axe Parser
Post by: alexgt on March 27, 2015, 01:00:58 AM
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 :).
Title: Re: I need help with Axe Parser
Post by: Snektron on March 27, 2015, 08:57:33 AM
Well if i made an axiom it would basically be the same thing.
Title: Re: I need help with Axe Parser
Post by: CKH4 on March 27, 2015, 01:32:47 PM
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.
Title: Re: I need help with Axe Parser
Post by: Snektron on March 27, 2015, 01:36:55 PM
It will be stored to the address you supply in the 3rd argument
Title: Re: I need help with Axe Parser
Post by: CKH4 on March 27, 2015, 02:41:58 PM
That just counts up by 8. What kind of variable should I use?
Title: Re: I need help with Axe Parser
Post by: Snektron on March 27, 2015, 03:26:22 PM
no, it copies data to there. And things like L1 is fine, or you could even use PicN if you already defined one.
anyway just make sure there are 8 bytes free at that location, so things like A are not usable because they're only 2 bytes.
Also: it looks like pt-Get(X,Y) will return a temporary pointer to the 8x8 sprite at that location, it didn't see that command before (the key is plot2())
(http://axe.eeems.ca/Commands.html#spritesCommands)
Title: Re: I need help with Axe Parser
Post by: CKH4 on April 05, 2015, 12:05:06 PM
Can someone explain custom variables to me because figuring out where to put ° and where not to is confusing.
Title: Re: I need help with Axe Parser
Post by: Hayleia on April 05, 2015, 12:50:14 PM
I'll tell you several ways to remember, you'll choose the one you like most :P

Everything with a ° is a constant. It can be a constant pointer to a variable variable, but still, if there is a °, it's constant. Once this is said, you can't think that °Var is your variable ;)
You can for example do L1→°Lolz to declare a constant variable named Lolz which is pointed to by °Lolz, but you can also do [FFFFFFFFFFFFFFFF]→°TheSprite, and then you can do Pt-On(0,0,°TheSprite). Notice the ° at both places. And since they are constant, you can't do →°Lolz twice.

If you've already done C and if we are only talking about variables (not sprites or other pointers like I just did in my other point), just imagine the ° is like the &. Well ok, in C, you can't really do 5→&a, but whatever. What I mean here is that Name is the variable and that °Name is the pointer to that variable. And notice that °A exists by default, and that A→B is the same as Copy(°A,°B,2).
Title: Re: I need help with Axe Parser
Post by: CKH4 on April 06, 2015, 02:30:54 PM
Thanks hayleia. When I do:
.CSTMVAR
[FFFFFFFFFFFFFFFF]->Pic1
10->°XM

Repeat getKey(15)
°XM-getKey(2)+getKey(3)->XM
Pt-On(XM,10,Pic1
DispGraphClrDraw
End

It seems like XM changes back to 10 when I release the arrow key, what am I doing wrong?

Regarding this tutorial (http://sdz.tdct.org/sdz/l-axe-parser.html#Letilemapping) is there an easy way to use more than 10 tiles in a tilemap?
Title: Re: I need help with Axe Parser
Post by: Hayleia on April 06, 2015, 05:55:26 PM
Quote from: CKH4 on April 06, 2015, 02:30:54 PM
Thanks hayleia. When I do:
.CSTMVAR
[FFFFFFFFFFFFFFFF]->Pic1
10->°XM

Repeat getKey(15)
°XM-getKey(2)+getKey(3)->XM
Pt-On(XM,10,Pic1
DispGraphClrDraw
End

It seems like XM changes back to 10 when I release the arrow key, what am I doing wrong?
Lol, you didn't get it at all :P

What you need to do is
.CSTMVAR
[FFFFFFFFFFFFFFFF]->Pic1
L1->°XM
.or another place than L1, I don't care
.but this is declaring the POINTER, so use the °

10->XM
.here and in the loop, we are manipulating the VARIABLE so don't use the °
Repeat getKey(15)
XM-getKey(2)+getKey(3)->XM
Pt-On(XM,10,Pic1
DispGraphClrDraw
End


Quote from: CKH4 on April 06, 2015, 02:30:54 PM
Regarding this tutorial (http://sdz.tdct.org/sdz/l-axe-parser.html#Letilemapping) is there an easy way to use more than 10 tiles in a tilemap?
I tldr'd in front of that tutorial, but if that tutorial supports 10 tiles, it most likely supports 16 tiles without any change to the code. And if it's a beginner's tutorial, it most likely supports 256 tiles, still without any change to the code.
Title: Re: I need help with Axe Parser
Post by: CKH4 on April 06, 2015, 06:14:59 PM
OK I think I get it now. Thanks for explaining it.

As for the tilemap code here's less reading.
[222222222222222222222222222222222222]→GDB1
[200020000000000000000000020000000002]
[200020000000000005444445020000022002]
[202020000000000005000005020000220022]
[202220000000000005000005022222200222]
[200000000000000005000005000000000002]
[200000000000000005000005000000000002]
[200000000000000005444405000000000002]
[200000000000000000000000000000000002]
[200000000000000000000000000000000002]
[200000000000000000000000000022222222]
[200000000000000000000000000022222222]
[202220000000000000000000000022222222]
[202020000000000000000000000022222222]
[200020000000000000000000000020000032]
[222222222222222222222222222222222222]

For(Y,0,7)
For(X,0,11)
sub(ZIP,X+A,Y+B)→r1
Pt-On(X*8,Y*8,r1*8+Pic1
End
End

Lbl ZIP
nib{r2*18+GDB1*2+r1}
Title: Re: I need help with Axe Parser
Post by: Hayleia on April 09, 2015, 05:54:26 AM
Well with no change to that code, you can use up to 16 tiles. Use numbers from 0 to F in your tilemap :)

And I think it's a bit weird for a tilemapping tutorial to use nibbles. Of course, you'll have to cover nibbles someday, and you'll have to cover tilemapping one day, but in my opinion, it's best in a tutorial, for beginners, where you want everyone to understand each point and not just to have working code, to not mix all notions in the same place but to teach them one by one with a warning like "this is a tutorial, you can obviously write more efficient code but we want to make sure you understand".
Title: Re: I need help with Axe Parser
Post by: Snektron on April 09, 2015, 07:46:06 AM
Yeah i read that kind of tutorial sometimes too. Though i mostly still get it, its very irritating that it's so poorly done :/
Title: Re: I need help with Axe Parser
Post by: Duke "Tape" Eiyeron on April 09, 2015, 07:56:42 AM
I'm tempted to do a breakdown on the theory with blackjack and hookers with drawings to try to make things clear, I don't really have time for this and my english would be too poor for that...
Title: Re: I need help with Axe Parser
Post by: CKH4 on April 19, 2015, 05:33:58 AM
Is there a way to count the number of arguments loaded in a sub routine?

Example:
SOMETHING(X,Y,"lolwhynot","wow","cat")

Lbl Something
.code to count the number of arcuments
For(A,0,number of arguments)
Return
Title: Re: I need help with Axe Parser
Post by: Snektron on April 19, 2015, 09:01:41 AM
I don't think there is :/. But you can always do something like
Quote from: CKH4 on April 19, 2015, 05:33:58 AM
SOMETHING(X,Y,3,"lolwhynot","wow","cat")

Lbl Something
.code to count the number of arcuments
For(A,0,r3)
Return

Also keep in mind there are only 6 possible arguments.
Title: Re: I need help with Axe Parser
Post by: CKH4 on April 19, 2015, 01:23:20 PM
Yeah I was hoping to save the argument because that is what I have already. Maybe @Hayleia knows. My other thought would be to zero out all of the r arguments at the end and then test for the lat one that is 0.
Title: Re: I need help with Axe Parser
Post by: Snektron on April 19, 2015, 09:49:04 PM
Yeah, or you could lay them out in some buffer.

BTW: This topic should be renamed to "Can i Axe you a question?"
Title: Re: I need help with Axe Parser
Post by: CKH4 on April 19, 2015, 10:33:31 PM
My thought would be that I can do it without using any other variables. Is there a way to do a for loop counting between [r#] variables?
Also I'll add that joke as a topic tag.
Title: Re: I need help with Axe Parser
Post by: Hayleia on April 30, 2015, 05:12:41 AM
I don't think it's possible indeed. But maybe what you can do is put a last argument at 0, like SOMETHING(A,B,C,0), then your code loops from °r1 to °r6 and stops at the first pointer that contains 0 ? It is only a little bit smarter than having an argument describing how many arguments there are though.
The other solution being what @Cumred_Snektron said, filling a buffer with your arguments then having the routine read that buffer, which allows for a lot more arguments by the way.
Title: Re: I need help with Axe Parser
Post by: CKH4 on April 30, 2015, 11:47:11 AM
Thanks hayleia. That is what I'm doing right now except hopefully saving a few bytes by using r2 to describe the height of the box and how many arguments there are. I'm a slight bit confused buff(, what exactly does it do? Does it set a blank spot in ram that you can store as a variable?

Is it best practice to delete user variables at the end of your program or are they automatically cleaned or does it not even matter?
Title: Re: I need help with Axe Parser [Can I Axe you a question?]
Post by: Snektron on April 30, 2015, 01:55:38 PM
User variables? you mean appvars or vars like A and theta?
also buff( just makes a x long area of 0's on your program
Title: Re: I need help with Axe Parser
Post by: CKH4 on April 30, 2015, 03:14:42 PM
Like ones that you have to define with °.
Title: Re: I need help with Axe Parser [Can I Axe you a question?]
Post by: Snektron on April 30, 2015, 03:16:30 PM
Nah they are just in some ram area, if something needs their place it just overwrites them, so you can just leave them be