Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: squidgetx on February 12, 2011, 11:28:50 am

Title: Axe Q&A
Post by: squidgetx on February 12, 2011, 11:28:50 am
Since we no longer have the Axe Parser general thread due to the forum split (and since q/a wasn't even that appropriate for the Axe Parser thread), this topic will be the new quick question/answer thread. :)
If you have any quick questions about Axe programming: things that you feel don't quite merit their own thread, feel free to post them here. :) Anyone able to answer your question will most certainly do so.

Questions like "What does [function] do" or "How do I do grayscale" are suited for this thread, while we encourage the creation of a new thread for more indepth questions and issues :)

FAQ/RANDOM:

Please, do not refer to Axe "lists" L1, L2, etc. as "lists." Instead, refer to them as "saferam" or "free ram." The term "list" is reserved for the OS lists that are used in plots and BASIC
Q-Help! Why doesn't Fill({L1},1000) work?
Fill() takes a pointer as an argument. Fill({L1},XXX) is incorrect. You want Fill(L1,XXX). Same with the Copy/Exch commands.[/green]

Q-Help! My program is inexplicably crashing on execution!
A-Asm programs have a size limit of 8192 bytes. If you compile for MOS/DCS, you have a limit of 8811 bytes of code, and unlimited data (well as much data that you can fit into RAM). If you're over 8811 bytes, you might want to think about compiling to an application, using Crabcake or Fullrene. or optimizing some more.

Q-How come this doesn't work: 0->{GDB1+xxxx}???
A-GDB1, Str1, etc. are all static pointers This means that you aren't supposed to change the data defined there. You can however, do this (called SMC; and be warned that it will not work in an application) by using Copy and Exch, or by storing the static pointer to a variable and then using that variable as a pointer instead, eg GDB1->theta:0->{theta}

Q-How do I do realistic gravity???
A: Check out Builderboy's physics lessons. (http://ourl.ca/4279)
Title: Re: Axe Q&A
Post by: aeTIos on February 12, 2011, 02:38:15 pm
Yay 1st question!

How to deal with variable string lengths, like as in an input routine?
Title: Re: Axe Q&A
Post by: Builderboy on February 12, 2011, 02:39:06 pm
what do you mean how to deal with them?  What do you need to do?
Title: Re: Axe Q&A
Post by: aeTIos on February 12, 2011, 02:41:35 pm
I mean, if you put in some data in str1, the next time you start the program the same data is still in str1 ( maybe this is more like self-modifying-code )
Title: Re: Axe Q&A
Post by: Deep Toaster on February 12, 2011, 02:45:37 pm
You mean saving back to the program? Because (as you probably know) Str1 isn't a real variable. It's a chunk of bytes in the program itself. So if you want to save back to the program, you have to find the program in memory, then calculate the offset of Str1 from the beginning of the program, then Copy( the bytes there. I made a little routine to do that in PapiJump :D Let's see if I can find it...
Title: Re: Axe Q&A
Post by: aeTIos on February 12, 2011, 02:47:11 pm
Yes, restoring the default value of a string, that would help me out a whole lot times :D
Title: Re: Axe Q&A
Post by: Deep Toaster on February 12, 2011, 02:48:01 pm
Yes, restoring the default value of a string, that would help me out a whole lot times :D


Wait, what exactly are you trying to do?
Title: Re: Axe Q&A
Post by: aeTIos on February 12, 2011, 02:49:10 pm
nvm, what you said earlier
<offtopic> yay my axeparser usrbar changed lol </offtopic>
and, I lost :hyper:
Title: Re: Axe Q&A
Post by: Builderboy on February 12, 2011, 02:51:06 pm
Well if you use MirageOS, it has automatic copyBack, so anything you modify will stay modified.  Maybe just make your program for MirageOS/Doors?
Title: Re: Axe Q&A
Post by: Deep Toaster on February 12, 2011, 02:53:25 pm
Well if you use MirageOS, it has automatic copyBack, so anything you modify will stay modified.  Maybe just make your program for MirageOS/Doors?

That would work, and if by

Yes, restoring the default value of a string, that would help me out a whole lot times :D


you meant you want it to stay unmodified, just use a saferam area (L1, L2, etc.) and initialize it at the beginning of your program.
Title: Re: Axe Q&A
Post by: aeTIos on February 12, 2011, 02:54:25 pm
Sorry, i'm not clear.
What I mean, is actually not the modifying. so if I set "0000->str1, the next time its loaded, it should be again "0000 and not "1111 or so.
I hope this is more clear and not ambiguous (is that the right word here?)

EDIT: and, Deep Thought, I've tried that earlier, but that didnt work ???

EDIT2: nvm, understood it.
Title: Re: Axe Q&A
Post by: Builderboy on February 12, 2011, 02:56:04 pm
So you want the Data to always be the same when you start the program?  The best way to do that would be to never modify it in the first place.  If you need to modify it, you can copy() it to a SafeRam location such as L1 and work with it from there
Title: Re: Axe Q&A
Post by: aeTIos on February 12, 2011, 02:58:47 pm
Ah ok, I understand it, i'll try, thanks all!
Title: Re: Axe Q&A
Post by: Builderboy on February 12, 2011, 02:59:50 pm
Also note that if you are running from the homescreen, there are no issues and the data will always reset back to its default :)
Title: Re: Axe Q&A
Post by: Elsewhere on February 12, 2011, 04:38:01 pm
Okay, here's a question (or two):

The Text( command seems to only draw whatever you want it to for one frame at which point the text seems to disappear. Is this just how Text( works or am I doing something wrong? So, if I wanted to output text that would stay there (the graph screen) until I used ClrDraw, how would I go about doing that? (Sprites would be really inefficient, mind you).

Also, what does it mean when I try to run my program after compiling and get ERR:INVALID? I have ample RAM left (>15000) and tons of archive (>100000) so I couldn't think it'd be a memory issue, but all the same it happened after I wrote a few everyday lines. An example of the format these lines were in is:
Code: [Select]
:If A=0:If B=0:Text(1,1,"COOL"):End:EndAfter commenting those lines out it worked fine again, but if I bring one back my sprites glitch up and more makes me get ERR:INVALIDs again. My game is rather huge, using like, 30 pictures, all the letter variables, and a bit of L1, so it makes me think it might have to do with free RAM or whatever? Mind you, it's not an Axe error but a TI error I'm getting, after trying to run the game.

Title: Re: Axe Q&A
Post by: squidgetx on February 12, 2011, 04:39:47 pm
Question 1: If you want to draw to the buffer, put a Fix 5 at the beginning of your program and a Fix 4 at the end :)
Question 2: Is the game over 8192 bytes? Nostub executables have to be under 8192 bytes, while MOS and DCS programs can have up to 8811 bytes of code and unlimited data. However, be warned that Axe doesn't guarantee that a MOS/DCS program will have all the data at the end. The safest way to get past the code limit once you're at 8811 is by compiling to an application which gives you 16384 bytes to work with.
Title: Re: Axe Q&A
Post by: Elsewhere on February 12, 2011, 04:50:08 pm
Oh, I see, that's the problem then. those commands push me right over 8192. Problem(s) solved, then!
Title: Re: Axe Q&A
Post by: Deep Toaster on February 12, 2011, 04:51:24 pm
Oh, I see, that's the problem then. those commands push me right over 8192. Problem(s) solved, then!

Remember that you can still run from shells up to 8811 bytes, so just compile for MOS if you have to :)
Title: Re: Axe Q&A
Post by: DJ Omnimaga on February 12, 2011, 07:37:24 pm
<late>On a very off-topic note, welcome on the forums Elsewhere.</late>
Title: Re: Axe Q&A
Post by: Elsewhere on February 12, 2011, 09:50:21 pm
Hah, thanks. ;D
Title: Re: Axe Q&A
Post by: Darl181 on February 12, 2011, 11:54:34 pm
I've got one.  I was wondering if multiplying something by zero makes the product zero.
The idea is that something like 3*(B>C)+A→A would only increase A by 3 if B is greater than C, doing the same as If B>C:A+3→A:End .  Will this work? Also, would the parenthesis be necessary?
Another idea, does multiplying by -1 (negative 1) make the result the opposite?  Like, 6 * -1 = -6
Title: Re: Axe Q&A
Post by: Runer112 on February 12, 2011, 11:56:36 pm
Yes, that would work. Although it would be more optimized as follows, because multiplying by 3 is an optimized calculation:

B>C*3+A→A


EDIT: And yes, multiplying by negative 1 negates the number as you would expect. Remember that the result is only treated as negative if you use a signed comparison or something else that uses signed numbers. Otherwise as far as the processor knows it's just a really big positive number. -6 is just 65530 interpreted differently.
Title: Re: Axe Q&A
Post by: Darl181 on February 13, 2011, 12:00:10 am
Cool, this will help ;D
Thanks.
Title: Re: Axe Q&A
Post by: Builderboy on February 13, 2011, 01:16:17 am
How large is your program?  Any Homescreen program that is over 8100 bytes will give an error, it sounds to me like you are very close to this value?

As for text, try putting a Fix 5 at the very start of your program
Title: Re: Axe Q&A
Post by: Munchor on February 13, 2011, 10:12:31 am
How large is your program?  Any Homescreen program that is over 8100 bytes will give an error, it sounds to me like you are very close to this value?

As for text, try putting a Fix 5 at the very start of your program

When using Fix 5 we always need a Fix 4 before ending, don't forget (I think you know that, though).


Also, how to get a number input in Axe like in Basic (Prompt A, or Input A)?
Title: Re: Axe Q&A
Post by: ztrumpet on February 13, 2011, 10:31:04 am
I believe this may be what you're looking for:
http://ourl.ca/4129/80803
http://ourl.ca/4129/81340
-- or this --
http://ourl.ca/4129/123530
http://ourl.ca/4129/125194
Title: Re: Axe Q&A
Post by: Munchor on February 13, 2011, 10:36:38 am
I believe this may be what you're looking for:
http://ourl.ca/4129/80803
http://ourl.ca/4129/81340
-- or this --
http://ourl.ca/4129/123530
http://ourl.ca/4129/125194

Code: [Select]
.NUMINP

0?F?B
Repeat F
0?K
Repeat K
Output(0,{E844B},'?'?Frac
getKey?K=9?F
End
K-1/10?A
4-A?A
If A=1
K^10-4*3+A?A
End
If A=2
K^10-6*3+A?A
End
If A=3
K-1^10-7*3+A?A
End
If K=33
0?A
End
If K?9
B*10+A?B?A
sub(A)
End
End
Return

Lbl A
[000000?Pic99
A?{Pic99}r
If {Pic99}r>9
1?{Pic99+2
End
If {Pic99}r>99
2?{Pic99+2
End
If {Pic99}r>999
3?{Pic99+2
End
If {Pic99}r>9999
4?{Pic99+2
End
For(A,0,{Pic99+2
Output(1+{Pic99+2}-A,{E844B},{Pic99}r^10+48?Frac
{Pic99}r/10?{Pic99}r
End

I see, there's no included command, I'd have to use these subroutines for example.

Thanks!
Title: Re: Axe Q&A
Post by: squidgetx on February 13, 2011, 12:41:58 pm
How large is your program?  Any Homescreen program that is over 8100 bytes will give an error, it sounds to me like you are very close to this value?

As for text, try putting a Fix 5 at the very start of your program
Builderboy, I think you were ninja'd by 9 hours XD
Title: Re: Axe Q&A
Post by: Builderboy on February 13, 2011, 12:47:56 pm
How large is your program?  Any Homescreen program that is over 8100 bytes will give an error, it sounds to me like you are very close to this value?

As for text, try putting a Fix 5 at the very start of your program
Builderboy, I think you were ninja'd by 9 hours XD

Awwww I didn't realize there was a second page, haha silly me :P
Title: Re: Axe Q&A
Post by: Deep Toaster on February 13, 2011, 12:57:41 pm
Lol, I was wondering. I thought you were answering Darl181 in some 1337 way ;D
Title: Re: Axe Q&A
Post by: Munchor on February 13, 2011, 12:58:42 pm
How large is your program?  Any Homescreen program that is over 8100 bytes will give an error, it sounds to me like you are very close to this value?

As for text, try putting a Fix 5 at the very start of your program
Builderboy, I think you were ninja'd by 9 hours XD

How could that happen? XD

I have yet another question. To use Axioms we need to know Assembly, right?
Title: Re: Axe Q&A
Post by: Deep Toaster on February 13, 2011, 01:00:05 pm
How large is your program?  Any Homescreen program that is over 8100 bytes will give an error, it sounds to me like you are very close to this value?

As for text, try putting a Fix 5 at the very start of your program
Builderboy, I think you were ninja'd by 9 hours XD

How could that happen? XD

I have yet another question. To use Axioms we need to know Assembly, right?

Nah, Axioms are just like the functions built into Axe. To make Axioms you need ASM, though.

EDIT: It's like a define in Python ;)
Title: Re: Axe Q&A
Post by: Munchor on February 13, 2011, 01:03:51 pm
"Nah, Axioms are just like the functions built into Axe. To make Axioms you need ASM, though.

EDIT: It's like a define in Python"

If only I knew what a define is... Is it like #define in Assembly?
Title: Re: Axe Q&A
Post by: Deep Toaster on February 13, 2011, 01:05:26 pm
Er, just def (for a function). Sorry, I keep getting these languages mixed up :P

Serves me right for learning three languages in two days.
Title: Re: Axe Q&A
Post by: Munchor on February 13, 2011, 01:07:03 pm
Er, just def (for a function). Sorry, I keep getting these languages mixed up :P

Serves me right for learning three languages in two days.

OOOOH Like a function written in Assembly code.

So it's like a subroutine but that can be written in Assembly, pure epic!
Title: Re: Axe Q&A
Post by: Deep Toaster on February 13, 2011, 01:08:05 pm
Er, just def (for a function). Sorry, I keep getting these languages mixed up :P

Serves me right for learning three languages in two days.

OOOOH Like a function written in Assembly code.

So it's like a subroutine but that can be written in Assembly, pure epic!

Yeah, that's basically it :)

Axe extensions = Axioms.
Title: Re: Axe Q&A
Post by: Darl181 on February 14, 2011, 09:43:34 pm
What do EndIf and End!If do?
And, while I'm at it, What do ElseIf and Else!If do?
Title: Re: Axe Q&A
Post by: squidgetx on February 15, 2011, 07:22:17 am
Code: [Select]
If A
stuff
Else
!If B
stuff
End
End
is the same as
Code: [Select]
If A
stuff
Else!If B
stuff
End

EndIf does what it sounds like...it Ends the loop If condition is true. Like ReturnIf, but for loops instead of subroutines.
Title: Re: Axe Q&A
Post by: aeTIos on February 15, 2011, 07:50:36 am
I have a question: how to create a up/down or left/right moving platform in a tilemapper? i dont know how to do this...
Thanks in advance!
Title: Re: Axe Q&A
Post by: Deep Toaster on February 15, 2011, 09:13:28 am
Code: [Select]
If A
stuff
Else
!If B
stuff
End
End
is the same as
Code: [Select]
If A
stuff
Else!If B
stuff
End

EndIf does what it sounds like...it Ends the loop If condition is true. Like ReturnIf, but for loops instead of subroutines.


The point is kinda like for Repeat loops in BASIC -- you go through the loop at least once, then check at the bottom. (If you haven't noticed, Repeat in Axe is pretty much the same as While ).

I have a question: how to create a up/down or left/right moving platform in a tilemapper? i dont know how to do this...
Thanks in advance!

The easiest way would be to treat as a bullet, stored separately in an array. I'm writing a tutorial on that stuff right now ;D
Title: Re: Axe Q&A
Post by: aeTIos on February 15, 2011, 02:44:35 pm
bump
anyone knowing the answer on m question?
Title: Re: Axe Q&A
Post by: Darl181 on February 15, 2011, 02:46:49 pm
Look at the previous post. ;)
Title: Re: Axe Q&A
Post by: aeTIos on February 15, 2011, 02:47:49 pm
oops, i didnt see that :$ excuse me
And DT: nice! im looking forward to that tutorial! is it gonaa be on your site or here?
Title: Re: Axe Q&A
Post by: Deep Toaster on February 15, 2011, 03:48:55 pm
Probably both :) One in BB form for all the forums, one in HTML form for the Whetting Stone.
Title: Re: Axe Q&A
Post by: Darl181 on February 15, 2011, 05:01:01 pm
Okay, I'm having like endless problems trying to figure out smoothscrolling...
http://ourl.ca/8025/174452
What am I doing wrong ???
Title: Re: Axe Q&A
Post by: ztrumpet on February 15, 2011, 05:13:47 pm
bump
anyone knowing the answer on m question?
If you want an example in TI Basic, you can look at the code for "Stack'em Up" in my HGP: http://ourl.ca/4491/142729 ;D
Title: Re: Axe Q&A
Post by: ACagliano on February 17, 2011, 09:42:33 am
In a game map, if you need a edit the value of a tile on the fly, like a piece being collected, and you want to replace it with the value 00h, would you do

E00->tile  or   [00]->tile

the E represents the hex->dec token.
Title: Re: Axe Q&A
Post by: aeTIos on February 17, 2011, 09:43:34 am
quote from omnomirc:
Quote
...
[07:39:43] <aeTIos> Oh wait you should copy the whole tilemap to a list, Copy(Tilemap, L1-6,length tilemap)
[07:40:29] <aeTIos> and then you can write the new var to it with var->{position in list}
[07:41:13] <aeTIos> I hope that is clear. You have to draw the tilemap from the list, obviously.
...
Title: Re: Axe Q&A
Post by: ACagliano on February 17, 2011, 09:49:25 am
quote from omnomirc:
Quote
...
[07:39:43] <aeTIos> Oh wait you should copy the whole tilemap to a list, Copy(Tilemap, L1-6,length tilemap)
[07:40:29] <aeTIos> and then you can write the new var to it with var->{position in list}
[07:41:13] <aeTIos> I hope that is clear. You have to draw the tilemap from the list, obviously.
...


Well, I actually planned on drawing directly from the appvar, using a graphics engine that has sprites for all tiles. And I was hoping to continue to work in hex with the numbers. I am just unsure whether the E token is what I need here.
Title: Re: Axe Q&A
Post by: aeTIos on February 17, 2011, 10:46:09 am
Oops, nah, you can just do that this way: [hex]->tile
Title: Re: Axe Q&A
Post by: ACagliano on February 17, 2011, 10:51:54 am
ok. cool.
Title: Re: Axe Q&A
Post by: squidgetx on February 17, 2011, 11:33:29 am
That won't work, you'll need to just use regular numbers... (or EHEX)

Tile value -> {Y coord * map width +X coord + pointer to map}

and "pointer to map" needs to be a variable or address like {L1}r or A, not something like GDBXXX
Title: Re: Axe Q&A
Post by: Deep Toaster on February 17, 2011, 06:50:40 pm
Oops, nah, you can just do that this way: [hex]->tile

Each time you do that you're adding more data to the end of your program, because every time Axe sees [] when compiling, it adds the data then, not when the program is running. And then you're storing the pointer to the data to a var, instead of the data itself, so it'll act in a completely different way.
Title: Re: Axe Q&A
Post by: Darl181 on February 17, 2011, 07:45:56 pm
Is there an updated version of this?
http://ourl.ca/8409/154963

Also, I'm working on a smoothscroller in tandem with Tio.  The 6*6 char is locked in the middle (so (x,y)=45,29)), and the blocks are in 8*8.
What kind of formula would I use to figure out which 8*8 square each corner of the 6*6 sprite?
Variables:
Pointer: E (reads at random from RAM)
Top-left corner: I,J
Offset: N,O

Thanks in advance.
Title: Re: Axe Q&A
Post by: Runer112 on February 18, 2011, 05:22:09 pm
Here's the most optimized code I could come up with. Only while finding the top left corner does it fully calculate the position. The other corners reuse previously found values and conditionally add to them as necessary. Note that this will only work with the corner locations being calculated in the order below (although code can exist between calculations), and only for the player being at (45,29) due to optimizations tuned specifically to this coordinate.


Code: [Select]
.Top Left
29-Osub(D8)+J*[map_width]+(45-Nsub(D8)+I)+E→r₆
.Top Right
Nsub(O00)→r₅+r₆
.Bottom Left
Osub(O00)*[map_width]+r₆→r₆
.Bottom Right
r₅+r₆

Lbl D8
  /2/2/2
Return

Lbl O00
  //2≠⁻2
Return
Title: Re: Axe Q&A
Post by: Darl181 on February 18, 2011, 06:33:56 pm
And what does it do? Does it store each in r6 one at a time?  How are they recalled?
Title: Re: Axe Q&A
Post by: Runer112 on February 18, 2011, 06:40:21 pm
I use r5 and r6 to avoid having to redo calculations, they're not necessarily the actual results. Each line gives the result for the corner specified in the comment above it, so if you wanted to store the results to a variable for instance, you'd have to add a →VAR to the end of those lines.
Title: Re: Axe Q&A
Post by: Darl181 on February 18, 2011, 07:00:57 pm
Ah, ok.  So it returns four pointers...
Just wondering--what would the unoptimized version of this be like?
Title: Re: Axe Q&A
Post by: Runer112 on February 18, 2011, 07:05:44 pm
This is effectively what it does, only this is larger and slower.

Code: [Select]
.Top Left
29-O/2/2/2+J*[map_width]+(45-N/2/2/2+I)+E
.Top Right
29-O/2/2/2+J*[map_width]+(51-N/2/2/2+I)+E
.Bottom Left
35-O/2/2/2+J*[map_width]+(45-N/2/2/2+I)+E
.Bottom Right
35-O/2/2/2+J*[map_width]+(51-N/2/2/2+I)+E
Title: Re: Axe Q&A
Post by: Darl181 on February 18, 2011, 07:08:22 pm
Quote
...Jsub*[map_width]
What does that do?  I thought sub( called a subroutine, but in the code there's no parenthesis or label pointer...
Title: Re: Axe Q&A
Post by: Runer112 on February 18, 2011, 07:11:51 pm
Whoops, not sure how those sub's got in there... I fixed both blocks of code now.
Title: Re: Axe Q&A
Post by: Darl181 on February 18, 2011, 07:13:36 pm
Lol ok
I was asking partly because I think I've seen similar uses of sub( , but they were probably just hl abuse :P
Title: Re: Axe Q&A
Post by: ee511 on February 18, 2011, 07:39:47 pm
hello fellow axe-ers. I am trying to create some code that uses the "sin(" function, but when the value should be negative, it turns up a really big number like 65000 or so. Help!  :mad:
Title: Re: Axe Q&A
Post by: Deep Toaster on February 18, 2011, 07:48:37 pm
Welcome to Omnimaga, ee511!

In Axe, negative numbers are the same as "really big numbers". Everything above the value 32,767 is treated as a negative number. (See the Axe guide for details.)

The only thing that makes any difference is how you treat a number. Try drawing a sprite at y-value 65,535, then draw it at y-value -1. It's exactly the same :)
Title: Re: Axe Q&A
Post by: Darl181 on February 18, 2011, 07:50:19 pm
I kinda wondered about that...is there a way to force axe to see it as a negative number i.e. when using Disp ?
Title: Re: Axe Q&A
Post by: Deep Toaster on February 18, 2011, 07:51:20 pm
I kinda wondered about that...is there a way to force axe to see it as a negative number i.e. when using Disp ?

It's exactly the same. The only reason Disp >Dec displays it unsigned (large number) is because the OS routine that displays numbers treats it that way. There's no routine to display a negative, unfortunately.
Title: Re: Axe Q&A
Post by: ee511 on February 18, 2011, 07:52:35 pm
but in calculations, how can i make it be treated as a negative number?
Title: Re: Axe Q&A
Post by: Darl181 on February 18, 2011, 07:54:13 pm
Addition/subtraction work fine, // does signed division, idk about multiplication tho...it's something weird about high/low order bits or something.
Title: Re: Axe Q&A
Post by: Deep Toaster on February 18, 2011, 07:55:43 pm
Well, it's sort of weird. When you're adding, subtracting, or multiplying, it's exactly the same. 65530-5 and -6-5 both result in the same value, for example. But when it comes to division, there are two forms: signed and unsigned. That's when you get to decide which it is. Use / for unsigned division, and // for signed division.
Title: Re: Axe Q&A
Post by: Ashbad on February 18, 2011, 07:56:03 pm
when using the Sin( function, depending on where it is used you can use the Sign{ command to convert a "Normal" negative number into input the function can read in the right context.  Since -1 == 65535 in axe (if you're using a general purpose variables [all of which are 16 bit] such as vars A-Z and Theta)  then the Sin( is calculating the sin of 65535.  at least methinks.  Even if it is doing it correctly, a Sign{ function never hurts, I know that for sure.

also one way you can tell a positive number/negative number is by the highest bit -- if it is set, and you're treating the number as a signed value, then it's negative.  Thing is, if you're treating it unsigned, all numbers (except 0) are positive -- and like DT said it's the usage that matters, not the high bit.  So, in axe,  5 plus -1 actually reads as 5 plus 65535, the 16 bit equivalent.    the thing is, when you add those two numbers, you reach a number that cannot fit inside a 16 bit space -- so it loops it back to zero and adds the rest.  So, 5 plus 65535 comes out with 4.  Easy to understand?  Not a chance if you didn't already know some of the concept, but I'm sure you'll get the hang of the concept eventually.

also welcome :)
Title: Re: Axe Q&A
Post by: Deep Toaster on February 18, 2011, 07:57:51 pm
when using the Sin( function, depending on where it is used you can use the Sign{ command to convert a "Normal" negative number into input the function can read in the right context.  Since -1 == 65535 in axe (if you're using a general purpose variables [all of which are 16 bit] such as vars A-Z and Theta)  then the Sin( is calculating the sin of 65535.  at least methinks.  Even if it is doing it correctly, a Sign{ function never hurts, I know that for sure.

No, DON'T use sign{! sign{ is only used to get a signed value from a pointer. If you use it on a value you already have, you will end up with some random number you don't need.
Title: Re: Axe Q&A
Post by: Ashbad on February 18, 2011, 08:00:08 pm
ahh, I see.  my bad, disregard that part from my little speech.  Though the second part will go unchallenged I'm sure :)

anyways it's just that It's been a while since I even touched the Sin( command in axe, and I wasn't really thinking while I was posting and while I was posting I was both eating and taking a dump at the same time and... [/excuse]
Title: Re: Axe Q&A
Post by: ee511 on February 18, 2011, 08:07:16 pm
ummmm... ok. i sorta get it. well fortunately, i won't be dealing with anything over 65535, unless its negative. but in the event that it i do have to deal with the sin( of a negative number, is there some way to get a pointer to the ram where the A-Z and Theta variables are stored? (or even better, the pointer to a specific variable.)
Title: Re: Axe Q&A
Post by: Deep Toaster on February 18, 2011, 08:18:49 pm
ummmm... ok. i sorta get it. well fortunately, i won't be dealing with anything over 65535, unless its negative. but in the event that it i do have to deal with the sin( of a negative number, is there some way to get a pointer to the ram where the A-Z and Theta variables are stored? (or even better, the pointer to a specific variable.)

Hmm, why would you need the pointer? If you need to get the signed value, know that just using a var like A-Z and theta, it's already in the right format for both signed and unsigned.
Title: Re: Axe Q&A
Post by: Runer112 on February 18, 2011, 08:21:54 pm
You definitely won't be dealing with anything over 65535, because the calculator is physically incapable of storing a number larger than that in its 16-bit registers. When it comes down to signs, the only difference between an unsigned and a signed number is just how you interpret the number. ⁻1 and 65535 are stored exactly the same on the calculator. It has no idea if it should be unsigned or signed. The only thing that "makes" a number signed is if you treat it as so.

The sin() function is periodic, meaning that for every 256 input values, it loops back around to where it started. For example, sin(254) would return the same result as sin(510) or sin(⁻2) (which is the same exact thing as sin(65534)), so you don't even have to worry about negative inputs.

Regarding the locations of variables in RAM, you can find the pointer to any variable by prefixing the variable with a degree symbol, such as °A. There are 27 2-byte variables, and they are stored in a contiguous 54-byte section of RAM in the order A,B,C,...,Z,θ. The variables start, by default, at the hexadecimal location $89B6 in RAM, which is equal to L1+714.
Title: Re: Axe Q&A
Post by: Darl181 on February 18, 2011, 08:35:35 pm
Question dealing with earlier: the tilemapper I'm making reads from the RAM at random (like, rand→A at the beginning and for the rest of the program it reads from {A}).
Does this mean the width is variable?
If not what would the width be?  I'm thinking 256, but I'm not sure...
Title: Re: Axe Q&A
Post by: Deep Toaster on February 18, 2011, 08:36:18 pm
Depends on how you're storing the width?
Title: Re: Axe Q&A
Post by: Darl181 on February 18, 2011, 08:42:03 pm
For this:
Spoiler For optimized:
Here's the most optimized code I could come up with. Only while finding the top left corner does it fully calculate the position. The other corners reuse previously found values and conditionally add to them as necessary. Note that this will only work with the corner locations being calculated in the order below (although code can exist between calculations), and only for the player being at (45,29) due to optimizations tuned specifically to this coordinate.


Code: [Select]
.Top Left
29-Osub(D8)+J*[map_width]+(45-Nsub(D8)+I)+E→r₆
.Top Right
Nsub(O00)→r₅+r₆
.Bottom Left
Osub(O00)*[map_width]+r₆→r₆
.Bottom Right
r₅+r₆

Lbl D8
  /2/2/2
Return

Lbl O00
  //2≠⁻2
Return
Spoiler For unoptimized:
This is effectively what it does, only this is larger and slower.

Code: [Select]
.Top Left
29-O/2/2/2+J*[map_width]+(45-N/2/2/2+I)+E
.Top Right
29-O/2/2/2+J*[map_width]+(51-N/2/2/2+I)+E
.Bottom Left
35-O/2/2/2+J*[map_width]+(45-N/2/2/2+I)+E
.Bottom Right
35-O/2/2/2+J*[map_width]+(51-N/2/2/2+I)+E

Also wow, this topic grew fast...
Title: Re: Axe Q&A
Post by: Deep Toaster on February 18, 2011, 08:51:51 pm
Please don't put [code] tags in spoilers. It's tiny in Chrome :(
Title: Re: Axe Q&A
Post by: Darl181 on February 18, 2011, 08:53:37 pm
Oh.. :P
For this:
Here's the most optimized code I could come up with. Only while finding the top left corner does it fully calculate the position. The other corners reuse previously found values and conditionally add to them as necessary. Note that this will only work with the corner locations being calculated in the order below (although code can exist between calculations), and only for the player being at (45,29) due to optimizations tuned specifically to this coordinate.


Code: [Select]
.Top Left
29-Osub(D8)+J*[map_width]+(45-Nsub(D8)+I)+E→r₆
.Top Right
Nsub(O00)→r₅+r₆
.Bottom Left
Osub(O00)*[map_width]+r₆→r₆
.Bottom Right
r₅+r₆

Lbl D8
  /2/2/2
Return

Lbl O00
  //2≠⁻2
Return
This is effectively what it does, only this is larger and slower.

Code: [Select]
.Top Left
29-O/2/2/2+J*[map_width]+(45-N/2/2/2+I)+E
.Top Right
29-O/2/2/2+J*[map_width]+(51-N/2/2/2+I)+E
.Bottom Left
35-O/2/2/2+J*[map_width]+(45-N/2/2/2+I)+E
.Bottom Right
35-O/2/2/2+J*[map_width]+(51-N/2/2/2+I)+E

Also wow, this topic grew fast...
Title: Re: Axe Q&A
Post by: Darl181 on February 19, 2011, 04:42:46 am
Okay, I kind of have the above figured out.
I'm thinking of making my old character explorer thing (here) (http://ourl.ca/4129/146938) more useful for two-byte tokens.
One idea is to text the token to the graphscreen.
Does the graphscreen do text wrapping, and if not, is there a way to make it?
Title: Re: Axe Q&A
Post by: aeTIos on February 19, 2011, 09:39:39 am
How does the float{} function work? I've tried it, but everything after float{X} returned an error...
Title: Re: Axe Q&A
Post by: Happybobjr on February 19, 2011, 10:33:22 am
your x has to be a location in the memory.
Such as L1
Title: Re: Axe Q&A
Post by: Deep Toaster on February 19, 2011, 10:56:11 am
How does the float{} function work? I've tried it, but everything after float{X} returned an error...

Floating values are always nine bytes. It should be stored somewhere in RAM (such as after doing something like GetCalc("varA")→P). Then float{P} returns the value of the nine bytes pointed to (hence the curly braces after float{).
Title: Re: Axe Q&A
Post by: Darl181 on February 20, 2011, 01:40:21 am
Is there a way to make RecallPic and StorePic work in a way so they don't overwrite the buffer being stored to?  So, instead of it working like Pt-Off, it would work like pt-on or pt-change?
Title: Re: Axe Q&A
Post by: Builderboy on February 20, 2011, 01:42:24 am
You could do something like this:

Code: [Select]
For(F,0,767
{L3+F} or {L6+F}->{L6+F}
End
Title: Re: Axe Q&A
Post by: Darl181 on February 20, 2011, 02:16:38 am
I thought the buffers were in bits though...that would work anyway?
Title: Re: Axe Q&A
Post by: Builderboy on February 20, 2011, 02:17:17 am
yep, OR works with the bits for us :)
Title: Re: Axe Q&A
Post by: Darl181 on February 20, 2011, 02:19:14 am
Ah cool.
So that does xor, or is it like Pt-on?
Title: Re: Axe Q&A
Post by: Deep Toaster on February 20, 2011, 10:51:36 am
Pt-On is OR, Pt-Change is XOR.

Pt-Off is really a mask, hence why it's so much bigger.
Title: Re: Axe Q&A
Post by: squidgetx on February 20, 2011, 12:20:42 pm
Also wow, this topic grew fast...

I knew that it would ;)
Title: Re: Axe Q&A
Post by: Happybobjr on February 20, 2011, 12:24:23 pm
Who all are working on axioms?
Seems like a good place to ask :)

Edit: also,  Can axe programs have already assembled programs be included in them?
Title: Re: Axe Q&A
Post by: Deep Toaster on February 20, 2011, 02:35:04 pm
Edit: also,  Can axe programs have already assembled programs be included in them?

You can call them, but you can't import them, unfortunately.
Title: Re: Axe Q&A
Post by: ralphdspam on February 21, 2011, 02:15:40 pm
How do you get the appv token?  It is not in the vars or catalog.
Title: Re: Axe Q&A
Post by: turiqwalrus on February 21, 2011, 02:16:13 pm
press 2nd + 8
Title: Re: Axe Q&A
Post by: ralphdspam on February 21, 2011, 02:18:59 pm
Thanks.  :)
Someone should make a list of Axe specific tokens and the key strokes to get them.  It would make learning Axe easier for n00bs like me.
Title: Re: Axe Q&A
Post by: Deep Toaster on February 21, 2011, 02:21:21 pm
They should all be in the commands list page, except maybe for those three (var, appv, and grp).
Title: Re: Axe Q&A
Post by: turiqwalrus on February 21, 2011, 02:22:03 pm
the axe command list thread does. under many commands, the shortcut to reach them is listed.
Title: Re: Axe Q&A
Post by: ee511 on February 21, 2011, 04:00:42 pm
Where in RAM is the calculator's internal clock stored?  (something like getTime or startTmr)
Title: Re: Axe Q&A
Post by: Darl181 on February 23, 2011, 02:16:05 am
I remember finding a port in calcsys...I'd need to find it again

Is it any faster to read from a list than an appvar?
I think it should be the same speed b/c they're both just pointers, but just to be sure ;)
Title: Re: Axe Q&A
Post by: ralphdspam on February 23, 2011, 03:25:49 am
the axe command list thread does. under many commands, the shortcut to reach them is listed.

Oh, I should have checked.  When I can't find a token, I start to panic and run around in circles.  :P
Title: Re: Axe Q&A
Post by: squidgetx on February 23, 2011, 07:18:11 am
Darl, if by list you mean a free RAM location (ie L1, L2, etc) then yes it is slightly faster and smaller to do that over a variable-location appvar. The difference isn't huge though, only a few cycles.
Title: Re: Axe Q&A
Post by: aeTIos on February 23, 2011, 08:04:05 am
I've tried many times to create a level editor, but it wont work... Is there a way to do it?
(there is, as i've seen many around here)
Title: Re: Axe Q&A
Post by: Deep Toaster on February 23, 2011, 09:14:41 am
Darl, if by list you mean a free RAM location (ie L1, L2, etc) then yes it is slightly faster and smaller to do that over a variable-location appvar. The difference isn't huge though, only a few cycles.

L1 is a fixed pointer (it's pretty much just a number), while GetCalc("appvNAME") involves an OS routine to find that location.

But if you're talking about actual lists, as in OS lists, it's just data, so it'd be the same as reading from an appvar. The difference is that an OS list is stored as an array of floating-point numbers, so if you want to read the actual numbers, it would be a lot slower than reading single bytes.
Title: Re: Axe Q&A
Post by: Darl181 on February 23, 2011, 11:15:36 am
I mean, after it has a pointer.  Would {L1+A} be any faster than {P+A} ?
What I'm trying to do is see if I can get levels out of the limiting size of L1 and have them read directly from an appvar and/or the archive.
Title: Re: Axe Q&A
Post by: Builderboy on February 23, 2011, 11:28:01 am
{L1+A} is slightly faster than {P+A}, but not by a lot, only 6 cycles.
Title: Re: Axe Q&A
Post by: Darl181 on February 23, 2011, 11:46:55 am
Ok, thanks :D
I'm guessing reading from the archive takes longer, but is it a large slowdown?
Title: Re: Axe Q&A
Post by: Builderboy on February 23, 2011, 11:49:13 am
Yeah it is slower, but unfortunately it seems Runners documentation is lacking in that regards D:
Title: Re: Axe Q&A
Post by: Runer112 on February 23, 2011, 11:58:09 am
A helpful optimization hint: always put constants last!

{P+A}: 11 bytes, 61 cycles
{L1+A}: 11 bytes, 55 cycles
{A+L1}: 10 bytes, 51 cycles


Ok, thanks :D
I'm guessing reading from the archive takes longer, but is it a large slowdown?

Reading a single byte or word from the archive is about 30 times slower; it takes about 1600 cycles. If your program regularly reads from a relatively small amount of archived data at any one time, like the tilemap for a level, the best thing to do is Copy() the data from archive into RAM somewhere and read it from there. You can then access this data from RAM much more quickly during gameplay, and copy new level data from archive as necessary.


Yeah it is slower, but unfortunately it seems Runners documentation is lacking in that regards D:

You are right, I have not documented the speed of the archive reading commands. Reading from the archive uses OS routines so it is a bit harder to calculate the speed of, as I can't look at the code and simply calculate speed based on the instructions that make it up.
Title: Re: Axe Q&A
Post by: Deep Toaster on February 24, 2011, 09:45:57 am
A helpful optimization hint: always put constants last!

{P+A}: 11 bytes, 61 cycles
{L1+A}: 11 bytes, 55 cycles
{A+L1}: 10 bytes, 51 cycles

And so always put variables before constants :) (L1 is a constant. It's just a number. {L1} is exactly the same to Axe as {86EC}.)
Title: Re: Axe Q&A
Post by: squidgetx on February 26, 2011, 11:02:27 am
Added a quick FAQ/random answers section to the first post for things that I see many users having problems with :P
Title: Re: Axe Q&A
Post by: aeTIos on March 02, 2011, 05:23:42 am
How can you display a variable number like 12.34?
I mean, if Ans is 12.34, how to display that?
Title: Re: Axe Q&A
Post by: Deep Toaster on March 02, 2011, 05:38:15 am
Axe doesn't support decimals, so you can't unless you wrote your own routine to display a 9-byte floating point number. It's possible but gets a bit complicated because of the way a float is structured: the first byte determines if it's real or complex and if it's positive or negative, the second byte subtracted by $80 (128) gives you the exponent (floating points are always in scientific notation), and the other seven bytes are the digits.

Each nibble in the last seven bytes is a digit. The first nibble in particular is the digit to the left of the decimal when written in scientific notation (the first non-zero digit from the left). Each digit is stored as a decimal digit, so the full 9-byte floating point for "1337" is

Code: (Floating point format) [Select]
00 83 13 37 00 00 00 00 00

(all in hex).
Title: Re: Axe Q&A
Post by: aeTIos on March 02, 2011, 07:00:04 am
Okay, thanks.
Another question: How can you use the Parser hook in an Axe program (In other words, what is the hex opcode?)

EDIT:
I used memkit to get the name of a program in L1. How do I now do a GetCalc( for that program? I can't get a "prgm" before the name :S
Title: Re: Axe Q&A
Post by: Deep Toaster on March 02, 2011, 09:24:38 am
Okay, thanks.
Another question: How can you use the Parser hook in an Axe program (In other words, what is the hex opcode?)

First of all, the hook needs to be stored in the form of hex. Just grab the opcodes for your parser hook and stick it in your program as data (stored in []→GDB1 or something similar). Make sure it starts with the byte $83, because that's what the OS uses as a signal for the start of a hook.

Then you need to copy the code somewhere in RAM where it won't be destroyed easily. A good choice is smallEditRAM, so to use it do Copy(GDB1,E90D3,LEN) where LEN is the length of your parser code.

To actually start the hook, use this code:

Code: (Axe) [Select]
:E90D3
:Asm(EF2650)

That's all you need to do. To disable the hook, it's simply

Code: (Axe) [Select]
:Asm(EF2950)

You'll have to write the hook code yourself in ASM, of course. See http://wikiti.brandonw.net/index.php?title=83Plus:Hooks:9BAC for information on how to use this hook.

EDIT:
I used memkit to get the name of a program in L1. How do I now do a GetCalc( for that program? I can't get a "prgm" before the name :S

Just store a 5 in before the program name and it should work.
Title: Re: Axe Q&A
Post by: aeTIos on March 02, 2011, 09:27:06 am
:w00t: Thanx for this!
+1
I think this can be useful for making Shells...
(hint hint :P)

So, how can you run a Basic prog with this?
Or am I missing the point with this hook? :x
Title: Re: Axe Q&A
Post by: ee511 on March 02, 2011, 08:44:42 pm
is there a way to turn an "input" string of tokens into a normal string? in this particular situation, I want the user to be able to input a file name (for use with getcalc()
Title: Re: Axe Q&A
Post by: Deep Toaster on March 02, 2011, 08:46:46 pm
Capital letters and numbers are the same between token format and character format, so you don't have to worry about that there :)
Title: Re: Axe Q&A
Post by: ee511 on March 02, 2011, 09:22:49 pm
so i can treat it as a string? is there any way to store the output of "input" directly to a string?
Title: Re: Axe Q&A
Post by: Binder News on March 02, 2011, 10:10:02 pm
It is already stored as a string. If you do:
Code: [Select]
input->S
it will ask for input, and store a pointer to that input in S. S can then be used as a string.
Title: Re: Axe Q&A
Post by: Deep Toaster on March 02, 2011, 11:15:17 pm
so i can treat it as a string? is there any way to store the output of "input" directly to a string?

Of course. As long as the input is only capital letters and numbers, it should show up perfectly. If the user inputs other characters, though, they may show up as weird characters.
Title: Re: Axe Q&A
Post by: willrandship on March 02, 2011, 11:19:35 pm
He doesn't understand non-OO langs yet. Aka, teach the concept of pointers.
Title: Re: Axe Q&A
Post by: Deep Toaster on March 02, 2011, 11:34:17 pm
Ah. Well here's a breakdown:

When you get as low-level as Axe, everything's stored as individual bytes. A variable (A-Z and theta) is 2 bytes (in Axe), a floating-poiint number is 9 bytes, etc. Your calculator has 32,768 bytes of RAM for you to work with. They're just stored one after the other, 32,768 in a row. There's no way to tell the bytes apart, so that's why each one is given an address.

Think of it this way: You've got 32,768 houses lined up in a row that look exactly identical. What really matters is what's in each house, which could be a number from 0 to 255. How do you tell them apart? By using addresses. Each address is a number between $8000 and $FFFF, and they all point to a distinct hou-- er, byte. Hence addresses are called pointers :)

You can literally store anything here, since they're all numbers anyway. You could represent a string as a sequence of bytes; maybe one particular string you need starts at address $C38E and runs to $C390 (three bytes). $C38E would be the pointer that points to the string.

And then since each pointer is just a number, you can store that in a variable too. The input simply asks the user to input a string, stores it to a string structure somewhere in RAM, and returns the pointer to (address of) the string. That's all that input→P does: it gets an input string, stores it somewhere, then stores the pointer to the string into variable P. You can then display the contents of that string by calling Disp P, for example.

(This is because Disp takes a pointer as an argument and displays the string starting at that address. When you do something like "HELLO"→GDB0:Disp GDB0, all that Axe does is stick the bytes of the string "HELLO" into the program memory and define GDB0 as the address of that string.)

Hope that helps (and hope that clears some stuff up for other people, too)!
Title: Re: Axe Q&A
Post by: willrandship on March 02, 2011, 11:36:04 pm
Quote from: Deep Thought
Ah. Well here's a breakdown:

When you get as low-level as Axe, everything's stored as individual bytes. A variable (A-Z and theta) is 2 bytes (in Axe), a floating-poiint number is 9 bytes, etc. Your calculator has 32,768 bytes of RAM for you to work with. They're just stored one after the other, 32,768 in a row. There's no way to tell the bytes apart, so that's why each one is given an address.

Think of it this way: You've got 32,768 houses lined up in a row that look exactly identical. What really matters is what's in each house, which could be a number from 0 to 255. How do you tell them apart? By using addresses. Each address is a number between $8000 and $FFFF, and they all point to a distinct hou-- er, byte. Hence addresses are called pointers :)

You can literally store anything here, since they're all numbers anyway. You could represent a string as a sequence of bytes; maybe one particular string you need starts at address $C38E and runs to $C390 (three bytes). $C38E would be the pointer that points to the string.

And then since each pointer is just a number, you can store that in a variable too. The input simply asks the user to input a string, stores it to a string structure somewhere in RAM, and returns the pointer to (address of) the string. That's all that input→P does: it gets an input string, stores it somewhere, then stores the pointer to the string into variable P. You can then display the contents of that string by calling Disp P, for example.

(This is because Disp takes a pointer as an argument and displays the string starting at that address. When you do something like "HELLO"→GDB0:Disp GDB0, all that Axe does is stick the bytes of the string "HELLO" into the program memory and define GDB0 as the address of that string.)

Hope that helps (and hope that clears some stuff up for other people, too)!
I love pointers sometimes, hate them others. It's useful, and annoying (especially when using disp :P), but mostly useful :P
Title: Re: Axe Q&A
Post by: Deep Toaster on March 02, 2011, 11:39:01 pm
I like pointers better than references. With pointers you can do anything :D
Title: Re: Axe Q&A
Post by: willrandship on March 03, 2011, 12:01:16 am
The nice thing about C++ is you can do both :D
Title: Re: Axe Q&A
Post by: Binder News on March 03, 2011, 12:21:05 am
The nice thing about Java is that because almost everything is a pointer (primitives aren't), you don't need both.:)
Title: Re: Axe Q&A
Post by: ralphdspam on March 03, 2011, 01:11:36 am
Thanks, Deep Thought!
I wish someone explained it like that when I was first learning Axe.
Title: Re: Axe Q&A
Post by: ee511 on March 03, 2011, 08:43:25 am
but how would you store the "input" data to a string? would it be
input->p
copy(p,str1,length(p))
Title: Re: Axe Q&A
Post by: Freyaday on March 03, 2011, 10:45:19 am
How many buffers are there, and how do I use them in Axe?
Title: Re: Axe Q&A
Post by: aeTIos on March 03, 2011, 02:53:46 pm
phew... I think 3: L3, L5,L6
L3: I think this is the backbuffer
L5: this is the buffer of the homescreen (where the chars are stored)
L6: this is the buffer for the screen.

You can call the buffers by using the list variables.

Title: Re: Axe Q&A
Post by: Runer112 on March 03, 2011, 02:55:10 pm
but how would you store the "input" data to a string? would it be
input->p
copy(p,str1,length(p))


Why would you need to copy the string somewhere else? It already exists in RAM at the location pointed to by the output of input. Also, copying the string to a static pointer could be dangerous if the string that the user entered is larger than the space you allocated for the Str1 pointer.


How many buffers are there, and how do I use them in Axe?

There are 3 buffers built into the operating system. L6 points to one, which is usually treated as the "main" buffer by programmers because that's the buffer the OS treats as the main buffer. This is also the buffer used with Axe's DispGraph by default. Another buffer is pointed to by L3, which Axe treats as the second buffer for grayscale images. Axe also has the option to use most of its drawing commands to this buffer in addition to the normal L6, which could be useful whether or not you're using grayscale. The final buffer allocated by the OS is L1, the last 54 bytes of which are used by the Axe variables by default. However, you can redefine the variables to point somewhere else and then use this whole buffer. And of course, you can always define your own buffers by just allocating 768 bytes of RAM for one. You could do that by adding 768 bytes of data to your program or making a 768-byte appvar.
Title: Re: Axe Q&A
Post by: aeTIos on March 03, 2011, 02:56:36 pm
I was partially right, I cee...
Title: Re: Axe Q&A
Post by: NinjaKnight on March 03, 2011, 11:45:05 pm
How do I create a program with GetCalc(? I can create appvars just fine, but trying to create a program crashes. (It really just freezes, actually.)
Title: Re: Axe Q&A
Post by: Darl181 on March 04, 2011, 02:32:47 am
And speaking of getcalc, did the syntax change by any chance?  b/c in a side program I'm writing GetCalc(Str1,384)→P only works something like a third of the time.
Yes, Str1 is defined, as appvLightSav.

How do I create a program with GetCalc(? I can create appvars just fine, but trying to create a program crashes. (It really just freezes, actually.)
Don't you get the prgm token from the catalog, then type the name of the desired program?
Title: Re: Axe Q&A
Post by: Deep Toaster on March 04, 2011, 09:09:50 am
How do I create a program with GetCalc(? I can create appvars just fine, but trying to create a program crashes. (It really just freezes, actually.)
Don't you get the prgm token from the catalog, then type the name of the desired program?

Actually it's under the PRGM menu (PRGM I/O > D:prgm), but yeah, it's the same process as making an appvar. I noticed there are occasionally some issues when the program already exists, however, so try deleting the program before creating it again with GetCalc(.
Title: Re: Axe Q&A
Post by: Darl181 on March 04, 2011, 10:39:04 am
Already tried that, providing that's what DelVar Str1 does :P
Title: Re: Axe Q&A
Post by: Camdenmil on March 08, 2011, 09:26:08 pm
Are there any places in axe that goto will cause a memory leak. Does it cause any damage to use goto in a subroutine to go to another part of a subroutine, as long as it ends up returning.
Title: Re: Axe Q&A
Post by: Michael_Lee on March 08, 2011, 09:40:13 pm
I don't think that there are any memory leaks, so long as you make sure you never do anything like goto from a subroutine to your main code.

If you use 'goto' to jump to another subroutine, then as long as you return, there won't be any damage.  As a general rule of thumb, you have to match each 'sub(' with a 'Return'.

Can somebody else confirm?
Title: Re: Axe Q&A
Post by: Happybobjr on March 08, 2011, 10:17:52 pm
I don't think that there are any memory leaks, so long as you make sure you never do anything like goto from a subroutine to your main code.

If you use 'goto' to jump to another subroutine, then as long as you return, there won't be any damage.  As a general rule of thumb, you have to match each 'sub(' with a 'Return'.

Can somebody else confirm?
I can.
Title: Re: Axe Q&A
Post by: willrandship on March 08, 2011, 10:36:58 pm
I prefer to never use goto, only sub. I like to program in loops anyways. It keeps you safe from that issue (which is prevalent in many languages) as well.

Anyone ever consider the idea of axe libraries? Not axioms, which are more asm, but basically having a collection of programs that use sub() or similar to use the same easy, optimized code in all your progs. I like the idea myself, and it works in current Axe, you just tend to run out of symbols fairly often :P
Title: Re: Axe Q&A
Post by: Happybobjr on March 08, 2011, 10:41:55 pm
Such as an menu rutine. I have a pretty sexy one right now. (you won't see it until i release demo of my secret project >:D )
Title: Re: Axe Q&A
Post by: willrandship on March 08, 2011, 10:43:09 pm
ooh!

Is it customizable?
Title: Re: Axe Q&A
Post by: Happybobjr on March 08, 2011, 10:50:48 pm
ooh!

Is it customizable?
Naturally. ;)
Hint: It is a utility to help a person program in axe ;)
Title: Re: Axe Q&A
Post by: willrandship on March 08, 2011, 11:20:01 pm
aah. I was referring more to something akin to stdio.h in C, a lib, not a program.
Title: Re: Axe Q&A
Post by: Freyaday on March 11, 2011, 10:56:09 am
How do I use interrupts?
Title: Re: Axe Q&A
Post by: Deep Toaster on March 11, 2011, 10:57:19 am
Put your interrupt code in a label, then start it up with fnInt(LBL,SPEED) where SPEED is the frequency you want the interrupt to run at. It's all in the commands.html file :)
Title: Re: Axe Q&A
Post by: aeTIos on March 12, 2011, 10:05:01 am
:w00t: nice!!!! I didnt know that. would be useful!!!

How to do animated tiles? Its for my mario game
Title: Re: Axe Q&A
Post by: Deep Toaster on March 12, 2011, 10:11:11 am
Treat the tiles as independent moving objects like with bullets and enemies (put them in an array) and redraw them every frame.
Title: Re: Axe Q&A
Post by: Camdenmil on March 13, 2011, 01:00:27 am
I'm trying to make an axiom and tried assembling memkit to make sure I had everything set up right. When I try to use it, axe just says bad axiom, how to I get axe to accept it?
Title: Re: Axe Q&A
Post by: Runer112 on March 13, 2011, 01:06:48 am
A few things can cause the bad axiom error. My first guess would be that what you put in the #Axiom() statement is causing the problem. What you enter inside that has to be the name of the axiom as it is present on the calculator, with correct capitalization and without a prefix like "appv". For instance, for the already compiled version of MemKit that was distributed in the Axe 0.5.0 zip file, you would use #Axiom(MemKit). The only other thing I can think of is that the axiom wasn't compiled correctly. If my first suggestion as to what the error could be isn't the problem, if you post the program your compiler produced I can check the second possible problem.
Title: Re: Axe Q&A
Post by: NinjaKnight on March 14, 2011, 09:04:24 pm
How would I use inData to look up a getKey value? I tried to do something like

inData(getKey,Data(1,2,3,4,etc))

but it returns random values for anything not in Data(.
Title: Re: Axe Q&A
Post by: ztrumpet on March 14, 2011, 09:07:26 pm
Try this: http://ourl.ca/4129/114828
I hope it helps. :)
Title: Re: Axe Q&A
Post by: Runer112 on March 14, 2011, 09:13:59 pm
You would want to do something like the following:

inData(getKey+1,Data(KEYCODE+1,ANOTHER_KEYCODE+1,ETC+1,0))

The inData() relies on a value of zero to specify the end of the data to search. Without a specified end of the data to search, the routine would just keep searching all of RAM until it finds the value, which is probably not what you want. This is why I added a 0 as the final byte of data. And because zero is used to specify the end, having zeros anywhere else would cause problems. This is why I then appended +1's to getKey and to all the keycodes you want to search for, so the value to search for or the match value will never be zero.


EDIT: I'll look at the inData() routine though and see if there's a way to avoid this necessity of adding 1s, so maybe with a future release of Axe you won't have to worry about it. But you'll always need the final data byte to be a 0.
Title: Re: Axe Q&A
Post by: squidgetx on March 16, 2011, 03:15:39 pm
You could also do something like..
Code: [Select]
If getKey
inData(,Data(stuff,0))->wherever
End
A bit easier to deal with, but idk how optimized it is

Edit: I think it may be a couple of bytes larger :P. Oh well.
Title: Re: Axe Q&A
Post by: Happybobjr on March 17, 2011, 06:13:15 pm
How can I use archive variables in the form of a file  (note that when I am done, it will be about 30k bytes large, so don't say unarchive it... :P)

I am currently using, for a different prgm...
Code: [Select]
:!If getcalc("appvarSPREDIT",Y1)
:Return
:End
...
:Copy(Y1+C,L1,64)
:For(F,0,3)
:Pt-On(F^2*8,F/2*8,F*8+L1)
:Pt-On(F^2*8,F/2*8,F*8+L1+32)r
:End
:DispGraphrr
I would like to remove the Copy( part of it though.
Any ideas?
Title: Re: Axe Q&A
Post by: Deep Toaster on March 17, 2011, 08:59:26 pm
Well, you can't edit it while it's in the archive, that's for sure.

As for reading, I may be completely off on this, but does {Y1} not work? A "file" in Axe is really just a pointer to the archived location (with the page switched).

But if that program is 30 KB large, you might still run into problems if it's in the archive. The archive is split into 16-KB pages, and you can't access two pages at a time; if you need to access data that goes beyond a page, you need to switch to that page. I don't know how Axe does this, or if it switches pages for you at all, so you'd definitely have problems working with something that large. Any chance you could use smaller chunks?
Title: Re: Axe Q&A
Post by: Happybobjr on March 17, 2011, 09:15:35 pm
The documentations says I can.
I probably will have the total size be under 20K But I still am unsure.
I could separate into chucks yes, but preferably not.  It doesn't make a diff at this point.

{Y1} works completly...
The problem is that I am using a drawing command
Pt-on(_,_,_)   can better be described  Pt-on(_,_,{_})
Since the {} is implied in the command, it would look like this {F*8+C+{Y1}}
If I were to use Pt-on(_,_, F*8+C+Y1)  It throws an error about filetype misuse.
Sorry if I am not clear.

Edit: would this be coincided a bug?
Title: Re: Axe Q&A
Post by: Deep Toaster on March 17, 2011, 09:21:52 pm
Pt-on(_,_,_)   can better be described  Pt-on(_,_,{_})
Since the {} is implied in the command, it would look like this {F*8+C+{Y1}}
If I were to use Pt-on(_,_, F*8+C+Y1)  It throws an error about filetype misuse.

Just to clear something else up: {} is never optional. PTR returns an address (a number), while {PTR} returns the byte stored at the address. Pt-On( always takes an address as an argument.

Anyway, about your problem, Pt-on(X,Y,F*8+C+{Y1}) seems to work fine?
Title: Re: Axe Q&A
Post by: Happybobjr on March 17, 2011, 09:26:06 pm
/me curses as he tries it.

Caused an instant ram clear when run.

Edit: Did you try it on calc
Title: Re: Axe Q&A
Post by: Deep Toaster on March 17, 2011, 09:34:20 pm
/me curses as he tries it.

Caused an instant ram clear when run.

Edit: Did you try it on calc

Whoops, I didn't actually try running it, sorry.

Wait, is the sprite itself stored in Y1? If so why would you put braces around it?

But apparently if you take the braces off it gives you a file misuse error... I think that would count as a bug :)
Title: Re: Axe Q&A
Post by: Happybobjr on March 17, 2011, 09:38:53 pm
oh, ok.  thank you for your help.
If it would have been in my ram (Y1)  I would be screwed in losing all my data :/
But i suppose the whole point of this was that it wasn't in my ram :P.

Title: Re: Axe Q&A
Post by: squidgetx on March 18, 2011, 07:17:57 am
You can't use files in sprite commands. You'd best stick with copying to L1 for now :P
Title: Re: Axe Q&A
Post by: Yeong on March 18, 2011, 07:20:03 am
I's just wondering, but when I tried to create appvar, there was something else called "u" created too along with my appvar "MYAPPVAR". When I tried to delete that "u", it caused instant calc reset. What is happening?
Title: Re: Axe Q&A
Post by: aeTIos on March 18, 2011, 08:45:37 am
lol you screwed up something in RAM, that 'u' is the 'u' token (2nd 7). its an equation variable, you can access it via mode-> seq (the graphing mode)
this happens very often when you screw something up by creating appvars/ using strings. just dont do anything with it, or delete them and watch your calc crashing :)
Title: Re: Axe Q&A
Post by: Deep Toaster on March 18, 2011, 09:15:59 am
I's just wondering, but when I tried to create appvar, there was something else called "u" created too along with my appvar "MYAPPVAR". When I tried to delete that "u", it caused instant calc reset. What is happening?

Oh, I know what that is -- I've done that too. You made an appvar, then stored too far. For example, you might have created a 32-byte appvar and copied 33 bytes of data to it. That 33rd byte would affect the size bytes of the next variable in RAM, which happened to be the equation u. The equation "u" is an OS variable that always exists, but it doesn't show up unless something happens to it.
Title: Re: Axe Q&A
Post by: Yeong on March 18, 2011, 08:06:06 pm
Oh so it happened because of overstoring...
Thanks for the help  ;D
Title: Re: Axe Q&A
Post by: Darl181 on March 19, 2011, 03:52:49 pm
Ok, I'm looking for an optimized way to store >19 strings, not compression-wise but so they can easily be recalled like numbers after a static pointer of something.
What I'm using it for is if you move a cursor, the text changes depending on what a number specified by the selected item is.

The strings are of different lengths, btw
Title: Re: Axe Q&A
Post by: ztrumpet on March 19, 2011, 04:07:40 pm
Darl, you could try something like this:

:"Test"->Str1
:"Try"
:[00]
:"Moar"
:[00]
:"Text"
:[00]
:"Trial"
:[00]
:
:3->A  // Spot in Data, so it would be "Text" if A=3
:
:Str1->C
:For(B,1,A)
:length(C)+C+1->C
:End
Now C should point to your string. ;D

Good luck! :)
Title: Re: Axe Q&A
Post by: Darl181 on March 19, 2011, 04:19:56 pm
How does that work?  IIRC, length is zero-terminated, I know that much :P
Also, is there a way to skip numbers, because not every number is associated with a place-able tile.
Title: Re: Axe Q&A
Post by: Deep Toaster on March 19, 2011, 04:20:30 pm
Code: (Axe) [Select]
:"This"→Str00
:"is"→Str01
:"a"→Str02
:"test."→Str03
:Data(Str00ⁿ,Str01ⁿ,Str02ⁿ,Str03ⁿ)→Str0        . The pointers to each string
:Disp {A*2+Str0}ⁿ        . Where A is the index of the string

is pretty fast and can easily be modified in-program.
Title: Re: Axe Q&A
Post by: Darl181 on March 19, 2011, 05:35:34 pm
Code: (Axe) [Select]
:"This"→Str00
:"is"→Str01
:"a"→Str02
:"test."→Str03
:Data(Str00ⁿ,Str01ⁿ,Str02ⁿ,Str03ⁿ)→Str0        . The pointers to each string
:Disp {A*2+Str0}ⁿ        . Where A is the index of the string

is pretty fast and can easily be modified in-program.
what are the n's?  I just looked through the catalog and didn't see anything like that...unless that's the ° or r ?
Title: Re: Axe Q&A
Post by: Deep Toaster on March 19, 2011, 09:00:28 pm
Oh, sorry, those are rs. I just couldn't get them into the quote box.
Title: Re: Axe Q&A
Post by: Happybobjr on March 19, 2011, 09:10:44 pm
Code: (Axe) [Select]
:"This"→Str00
:"is"→Str01
:"a"→Str02
:"test."→Str03
:Data(Str00ⁿ,Str01ⁿ,Str02ⁿ,Str03ⁿ)→Str0        . The pointers to each string
:Disp {A*2+Str0}ⁿ        . Where A is the index of the string

is pretty fast and can easily be modified in-program.
You saved me almost 3000 bytes!
I love you <3
Title: Re: Axe Q&A
Post by: Deep Toaster on March 19, 2011, 09:19:50 pm
Code: (Axe) [Select]
:"This"→Str00
:"is"→Str01
:"a"→Str02
:"test."→Str03
:Data(Str00ⁿ,Str01ⁿ,Str02ⁿ,Str03ⁿ)→Str0        . The pointers to each string
:Disp {A*2+Str0}ⁿ        . Where A is the index of the string

is pretty fast and can easily be modified in-program.
You saved me almost 3000 bytes!
I love you <3

/me backs away <_<

You're welcome, lol.

It's also great for keeping track of levels (that's what I'm using it for). All you do is subtract two adjacent numbers, and it gives you the length of that piece of data.
Title: Re: Axe Q&A
Post by: Darl181 on March 20, 2011, 02:04:18 am
That works with Text( too, right?
Title: Re: Axe Q&A
Post by: Deep Toaster on March 20, 2011, 09:57:04 am
Well, the point is that {A*2+Str0}r gets the pointer to the Ath string in the list. You can do anything you want with that pointer, so yeah, Text(, Output(, Pt-On( (for whatever reason ._.), anything.
Title: Re: Axe Q&A
Post by: Darl181 on March 20, 2011, 04:23:17 pm
Can it be made to work with three-byte pointers, i.e. Str103?
How would I do the data( for that?
Title: Re: Axe Q&A
Post by: Runer112 on March 20, 2011, 04:43:18 pm
What would you need a 3-byte pointer for? Axe operates on 2-byte numbers anyway so I'm not sure how you would use a 3-byte value. The only thing that uses 3-byte values is archive reading with the Y0-Y9 "files."
Title: Re: Axe Q&A
Post by: Darl181 on March 20, 2011, 04:59:11 pm
That would be to reduce the limit of vars possible, but I can get around that anyway w/ letters.
Title: Re: Axe Q&A
Post by: Runer112 on March 20, 2011, 05:04:14 pm
Oh, you mean a 3-character static pointer. Yeah, you can use them. And the name of a static pointer contributes nothing to the compiled program size. The only quirk about static pointers is that, when adding a pointer to string data in the form of:
Code: [Select]
:"String here"→Str___A zero byte is added to the end of the data automatically.
Title: Re: Axe Q&A
Post by: Darl181 on March 20, 2011, 05:07:55 pm
Code: (Axe) [Select]
:"This"→Str000
:"is"→Str001
:"a"→Str002
:"test."→Str003
:Data(Str000r,Str001r,Str002r,Str003r)→Str0        . The pointers to each string
:Disp {A*2+Str0}r        . Where A is the index of the string
So, it would work with that Data( line?
Title: Re: Axe Q&A
Post by: Happybobjr on March 20, 2011, 05:14:02 pm
when did 3 char. strings become available???
Title: Re: Axe Q&A
Post by: Runer112 on March 20, 2011, 05:15:00 pm
Yes, that would work. The one thing you have to watch out for when using that method though is the 150 pointer/label limit, which you could hit pretty fast that way. Unfortunately, there isn't really a way around this except for giving the first string a pointer, not giving pointers to every other string, and manually calculating the pointers for all the other strings based on the pointer to the first string. Like:

Code: (Axe) [Select]
:"This"→Str00
:"is"[00]
:"a"[00]
:"test."[00]
:Data(Str00+0ʳ,Str00+5ʳ,Str00+8ʳ,Str00+10ʳ)→Str0
:Disp {A*2+Str0}ʳ

That could be pretty tedious, and getting anything wrong or changing one string would require you to adjust the data for every other string after it. You'll have to wait for Axe v2 to get around the 150 pointer limit. :P
Title: Re: Axe Q&A
Post by: Darl181 on March 20, 2011, 05:18:46 pm
Ok, I'll just stick to letters then :P
Thanks anyway
Title: Re: Axe Q&A
Post by: Happybobjr on March 20, 2011, 05:19:37 pm
Oh crap!!!
And to think i was going to have each of the 151 Pokemon's name in a string...
/me hugs runner.
How can I easily add a 0 byte to a string or what ever, 151 times?
Title: Re: Axe Q&A
Post by: Runer112 on March 20, 2011, 05:25:00 pm
Happybobjr, I think your best bet for storing the names of Pokemon would be to make each name a constant size. As far as I can see, the names of Pokemon in the Generation I games were limited to 10 characters, so you could make each name be 10 bytes long. To display the names, you would have to copy the 10 bytes to another location in RAM where you can add an 11th byte, a zero in case the name was 10 characters long and didn't have a terminating zero already.
Title: Re: Axe Q&A
Post by: Happybobjr on March 20, 2011, 05:46:11 pm
Thank you.  Wish I didn't have to waste all those bytes though...
Title: Re: Axe Q&A
Post by: Deep Toaster on March 20, 2011, 06:47:31 pm
Thank you.  Wish I didn't have to waste all those bytes though...

Actually, there's another way. Watch:

Thanks to Axe auto-opting static pointers,

Code: (Axe) [Select]
:"Bulbasaur"→Str000
:"Vsaur"
:[00]
:"Chucknorrissaur"
:[00]
:Data(Str000ʳ,Str000+10ʳ,Str000+16ʳ)

is exactly the same (in terms of size, time, code, etc.) as

Code: (Axe) [Select]
:"Bulbasaur"→Str000
:"Vsaur"→Str001
:"Chucknorrissaur"→Str002
:Data(Str000ⁿ,Str001,Str002)

except that it doesn't use up two more of those 151 pointers you're allowed to have. That solve your problem? :)
Title: Re: Axe Q&A
Post by: Runer112 on March 20, 2011, 06:52:31 pm
Not sure why I decided to use offsets instead of static pointers in my example. Changed that. But yeah, that's pretty much what I suggested to Darl181 earlier. Although where are these offsets coming from? The +19 and the +6?


EDIT: Side note, why do you use the ⁿ symbol in your code Deep Thought? Why not use the ʳ that I use? :P
Title: Re: Axe Q&A
Post by: Deep Toaster on March 20, 2011, 07:02:57 pm
Although where are these offsets coming from? The +19 and the +6?

That's supposed to be a 10 and a 16 :P Not typing well today.

EDIT: Side note, why do you use the ⁿ symbol in your code Deep Thought? Why not use the ʳ that I use? :P

Because I couldn't find that character anymore for some reason. How'd you find it?

EDIT: Got it: http://www.fileformat.info/info/unicode/char/02b3/index.htm
Title: Re: Axe Q&A
Post by: Runer112 on March 20, 2011, 07:11:10 pm
I think I just spent a long time searching around http://www.fileformat.info/info/unicode/index.htm (http://www.fileformat.info/info/unicode/index.htm). I ended up compiling a file with a bunch of useful calculator symbols:

Code: [Select]

˪
L₁
L₂
L₃
L₄
L₅
L₆
r₁
r₂
r₃
r₄
r₅
r₆
Y₁
Y₂
Y₃
Y₄
Y₅
Y₆
Y₇
Y₈
Y₉
Y₀
°
∆List(



·


⁻¹
²
³
√(
³√(
ˣ√


ʳ
►Dec
►Frac
►Char
►DMS
►Tok
θ
α
β
γ
Δ
δ
ε
λ
μ
π
ρ
Σ
Φ
Ω

χ
σ
τ



ß
ˣ




×


ȳ

Title: Re: Axe Q&A
Post by: Deep Toaster on March 20, 2011, 07:30:46 pm
Thank you! That is awesome!

And speaking of turtles, ALT+26 gives you the store arrow → :) It's really useful.

EDIT:

Code: [Select]


When do you use that? ???
Title: Re: Axe Q&A
Post by: Darl181 on March 20, 2011, 07:50:55 pm
That's one of the tokens, iirc
I'm guessing he meant ► like ►Dec
Title: Re: Axe Q&A
Post by: jnesselr on March 20, 2011, 07:54:15 pm
So, while I was trying to do Alt+26 (Which doesn't work for me, btw), I accidentally did Alt+2602 and got ☂.  I then tried Alt+2603 and got ☃. :D

EDIT: Wow, way to get uber-ninja'd.  I even did my own ninja, me-thinks!
Title: Re: Axe Q&A
Post by: Runer112 on March 20, 2011, 07:54:31 pm
EDIT:

Code: [Select]


When do you use that? ???

Pretty much never. But it's a valid character/token. ASCII CFh, token BBEDh.
Title: Re: Axe Q&A
Post by: ztrumpet on March 20, 2011, 08:38:01 pm
Not to shove my routine down anyone's throat, but I believe it's still a very good option:
Spoiler For Quote:
Darl, you could try something like this:

:"Test"->Str1
:"Try"
:[00]
:"Moar"
:[00]
:"Text"
:[00]
:"Trial"
:[00]
:
:3->A  // Spot in Data, so it would be "Text" if A=3
:
:Str1->C
:For(B,1,A)
:length(C)+C+1->C
:End
Now C should point to your string. ;D

Good luck! :)
The way I suggested would just take a little bit more time on fetching the string (but not much, since Axe is so fast), plus it's easier to code and smaller than the massive Data() structure if you are using many strings.  My routine works by looping through the array and jumping from null-byte to null-byte with the length command and returning with a pointer to the string.

Please note: I think Runer and Deep's routines are great, it just seems like mine was just disregarded for easier to understand routines, so I figured I'd bring it to the limelight again. ;)
Title: Re: Axe Q&A
Post by: Runer112 on March 20, 2011, 09:52:22 pm
Yeah, that method would work. Let me compare and contrast the available methods so we can find which one would be best in which scenarios. I'll also optimize your routine while I'm at it. :P


LUT Method

Code: (Example) [Select]
.Data
"This"→Str000
"is"→Str001
"a"→Str002
"test."→Str003
Data(Str000ʳ,Str001ʳ,Str002ʳ,Str003ʳ)→GDB0

.Example call
5sub(SF)

.String fetching routine
Lbl SF
  {*2+GDB0}ʳ
Return







  • Size: 2n+10 bytes, n=number of strings; smaller for n≤18
  • Speed: 83 cycles; always faster
  • Symbols used: n+2 for easy method, 3 for manual string length counting method

Final verdict: The fastest solution, and the smallest for a low number of strings. As the number of strings goes up, it will become larger than the search method and will consume many symbols, requiring you to start manually calculating the length of strings to put in the LUT. Suggested if speed is important or if using a low number of strings (≤18).
       
Search Method

Code: (Example) [Select]
.Data
"This"→Str0
"is"[00]
"a"[00]
"test."[00]


.Example call
5sub(SF)

.String fetching routine
Lbl SF
  →r₁
  Str0
  Goto SF0
  While 1
    -1→r₁
    length(r₂)+r₂+1
    Lbl SF0
    →r₂
  End!If r₁
  r₂
Return

  • Size: 47 bytes; smaller for n>18
  • Speed: 21m+157n+129, m=number of bytes searched, n=string index; always slower
  • Symbols used: 3

Final verdict: Uses only 3 symbols without requiring the programmer to manually enter the length of the strings in a table. A smaller solution for a larger number of strings, but will quickly become many times slower than the LUT method with more and longer strings (e.g. getting the pointer to the name of a first generation Pokemon might take on average 20,000 cycles). Suggested if speed is not important for a larger number of strings (>18) or if you are tight on symbols and do not want to tally up the string lengths to put in a LUT.
Title: Re: Axe Q&A
Post by: Builderboy on March 20, 2011, 10:05:03 pm
There is another advantage to the LUT method, you can have data that contains zeros :) Also, if you do the manual tally method, you can leave off the terminating zero's that Axe automatically adds when you do ->Symbol, saving a byte for every entry.
Title: Re: Axe Q&A
Post by: Runer112 on March 20, 2011, 10:27:27 pm
Well they might want all the terminating zeros on the strings. But if not, you can always avoid that by doing something like the following:

Code: [Select]
.Will have a terminating zero
"Test"→Str0
.Will not have a terminating zero
"Test"[]→Str0
Title: Re: Axe Q&A
Post by: calc84maniac on March 20, 2011, 10:45:50 pm
You can also use length-prefixed data, for a more optimized search loop. Removes a lot of unnecessary calls to length().
Code: [Select]
.Data
[]→Str0
[04]"This"
[02]"is"
[01]"a"
[05]"test."


.Example call
2sub(SF)

.String fetching routine
Lbl SF
  →r₁
  Str0
  Goto SF0
  While 1
    -1→r₁
    r₂+{}+1
    Lbl SF0
    →r₂
  End!If r₁
  r₂
Return
Of course, you can't display such strings with the built-in routines. It's fairly simple to display char-by-char in a loop though.
Title: Re: Axe Q&A
Post by: Camdenmil on March 27, 2011, 04:54:46 pm
Does anyone have a small routine to convert a hex string to a number.
Title: Re: Axe Q&A
Post by: ztrumpet on March 27, 2011, 06:32:55 pm
Might this work for you?
http://ourl.ca/4129/124589
Good luck. :)
Title: Re: Axe Q&A
Post by: Runer112 on March 27, 2011, 06:35:00 pm
I think he wants conversion the other way around. :P
Title: Re: Axe Q&A
Post by: Camdenmil on March 27, 2011, 11:25:21 pm
Yeah, I'm getting user input as a hex string and I need to convert the string to a number I can use in the program.
Title: Re: Axe Q&A
Post by: Freyaday on March 28, 2011, 02:46:57 am
What about something that converts a sprite into a string?
Title: Re: Axe Q&A
Post by: Camdenmil on March 28, 2011, 11:54:13 pm
I think the routines ztrumpet suggested could be used for sprite to hex. Just convert each byte to a hex character, there's probably a faster/smaller way floating around here somewhere.

http://ourl.ca/4129/124589
Title: Re: Axe Q&A
Post by: Happybobjr on March 29, 2011, 09:54:12 pm
Ho could I decompile a program into hex and run it in an axe program?
(prgmALCDFIX) :P
Title: Re: Axe Q&A
Post by: Deep Toaster on March 29, 2011, 11:25:21 pm
Code: (Axe) [Select]
.UNSQUISH
5->{L1}^^r
"0123456789ABCDEF"->GDB0
ClrHome
Disp "To unsquish:    >prgm"
!If sub(INP)
Disp "Program not found!"
Return
End
->P
Disp "Save as:",[i],">prgm"
If sub(INP)
Disp "Program exists! Overwrite? (y/n)>"
Input ->R
!If {}-'Y'
Goto YES
End
!If -|E20
Goto YES
End
Return
End
Lbl YES
GetCalc(L1,{P-2}^^r->S*2)->Q
For(I,0,S-1)
{P+I}->J^16sub(GC)->{J/16sub(GC)->{I*2+Q}+1}
End
Disp "Program has beensuccessfully    unsquished."
Return
Lbl GC
{+GDB0}
Return
Lbl INP
Fill(0->{(L1+1)},7)
Copy(Input ->I,L1+1,{I-2}^^r)
GetCalc(L1)
Return

Remember to remove the BB6D in the beginning of the program.

Pointers may be thrown off, though, so make sure you deal with fixed addresses appropriately.
Title: Re: Axe Q&A
Post by: Freyaday on April 01, 2011, 12:27:26 am
How do I use Indata?
Title: Re: Axe Q&A
Post by: ztrumpet on April 01, 2011, 09:52:34 am
Here's the first tutorial ever published on the subject: http://ourl.ca/4129/114828
There may be more tucked around in places, but that was the real eye-opening one. :)
Title: Re: Axe Q&A
Post by: Darl181 on April 02, 2011, 02:41:59 am
If you include a program in axe source, like ↓
Code: [Select]
:.PROGRAM
:[stuff]
:prgmPROGRAM2
:[more stuff]
Does Axe put a return after the sub-program, or do you have to put in the ret manually?
Title: Re: Axe Q&A
Post by: Deep Toaster on April 02, 2011, 09:52:33 am
Nope. It's included exactly as if the subprogram code were in the main program.
Title: Re: Axe Q&A
Post by: Munchor on April 18, 2011, 07:12:20 am
I love multiple programs in Axe, I just tried them.

I have an Axe question:

Code: [Select]
.POP
prgmPOPSTUP
prgmGKSRC
If pxl-Test(X,Y+5)
Return
End
Pt-On(20,55,[FFFFFFFFFFFFFFFF
Pt-On(X,Y,[FF42241800000000
End

1. I know I can use a Rect( instead of the Pxl-On(20,55. Is it faster/smaller?
2. The sprite at X,Y is 4 pixels tall, so why won't pxl-Test(Y+5) execute? The program is never closed, that if is never checked.
3. The prgmGKSRC is getKey movement for sprite X,Y (like If getKey(1):Y+2->Y) and I move the sprite all over the screen right ABOVE THE OTHER SPRITE, and still the program never closes.

What am I doing wrong?
Title: Re: Axe Q&A
Post by: Builderboy on April 18, 2011, 09:38:27 am
1) Yes

2) If its 4 pixels tall, that means starting at the top left corner, there is a black pixel at Y+0,Y+1,Y+2, and Y+3, and there is white everywhere else.  Y+5 will *not* trigger.

3) Return does not close the program if you are inside a subroutine, are you inside a subroutine?
Title: Re: Axe Q&A
Post by: Munchor on April 18, 2011, 09:45:20 am
1) Yes

2) If its 4 pixels tall, that means starting at the top left corner, there is a black pixel at Y+0,Y+1,Y+2, and Y+3, and there is white everywhere else.  Y+5 will *not* trigger.

3) Return does not close the program if you are inside a subroutine, are you inside a subroutine?

1) Thanks
2) I tried 4, didn't work
3) I am not in a subroutine and I changed 'Return' to other stuff, nothing worked.

Perhaps I should post all the code:

POPSRC
Code: [Select]
.POP
prgmPOPSTUP
Repeat getKey(15)
prgmGKSRC
If pxl-Test(X,Y+4)
Return
End
Pt-On(20,55,[FFFFFFFFFFFFFFFF
Pt-On(X,Y,[FF42241800000000
End

prgmPOPSTUP
Code: [Select]
..SETUP
Asm(EF4645EF7045FDCB00AE

prgmGKSRC
Code: [Select]
..GETKEYS
DispGraphClrDraw
If getKey(1) and (Y<60
Y+2->Y
End
If getKey(2) and (X>0
X-2->X
End
If getKey(3) and (X<88
X+2->X
If getKey(4) and (Y>0
Y-2->Y
End
Title: Re: Axe Q&A
Post by: Builderboy on April 18, 2011, 09:54:48 am
Could it be that you are clearing the screen right before you pixel test, and that there hasn't been anything drawn to the screen yet?  Try doing the test after the sprite displays.  And also, stick with +4, I didn't realize you were trying to detect the *other* sprite :)
Title: Re: Axe Q&A
Post by: Munchor on April 18, 2011, 10:16:38 am
Could it be that you are clearing the screen right before you pixel test, and that there hasn't been anything drawn to the screen yet?  Try doing the test after the sprite displays.  And also, stick with +4, I didn't realize you were trying to detect the *other* sprite :)

It worked perfectly! My program just became a lot bigger though :S

Old size: 497 bytes
New size: 528 bytes

The difference between old and new is a a or:

Old program:
Code: [Select]
If pxl-Test(X+3,Y+5
Return
End

New program:
Code: [Select]
If pxl-Test(X+4,Y+5 or ((pxl-Test(X+3,Y+5
Return
End

The 'or' is big in Assembly in seems.
Title: Re: Axe Q&A
Post by: Builderboy on April 18, 2011, 10:22:39 am
Why did you add the second pixel test command?
Title: Re: Axe Q&A
Post by: Munchor on April 18, 2011, 10:24:46 am
Why did you add the second pixel test command?

My sprite is like:

MySprite:
 .db $FF
 .db %01000010
 .db %00100100
 .db %00011000
...


So it's like an arrow, but it's point  has two sprites. I'll change the sprite though =D
Title: Re: Axe Q&A
Post by: Builderboy on April 18, 2011, 10:26:48 am
Oh gotcha, well glad you got it working :D
Title: Re: Axe Q&A
Post by: Munchor on April 18, 2011, 10:36:15 am
Also, I'm pretty sure that Rect( is much bigger than Pt-On(.

Size with Pt-On:
Pt-On(20,56,[FFFFFFFFFFFFFFFF
542 bytes
Size with Rect(:
Rect(20,56,8,8
650 bytes

Also, it's bigger, in this case, does it also mean it's faster?
Title: Re: Axe Q&A
Post by: Builderboy on April 18, 2011, 10:44:55 am
Actually Rect() is smaller, but since you still have the other Pt-On in your program, it still has the Pt-On subroutine and is *also* adding in the Rect() subroutine, making it larger.  Also note that size doesn't necessarily have any correlation with speed, but smaller is in general faster.
Title: Re: Axe Q&A
Post by: Munchor on April 18, 2011, 10:48:31 am
Actually Rect() is smaller, but since you still have the other Pt-On in your program, it still has the Pt-On subroutine and is *also* adding in the Rect() subroutine, making it larger.  Also note that size doesn't necessarily have any correlation with speed, but smaller is in general faster.

It only uses the defines/subroutines it needs, smart Quigibo.

rand^n generates a number from 0 to n? Including 0 and n? Or from 0 to n+1? Wondering.

Also, can I have a Lbl B and a variable B in the same program and they won't be confused?
Title: Re: Axe Q&A
Post by: Builderboy on April 18, 2011, 10:57:11 am
rand^n generates a random number from 0 to N-1.

and you can have Lbl B and variable B and the program will have no issue :)
Title: Re: Axe Q&A
Post by: Munchor on April 18, 2011, 11:01:26 am
rand^n generates a random number from 0 to N-1.

and you can have Lbl B and variable B and the program will have no issue :)

How to make border-line rectangles? I really need this.
Title: Re: Axe Q&A
Post by: Builderboy on April 18, 2011, 11:15:27 am
You can use rectI() (inverted rectangle) to make all sorts of fun effects.  To make a white rectangle with black borders, simply draw a black rectangle and then an inverted one that is inside of it
Title: Re: Axe Q&A
Post by: Munchor on April 18, 2011, 11:36:42 am
You can use rectI() (inverted rectangle) to make all sorts of fun effects.  To make a white rectangle with black borders, simply draw a black rectangle and then an inverted one that is inside of it

Sweet, thanks.

Thanks a lot Builderboy, all this help has been wonderful.

I have a new question.

This isn't really an Axe question, this is more like problem solving.

I have a part of the screen where the main sprite can't enter (X>=78 and Y<=9). So, if X>=71 or Y<=9 all the getkeys should be disabled (71 cos the sprite is 7 pixels width).

I tried this:

Code: [Select]
If Y>=9 or (X<=71
//All getKeys code
End

However, when Y=9 or X=71, the sprite can't move.

So I though, when Y=9 and X=71, it can only walk left or down. It didn't work.

How can I only let the player move when (Y<=9 and X>=71) is false. I have to let the user move but not inside the forbidden area.

Thanks
Title: Re: Axe Q&A
Post by: aeTIos on April 18, 2011, 11:39:27 am
You should use:
Code: [Select]
if getkey(keycode)                         
If x/y (any) != (max/min for x/y value)   ; choose the fitting one
x/y(any) +/-1 ->x/y                           ; idem
end
Title: Re: Axe Q&A
Post by: Munchor on April 18, 2011, 12:06:25 pm
You should use:
Code: [Select]
if getkey(keycode)                         
If x/y (any) != (max/min for x/y value)   ; choose the fitting one
x/y(any) +/-1 ->x/y                           ; idem
end

Code: [Select]
If getKey(1)
If X/Y != 71/9
X/Y +1 ->X/Y
End

I don't get the third line at all. What is +1/-1. Also, is there a way to make it global?

Thanks
Title: Re: Axe Q&A
Post by: Munchor on April 19, 2011, 04:55:17 am
*Double Post Alert*

I have another question, how can I have sprite so that if it touches the left and right border of the screen it appears on the other side.
For now it disappears for a while and then reappears on the other side after a while, but it's X/Y positions are crazy and it don't work.

Thanks.
Title: Re: Axe Q&A
Post by: aeTIos on April 19, 2011, 08:08:26 am
This code works. I made and tested it myself 1 minute ago on your request ;)
Code: [Select]
.SCROLLJP ;Scroll-Jump :P
0→X
20→Y
Repeat getkey(15)
ClrDraw
If getKey(2)
X+1→X    ;that cool arrow do you type with left-alt + 2 6
End
If getKey(3)
X-1→X
End
Pt-On(X,Y,[FF818181818181FF])
If X>88
Pt-On(X-96,Y,[FF818181818181FF])
End
If X=96
0→X
End
If X=666
Disp "The Game",imaginary i,"Never Gonna Give You up"   ; Could not resist xD
If X≤65535
Pt-On(X+96,Y,[FF818181818181FF])
End
If X=65528
88→X
End
DispGraph
End
Return
Just change the sprites to the ones you need.
Title: Re: Axe Q&A
Post by: Munchor on April 19, 2011, 10:59:52 am
My getkeys file:

Code: [Select]
:..GETKEYS
:DispGraphClrDraw
:If getKey(1) and (Y<59
:Y+2→Y
:End
:If getKey(2)
:X-2→X
:End
:If X>88
:Pt-On(X-96,Y,[FE44381000000000
:End
:If X=96
:0→X
:End
:If getKey(3)
:X+2→X
:End
:If X≤65535
:Pt-On(X+96,Y,[FE44381000000000
:End
:If X=65528
:88→X
:End
:If getKey(4) and (Y>8
:Y-2→Y
:End

My screenshot:

(http://img.removedfromgame.com/imgs/0-PoPError.gif)
Title: Re: Axe Q&A
Post by: aeTIos on April 19, 2011, 11:02:16 am
Try to find the bug with "text(0,0,X>Dec.
Title: Re: Axe Q&A
Post by: Munchor on April 19, 2011, 11:09:13 am
@aeTIos: I don't need it to be smooth =D

Here's my new and working code:

Code: [Select]
:..GETKEYS
:DispGraphClrDraw
:If getKey(1) and (Y<59
:Y+2→Y
:End
:If getKey(2)
:X-2→X
:End
:If X=96
:0→X
:End
:If getKey(3)
:X+2→X
:End
:If X=0
:88→X
:End
:If getKey(4) and (Y>8
:Y-2→Y
:End
Title: Re: Axe Q&A
Post by: Munchor on April 24, 2011, 09:33:27 am
I know how rand works more or less...

Code: [Select]
rand^n
.THIS GENERATES A RANDOM NUMBER UP TO N-1

So how to get numbers between n and m? I know we can do it with rand somehow, but can't remember how.
Title: Re: Axe Q&A
Post by: Deep Toaster on April 24, 2011, 11:06:38 am
Think about it:

rand generates a number between 0 and 255. When you do a modulus (rand^12, for instance), you're taking that number between 0 and 255 and taking its remainder when it's divided by 12, which is always between 0 and 11. It's all just arithmetic after that.

If you add thirty (rand^12+30), you get a number between 30 and 41. If you multiply by two instead (rand^12*2), you get a number between 0 and 22 that's a multiple of 2. No fancy tricks; it's all just math.
Title: Re: Axe Q&A
Post by: Happybobjr on April 24, 2011, 03:59:29 pm
Think about it:

rand generates a number between 0 and 255.

Rand returns a 2 byte number i think,
Title: Re: Axe Q&A
Post by: Michael_Lee on April 24, 2011, 06:06:32 pm
Code: [Select]
Lbl RAN
    ...
    Returns a random number from r1 to r2, excluding r2.
    r3 is the increment.
    ...
    r2-r1/r3
    rand^
    *r3+r1
Return

I think that works?
Title: Re: Axe Q&A
Post by: calc84maniac on April 24, 2011, 06:12:18 pm
Code: [Select]
Lbl RAN
    ...
    Returns a random number from r1 to r2, excluding r2.
    r3 is the increment.
    ...
    r2-r1/r3
    rand^
    *r3+r1
Return

I think that works?
You'll have to put the second argument to the ^ operator after it (the omission trick only works for the first argument of an operator)
rand^(r2-r1/r3)
Title: Re: Axe Q&A
Post by: Munchor on April 25, 2011, 06:04:10 am
Thanks calc84maniac and Michael Lee :) I found another way of doing it though.

I have a new question... How to handle 2 byte highscores with appvars?

I just need to store 1 value in the appvar, but it is over 255.

I have the appvar created with 2 bytes of size, they are all I need.

I tried 500->{T+1} and 500->{T} and then to display it tried Text(X,Y,{T}>Dec and Text(X,Y,{T+1}>Dec.

What should I do?
Title: Re: Axe Q&A
Post by: Binder News on April 25, 2011, 06:40:33 am
add an r at the end of the {}s
500->{T}r
Text(X,Y,{T}r>Dec
Title: Re: Axe Q&A
Post by: Munchor on April 25, 2011, 06:42:54 am
Thx binder, graduados gás already told me thogh. Thx :)
Title: Re: Axe Q&A
Post by: Binder News on April 25, 2011, 06:43:18 am
Welcome :)
Title: Re: Axe Q&A
Post by: Munchor on April 28, 2011, 09:31:38 am
I have a new question :$

How to check if a number in a variable is divisible by another number.

Let's say I have the var B and want to check if it is divisible by 5. Axe is an integer language, so can that be done?
Title: Re: Axe Q&A
Post by: Freyaday on April 28, 2011, 09:35:49 am
!If A^B
Title: Re: Axe Q&A
Post by: Deep Toaster on April 28, 2011, 09:49:44 am
Yep, remember ^ (modulus) is just the remainder after division, so if it's zero, there is no remainder (it's divisible).
Title: Re: Axe Q&A
Post by: Munchor on April 28, 2011, 09:55:42 am
Yep, remember ^ (modulus) is just the remainder after division, so if it's zero, there is no remainder (it's divisible).

I had no idea there was such an operator. Thanks :D
Title: Re: Axe Q&A
Post by: Munchor on April 29, 2011, 02:16:02 pm
I have a new question:

Code: [Select]
:If X=88 or (Y=62 or (X=65532 or (pxl-Test(X-1,Y+2 or (pxl-Test(X-1,Y+3 or (pxl-Test(X-1,Y+4 or (pxl-Test(X,Y+1 or (pxl-Test(X,Y+5 or (pxl-Test(X+1,Y+1 or (pxl-Test(X+1,Y+6 or (pxl-Test(X+2,Y or (pxl-Test(X+2,Y+7 or (pxl-Test(X+3,Y+8 or (pxl-Test(X+4,Y-1 or pxl-Test(X+4,Y+8 or (pxl-Test(X+5,Y or (pxl-Test(X+5,Y+8 or (pxl-Test(X+6,Y or (pxl-Test(X+6,Y+8 or (pxl-Test(X+7,Y+8 or (pxl-Test(X+8,Y or (pxl-Test(X+8,Y+3 or (pxl-Test(X+8,Y+4 or (pxl-Test(X+8,Y+5 or (pxl-Test(X+8,Y+7
First of all, does this error have any problem? It doesn't seem to be working as I want it to. Is there a problem with parentheses or having too many pxl-Test.

Code: [Select]
:If X=88 or (Y=62 or (X=65533 or (pxl-Test(X+8,Y) or (pxl-Test(X+8,Y+7 or (pxl-Test(X+6,Y+1 or (pxl-Test(X+2,Y or (pxl-Test(X+7,Y+8 or (pxl-Test(X+7,Y-1 or (pxl-Test(X+2,Y+7 or (pxl-Test(X+3,Y+8 or (pxl-Test(X+4,Y+8 or (pxl-Test(X,Y+3
This works more or less.

Thanks, any help is appreciated.
Title: Re: Axe Q&A
Post by: aeTIos on April 29, 2011, 02:20:11 pm
You should write a for loop for the pxl-test.
Title: Re: Axe Q&A
Post by: Munchor on April 29, 2011, 02:20:52 pm
You should write a for loop for the pxl-test.

That's actually a very good idea, I never thought of it. Thanks.
Title: Re: Axe Q&A
Post by: aeTIos on April 29, 2011, 02:22:43 pm
You should do it this way:
Code: [Select]
0->Z
For(A,0,7
Z+Pxl-Test(X,Y+A)->Z
End
If Z!=0
blah blah
end
Title: Re: Axe Q&A
Post by: Munchor on April 29, 2011, 02:26:46 pm
Code: [Select]
:If X=88 or (Y=62 or (X=65532 or (pxl-Test(X-1,Y+2 or (pxl-Test(X-1,Y+3 or (pxl-Test(X-1,Y+4 or (pxl-Test(X,Y+1 or (pxl-Test(X,Y+5 or (pxl-Test(X+1,Y+1 or (pxl-Test(X+1,Y+6 or (pxl-Test(X+2,Y or (pxl-Test(X+2,Y+7 or (pxl-Test(X+3,Y+8 or (pxl-Test(X+4,Y-1 or pxl-Test(X+4,Y+8 or (pxl-Test(X+5,Y or (pxl-Test(X+5,Y+8 or (pxl-Test(X+6,Y or (pxl-Test(X+6,Y+8 or (pxl-Test(X+7,Y+8 or (pxl-Test(X+8,Y or (pxl-Test(X+8,Y+3 or (pxl-Test(X+8,Y+4 or (pxl-Test(X+8,Y+5 or (pxl-Test(X+8,Y+7
(http://img.removedfromgame.com/imgs/coptersprite.png) (http://img.removedfromgame.com/imgs/coptersprite.png)

I have that image (click and enlarge to view the pixels). The code above is supposed to make a pixel collision for copter. any ideas?

Title: Re: Axe Q&A
Post by: aeTIos on April 29, 2011, 02:28:17 pm
Do it the way I posted. this is a cheap, but good way for collission checking.
Title: Re: Axe Q&A
Post by: Runer112 on April 29, 2011, 03:11:15 pm
Here is a pretty small method for pixel-based sprite collision checking. Whereas your previous combination of 22 hard-coded pxl-Test() checks weighs in at a whopping 620 bytes, this routine is 99 bytes. As you might expect from this loop-based approach, though, it trades size for speed. Whereas your previous method would take about 9,000 cycles, this method will take about 26,000 cycles for your sprite.

Another great thing about this approach is that it, instead of using a large list of X and Y offsets for each pixel that you want to check, it simply reads from a sprite. This means that this routine can be adapted to any sprite by simply changing the Pic0 reference to point to your 8x8 sprite. However, this also means that is slowed down additionally by checking pixels inside of the sprite, which you may not need to check. You can get rid of these unnecessary checks by having this routine read from an 8x8 sprite only containing the collision points (probably the border). If you added another 8x8 sprite containing the 22 collision points you used in your hardcoded method, you would be adding 8 bytes for the sprite but subtracting about 6,000 cycles from the collision checking.

Code: (99 bytes, ~26,000 cycles if no collision (based on Scout's helicopter sprite)) [Select]
8
While 1
  -1→T    .that's a subtraction sign
  {+Pic0}→U
  8
  While 1
    -1→S
    If U^2
      If pxl-Test(X+S,Y+T)
        Goto COL
      End
    End
    U/2→U
  End!If S
End!If T
Title: Re: Axe Q&A
Post by: Munchor on April 29, 2011, 03:13:31 pm
Runer, I wish I got anything of what you're doing there. I would like to try it anyway, where should I place it, before or after displaying the sprite?
Title: Re: Axe Q&A
Post by: Runer112 on April 29, 2011, 03:14:43 pm
You would want to have this code execute when your sprite is not currently on screen, so before you draw it. Note that if a collision is detected, this routine would jump to a Lbl COL, so you would need to add this as your collision handler.
Title: Re: Axe Q&A
Post by: Munchor on April 29, 2011, 03:15:44 pm
I have a new question. How to order things in the loop so that everything works fine?

Code: [Select]
Repeat getKey(15)
...
End

I need to draw the tunnel, draw the sprite, check for collision and shift the screen

Here's the code to draw the sprite:

Code: [Select]
Pt-On(X,Y,Pic1
DispGraph
Pt-Change(X,Y,Pic1

I'm doing this:

Code: [Select]
DRAW TUNNEL
Pt-On(X,Y,Pic1
DispGraph
Pt-Change(X,Y,Pic1
COLLISION
SHIFT SCREEN

Shift Screen = Horizontal - (3 times)

However, it's not working. How should I make it?

I also tried:

Code: [Select]
DRAW TUNNEL
COLLISIONS
SHIFT SCREEN
Pt-On(X,Y,Pic1
DispGraph
Pt-Change(X,Y,Pic1

My problem is handling collisions because of shifting the screen (for example, X collision checking doesn't work because I shift the screen).

So, what order do you recommend?
Title: Re: Axe Q&A
Post by: Binder News on April 30, 2011, 10:42:28 am
First, you should try to use only one of Pt-On, Pt-Change, or Pt-Off if possible, as each is a couple hundred bytes in size.
Second, try:
Code: [Select]
DRAW TUNNEL
COLLISIONS
Pt-Change(X,Y,Pic1
DispGraph
Pt-Change(X,Y,Pic1
SHIFT SCREEN
Title: Re: Axe Q&A
Post by: calc84maniac on April 30, 2011, 10:20:04 pm
The problem with your previous code was that you needed to close the parentheses of each pxl-Test. In your code, you were performing the or on the second argument of the pxl-Test, not the result of the pxl-Test.
Title: Re: Axe Q&A
Post by: Deep Toaster on May 01, 2011, 12:28:52 am
In Axe it's always a good idea to close your parentheses and braces. Leaving them off doesn't save any bytes from the compiled version, and code can become more messy and harder to understand and optimize.

If you're used to the way it is in BASIC, just make sure you close them before an operation that deals with something other than the immediate value.
Title: Re: Axe Q&A
Post by: Munchor on May 01, 2011, 05:33:51 am
:crazy: I actually knew it didn't save any bytes in the compiled version, but didn't know it could affect my code. I'll change it and thanks, thanks thanks so much!
Title: Re: Axe Q&A
Post by: collechess on May 13, 2011, 05:33:31 pm
Why doesn't Text(x,y,"(text)") work?
Title: Re: Axe Q&A
Post by: Runer112 on May 13, 2011, 05:35:40 pm
If that's your exact code, the coordinates are a problem. The lowercase x and y mean nothing to Axe and will generate errors.

If, however, you just forgot to capitalize them in this post, I don't know what the problem is. Can you elaborate on "doesn't work"?
Title: Re: Axe Q&A
Post by: FinaleTI on May 13, 2011, 05:37:14 pm
It may also be that he's calling a DispGraph routine and hasn't called Fix 5 yet, which would make it appear to not work.
Title: Re: Axe Q&A
Post by: collechess on May 13, 2011, 05:38:33 pm
sorry, in the actual code x and y are numbers
its really Text(20,50,"(text)")
Title: Re: Axe Q&A
Post by: Ashbad on May 13, 2011, 05:39:25 pm
What exactly happens? ;) It's working fine for me on 0.5.1.
Title: Re: Axe Q&A
Post by: collechess on May 13, 2011, 05:40:25 pm
When it compiles it returns an error: argument
Title: Re: Axe Q&A
Post by: Happybobjr on May 13, 2011, 05:44:55 pm
Which Text command are you using?  Remember, there are two of them.
Title: Re: Axe Q&A
Post by: Ashbad on May 13, 2011, 05:45:48 pm
good point, Happybob ;)

Use the one with the parenthesis right after the Text (it looks like Text( in the catalog, not Text with a space)
Title: Re: Axe Q&A
Post by: Runer112 on May 13, 2011, 05:46:40 pm
ERR: ARGUMENT means that you called a command with too few or too many arguments. However, it should be impossible to call Text() with too many or too few arguments, which would suggest that something else is causing the problem. Try compiling the program with the source code in RAM, and when you get the error, press PRGM. Where does the program editor scroll to?
Title: Re: Axe Q&A
Post by: collechess on May 13, 2011, 05:52:03 pm
It scrolls to the comma between the x and y coordinates in the text command
Text(20,20,"(text)")
Title: Re: Axe Q&A
Post by: Ashbad on May 13, 2011, 06:01:58 pm
can you post your source via TI-Connect or tiLP?
Title: Re: Axe Q&A
Post by: collechess on May 13, 2011, 06:05:05 pm
I have the program on my computer, but how do you access the source code?
Title: Re: Axe Q&A
Post by: Ashbad on May 13, 2011, 06:06:12 pm
Can you send the source program over?  If so, can you attach it here?

The source one is the one where you type stuff in - the executable is the one you run.  Send the one that you type into ;)
Title: Re: Axe Q&A
Post by: collechess on May 13, 2011, 06:09:00 pm
here it is
Title: Re: Axe Q&A
Post by: Ashbad on May 13, 2011, 06:11:31 pm
Here you go, in SC 2.5 format, a la Ashbad:

Code: [Select]
:.VOYAGERX
:Fix 5
:DelVar A
:0→A→S
:Full
:ClrHome
:ClrDraw
:31→Y
:[0000000000000000]→Pic0
:[10587EFD7E581000]→Pic1
:[F87E1B79791B7EF8]→Pic3
:[387C7EFFFFFF7E30]→Pic2
:[1E3F1EFDFD1E3F1E]→Pic4
:0→T
:DrawF (20,20,"VOYAGER X")
:
:
:
:
:
:Repeat T>0
:If getKey(34)
:1→T
:End
:If getKey(26)
:2→T
:End
:If getKey(18)
:3→T
:End
:End
:ClrDraw
:Repeat getKey(15)
:S+1→S
:Text(0,,S►Dec)
:Pt-Off(0,Y,Pic0)
:Horizontal -
:Horizontal -
:If pxl-Test(5,Y) or pxl-Test(6,Y+1) or pxl-Test(8,Y+2) or pxl-Test(9,Y+3) or pxl-Test(8,Y+4) or pxl-Test(6,Y+5) or pxl-Test(5,Y+6)
:If S>H
:S→H
:End
:Return
:End
:If pxl-Test(4,Y) or pxl-Test(5,Y+1) or pxl-Test(7,Y+2) or pxl-Test(8,Y+3) or pxl-Test(7,Y+4) or pxl-Test(5,Y+5) or pxl-Test(4,Y+6)
:If S>H
:S→H
:End
:Return
:End
:If rand^14-T=1
:rand^45+9→B
:Pt-Off(86,B,Pic2)
:End
:If getKey(4)
:If Y≥11
:Y-T→Y
:End
:End
:If getKey(1)
:If Y≤52
:Y+T→Y
:End
:End
:If T=2
:Pt-On(0,Y,Pic1)
:End
:If T=1
:Pt-On(0,Y,Pic3)
:End
:If T=3
:Pt-On(0,Y,Pic4)
:End
:DispGraph
:End
Title: Re: Axe Q&A
Post by: collechess on May 13, 2011, 06:15:25 pm
Wheres DrawF ???
Title: Re: Axe Q&A
Post by: Deep Toaster on May 13, 2011, 06:26:51 pm
You're using Text (with a space after it; 2ND + [DRAW] > 6:Text ), not Text( (with a parenthesis after; 2ND + [DRAW] > 0:Text(). There is a difference.

Basically, Text( lets you set the coordinates before displaying text, while Text uses the current coordinates and takes only a single argument (the string).
Title: Re: Axe Q&A
Post by: collechess on May 13, 2011, 06:30:39 pm
Thanks, I've been working on this for like two hours.
Title: Re: Axe Q&A
Post by: Deep Toaster on May 13, 2011, 06:45:07 pm
Np, just remember that there are some commands that look like what you want, but you should always check the commands list (http://ourl.ca/8409/154963) just in case :)
Title: Re: Axe Q&A
Post by: Munchor on May 14, 2011, 04:26:47 am
Press [2ND] and then [PRGM] and then press [KEY_UP] and that's the Text( you need :)
Title: Re: Axe Q&A
Post by: Quigibo on May 14, 2011, 06:41:42 am
Basically, Text( lets you set the coordinates before displaying text, while Text uses the current coordinates and takes only a single argument (the string).

Actually, you can have as many arguments as you want for Text also, it just skips having to specify the X and Y value since you've presumably already set that.  The idea is to be exactly the same mapping from "Disp " and "Output(" to "Text " and "Text(".  The first set is for the cursor and the second set is for the pen.
Title: Re: Axe Q&A
Post by: Anima on May 14, 2011, 07:15:30 am
1. There is an error, when I want to compile one of my programs:
Quote
1st Pass: 19%
ERR: BAD SYMBOL
Source code:
Code: [Select]
.KEY
While 1
getKey->K
If K=25:Then
Disp getKey(K)
End:End
What's wrong?

Title: Re: Axe Q&A
Post by: Aichi on May 14, 2011, 07:19:16 am
"If" needs this format in Axe:
If (condition)
(code)
End
Title: Re: Axe Q&A
Post by: Deep Toaster on May 14, 2011, 09:27:36 am
There are no Thens in Axe. Everything else is fine.
Title: Re: Axe Q&A
Post by: Freyaday on May 16, 2011, 04:29:26 pm
Is there any way to create, like, a four-screen drawing space and have the space to which the screen is mapped be freely roaming, like scrolling through a zoomed-in pic on a computer?
Title: Re: Axe Q&A
Post by: Binder News on May 16, 2011, 05:01:47 pm
There is a way in asm. I think it would be possible, just somewhat slow (or maybe not), and kinda tricky.
Title: Re: Axe Q&A
Post by: Runer112 on May 16, 2011, 05:05:18 pm
In pure Axe it would be very difficult. The least of your problems would be copying a rectangular part of the image to the screen. A much larger obstacle would be that every Axe drawing and buffer command depends on using a 96x64 buffer, whereas it sounds like you would be using a 192x128 buffer.
Title: Re: Axe Q&A
Post by: Freyaday on May 16, 2011, 05:14:59 pm
Well, the idea here is that it would copy a 96x64 portion of it to a buffer, where it could then be used
Title: Re: Axe Q&A
Post by: Builderboy on May 16, 2011, 05:16:54 pm
The tricky thing tho is that it's not just as simple as copying a 94x64 portion of a buffer, because we have bit shifting to account for, and that makes things quite a bit more difficult, since every single byte of the buffer needs to be shifted a certain amount and overflow into other buffers and such.
Title: Re: Axe Q&A
Post by: Binder News on May 16, 2011, 05:18:02 pm
And it would be really slow. But, couldn't you use the BufCpy bcall?
Title: Re: Axe Q&A
Post by: Freyaday on May 16, 2011, 05:19:50 pm
I'm trying to figure out what makes this so complicated. Could someone please elucidate?
Title: Re: Axe Q&A
Post by: Builderboy on May 16, 2011, 05:20:23 pm
Mmmm i don't think it would be *terribly* slow.  It would run at about the same speed as copying a 768 byte chunk of memory, and doing 4 (average) screenshifts.  The variable amount of screenshifts though would make the engine a bit unreliable in terms of speed though, it could run really fast on some locations and really slow on others
Title: Re: Axe Q&A
Post by: Binder News on May 16, 2011, 05:20:58 pm
Exactly.
Title: Re: Axe Q&A
Post by: Deep Toaster on May 16, 2011, 06:31:54 pm
Remember that 8 bits are stored in a byte, so what if you wanted to display a 96x64 box starting at (4,4)? Then you'd have to shift each byte 4 bits left so you have a nice box to copy to the screen.
Title: Re: Axe Q&A
Post by: Freyaday on May 16, 2011, 06:41:45 pm
It took me a few reads to understand that, but thanks DT, it makes sense now.
Also, about the widely variable speed, Quigibo managed to get all the Pt- commands to always run at the same speed, right?
Title: Re: Axe Q&A
Post by: Anima on May 17, 2011, 10:00:42 am
How can you change the content/entry/data of a AppVar with Axe?
Title: Re: Axe Q&A
Post by: Binder News on May 17, 2011, 10:54:17 am
Not to be mean, but have you read the documentation? It's the PDF file in the zip.
Title: Re: Axe Q&A
Post by: Munchor on May 17, 2011, 02:00:01 pm
I have a question, what is the x256 mode and can someone give me an example?

I have no idea of how to use it and would like to learn, can I have a sample? Thanks
Title: Re: Axe Q&A
Post by: BrownyTCat on May 17, 2011, 02:29:12 pm
I have a question, what is the x256 mode and can someone give me an example?

I have no idea of how to use it and would like to learn, can I have a sample? Thanks
256 mode?? Whoa.
Title: Re: Axe Q&A
Post by: Builderboy on May 17, 2011, 03:41:51 pm
Its not a mode, but more like a style of programming that gives you more precision.  The idea is that you multiply your position variables by 256 to give you a screen that is 256 times as big (and consequently has a *lot* more possible positions and a lot more precision) and then when you display your sprites you "zoom" back out by dividing by 256.

This has been written about a lot, I'm sure there has got to be a tutorial about this somewhere, or at least a more in depth explanation.
Title: Re: Axe Q&A
Post by: ztrumpet on May 17, 2011, 11:06:54 pm
The multiply by 256 thing has another name too that I'm sure you've seen: 8.8 Fixed Point. :)  Good luck!
Title: Re: Axe Q&A
Post by: Freyaday on May 17, 2011, 11:10:17 pm
Is there a way to use the ON key?
Title: Re: Axe Q&A
Post by: ztrumpet on May 17, 2011, 11:13:37 pm
Yes.
getKey(41) will do it. :)
By the way, here's a nifty link: http://julosoft.net/ti/getkey.php
Title: Re: Axe Q&A
Post by: Freyaday on May 17, 2011, 11:14:37 pm
getkey(41) is the keycode, but it doesn't register.
Nvm, I've eaten my words.
Title: Re: Axe Q&A
Post by: BrownyTCat on May 18, 2011, 12:58:43 pm
Its not a mode, but more like a style of programming that gives you more precision.  The idea is that you multiply your position variables by 256 to give you a screen that is 256 times as big (and consequently has a *lot* more possible positions and a lot more precision) and then when you display your sprites you "zoom" back out by dividing by 256.

This has been written about a lot, I'm sure there has got to be a tutorial about this somewhere, or at least a more in depth explanation.
Maybe I can fix my engine's "/\" jump. Not before I get a freaking tilemap routine./me has lost several brain cells trying to tilemap.
Title: Re: Axe Q&A
Post by: Builderboy on May 18, 2011, 01:09:24 pm
Is it a scrolling tilemap?
Title: Re: Axe Q&A
Post by: BrownyTCat on May 18, 2011, 01:14:33 pm
Is it a scrolling tilemap?
Yes. I saw the tutorial, but it's hard to implement in a platformer game.
Title: Re: Axe Q&A
Post by: aeTIos on May 18, 2011, 01:41:35 pm
Okay, so I saw this screenie, and I would like to know how Builderboy makes the box hanging at the rope. (http://www.omnimaga.org/index.php?action=dlattach;topic=8450.0;attach=7790;image)
Anyone knowing this?
Title: Re: Axe Q&A
Post by: Freyaday on May 18, 2011, 03:54:19 pm
He can't share any source code until the contest is over; that is his entry
Title: Re: Axe Q&A
Post by: Munchor on May 18, 2011, 03:55:11 pm
I seriously have no idea how in Earth he freaking made that, seriously.

He can't tell you though.
Title: Re: Axe Q&A
Post by: Michael_Lee on May 18, 2011, 03:56:53 pm
You could look at his Chainfire library, and see if he has similar code.
Title: Re: Axe Q&A
Post by: Munchor on May 19, 2011, 12:59:25 pm
I have a question, I just made my first program to try and learn acceleration and more about physics.

here's my problem though:

Code: [Select]
0→Y
5→X
Repeat getKey(15)
  ClrDraw

  Line(0,63,95,63)
  Pxl-On(X,Y/256)

  If (pxl-Test(X,Y+1)=0)
    Y+128→Y
  End

  DispGraph
End

That's a little tiny dot but it doesn't move down as it was supposed to (due to gravity).

Any idea of what I'm doing wrong?

Thanks
Title: Re: Axe Q&A
Post by: Deep Toaster on May 19, 2011, 01:12:09 pm
pxl-Test(X,Y+1) should be pxl-Test(X,Y/256+1)

Also you can save a lot of memory by doing !If pxl-Test(X,Y/256+1) instead of If (pxl-Test(X,Y/256+1)=0).
Title: Re: Axe Q&A
Post by: Munchor on May 19, 2011, 01:16:04 pm
pxl-Test(X,Y+1) should be pxl-Test(X,Y/256+1)

Also you can save a lot of memory by doing !If pxl-Test(X,Y/256+1) instead of If (pxl-Test(X,Y/256+1)=0).

I had tried that before and I knew it would work.

My problem is though: Aren't I ruining all the 256 collision by pixel testing with Y/256. Isn't that doing the same as if Y was not a giant value?
Title: Re: Axe Q&A
Post by: Deep Toaster on May 19, 2011, 01:22:40 pm
Yes, it is. The advantage to having x256 is that you can have the object move at partial speeds (such as one pixel every three frames for the illusion of 33% speed). pxl-Test( and all those other commands still treat it as if it were a multiple of 256, but this way you can have one object moving one pixel every frame and another at a fraction of that speed.
Title: Re: Axe Q&A
Post by: Munchor on May 19, 2011, 01:31:18 pm
Yes, it is. The advantage to having x256 is that you can have the object move at partial speeds (such as one pixel every three frames for the illusion of 33% speed). pxl-Test( and all those other commands still treat it as if it were a multiple of 256, but this way you can have one object moving one pixel every frame and another at a fraction of that speed.

Ah I see, thanks.

So I have a new question about this, can I have like the acceleration of X in values that are also in 256 mode?

So, I'll give this example:

Code: [Select]
.Y of the sprite
0→Y
.X of the sprite
0→X
.X Acceleration of the sprite
0→A
.Y Acceleration of the sprite
0→B
Repeat getKey(15)
  ClrDraw

  If getKey(2)
    A-128→A
  End

  If getKey(3)
    A+128→A
  End

  Line(0,63,95,63)
 
  X+A→X
  Y+B→Y

  Pxl-On(X/256,Y/256)

  If (pxl-Test(X,Y+1)=0)
    Y+128→Y
  End

  DispGraph
End

Is this code OK for accelerating a sprite? For the record, this crashed my calculator during runtime.
Title: Re: Axe Q&A
Post by: Builderboy on May 19, 2011, 01:53:22 pm
That crashed your calculator?  What version of Axe are you using?  Under no circumstances should that code cause a crash o.O

And yes that will work for acceleration, but you are accelerating at .5 (128/256) pixels per frame, which is actually really really fast for a high framerate program.  Try turning it down to like 8 or so.
Title: Re: Axe Q&A
Post by: calc84maniac on May 19, 2011, 01:57:32 pm
The pxl-Test arguments need to be scaled down by 256 as well. And it might be a good idea to make sure that the velocity does not exceed 256 (i.e. one pixel per frame), or else the vertical line might be jumped over.
Title: Re: Axe Q&A
Post by: Munchor on May 19, 2011, 02:06:07 pm
I seriously don't get this, in most of my programs I use X+2->X and sometimes even 3. In order to avoid skipping vertical lines I usually check if (X<88) and (X<87) and stuff like that.

Either way, I am using Axe 0.5.2, but perhaps it was not the program's problem, I shall try again.
Title: Re: Axe Q&A
Post by: Michael_Lee on May 19, 2011, 02:45:28 pm
It occurred to me that I'm treating memory almost as magic in some cases.
So, some questions.

What's the difference between doing
Code: [Select]
[FFFFFF->Str1
[010203
[More hex
[504432]
and
Code: [Select]
[FFFFFF
[010203
[More hex
[504432]->Str1

If want to load a large amount of memory (using hex, strings or Data()) on multiple lines, how does Axe know when the block of memory ends?  For example, if I have
Code: [Select]
[0102
"Foobar"
Data(42)->Str1
How does the compiler know the limits of the block of memory?
Title: Re: Axe Q&A
Post by: Builderboy on May 19, 2011, 02:53:29 pm
It occurred to me that I'm treating memory almost as magic in some cases.
So, some questions.

What's the difference between doing
Code: [Select]
[FFFFFF->Str1
[010203
[More hex
[504432]
and
Code: [Select]
[FFFFFF
[010203
[More hex
[504432]->Str1

In the first example, the location Str1 points to is the first byte FF of the first line.  In the second example it points to the byte 50 in the last line.

If want to load a large amount of memory (using hex, strings or Data()) on multiple lines, how does Axe know when the block of memory ends?  For example, if I have
Code: [Select]
[0102
"Foobar"
Data(42)->Str1
How does the compiler know the limits of the block of memory?
I'm not quite sure what you mean?  You have defined 51 bytes in that code, and so Axe adds those 51 bytes into your program.
Title: Re: Axe Q&A
Post by: Michael_Lee on May 19, 2011, 02:56:54 pm
If want to load a large amount of memory (using hex, strings or Data()) on multiple lines, how does Axe know when the block of memory ends?  For example, if I have
Code: [Select]
[0102
"Foobar"
Data(42)->Str1
How does the compiler know the limits of the block of memory?
I'm not quite sure what you mean?  You have defined 51 bytes in that code, and so Axe adds those 51 bytes into your program.
[/quote]

Hmm, let me ask different questions.

Is there any difference between
Code: [Select]
[FFFFFF]->Str1
[010203]
[HEX000]
[FFFFFF]
or
Code: [Select]
[FFFFFF->Str1
[010203
[HEX000
[FFFFFF]
?
Title: Re: Axe Q&A
Post by: Builderboy on May 19, 2011, 02:59:55 pm
Nope, no difference :)
Title: Re: Axe Q&A
Post by: Munchor on May 19, 2011, 03:02:02 pm
Also,

Code: [Select]
.Y of the sprite
0→Y
.X of the sprite
0→X
.X Acceleration of the sprite
0→A
.Y Acceleration of the sprite
0→B
Repeat getKey(15)
  ClrDraw

  If getKey(2)
    A-128→A
  End

  If getKey(3)
    A+128→A
  End

  Line(0,63,95,63)
 
  X+A→X
  Y+B→Y

  Pxl-On(X/256,Y/256)

  !If (pxl-Test(X/256,Y/256+1))
    Y+128→Y
  End

  DispGraph
End

This freezes my calculator, not crashes, but freezes.
Title: Re: Axe Q&A
Post by: Builderboy on May 19, 2011, 03:04:59 pm
Is that all of your code?  Because that works perfectly fine on my calc
Title: Re: Axe Q&A
Post by: yunhua98 on May 19, 2011, 03:13:14 pm
you're using an Nspire, I take it?

Blame TI.
Title: Re: Axe Q&A
Post by: Munchor on May 19, 2011, 03:18:36 pm
I am indeed using a Nspire. Either way, I figured it out. I now have a sort of working platforming engine with gravity, my problem is stoping the sprite.

B is the Y acceleration
A is the X acceleration

How to stop the sprite when Y=0?
Title: Re: Axe Q&A
Post by: Builderboy on May 19, 2011, 03:21:48 pm
This will stop it when the sprite is exactly on the 0th pixel, that might be not what you want though. 

Code: [Select]
!If Y/256
0->A->B
End

Do you want to stop the sprite completely, or only the Y velocity?  Or maybe if it goes past the 0th pixel? 

Title: Re: Axe Q&A
Post by: Munchor on May 19, 2011, 03:36:57 pm
The problem is if I keep pressing <UP> the pixel will go up and pass the vertical line.
Title: Re: Axe Q&A
Post by: Deep Toaster on May 19, 2011, 03:51:13 pm
I seriously don't get this, in most of my programs I use X+2->X and sometimes even 3. In order to avoid skipping vertical lines I usually check if (X<88) and (X<87) and stuff like that.

Either way, I am using Axe 0.5.2, but perhaps it was not the program's problem, I shall try again.

Since everything's inflated by 256 times now, you have to inflate those numbers too. Instead of X+2→X, you use X+512→X. Instead of (X<88) and (X<87), you use (X<22528) and (X<22272).
Title: Re: Axe Q&A
Post by: Munchor on May 19, 2011, 04:18:04 pm
Yeah I know Deep thought, but the pixel can still leave the screen :S
Title: Re: Axe Q&A
Post by: Builderboy on May 19, 2011, 04:20:37 pm
Notice how in your code, it goes like this:

Keypresses
Move Object
Check for collision

What this means is that if you press a key, it *Will* move the object, because it's only after you move the object that you check to see if it should be stopping.  Move the collision test before the movement and it should work
Title: Re: Axe Q&A
Post by: Munchor on May 19, 2011, 04:52:26 pm
My current code is the following and the pixel doesn't really stop when hits the line:

Code: [Select]
512→Y
12288→X
0→A→B
Repeat getKey(15)
  ClrDraw
  Line(0,63,95,63)
  Pxl-On(X/256,Y/256)
 
  If getKey(2)
    A-8→A
  End
 
  If getKey(3)
    A+8→A
  End
 
  If getKey(4)
    B-8→B
  End

  !If (pxl-Test(X/256,Y/256+1))
    B+1→B
  End

  X+A→X
  Y+B→Y
 
  DispGraph
End
Title: Re: Axe Q&A
Post by: Builderboy on May 19, 2011, 05:00:26 pm
Its because you are increasing the velocity of B when you collide.  You want it to stop right?  Try 0->B instead of B+1->B
Title: Re: Axe Q&A
Post by: yunhua98 on May 19, 2011, 05:00:55 pm
There's not code for stopping.

try this:
Code: [Select]
512→Y
12288→X
0→A→B
Repeat getKey(15)
  ClrDraw
  Line(0,63,95,63)
  Pxl-On(X/256,Y/256)
 
  If getKey(2)
    A-8→A
  End
 
  If getKey(3)
    A+8→A
  End
 
  If getKey(4)
    B-8→B
  End

  !If (pxl-Test(X/256,Y/256+1))
    B+1→B
  End

<add this>
  If (pxl-Test(X/256,Y/256+1))
    0->B
  End
</add this>


  X+A→X
  Y+B→Y
 
  DispGraph
End

Also, you should put a terminal velocity in, such as B can't be greater than 256.  ;)


Its because you are increasing the velocity of B when you collide.  You want it to stop right?  Try 0->B instead of B+1->B

actually, that's his fall code.  ;)   note the "!"
Title: Re: Axe Q&A
Post by: Builderboy on May 19, 2011, 05:06:21 pm
Oooh gotcha, that makes more sense ^^
Title: Re: Axe Q&A
Post by: collechess on May 19, 2011, 05:14:16 pm
How many bytes is an 8x8 monochrome sprite?
Title: Re: Axe Q&A
Post by: Munchor on May 19, 2011, 05:15:35 pm
How many bytes is an 8x8 monochrome sprite?

8 bytes exactly.
Title: Re: Axe Q&A
Post by: Builderboy on May 19, 2011, 05:15:57 pm
8 bytes :) each pixel is 1 bit, and 8x8 is 64 pixels total, and 8 bits per byte, so 64pixels divided by 8pixels per byte equals 8 bytes ^^

EDIT: With simpler explanation :P
Title: Re: Axe Q&A
Post by: Munchor on May 19, 2011, 06:45:24 pm
There's not code for stopping.

try this:
Code: [Select]
512→Y
12288→X
0→A→B
Repeat getKey(15)
  ClrDraw
  Line(0,63,95,63)
  Pxl-On(X/256,Y/256)
 
  If getKey(2)
    A-8→A
  End
 
  If getKey(3)
    A+8→A
  End
 
  If getKey(4)
    B-8→B
  End

  !If (pxl-Test(X/256,Y/256+1))
    B+1→B
  End

<add this>
  If (pxl-Test(X/256,Y/256+1))
    0->B
  End
</add this>


  X+A→X
  Y+B→Y
 
  DispGraph
End

Also, you should put a terminal velocity in, such as B can't be greater than 256.  ;)


Its because you are increasing the velocity of B when you collide.  You want it to stop right?  Try 0->B instead of B+1->B

actually, that's his fall code.  ;)   note the "!"

That worked, how stupid of me! The only problem is I can't jump since 0→A if I'm on the line. This I don't know how to change :S
Title: Re: Axe Q&A
Post by: collechess on May 19, 2011, 06:53:13 pm
How many bytes is an 8*12 tilemap?
Title: Re: Axe Q&A
Post by: Michael_Lee on May 19, 2011, 07:12:23 pm
96 bytes?

Depends on how many bytes each tile is, I think.
Title: Re: Axe Q&A
Post by: Ashbad on May 19, 2011, 08:25:49 pm
and if you compress it ;) if you have 16 or less different tiles, you can automagically cut that number in half by using nibbles (4 bit numbers).  In that case, a 8*12 tilemap goes down to only 48 bytes.  But it can get smaller with more compression techniques -- using RLE for example, with one nibble for the data and one for the length could even cut the size down below 20.  However, it can also be larger than 96 -- TaNF used 150-byte tilemaps, because each 'room' had more than just tiles, it also had things like enemy stats, objects, etc. So, it depends on what you're cramming in the space.
Title: Re: Axe Q&A
Post by: Munchor on May 20, 2011, 11:51:36 am
I have some little code, but it runs slow like hell, I'd like to know your opinions on why:

Code: [Select]
.C
512→Y
12288→X
0→A→B
Repeat getKey(15)
  ClrDraw
  Rect(0,0,96,64)
  RectI(3,3,90,58)
  Line(0,30,40,30)
  Rect(X/256,Y/256,8,8)

  If getKey(2)
    A-16→A
  End

  If getKey(3)
    A+16→A
  End
 
  X+A→X
  Y+B→Y

  If (pxl-Test(X/256+8,Y/256))
    0→A
  End

  If (pxl-Test(X/256-1,Y/256))
    0→A
  End
 
  If (pxl-Test(X/256,Y/256+8))
    0→B
  End

  !If (pxl-Test(X/256,Y/256+8))
    B+4→B
  End
 
  If getKey(4)
    B-16→B
  End
 
  DispGraph
End

I know it can be optimized like having 'or's in the first two pixel tests, but would that enchance its speed that much?

I have a theory, dividing variables by 256 is what's making it slow. Am I right?

I just tried this and it was much faster, I'm wondering why:

Code: [Select]
.C
512→Y
12288→X
0→A→B
Repeat getKey(15)
  ClrDraw
  Rect(0,0,96,64)
  RectI(3,3,90,58)
  Line(0,30,40,30)
  Rect(X/256,Y/256,8,8)

  If getKey(2)
    A-16→A
  End

  If getKey(3)
    A+16→A
  End
 
  X+A→X
  Y+B→Y

  If (pxl-Test(X/256+8,Y/256)) or (pxl-Test(X/256-1,Y/256))
    0→A
  End
 
  If (pxl-Test(X/256,Y/256+8))
    0→B
  End

  !If (pxl-Test(X/256,Y/256+8))
    B+4→B
  End
 
  If getKey(4)
    B-16→B
  End
 
  DispGraph
End
Title: Re: Axe Q&A
Post by: Runer112 on May 20, 2011, 11:55:31 am
You can divide by 256 about 500,000 times a second, which is one of the reasons why inflating variables by 256 is the preferred method of increasing accuracy. My guess would be that drawing 2 massive rectangles every frame can't help.


EDIT: The second block of code you posted should run at virtually the exact same speed as the original block of code. Are you sure it actually sped up? And if so, did you make any other changes to the code?

EDIT 2: I think the program appearing to run slowly is just an illusion caused by your object moving at slow speeds. It gets about 40 frames per second, the object is just in the same position in many frames because it is moving slowly.
Title: Re: Axe Q&A
Post by: Munchor on May 20, 2011, 12:24:46 pm
I have a huge problem in Axe, I can't avoid that my sprites go through walls or even the floor when they are in fast speeds. Is there any way to avoid this?
Title: Re: Axe Q&A
Post by: yunhua98 on May 21, 2011, 10:03:05 am
Yes, the velocity sometimes is over 256, so it goes more than 1 pixel at a time.  Add a terminal velocity, that is, stop accelerating when it's over 256
Title: Re: Axe Q&A
Post by: Deep Toaster on May 21, 2011, 10:50:13 am
I have a huge problem in Axe, I can't avoid that my sprites go through walls or even the floor when they are in fast speeds. Is there any way to avoid this?

That's because when a bullet moves, say, 8 pixels at once, it only tests if that 8th pixel is a wall or a floor, so all the pixels in between (which might include a wall) don't get tested. The easy (but slow) fix is to test each bullet with a For( loop before moving.
Title: Re: Axe Q&A
Post by: Munchor on May 21, 2011, 10:53:33 am
I will probably loop all positions :/
Title: Re: Axe Q&A
Post by: Binder News on May 21, 2011, 11:31:06 am
Another thing to do is only redraw the screen every other frame. Just put
Code: [Select]
Main Loop
For({<insert pointer here>},0,1)
...
End
DispGraph
End
Title: Re: Axe Q&A
Post by: Deep Toaster on May 21, 2011, 11:38:48 am
Another thing to do is only redraw the screen every other frame.

What's that for?
Title: Re: Axe Q&A
Post by: Happybobjr on May 21, 2011, 12:34:28 pm
Or you could do...

Code: [Select]
!If A+1^2->A
DispGraph
End
Title: Re: Axe Q&A
Post by: Munchor on May 21, 2011, 01:39:13 pm
Hey, the problem with looping is that if I only allow the sprite to move if pxl-Tests=0 8pixels to the right/left, it will not be able to even be close to walls.

This is not a good alternative and I do n't get Yeong's nor Happybojr's.
Title: Re: Axe Q&A
Post by: Happybobjr on May 21, 2011, 01:46:38 pm
Displaying the graph is the slowest thing you can do on a calculator.
If you display the graph every other frame, you are just about guaranteed to have a 33% speed increase.
Title: Re: Axe Q&A
Post by: Runer112 on May 21, 2011, 01:49:54 pm
Actually, the slowest Axe command (that won't freeze the calculator altogether) is Pause 0, which would take about 220 million cycles. That's a bit over half a minute at 6MHz. ;)
Title: Re: Axe Q&A
Post by: Deep Toaster on May 21, 2011, 05:04:59 pm
Actually, the slowest Axe command (that won't freeze the calculator altogether) is Pause 0, which would take about 220 million cycles. That's a bit over half a minute at 6MHz. ;)

Slowest useful command, I guess. Pause pauses, so it should pause.
Title: Re: Axe Q&A
Post by: Freyaday on May 22, 2011, 12:28:19 am
I think Pause 0 should pause for 0 time, but it doesn't.
How long is Pause 1, anyway?
Title: Re: Axe Q&A
Post by: Deep Toaster on May 22, 2011, 12:34:33 am
It's like a For( loop with 0 frames -- it actually does the Pause routine 65,536 times, or half a minute.

Each Pause is about 1/1800 of a second.
Title: Re: Axe Q&A
Post by: Freyaday on May 22, 2011, 12:36:18 am
No, I mean, like, Is a pause 1024 cycles, or what?
Title: Re: Axe Q&A
Post by: Deep Toaster on May 22, 2011, 12:40:14 am
According to Runer: Pause [NUMBER] is ~[NUMBER] * 3349 - 1662 cycles. So Pause 1 would be around 1687 cycles.

It depends on the value of B (anything between 0 and 255) when you call the routine.
Title: Re: Axe Q&A
Post by: Freyaday on May 22, 2011, 01:08:59 am
Why does it depend on the low byte of B? And what do different values of B do to it?
Title: Re: Axe Q&A
Post by: Quigibo on May 22, 2011, 01:46:23 am
Not Axe's "B" the assembly "b".  The way pause works is it runs a loop which executes b number of times, which is then repeated pause number of times.  The thing is, after each loop, b is reset to 256.  But since b is not set to anything the first time, it could be any number.  So each cycle of "Pause 5" could look something like this:

loop 100
loop 256
loop 256
loop 256
loop 256

So the first iteration could be any random number of cycles.  But you generally never need to worry about that because you don't normally call pause with such low numbers.
Title: Re: Axe Q&A
Post by: Freyaday on May 22, 2011, 02:37:30 am
Ah, ok. The register. Thanks Quigibo!
Title: Re: Axe Q&A
Post by: Tgooseman on May 22, 2011, 10:44:05 am
Why does my application sometimes randomly defragment itself when exiting it?
Title: Re: Axe Q&A
Post by: Aichi on May 22, 2011, 10:59:03 am
Why does my application sometimes randomly defragment itself when exiting it?
An unsigned application deletes itself after 30 starts. You have 30 new starts after recompiling your project.
You can sign your application with rabbitsign in the Axe Parser/Tools directory.
Title: Re: Axe Q&A
Post by: annoyingcalc on May 22, 2011, 03:30:09 pm
Can someone post how to delete a variable EX: pic2 or overwrite it in Axe?
Title: Re: Axe Q&A
Post by: Deep Toaster on May 22, 2011, 03:41:31 pm
DelVar "Pic2"
deletes the real variable Pic2 if it exists. Breakdown:
"Pic2"
Name of the variable.
DelVar "Pic2"
Finds and deletes the variable.

GetCalc("Pic2",756)→P
creates a new variable Pic2, overwriting the original if it exists. Breakdown:
"Pic2"
Name of the variable.
GetCalc("Pic2",756)
Creates (overwriting) a variable called Pic2 with 756 bytes. That's the size of a usual TI picture (12 bytes per row, 63 rows). After you add the VAT info and size bytes, it shows up as 767 bytes in the Mem Mgmt/Del... menu.
GetCalc("Pic2",756)→P
Stores the location of the newly created Pic2 to the Axe variable P. That way you can load data into it (like with Copy(L6,P,756)).
Title: Re: Axe Q&A
Post by: annoyingcalc on May 22, 2011, 03:43:55 pm
DelVar "Pic2"
deletes the real variable Pic2 if it exists. Breakdown:
"Pic2"
Name of the variable.
DelVar "Pic2"
Finds and deletes the variable.


I dont get the second part
Title: Re: Axe Q&A
Post by: Deep Toaster on May 22, 2011, 03:44:59 pm
What do you mean by second part? My post has two examples: one to delete Pic2 and one to create/overwrite it, as you asked :)
Title: Re: Axe Q&A
Post by: annoyingcalc on May 22, 2011, 03:49:13 pm
Oh I see
Title: Re: Axe Q&A
Post by: annoyingcalc on May 22, 2011, 03:58:09 pm
Didnt work

EDIT:: deleting I want to write over it
Title: Re: Axe Q&A
Post by: Deep Toaster on May 22, 2011, 03:59:42 pm
Can you describe what you did and how it didn't work? Can't help you unless I know what's wrong.

Also, if you want to double-post, you should use the Quick Modify button to edit your previous post instead.
Title: Re: Axe Q&A
Post by: Munchor on May 23, 2011, 02:58:17 am
Oh I see

Didnt work

EDIT:: deleting I want to write over it

Avoid double posting in a 10-minute time, please edit your posts in the "Modify" or in the "Quick Modify" button.
Title: Re: Axe Q&A
Post by: Deep Toaster on May 23, 2011, 09:38:07 am
Avoid double posting in a 10-minute time, please edit your posts in the "Modify" or in the "Quick Modify" button.

Ninja'd you there by 11 hours ;)
Title: Re: Axe Q&A
Post by: aeTIos on May 23, 2011, 11:00:12 am
Does data count to the maximum size of a flash app?
Title: Re: Axe Q&A
Post by: Deep Toaster on May 23, 2011, 11:03:37 am
Yes. It counts toward the max size of an Axe program too, anyway.
Title: Re: Axe Q&A
Post by: aeTIos on May 23, 2011, 12:48:34 pm
But does it also count to the executable code? I mean, can you for example have 8000 bytes exec code and 13000 bytes of data?
Title: Re: Axe Q&A
Post by: Builderboy on May 23, 2011, 12:53:44 pm
It does not count to the max size of a program, you *can* have 8800 bytes of code and as much data as you want :)
Title: Re: Axe Q&A
Post by: Aichi on May 23, 2011, 12:53:59 pm
But does it also count to the executable code? I mean, can you for example have 8000 bytes exec code and 13000 bytes of data?
Both data and code have to be under 16k together, your data is written directly into the app.
If you don't want it, you should use appvars.
Title: Re: Axe Q&A
Post by: Munchor on May 23, 2011, 01:50:20 pm
Can I use Lists (no, not arrays) the same way in Axe as in Basic or I need to use Arrays? Thanks
Title: Re: Axe Q&A
Post by: Aichi on May 23, 2011, 03:52:16 pm
Can I use Lists (no, not arrays) the same way in Axe as in Basic or I need to use Arrays? Thanks
I wonder what do you need it for?
Title: Re: Axe Q&A
Post by: Freyaday on May 23, 2011, 03:52:21 pm
It's all just a bunch of bytes. At this level, you could create a triangular array and be perfectly fine. What, exactly, are you trying to do?
Title: Re: Axe Q&A
Post by: Munchor on May 23, 2011, 04:07:37 pm
http://pastebin.com/L2Y2gg5F (http://pastebin.com/L2Y2gg5F)

Why can't I display greyscale (the Rect(^r)) in that code? The supposedly grey blocks appear as grey and a milisecond after change to black forever.
Title: Re: Axe Q&A
Post by: Freyaday on May 23, 2011, 04:21:38 pm
Is the second Rect() supposed to be a RectI()? And that Rect()r gets overwritten by the StorePic anyway.
The reason that It's going black is because immediately after you display the greyscale, you copy the back buffer to the front buffer, rendering the second frame b/w because the contents of the front buffer match the back buffer, so it's either 00 or 11 for every single pixel
Title: Re: Axe Q&A
Post by: Munchor on May 24, 2011, 07:15:52 am
Is the second Rect() supposed to be a RectI()? And that Rect()r gets overwritten by the StorePic anyway.
The reason that It's going black is because immediately after you display the greyscale, you copy the back buffer to the front buffer, rendering the second frame b/w because the contents of the front buffer match the back buffer, so it's either 00 or 11 for every single pixel

1. The secodn Rect is indeed RectI.
2. Ah I see so when we Store or RecallPics we can't use greyscale or is there a way around? Thanks.
Title: Re: Axe Q&A
Post by: Freyaday on May 24, 2011, 10:04:49 am
Well, what's going on is that StorePic and RecallPic make L3 and L6 the same, so it's still greyscale, but all the greyscale routine sees is black pixels and white pixels. Remove the RecallPic or draw some more on the back buffer to fix it.
Title: Re: Axe Q&A
Post by: Munchor on May 24, 2011, 02:59:16 pm
Well, what's going on is that StorePic and RecallPic make L3 and L6 the same, so it's still greyscale, but all the greyscale routine sees is black pixels and white pixels. Remove the RecallPic or draw some more on the back buffer to fix it.

I have tried drawing in the back buffer right before DispGraph (not just in the stored pic) but it changes quickly to black :S
Title: Re: Axe Q&A
Post by: Freyaday on May 24, 2011, 03:52:44 pm
Does it display as grey initially?
Title: Re: Axe Q&A
Post by: Munchor on May 24, 2011, 04:10:32 pm
Does it display as grey initially?

Yes for a bit of a second.
Title: Re: Axe Q&A
Post by: Freyaday on May 24, 2011, 04:19:45 pm
It'll keep doing that so long as you have that RecallPic in there. What's the RecallPic for, anyway?
Title: Re: Axe Q&A
Post by: Munchor on May 24, 2011, 04:29:34 pm
It'll keep doing that so long as you have that RecallPic in there. What's the RecallPic for, anyway?

To Recall the image I drew before the loop, I know it's not needed in this particular case, but I'll need it later.
Title: Re: Axe Q&A
Post by: Builderboy on May 24, 2011, 04:33:40 pm
Note that if you are using greyscale, you *can't* backup images using Store and Recallpic, because those store to the backbuffer, which is used in greyscale.  Remember, to display greyscale, it uses both L3 and L6.  When you StorePic, you store the image to L3, which is not the right place to backup an image if you want to do greyscale
Title: Re: Axe Q&A
Post by: Munchor on May 25, 2011, 11:55:39 am
Note that if you are using greyscale, you *can't* backup images using Store and Recallpic, because those store to the backbuffer, which is used in greyscale.  Remember, to display greyscale, it uses both L3 and L6.  When you StorePic, you store the image to L3, which is not the right place to backup an image if you want to do greyscale

Ah, thanks then, I won't use the recall/store pic thing anymore then :)
Title: Re: Axe Q&A
Post by: Darl181 on May 25, 2011, 10:14:28 pm
Is there a way to reverse a 1-pixel row and/or column?
Not in 8-pixel chunks, but pixel-for-pixel?
Title: Re: Axe Q&A
Post by: Builderboy on May 25, 2011, 10:15:47 pm
Probably the simplest way would be to copy it to a piece of free memory and then copy it back pixel by pixel but with inverted X coordinates.  Slow, but simple.  What are you looking to use this for?
Title: Re: Axe Q&A
Post by: Deep Toaster on May 25, 2011, 10:16:06 pm
Well, the screen is usually stored in 8-pixel chunks, so if you want to do it in pure Axe I guess you'd have to use a bunch of pxl-Test(s or something :-\
Title: Re: Axe Q&A
Post by: calc84maniac on May 25, 2011, 10:22:07 pm
RectI()?
Title: Re: Axe Q&A
Post by: Builderboy on May 25, 2011, 10:26:52 pm
He wants to laterally flip it, not invert it i think.
Title: Re: Axe Q&A
Post by: calc84maniac on May 25, 2011, 10:27:21 pm
He wants to laterally flip it, not invert it i think.
Ah, I see.
Title: Re: Axe Q&A
Post by: Deep Toaster on May 25, 2011, 10:27:34 pm
Er in that case, what do you mean by reverse? Change each pixel or flip a block of pixels?
Title: Re: Axe Q&A
Post by: Darl181 on May 25, 2011, 10:33:20 pm
RectI()?
Not invert the pixels, but flip them.  Like, 11100001 would become 10000111

Just had a thought.  Would FlipH work?  Thinking about it, sprites are 8-pixel-wide chunks...
Actually, just realized sprites are 8*8 and there's 12 chunks of data :P

What are you looking to use this for?
A way to flip the screen 180owith an animation, and b/c there doesn't seem to be a plausible way of making the screen look like it's rotating...
This post (http://ourl.ca/11071/212827) and a couple of others after it.
Title: Re: Axe Q&A
Post by: Builderboy on May 25, 2011, 10:35:23 pm
Instead of turning it, how about mirroring it instead?  The way I achieved the effect in the post you linked to was to simply clear the screen towards the center, and then redraw a flipped tilemap from the center.
Title: Re: Axe Q&A
Post by: Munchor on May 26, 2011, 04:59:40 pm
I have a 4*4 sprite (no tilemapping, just a sprite).

I have another sprite, 4*4.

I know the X and Y coordinates of both.

How to know if the latter sprite is touching the first one? Is it a too long code?
Title: Re: Axe Q&A
Post by: Runer112 on May 26, 2011, 05:03:20 pm
Touching? Or overlapping? Here's overlapping:
Code: [Select]
If (X-Z+3≤6) and (Y-θ+3≤6)
  .Sprites are overlapping
End

And here's touching:
Code: [Select]
If (X-Z+4≤8) and (Y-θ+4≤8)
  .Sprites are touching
End
Title: Re: Axe Q&A
Post by: Freyaday on May 26, 2011, 06:38:51 pm
Is
For(Q,0,65535
An infinite loop?
Title: Re: Axe Q&A
Post by: Runer112 on May 26, 2011, 06:40:23 pm
Yes, an infinite loop. The check in a For() loop consists of checking if the variable's value is greater than the upper bound. However, because a 16-bit number can never be greater than 65535, the condition will never be met and the loop will never end.

EDIT: If you need a loop with those bounds, use this instead. It's smaller, faster, and stronger too! (Well, maybe not stronger)

Code: [Select]
0
While 1
  →Q

  ;Put your code here

End!If Q+1
Title: Re: Axe Q&A
Post by: Freyaday on May 26, 2011, 06:43:48 pm
Thought so. Just wanted to make sure.
Title: Re: Axe Q&A
Post by: Munchor on May 27, 2011, 02:54:18 am
And here's touching:
Code: [Select]
If (X-Z+4≤8) and (Y-θ+4≤8)
  .Sprites are touching
End

I'm interested in this code, what would the variables mean? Only one of the object moves (coordinates X and Y) and the other object is stopped (C for it's x position, E for it's y position), but this is in my code.

I guess X=X, Y=Y and Z=E and θ=C?

Thanks
Title: Re: Axe Q&A
Post by: Runer112 on May 27, 2011, 08:51:32 am
Almost. Z is x and θ is y. Note how I paired the two x coordinates and the two y coordinates together in the If statement.
Title: Re: Axe Q&A
Post by: Munchor on May 27, 2011, 09:16:50 am
I didn't get it :(

I have a sprite at the coordinates (C,E). That sprite is still.
I have a sprite that moves and I need to check if the moving sprite touches the other sprite, the moving sprite's coordinates are (X,Y).

I tried this:

Code: [Select]
If (X-C+4<=8) and (Y-E+4<=8)
  Return
End

It didn't work though :(
Title: Re: Axe Q&A
Post by: Runer112 on May 27, 2011, 09:26:27 am
I whipped up a quick program and it worked for me. Are you sure you typed in the code correctly? And what is the context of where you added this code?
Title: Re: Axe Q&A
Post by: Munchor on May 27, 2011, 09:29:19 am
The context is:

Code: [Select]
24→C
24→E
Repeat getKey(15)
If (X-C+4<=8) and (Y-E+4<=8)
  Return
End

.MORE COLLISIONS

.GETKEYS FOR THE MAIN SPRITE

.DRAW FLAG
Pt-On(C,E,Pic1)

.THE MAIN SPRITE
Rect(X/256,Y/256,4,4)

.DISPLAY IT ALL
DispGraph
End

So the main sprite moves with the keys, I want it when I touch the Pic1 (at coordinates (C,E)) the program closes.
Title: Re: Axe Q&A
Post by: calc84maniac on May 27, 2011, 09:30:52 am
I see your problem, it's that your X and Y are scaled by 256 while your C and E are not, so you can't just compare them normally. You should probably scale down the X and Y in the collisions.
Title: Re: Axe Q&A
Post by: Munchor on May 27, 2011, 09:38:56 am
Woo! Thanks a lot calc84maniac and Runer112 :) I had to divide by 256 since it was in x256 mode.
Title: Re: Axe Q&A
Post by: Freyaday on May 27, 2011, 09:13:40 pm
Is it ok to make an Appvar smaller by modifying the two size bytes? And are the size bytes of the same endianness of Axevars?
Title: Re: Axe Q&A
Post by: Runer112 on May 27, 2011, 10:21:18 pm
It is not safe to allocate/deallocate memory for an OS variable by just changing the size bytes. You'll probably want to use MemKit's Delete() function, which is able to deallocate a specified number of byte from an OS variable.
Title: Re: Axe Q&A
Post by: Freyaday on May 27, 2011, 10:25:19 pm
So I can't change the size bytes no matter what? Is there a specific reason?
Title: Re: Axe Q&A
Post by: Runer112 on May 27, 2011, 10:30:59 pm
When the variable was created, the OS allocated just the right amount of size to contain it. It uses that size to know how far after it in memory to store the next variable, and how much of memory to free up when the variable is deleted or archived. If you alter the number, it will result in either a memory leak or the variable overlapping another variable. The next time the OS tries to overwrite the variable, delete the variable, or rearrange the contents of RAM, there will likely either be a memory leak left in RAM or part of another variable will be overwritten.
Title: Re: Axe Q&A
Post by: Freyaday on May 27, 2011, 10:41:37 pm
Can I do {byte}->VAR, or does it have to be two bytes?
Title: Re: Axe Q&A
Post by: Quigibo on May 27, 2011, 10:44:08 pm
That works.  It will automatically make the high byte zero so you'll get the range you're looking for (0 to 255).  That is, unless that's a signed byte, then you can use sign{byte}->VAR to get the -128 to 127 range.
Title: Re: Axe Q&A
Post by: Freyaday on May 27, 2011, 11:09:57 pm
Can I do
{byte}>number?
And can I do
{byte}+n>m?
Title: Re: Axe Q&A
Post by: Munchor on May 28, 2011, 06:19:56 am
Freyaday, I'm not sure but I think you have to do

{Byte+N}→M
Title: Re: Axe Q&A
Post by: Aichi on May 28, 2011, 06:28:02 am
Can I do
{byte}>number?
And can I do
{byte}+n>m?

Both constructions are possible. Note: m<{byte}+n would always return not zero, since it will be processed from left to right.

Edit @ Scout:

I think Freyaday means ">", not "->". Also, both {Byte}+N->M and {Byte+N}->M are possible, but they make for different results.
Title: Re: Axe Q&A
Post by: ZippyDee on May 28, 2011, 06:32:51 am
Can I do
{byte}>number?
And can I do
{byte}+n>m?

Both constructions are possible. Note: m<{byte}+n would always return not zero, since it will be processed from left to right.

Unless N is zero...
Title: Re: Axe Q&A
Post by: Aichi on May 28, 2011, 06:46:09 am
Can I do
{byte}>number?
And can I do
{byte}+n>m?

Both constructions are possible. Note: m<{byte}+n would always return not zero, since it will be processed from left to right.

Unless N is zero...

Yeah unless N is zero and M is higher than {Byte}.
...Or M is lower than / equal to {Byte} and N is 65535. :P
Title: Re: Axe Q&A
Post by: Deep Toaster on May 28, 2011, 09:47:19 am
Can I do {byte}->VAR, or does it have to be two bytes?

If you're still talking about size bytes, it's {P-2}r→M, where P is the pointer to the var as found by GetCalc(.
Title: Re: Axe Q&A
Post by: Freyaday on May 28, 2011, 10:39:29 am
Aichi had the answer I was looking for. Thanks guys!
Title: Re: Axe Q&A
Post by: Deep Toaster on May 30, 2011, 05:04:37 pm
The nice thing about Java is that because almost everything is a pointer (primitives aren't), you don't need both.:)

But you can't hack them since you can't actually use the pointer yourself ;)
Title: Re: Axe Q&A
Post by: Darl181 on May 30, 2011, 09:22:34 pm
Does using Zeros() increase the size of the program, or is the blank space not part the executable?
Title: Re: Axe Q&A
Post by: Deep Toaster on May 30, 2011, 09:26:59 pm
If Quigibo adds the fourth pass, data will be put at the end of the program, after all the code, so you don't have to worry about it contributing to your 8811-byte limit. Zeros( is exactly the same as doing [0000 ... ].
Title: Change value of an appvar
Post by: selectcoaxial on June 01, 2011, 07:19:45 am
Hi, I'm really new to this. I'm trying to change the value of an appvar from another program. The appvar already exists and was created by another program, it is currently placed in Archive. So this is what I've been doing:

Code: [Select]
.CHANGE VALUE OF APPVAR
"appvTest"→Str9
UnArchive Str9
GetCalc(Str9)→P
3000→S
If P
 If S>{P}r
  S→{P}r
 End
End

Then I compiled this for MirageOS. After selected and ran the program, I went into the original program that created appvTest and see whether the appvar has changed, and it still has the same value. Can you help me, please? Thank you.
Title: Re: Axe Q&A
Post by: Aichi on June 01, 2011, 07:45:55 am
Hi, I'm really new to this. I'm trying to change the value of an appvar from another program. The appvar already exists and was created by another program, it is currently placed in Archive. So this is what I've been doing:

Code: [Select]
.CHANGE VALUE OF APPVAR
"appvTest"→Str9
UnArchive Str9
GetCalc(Str9)→P
3000→S
If P
 If S>{P}r
  S→{P}r
 End
End

Then I compiled this for MirageOS. After selected and ran the program, I went into the original program that created appvTest and see whether the appvar has changed, and it still has the same value. Can you help me, please? Thank you.

Do you use the appv Token? And welcome here. :)
Edit: It works for me.
Title: Re: Axe Q&A
Post by: selectcoaxial on June 01, 2011, 08:09:05 am
I used  [2nd] [9] for the "v" in "appv" but I used lower cases for "app" because I didn't know where they are.

Edit: Sorry, I just re-read the documentation, and I found the token.
Title: Re: Axe Q&A
Post by: Aichi on June 01, 2011, 08:12:01 am
Take a look at the added video in my last post. The Axe Parser hooks have to be enabled.
Title: Re: Axe Q&A
Post by: Aichi on June 04, 2011, 01:24:40 pm
Are there any optimizations for these routines?

Collision check routine for an object at r1, r2 and an object at r3, r4:
Code: [Select]
Lbl O
< (r2+6) and (r1+6 > r3 and (r3+6 > r1 and (r4+6 > r2
Return

Changing a tile (arg1 = X, arg2 = Y, HL = new tile ID):
Code: [Select]
Lbl W
-> {r2 + 4 / 8 * 60 + (r1 + V + 4 / 8) + L3 + J }
Return
Title: Re: Axe Q&A
Post by: Deep Toaster on June 04, 2011, 01:32:31 pm
Code: (Axe) [Select]
Lbl O
-r₂+5<11 and (r₁-r₃+5<11)
Return

Working on the second.

EDIT: All I can get there is to swap the J and L₃, like this:

Code: (Axe) [Select]
Lbl W
→{r₂+4/8*60+(r₁+V+4/8)+J+L₃}
Return

You should always put constants last in an expression. It actually makes a difference (in both speed and size).
Title: Re: Axe Q&A
Post by: Aichi on June 04, 2011, 02:01:07 pm
Wow, thanks a lot, Deep Thought. :O
Title: Re: Axe Q&A
Post by: Deep Toaster on June 04, 2011, 03:05:10 pm
Np. Make sure you test it first, because I haven't ;D

Should work though.
Title: Re: Axe Q&A
Post by: Runer112 on June 04, 2011, 05:28:35 pm
Very good, padawan Deep Thought. But you still have much to learn to become a jedi master. ;)

10 bytes saved
Code: [Select]
Lbl O
Return!If -r₂sub(O0)
r₃-r₁
Lbl O0
+5<11
Return

3 bytes and ~1250 cycles saved  —  Note: although putting constants last is a good practice, in this case it saved nothing
Code: [Select]
Lbl W
→{r₂sub(W0)*60+(r₁+Vsub(W0))+J+L₃}
Lbl W0
*64+256/512
Return
Title: Re: Axe Q&A
Post by: Aichi on June 04, 2011, 06:03:24 pm
 O.O
That's epic, Runer. I would have never be able to come up with those things.
Does your collision routine affect the speed as well? Speed has more priority than size for me, at least in these cases.
Title: Re: Axe Q&A
Post by: Runer112 on June 04, 2011, 07:24:09 pm
The collision routine will be 7 cycles slower if the y values are in the collision range, but it will be 115 cycles faster if they are not.

Also, if you're aiming for speed, you may want to use this instead of what I originally suggested for the second routine. Optimizing for size and optimizing for speed are two different beasts altogether!

Compared to my size-optimized suggestion: 8 bytes larger, ~1200 cycles faster
Code: [Select]
Lbl W
→{r₂sub(W0)*10*6+(r₁+Vsub(W0))+J+L₃}
Return
Lbl W0
/2/2+1/2
Return
Title: Re: Axe Q&A
Post by: Aichi on June 05, 2011, 02:28:24 pm
Axe does automatically round off numbers by dividings. That causes a difference between X + 4 / 8 and X / 2 / 2 + 1 / 2.
* 64 + 256 / 512 seems fine though, thanks. :)
Title: Re: Axe Q&A
Post by: ztrumpet on June 05, 2011, 04:30:26 pm
Axe does automatically round off numbers by dividings. That causes a difference between X + 4 / 8 and X / 2 / 2 + 1 / 2.
* 64 + 256 / 512 seems fine though, thanks. :)
I don't think there should be a difference between the three.  Are you sure that there was one?
Title: Re: Axe Q&A
Post by: calc84maniac on June 05, 2011, 04:30:38 pm
Axe does automatically round off numbers by dividings. That causes a difference between X + 4 / 8 and X / 2 / 2 + 1 / 2.
* 64 + 256 / 512 seems fine though, thanks. :)
Well, X+4/4 is the same as X/2/2+1 though.
Title: Re: Axe Q&A
Post by: Aichi on June 05, 2011, 05:21:48 pm
Hm, strange, I've tested this:

Code: [Select]
.T
ClrHome
For(F,0,500)
If (Fsub(A)) - (Fsub(B))
Output(0,,F>Dec
End
End
sub(A)
+4 / 8
Return
sub(B)
/2/2+1/2
Return

And the screen stays white, so /2/2+1/2 is really equal to +4 / 8 for Axe Parser,
but /2/2+1/2 continues being not working (that seems to sound terribly for people who can actually speak correct english :P) in the code of my real project. It seems that any section of my code affects the collision routine.
I will use * 64 + 256 / 512, that works fine. :)
Title: Re: Axe Q&A
Post by: Darl181 on June 05, 2011, 05:26:41 pm
Under what conditions does...
Code: [Select]
If inData(A,Data([num here],[another num],[etc],0))...return as true?

I made a little test program and it works fine, but when I put it into the source for Shift--taking out If D=2 or (D=3) and replacing it with If inData(D,Data(2,3,0))--it seems to always output true, even when I explicitly do 5→D immediately before ???
Title: Re: Axe Q&A
Post by: Ashbad on June 05, 2011, 05:28:55 pm
Under what conditions does...
Code: [Select]
If inData(A,Data([num here],[another num],[etc],0))...return as true?

I made a little test program and it works fine, but when I put it into the source for Shift--taking out If D=2 or (D=3) and replacing it with If inData(D,(2,3,0))--it seems to always output true ???

You need to do:

Code: [Select]
inData(D,Data(2,3,0))
It'll take the Data() in and check if anything in it is equal to D.  Always put 0 at the end, also. :)
Title: Re: Axe Q&A
Post by: Darl181 on June 05, 2011, 05:32:04 pm
I know, look at the code box just above it :P
Forgot to type that in, but what I did was practically copy/paste from the working version and changed the numbers.  And it didn't work.
Title: Re: Axe Q&A
Post by: Quigibo on June 05, 2011, 06:42:13 pm
By the way, a faster way to determine if a number is 2 or 3 (since that's a continuous range) is like this:

Code: [Select]
If D-2<2
.D is 2 or 3
End
Title: Re: Axe Q&A
Post by: Runer112 on June 05, 2011, 06:46:26 pm
Actually if you wanted to see if a number was 2 or 3:

Code: [Select]
!If D/2-1
.D is 2 or 3
End

4 bytes smaller. ;) But for general cases, yes, that's a good way to check if a number is in a certain range.
Title: Re: Axe Q&A
Post by: Darl181 on June 05, 2011, 08:42:26 pm
/me was using 2 and 3 as example numbers :P

It gets interesting, like =6, =8, =10 or ^2.
And every statement is different.
Title: Re: Axe Q&A
Post by: Aichi on June 10, 2011, 10:54:05 am
Is
Code: [Select]
!If {L5 + 22} + 1 . Check if that byte is 255equal to
Code: [Select]
!If {L5 + 22} - 255 . Check if that byte is 255?

It seems to be different, for whatever reason.
Title: Re: Axe Q&A
Post by: Runer112 on June 10, 2011, 10:58:47 am
They're different. Although the memory read only reads a 1-byte value, all Axe math is done with 2-byte numbers. So the first statement would evaluate to 255+1=256, which is nonzero and will not activate the !If condition.
Title: Re: Axe Q&A
Post by: squidgetx on June 10, 2011, 11:00:37 am
Solution: the sign{} command. It'll take a one-byte value and convert it into the appropriate two byte number.
Title: Re: Axe Q&A
Post by: Munchor on June 10, 2011, 11:01:45 am
I would like to know what the free lists are in Axe, are there any lists I can save numbers to? Thanks.
Title: Re: Axe Q&A
Post by: Runer112 on June 10, 2011, 11:14:11 am
The Commands.htm file included in Axe releases has a pretty good summary of the L1-L6 RAM areas. And you can save data to any section of RAM you want. The question is what it will corrupt.

Quote from: Commands.htm
L1 = 714 bytes (saveSScreen) Volatility: LOW
L2 = 531 bytes (statVars) Volatility: LOW (Do not use this area when custom interrupts are enabled, including Mirage OS)
L3 = 768 bytes (appBackUpScreen) Volatility: MED (Saving to back-buffer will corrupt)
L4 = 256 bytes (tempSwapArea) Volatility: MED (Corrupt when archiving/unarchiving in program)
L5 = 128 bytes (textShadow) Volatility: MED ("Disp","Output", and "ClrHome" will corrupt)
L6 = 768 bytes (plotSScreen) Volatility: HIGH (Any buffer drawing will corrupt)
Title: Re: Axe Q&A
Post by: Aichi on June 11, 2011, 03:32:36 pm
Does
Code: [Select]
If 20 - {E} -> {E} > 10return something wrong or rather something other than
Code: [Select]
20 - {E} -> {E}
If {E} > 10
or is it just me? Is the upper code not working because the TI needs already HL for taking the E'th byte from the RAM?
Title: Re: Axe Q&A
Post by: Quigibo on June 11, 2011, 03:36:37 pm
Those return different things.

Something->{E} will return E instead of {E} after the store since E is variable.  On the other hand, if you store to a constant location like Something->{L1} then it will return {L1} instead of L1.  This strange behaviour is only because it leads to massive optimizations in the executables.
Title: Re: Axe Q&A
Post by: Runer112 on June 11, 2011, 03:41:25 pm
Those two blocks of code are different in a few ways:


Put the two together and you get this, which I believe should do what you want:
Code: [Select]
If {20-{E}→{E}}>10
Title: Re: Axe Q&A
Post by: Munchor on June 11, 2011, 04:13:55 pm
The Commands.htm file included in Axe releases has a pretty good summary of the L1-L6 RAM areas. And you can save data to any section of RAM you want. The question is what it will corrupt.

Quote from: Commands.htm
L1 = 714 bytes (saveSScreen) Volatility: LOW
L2 = 531 bytes (statVars) Volatility: LOW (Do not use this area when custom interrupts are enabled, including Mirage OS)
L3 = 768 bytes (appBackUpScreen) Volatility: MED (Saving to back-buffer will corrupt)
L4 = 256 bytes (tempSwapArea) Volatility: MED (Corrupt when archiving/unarchiving in program)
L5 = 128 bytes (textShadow) Volatility: MED ("Disp","Output", and "ClrHome" will corrupt)
L6 = 768 bytes (plotSScreen) Volatility: HIGH (Any buffer drawing will corrupt)

Thanks I guess L5 is the one I can use.
Title: Re: Axe Q&A
Post by: Aichi on June 13, 2011, 06:52:22 pm
How can I increase / decrase the contrast? I don't get it.
Shade( {E8447} + 1) just crashes my TI. :/
Title: Re: Axe Q&A
Post by: yunhua98 on June 15, 2011, 12:58:57 am
I thought you need {E8447}^r?
Title: Re: Axe Q&A
Post by: Aichi on June 15, 2011, 03:36:17 pm
I thought you need {E8447}^r?

I forgot the r in my post, sorry.^^
Shade( {E8447}r + 1) doesn't work.
Title: Re: Axe Q&A
Post by: Runer112 on June 15, 2011, 03:37:59 pm
You don't need a r, the contrast is a 1-byte value. I think it's not appearing to work correctly because the value stored at 0x8447 isn't the value actually sent to the LCD driver. When adjusting the contrast, the value the OS sends to the LCD driver is the byte stored at this address plus 24. So to set a contrast one higher than the current OS contrast, you would do:

Shade({ᴇ8447}+24+1)
Title: Re: Axe Q&A
Post by: Aichi on June 15, 2011, 05:22:10 pm
You don't need a r, the contrast is a 1-byte value. I think it's not appearing to work correctly because the value stored at 0x8447 isn't the value actually sent to the LCD driver. When adjusting the contrast, the value the OS sends to the LCD driver is the byte stored at this address plus 24. So to set a contrast one higher than the current OS contrast, you would do:

Shade({ᴇ8447}+24+1)

Ah, thanks. I was a bit confused. :)
Title: Re: Axe Q&A
Post by: ralphdspam on June 15, 2011, 09:13:06 pm
I have two questions:
How do you use Y1?
Is Y1 a static pointer?
Title: Re: Axe Q&A
Post by: Deep Toaster on June 15, 2011, 10:56:14 pm
It's actually a combination of a variable (like A-Z and theta and the r1-r6 arguments) and a page number, which is used to figure out which page of flash memory (the "archive") the data is on. It's used specifically to point to variables that are archived, so the only way you "store" to it is through the GetCalc("VARNAME")→Y1 command. Y1 can then be used in a limited set of commands, such as Copy() and {}.
Title: Re: Axe Q&A
Post by: calc84maniac on June 15, 2011, 11:02:49 pm
I think the command is actually GetCalc("VARNAME",Y1)
Title: Re: Axe Q&A
Post by: aeTIos on June 16, 2011, 03:39:22 am
Calc is right. Then you use {Y1+X} to get the byte.
Title: Re: Axe Q&A
Post by: Deep Toaster on June 19, 2011, 11:03:49 pm
Whoops, I haven't actually used that command :-[
Title: Re: Axe Q&A
Post by: pianoman on June 21, 2011, 04:10:27 pm
How do you run axe programs in an 84+?
Title: Re: Axe Q&A
Post by: Deep Toaster on June 21, 2011, 04:45:18 pm
What do you mean? If you have the executable (already compiled program), it's just an assembly program like any other. Run it from DoorsCS or MirageOS, or if you know it was compiled for no shell, run it from the homescreen with Asm(prgmNAME).
Title: Re: Axe Q&A
Post by: pianoman on June 21, 2011, 04:49:54 pm
Oh, you don't need an extra shell on your calc?
Title: Re: Axe Q&A
Post by: Deep Toaster on June 21, 2011, 04:57:16 pm
If the program was compiled for that extra shell, then yeah. It's exactly the same as any other ASM program.
Title: Re: Axe Q&A
Post by: pianoman on June 21, 2011, 04:57:47 pm
Ok, thanks!
Title: Re: Axe Q&A
Post by: Darl181 on June 27, 2011, 02:35:55 pm
Using [2ND][/] for the e...
I have a level pointer of {P}, like getcalc(Str1)→P
Would 1e{P} get the first byte of the number P points to, or would it be the last byte?  Also is it 1e{P} or 1eP ?

EDIT: answered via IRC.  It would be {P}e1 .
Title: Re: Axe Q&A
Post by: Darl181 on June 28, 2011, 11:58:00 am
How optimized are the ++ and -- commands?  Are they slower or faster than the normal A+1→A ?
Title: Re: Axe Q&A
Post by: Quigibo on June 28, 2011, 04:50:10 pm
They're the same for variables, but usually smaller/faster for memory locations.
Title: Re: Axe Q&A
Post by: Darl181 on June 28, 2011, 04:50:42 pm
Memory locations, meaning pointers?
Something like {P}++ ?
Title: Re: Axe Q&A
Post by: squidgetx on June 30, 2011, 11:29:14 am
Yes, and especially stuff like {P*2+4390+E+C}++; because whenever you have the form {EXP}+1->{EXP}, the expression has to be evaluated twice, while with the ++ and -- it only needs to be evaluated once.
Title: Re: Axe Q&A
Post by: Anima on July 01, 2011, 12:21:17 pm
Is it possible to delete programs with Axe?
Title: Re: Axe Q&A
Post by: Runer112 on July 01, 2011, 12:25:16 pm
Yes:

Code: [Select]
DelVar "prgmNAME"
Title: Re: Axe Q&A
Post by: Darl181 on July 06, 2011, 04:08:49 pm
Is there a bitwise expression to turn off bits?  I'm pretty sure it's and, but I tried Disp (7 and (5))►Dec and it outputted 4 instead of 2 ???
Title: Re: Axe Q&A
Post by: Deep Toaster on July 06, 2011, 04:16:27 pm
Think about it in binary: 7 is %00000111 and 5 is %00000101. ANDing them together would give you %00000101, which should be 5.

What AND does is leave on all the bits that are on in both operands and turn off all the others. If you want to turn off a specific bit, you should AND it with a number with just that bit turned off -- for example, to turn off the first bit (second rightmost), you'd use AND %11111101.
Title: Re: Axe Q&A
Post by: Darl181 on July 06, 2011, 04:23:31 pm
Ok, so you have to do it in a roundabout way.../me wonders if there should be a decent description of what they do in the docs or command list :P
Title: Re: Axe Q&A
Post by: ztrumpet on July 06, 2011, 04:25:14 pm
Here's how I learned it: http://eeezor.ec3club.tk/Files/Resources/Tutorials/ASMin28Days/lesson/day08.html
Title: Re: Axe Q&A
Post by: Quigibo on July 07, 2011, 01:14:27 pm
To turn off a bit pattern P in a number N, you just or the number with P and then And it with P compliment.  So for an 8 bit value in Axe:

N or P and not(P)
Title: Re: Axe Q&A
Post by: calc84maniac on July 07, 2011, 10:40:46 pm
Actually, N and not(P) is all you need.
Title: Re: Axe Q&A
Post by: Darl181 on July 11, 2011, 05:52:22 pm
About how axe rounds down...
Does it always "round down" per se, or does it round closer to zero?
As in, would -10//3 equal -3 or -4 ?
Title: Re: Axe Q&A
Post by: yunhua98 on July 11, 2011, 05:57:58 pm
with the number in decimal form, it just cuts off the digits to the right of the decimal point.  So closer to zero, I guess.
Title: Re: Axe Q&A
Post by: leafy on July 11, 2011, 06:20:16 pm
Axe doesn't round, it truncates.
Title: Re: Axe Q&A
Post by: Runer112 on July 11, 2011, 08:31:07 pm
In Axe, calculations that would generate decimals, such as division, will always be truncated. When dealing with positive numbers, this means results are rounded down. However, with negative numbers, the story changes slightly depending upon how the math is performed.

With something like ⁻10//3, the signed division routine converts any negative inputs to positives and then corrects the sign later. So it actually calculates the result of 10/3 which gives 3 due to truncation, but then negating the final answer to correct for the signs results in the answer actually having been rounded to zero from -3.333...

However, with optimized divisions like ⁻7//2, the inputs are not first converted to positive numbers and then operated on, resulting in the truncation actually rounding down to ⁻4.


In summary:
Title: Re: Axe Q&A
Post by: Darl181 on July 11, 2011, 08:53:05 pm
Ok...and the only place that lists the optimized constants is the auto-opts thing that comes with axe?
Title: Re: Axe Q&A
Post by: Runer112 on July 11, 2011, 08:55:55 pm
That, and my independent documentation of Axe's commands. These are the optimized signed divisions that will round down instead of to zero:

Title: Re: Axe Q&A
Post by: Darl181 on July 12, 2011, 06:04:24 pm
Ok, I guess I'll just use if statements or something :P

Another one..
Would this work...?
xor Be7→Be7
...e being the bit thing.
Or does and/or/xor always need two inputs, one bit or not?
Also, what exactly does not() do?
Title: Re: Axe Q&A
Post by: calc84maniac on July 12, 2011, 06:07:28 pm
You're trying to flip the bottom bit? Do B xor 1->B. and/or/xor do take 2 inputs. not() takes a value as input and inverts each bit.
Title: Re: Axe Q&A
Post by: Darl181 on July 12, 2011, 06:09:28 pm
Ok, cool.
I noticed you didn't put in parenthesis...when are they not needed?  When it's just a single number?
Title: Re: Axe Q&A
Post by: calc84maniac on July 12, 2011, 06:10:17 pm
Operations are always done from left to right unless you use parentheses to specify a different order.
Title: Re: Axe Q&A
Post by: Darl181 on July 12, 2011, 06:14:48 pm
Quote from: commands list http://omniurl.tk/5812
Returns the bitwise operation of the lower 8 bits of the expressions. You often need parenthesis on the second argument when used.

So...why is this?  All it does is switch the nums around (ie from 1 or (A) to A or 1 )?
Title: Re: Axe Q&A
Post by: calc84maniac on July 12, 2011, 06:16:16 pm
Ah, that just means if the second argument is an expression. For example, A=0 or (B=1)
Title: Re: Axe Q&A
Post by: Deep Toaster on July 12, 2011, 06:36:10 pm
Yeah, the point is that something like A=0 and B=0 gets evaluated as ((A=0) and B)=0. Just think strictly left to right.
Title: Re: Axe Q&A
Post by: Darl181 on July 14, 2011, 08:54:13 pm
Ok..

Is there a way to directly manipulate a single byte bit?
I've been checking it first then using xor if it's not the desired value, but is there a better way to do it?
Title: Re: Axe Q&A
Post by: calc84maniac on July 14, 2011, 08:58:38 pm
What do you mean, manipulate a single byte? Manipulate in what way?
Title: Re: Axe Q&A
Post by: Darl181 on July 14, 2011, 09:02:15 pm
byte bit

Like, you can do 1→A.  Is there a way to do something like that to one bit?
I've tried 1→#e# but that messes up the whole 8 bits..
Title: Re: Axe Q&A
Post by: calc84maniac on July 14, 2011, 09:20:07 pm
To work with bits, you need a bitmask. The bitmask corresponding to each of the 8 bits in a byte are 128, 64, 32, 16, 8, 4, 2, 1 (i.e. powers of 2). To store 1 to a bit of A, do A or bitmask->A. To store 0 to a bit of A, do A and not(bitmask)->A. To invert a bit of A, do A xor bitmask->A. You can even store to multiple bits at once by adding the appropriate masks together.

Edit:
It might also be easier to visualize the masks if you type them in directly as binary. For example, to set the 6th bit of A (counting from the left as the e command does), do A or π00000010->A. To reset the 3rd bit, do A and π11101111->A. To invert the 0th bit, do A xor π10000000->A
Title: Re: Axe Q&A
Post by: Darl181 on July 14, 2011, 10:27:56 pm
Yes, I figured out the binary and 2^n things I was just wondering what the commands would be to set the bit to a desired value.

So on, or; off and not(); invert, xor.  Thanks ;D
Title: Re: Axe Q&A
Post by: Freyaday on July 14, 2011, 10:53:47 pm
You can use the new Pxl(,,)command
Title: Re: Axe Q&A
Post by: Darl181 on July 14, 2011, 11:15:35 pm
Two things.
1: This isn't related to graphic stuff, but I can see where you're getting at using it with data.  I'd just prefer it to be more optimized.
2: I'm using 0.5.3 till the contest is over.

Good idea tho..
Title: Re: Axe Q&A
Post by: calc84maniac on July 14, 2011, 11:22:49 pm
By the way, using and not(mask) is actually much less optimized than doing and inverted_mask. If you're using a binary mask, change all the 0's to 1's or vice versa. If you're using a decimal mask, just subtract the mask from 255.
Title: Re: Axe Q&A
Post by: Hayleia on July 18, 2011, 02:20:59 pm
Ok, I have a very newbish question. Are there the binary and,nand,or,xor,etc ops in Axe ? Not that (4 and 2 = 1) because 4 and 2 aren't 0 but that (00000100 and 00000010 = 00000000) ?
Title: Re: Axe Q&A
Post by: Runer112 on July 18, 2011, 02:22:03 pm
In Axe, the logical operators are binary operators. 4 and 2 equals 0 in Axe.
Title: Re: Axe Q&A
Post by: Hayleia on July 18, 2011, 02:23:09 pm
O.O I didn't know that !
That's why I put "very newbish question".
Thanks a lot !!!
(I love Axe)

EDIT: You have exactly +255 respect O.O b11111111
Title: Re: Axe Q&A
Post by: Deep Toaster on July 18, 2011, 02:37:04 pm
It's and. 4 and 2 should actually return 0.

EDIT: Ninja'd by fifteen minutes ???
Title: Re: Axe Q&A
Post by: Darl181 on July 18, 2011, 02:39:50 pm
I think the reason bitwise expressions work in if statements is because it's only manipulating one bit.  They're essentially doing the same thing, iirc.

EDIT:/me pokes again for some tutorial or another on bitwise expressions to be put in the docs ;)
Title: Re: Axe Q&A
Post by: Deep Toaster on July 18, 2011, 02:49:48 pm
I think the reason bitwise expressions work in if statements is because it's only manipulating one bit.  They're essentially doing the same thing, iirc.

Yeah, that's why If 5 and 6 returns true, since

    %00000101
AND %00000110
=== %00000100


but If 4 and 2 returns false, since

    %00000100
AND %00000010
=== %00000000
Title: Re: Axe Q&A
Post by: Darl181 on July 18, 2011, 03:13:24 pm
Ok...
I went to compile DS in 1.0.1 and got a "Bad Flash" error pretty much instantly.
What exactly causes this to happen?


EDIT: nvm, just a really fun axe bug x.x
Title: Re: Axe Q&A
Post by: selectcoaxial on July 23, 2011, 12:22:40 am
Hi, I'm trying to create a new string randomly with letters from another string. This is what I have so far and it keeps giving me Bad Symbol error. I'm using Axe 0.5.3.

Code: [Select]
.RANDTXT
"0123456789-+/*^,()"→Str0
{Str0}+rand^18→Str1
Disp Str1
Title: Re: Axe Q&A
Post by: mrmprog on July 23, 2011, 12:48:45 am
I am no Axe expert, but I don't think you can store a var to a pointer. (I am probably wrong)
Title: Re: Axe Q&A
Post by: selectcoaxial on July 23, 2011, 01:11:33 am
or would it be better if I try to do this
Code: [Select]
{Str0+rand^18}→Str1?
Make a string with the byte at rand^18 of the string Str0 is pointing to and reference it with Str1?
Title: Re: Axe Q&A
Post by: Darl181 on July 23, 2011, 01:24:51 am
Try the latter.  As you're probably aware the brackets denote pointers.  What the initial code does is get the pointer to Str0, return the value of the byte there, then to that value add rand^18 to it.  I'm guessing that's what you're not trying to do :P
Also, iirc, you'll need to define Str1 before hand. 
Another thing, strings are zero-terminated.  That means the string lasts until it hits a zero.  So if you don't explicitly put a zero at the end of a string (unless you're defining with quotes (or maybe it always does that, I haven't tested it) ) the string could stretch for almost any amount.  Not good.

Assuming you're storing only one byte: [0000]→Str1 should work.  Then put the second code you posted. Read the post after this.
Title: Re: Axe Q&A
Post by: ztrumpet on July 23, 2011, 11:11:03 am
or would it be better if I try to do this
Code: [Select]
{Str0+rand^18}→Str1?
Make a string with the byte at rand^18 of the string Str0 is pointing to and reference it with Str1?
Please note that because Axe uses left to right order of operations that code isn't doing what you want.  It's doing {(Str0+rand)^18}->Str1 though you probably want {rand^18+Str0}->Str1 .  In addition, I'm pretty sure you want {Str1} instead of just Str1 .  Good luck with your program! :)
Title: Re: Axe Q&A
Post by: selectcoaxial on July 24, 2011, 12:26:02 am
I've tried what you said and it compiled nicely. I ran the program, it ran but the program return anything, it just says Done.

I want a 16-letter string so that's 32 0's for defining the string

Code: [Select]
.RANDTXT
[00000000000000000000000000000000]→Str1
"0123456789-+/*^,()"→Str0
For(I,1,16
{rand^18+Str0}→{Str1+2I-2}
End
Disp Str1

Why doesn't it display the string?
Title: Re: Axe Q&A
Post by: Darl181 on July 24, 2011, 12:37:38 am
Just as a hint/rule of thumb, you can count from zero--so that would be For(I,0,15).  Also iirc parenthesis, for the most part, should be closed.

At what part does it crash?  What might help figure out what's going on (because frankly I'm kind of confused at this point as well, I'll prolly have to test it or something :P): put in some Disps so you can tell how far it gets into the code before it goes.

Is this the entirety of the code, or is there something else in the program that might be messing with it?
Title: Re: Axe Q&A
Post by: selectcoaxial on July 24, 2011, 12:41:40 am
I modified my post above.
Title: Re: Axe Q&A
Post by: Darl181 on July 24, 2011, 12:52:12 am
It probably isn't displaying the string because it crashes before it gets to the code to display the string.

EDIT: {Str1+2I-2} ?  That would make it work with two-byte numbers if you had the r.
Just for the record, two hex digits (ie [00]) make one byte, not two.

EDIT2: The code from before you edited it, meaning the code with {Str1+I-1}, works correctly.  What might have happened is it displayed the string and quit so fast you didn't see it?  Try putting a Pause 1900 at the end (pauses for about a second) and then see what happens.
Title: Re: Axe Q&A
Post by: selectcoaxial on July 24, 2011, 01:07:55 am
The reason I edited to {Str1 + 2I - 2} was because each byte in the string with 16 letters represents a letter. So if I=1, position in the string (p) is 0; I=2, p=2, I=3, p=4 and so on. 2I-2 is the order of the 'th' in the string as 'I' increases.

I tried to put Pause 1900 at the end of the code and ran the program, the program paused for a while but still doesn't display anything.
Title: Re: Axe Q&A
Post by: Darl181 on July 24, 2011, 01:16:36 am
The code from before you edited it, meaning the code with {Str1+I-1}, works correctly.
That meaning, it displayed the string fine, and quit without a cinch.
Code: (What I'm using) [Select]
.ATEST
.[00000000000000000000000000000000]→Str1
Zeros(32)→Str1
.Zeros() does the same thing, but it's easier to code in in this case :P
.worked with initial bunch of 00s as well
"0123456789-+/*^,()"→Str0
For(I,0,15)
{rand^18+Str0}→{Str1+I}
.counting from zero is usually more efficient, in this case the -1 is omitted
End
ClrHome
Disp Str1
Repeat getKey(15)
.wait until clear is pressed
Pause 10
End
Worked without a problem for me.
Title: Re: Axe Q&A
Post by: selectcoaxial on July 24, 2011, 01:38:10 am
Oh, I think I know what I've been doing wrong all along now. Thanks for your help!
Title: Re: Axe Q&A
Post by: selectcoaxial on July 24, 2011, 01:55:52 am
Is there a way for Axe to input user's numbers? I looked at the command list of axe and there's a 'input' command. Anyone know how to use it?
Title: Re: Axe Q&A
Post by: Darl181 on July 24, 2011, 01:59:21 am
Input is really buggy, personally I'd only use it as a last resort.  You'd probably be better off making your own input routine :P (or use one from the routines thread, such as this (http://ourl.ca/4129/170416) from the routines thread)
Title: Re: Axe Q&A
Post by: calc84maniac on July 24, 2011, 02:52:10 am
The reason I edited to {Str1 + 2I - 2} was because each byte in the string with 16 letters represents a letter. So if I=1, position in the string (p) is 0; I=2, p=2, I=3, p=4 and so on. 2I-2 is the order of the 'th' in the string as 'I' increases.

I tried to put Pause 1900 at the end of the code and ran the program, the program paused for a while but still doesn't display anything.
You can't use implicit multiplication in Axe. The correct way to do it is {I*2+Str1-2}.
Title: Re: Axe Q&A
Post by: selectcoaxial on July 24, 2011, 02:55:48 am
thank you
Title: Re: Axe Q&A
Post by: Munchor on July 24, 2011, 05:30:30 am
Input is really buggy, personally I'd only use it as a last resort.  You'd probably be better off making your own input routine :P (or use one from the routines thread, such as this (http://ourl.ca/4129/170416) from the routines thread)

Yes, that's the only way to do it, even though I never managed to do it, even with the routines. I wish somebody posted an example :)
Title: Re: Axe Q&A
Post by: selectcoaxial on July 24, 2011, 06:44:43 am
In Axe example Axeguess, there are a few lines of code that confuses me.

1. While B-9→B>9:End, what is this for?
2. rand→B, this would make a random number all the way from 0 to 65000ish so how is this going to be contained within 0-9?
3. ReturnIf A 'not equal to' 0. why is the return here? isn't A not equal to 0 what the author wants?
4. Is there a way to display the user input number onto the screen at a specified coordinate and not as a text but something like Output( in TI-BASIC?

Code: [Select]
.GUESS
"GUESS THE NUMBERüStr1
"TOO HIGH!üStr1H
"TOO LOW!üStr1L
"YOU WIN!üStr1W
DiagnosticOff
Lbl MN
ClrHome
Disp Str1
rand→B
While B-9→B>9:End
Lbl M
sub(1)
If K=15
ClrHome
Return
End
If A>B
Disp Str1H,i
Goto M
End
If A<B
Disp Str1L,i
Goto M
End
Disp Str1W,i
Pause 2000
ClrHome
Return

Lbl 1
0→A
getKey→K
If K=36:7→AEnd
If K=35:4→AEnd
If K=34:1→AEnd
If K=28:8→AEnd
If K=27:5→AEnd
If K=26:2→AEnd
If K=20:9→AEnd
If K=19:6→AEnd
If K=18:3→AEnd
ReturnIf K=15
ReturnIf A not equal to 0
Goto 1
Title: Re: Axe Q&A
Post by: mrmprog on July 24, 2011, 07:44:27 am
Your first two questions are the answers to each other. The "While B-9→B>9:End"  limits the number to 0-9. The "ReturnIf A not equal to 0" causes the program to go back to after the subroutine is called. I think you can use the Output( command in a way similar to basic, the command list will probably say.
Title: Re: Axe Q&A
Post by: Munchor on July 24, 2011, 08:06:06 am
The "While B-9→B>9:End"  limits the number to 0-9.

Isn't it faster to just limit it with rand^X→B?
Title: Re: Axe Q&A
Post by: selectcoaxial on July 24, 2011, 08:07:51 am
I have no idea, this comes with the axe 0.5.3 package
Title: Re: Axe Q&A
Post by: mrmprog on July 24, 2011, 08:11:24 am
Well, that is from the example code that selectcoaxial posted, which I asume he got from the examples included with Axe. It may just be outdated. On that topic, is the sub(1) still valid in Axe 1.0.1?
Title: Re: Axe Q&A
Post by: selectcoaxial on July 24, 2011, 08:17:02 am
Darl gave me before a routine to display a text on the screen but that wasn't really what I was looking for so using Axeguess example, I've been trying to get input from user as follow:
1. "Input Number" is displayed on the screen
2. Number is input until user presses Enter
3. Number input is displayed on the screen

This is what I've come up with so far, I use 3→{length(A)+A} to add a byte at the end of an existing number in the memory like using lists in BASIC. 3→LX(1+dim(LX, if it works

Code: [Select]
.INPUTNO
"Input Number"→Str0
ClrHome
Disp Str0

sub(I)
Disp A,i
If getKey(15)
ClrHome
End

Lbl I
0→A
getKeyüK
Repeat getKey(9)
If K=36:7→{length(A)+A}
If K=35:4→{length(A)+A}
If K=34:1→{length(A)+A}
If K=28:8→{length(A)+A}
If K=27:5→{length(A)+A}
If K=26:2→{length(A)+A}
If K=20:9→{length(A)+A}
If K=19:6→{length(A)+A}
If K=18:3→{length(A)+A}
End
Goto I

I got an ERR: MISSING END during the compiling. Any help?

Edit: AXEGUESS in Axe 1.0.1 is exactly the same as the code in Axe 0.5.3 so I don't think it's outdated.
Title: Re: Axe Q&A
Post by: mrmprog on July 24, 2011, 08:20:27 am
Unfortunately, you can't do If statements without an end like in Basic. You must put an End after each one.
Title: Re: Axe Q&A
Post by: selectcoaxial on July 24, 2011, 08:33:15 am
if I have an infinite loop in my application, is there a quit button like ON in Basic? and not having to take out the batteries?
Title: Re: Axe Q&A
Post by: JosJuice on July 24, 2011, 08:39:16 am
if I have an infinite loop in my application, is there a quit button like ON in Basic? and not having to take out the batteries?
No, there is no quit button (unless you program one yourself).
Title: Re: Axe Q&A
Post by: mrmprog on July 24, 2011, 08:40:53 am
No, but doing Repeat Getkey(15) will loop until you press clear. I hope all these answers are helping you :)
Title: Re: Axe Q&A
Post by: Happybobjr on July 24, 2011, 11:53:47 am
Don't trust me 100% I have been known to make mistakes.

can you explain "{length(A)+A}" to me plz?  I am quite confused.
can't you just replace all instances of "{length(A)+A}"  to just be "A"
If you use {} you are pointing to a memory location. so basically you are just storing K to memory location 0.
Title: Re: Axe Q&A
Post by: Darl181 on July 24, 2011, 02:43:51 pm
Squidgetx made that routine, so idk really :P
But iirc what length() does is it goes through data until it reaches a zero, then returns that number.  If this is looped and used properly one could skip a definable number of [00]s, which the programmer could put in to separate strings and such.

Something to remember: Axe and basic are completely different.  The only thing they share are the editor and the tokens.  So a good part of the stuff that works in basic won't work in Axe, and vice-versa.


So waht you're trying to do with this is just have one number be put in, or a string of numbers?  Because the code above will only store one number to the variable. (actually I don't see the point of using length() in this, what are you trying to do with it?)
Title: Re: Axe Q&A
Post by: selectcoaxial on July 24, 2011, 09:48:41 pm
I'm just trying to input a 3 byte number. And you're right. It turns out using length is unnecessary. :)
N is a 3 byte number, and I have to to limit user input to those 3 bytes. A increases at every getKey interval

Code: [Select]
.INPUT
Zeros(6)→N
0→A
"Input number:"→Str0
Disp Str0,i
sub(I)
If K=15
ClrHome
Return
End
If K=9
Disp N>Dec,i
End

Lbl I
getKeyüK
If K=36:7→{N+A}End
If K=36:7→{N+A}End
If K=35:4→{N+A}End
If K=34:1→{N+A}End
If K=28:8→{N+A}End
If K=27:5→{N+A}End
If K=26:2→{N+A}End
If K=20:9→{N+A}End
If K=19:6→{N+A}End
If K=18:3→{N+A}End
A++
ReturnIf K=15
ReturnIf length(N)=3
ReturnIf K=9
Disp N>Dec,i
Goto I

The code above doesn't work and it just display 40802 continuously for some reasons.

What is the difference between using Repeat getKey(15):End vs Lbl:Goto? Don't they do the same thing? Is there any benefits in using one and not the other? Also, is there any benefits if I learn TI-ASM then Axe language?
Title: Re: Axe Q&A
Post by: Darl181 on July 24, 2011, 10:33:56 pm
Goto A would jump to Lbl A.  Repeat getKey(15):End waits until the user presses clear.

As for the code, A is always increased, not just when a key is pressed.  What might work is checking if the byte is non-zero, after the byte is stored.
Also I would change lines like this If K=36:7→{N+A}End to If K=36:7→{N+A}:End.  There's more optimized ways to handle it, but the way you have it works enough.
Btw numbers in axe/asm can only be up to two bytes.  trying to make a three-byte number won't work.

Axe is a lot less complicated than asm, but has some of the same concepts (pointers, data, etc)
Title: Re: Axe Q&A
Post by: Hayleia on July 25, 2011, 07:59:02 am
Another quick question. Is there a way to get the current level of contrast in Axe ? We can set it with Shade(X) but how to get it ?
Title: Re: Axe Q&A
Post by: Quigibo on July 25, 2011, 08:01:02 am
Shade().

To restore the OS's original contrast before you quit, use Shade(Shade()).  I've specifically optimized this nesting.
Title: Re: Axe Q&A
Post by: Hayleia on July 25, 2011, 08:02:17 am
Ok, thanks !
Title: Re: Axe Q&A
Post by: FinaleTI on July 25, 2011, 09:16:00 am
Goto A would jump to Lbl A.  Repeat getKey(15):End waits until the user presses clear.

As for the code, A is always increased, not just when a key is pressed.  What might work is checking if the byte is non-zero, after the byte is stored.
Also I would change lines like this If K=36:7?{N+A}End to If K=36:7?{N+A}:End.  There's more optimized ways to handle it, but the way you have it works enough.
Btw numbers in axe/asm can only be up to two bytes.  trying to make a three-byte number won't work.

Axe is a lot less complicated than asm, but has some of the same concepts (pointers, data, etc)
Actually, Runer wrote a library (http://ourl.ca/4129/155369) that lets you add, subtract and display 3 byte numbers.
Title: Re: Axe Q&A
Post by: selectcoaxial on July 27, 2011, 07:49:57 am
I'm a bit confused about the number system. If a 1-byte number can have a range from 0 to 255, then why is it when I type 55 into notepad then look at it in a hex editor (HxD), I got 35 35? Isn't it supposed to be hold in one byte and not two bytes?
Title: Re: Axe Q&A
Post by: Ashbad on July 27, 2011, 08:22:50 am
"55" is a string when looked at in a text format.  Once it is compiled, it will correspond to the actual 55, but each character is one byte in text format.  The ASCII equivalent of 5 on TI-8x calcs is 35.
Title: Re: Axe Q&A
Post by: selectcoaxial on August 03, 2011, 04:03:37 am
Thank you! I read somewhere on the forum that Axe doesn't handle decimals numbers and it will be rounded automatically down and up. Is that right? Is there a routine or a way to store numbers such as 0.53?
Title: Re: Axe Q&A
Post by: Aichi on August 03, 2011, 04:39:12 am
You could store the values 0.00 to 655.35 in two bytes if you multiplicate your values by 100.
Displaying them correctly would be possible with an own displaying routine.
Furthermore Axe supports access to the floating-point variables of the OS afaik. Just take a look at the commands list. :)
Title: Re: Axe Q&A
Post by: Quigibo on August 03, 2011, 05:06:28 am
There is also the new decimal feature in Axe... If you type: 0.53, it will automatically convert the number to fixed point notation, which in hex would be: 0x0087.  Some common operations with fixed point numbers are FP-inverse and FP-multiplication.  Converting from fixed point to decimal is easy: Divide by 256 to get the integer part.  Mod by 256 to get the fractional part (a fraction out of 256).
Title: Re: Axe Q&A
Post by: Ashbad on August 03, 2011, 07:33:37 am
You could store the values 0.00 to 655.35 in two bytes if you multiplicate your values by 100.
Displaying them correctly would be possible with an own displaying routine.
Furthermore Axe supports access to the floating-point variables of the OS afaik. Just take a look at the commands list. :)

Perhaps you mean 0.0 to 255.255?  655.35 wouldnt work so well as a FP high limit, considering the decimal part and integer part are both 8 bits.
Title: Re: Axe Q&A
Post by: ztrumpet on August 03, 2011, 09:23:42 am
You could store the values 0.00 to 655.35 in two bytes if you multiplicate your values by 100.
Displaying them correctly would be possible with an own displaying routine.
Furthermore Axe supports access to the floating-point variables of the OS afaik. Just take a look at the commands list. :)

Perhaps you mean 0.0 to 255.255?  655.35 wouldnt work so well as a FP high limit, considering the decimal part and integer part are both 8 bits.
Nah, I think he meant what he said.  I'm pretty sure he was giving an example with 100 as an arbitrary number.
Title: Re: Axe Q&A
Post by: Freyaday on August 03, 2011, 10:46:22 am
Your mixing your bases with 255.255, as that number is beyond Axe's precision in decimal and out of bounds in hex. What you're looking for is 0xFF.FF, 255+(255/256) in decimal.
Title: Re: Axe Q&A
Post by: selectcoaxial on August 04, 2011, 05:53:54 am
I found a way around using decimals numbers :D. thanks. I'm having a problem with calling sub functions. I'm using Ashbad's guide for Axe v0.5.3 because I've had problems of getting my RAM and Archive cleared when I used Axe v1.0.1. The problem I'm having with my program is that it display the value of C 6 times, even though I only ask for it thrice, and the value of C is even different from each other in every Disp call. the code is below:

Code: [Select]
.PAST

sub(PAS,5)

Lbl PAS
1->C
1->K
r1-K->B
sub(EXC,r1)
A->C
Disp C>Dec,i
sub(EXC,K)
C/A->C
Disp C>Dec,i
sub(EXC,B)
C/A->C
Disp C>Dec,i
Return

Lbl EXC
1->A
For(I,1,r1
A*I->A
End
Return

Display are as follow: 120, 120, 5, 24, 24, 4

EXC is used for factorials ! and PAS is to generate a binomial coefficient.

The value for C I expected is 5
Title: Re: Axe Q&A
Post by: MGOS on August 04, 2011, 07:27:09 am
Your problem is that you don't quit the program after calling sub(PAS). Then the programm will pass this function twice -> you get it displayed 6 times.
put a return after
sub(PAS,5)
Title: Re: Axe Q&A
Post by: selectcoaxial on August 05, 2011, 10:06:55 am
I don't think so because if I use
Code: [Select]
sub(EXC,3)
Disp A>Dec,i

I only get 1 display.
Title: Re: Axe Q&A
Post by: zeldaking on August 05, 2011, 10:10:30 am
Advice: Don't use axe 1.0.0 or 1.0.1 as of now, they have a pretty good bug that killed my calculator (still trying to fix it).
Title: Re: Axe Q&A
Post by: Ashbad on August 05, 2011, 02:33:45 pm
Advice: Don't use axe 1.0.0 or 1.0.1 as of now, they have a pretty good bug that killed my calculator (still trying to fix it).

You can use 1.0.2

Your problem is that you don't quit the program after calling sub(PAS). Then the programm will pass this function twice -> you get it displayed 6 times.
put a return after
sub(PAS,5)

Very, very correct.  PAS will be executed twice; the return for the definition label will eventually be used as the program-quitting return statement.  Put a return there where he said too; everything else seems fine from my quick skimming through it.

Your mixing your bases with 255.255, as that number is beyond Axe's precision in decimal and out of bounds in hex. What you're looking for is 0xFF.FF, 255+(255/256) in decimal.

Meh, 255.255 isn't out of the range at all.  It's the same as 0xFF.FF, but in decimal form, since 0xFF == 255.  It's a correct representation.
Title: Re: Axe Q&A
Post by: Runer112 on August 05, 2011, 04:28:11 pm
Just for clarification because people seem to be confused: fixed point numbers in Axe are represented in decimal just like you would represent them normally. 255.255 is not 255+(255/256) or 0xFFFF. It's a decimal representation, so 255.255 is 255+(255/1000) or 0xFF41. If you wanted to represent the maximum fixed point number, you would use 255.999 which is 0xFFFF.
Title: Re: Axe Q&A
Post by: Ashbad on August 05, 2011, 08:17:53 pm
but, to keep it clean since you can't represent every single one of those 255,999 numbers, 255.255 is a better representation because it keeps you thinking in binary terms.  255.999 works, but it's rather misleading because you can't access all of the numbers such as 255.999, 255.998, 255.997, etc.  you can only access 25.5% of them.  255.255 is a better representation because while it doesn't conform perfectly to decimal standards (it makes it seem like the max limit on the fpart is just over 1/4) it represents the range better, as it's just a decimal representation of each separate ipart and fpart, instead of the value as a whole.  I still stand correct, as it's still a correct representation, just a different one. :)

Title: Re: Axe Q&A
Post by: Runer112 on August 05, 2011, 08:33:22 pm
It's not the representation Axe uses though. So whether or not it can be correct in other situations, I don't want people using it in Axe and then being helplessly confused when their program acts just a little strange because of a slightly off constant.
Title: Re: Axe Q&A
Post by: Ashbad on August 05, 2011, 08:46:50 pm
It's not the representation Axe uses though. So whether or not it can be correct in other situations, I don't want people using it in Axe and then being helplessly confused when their program acts strange.

You use what you want, I'll use what I want; the correct way for axe if you are going to do it that way should be 999.999, since it's confusing for some if you mix a pure-decimal part with a "this is how many numbers a byte can portray" part.  Since it's entirely an incarnation of a u_int8.u_int8 format, either way is correct based on how you want to think of it.  Using 1000 units to fill a space where each of those units fills a space of .255 natural units (so, only 25.5% of them can actually represented by the fpart) is more confusing since the 1000 unit standard is rather arbitrary and made up while the 256 unit standard is extremely natural and conforming to how things actually work.  Just as long as people realize that .0x01 = .00390625, or 1/256 unnatural units, they'll be even better off.  Kinda like how radians are better to work with in many cases than degrees since 360 is a somewhat arbitrarily made up standard for units, whereas 2pi radians are more natural.

Of course, it all matter on how they are supposed to be thought of, but for the most part 255.255 is a more natural description.
Title: Re: Axe Q&A
Post by: Runer112 on August 05, 2011, 08:50:16 pm
Ashbad, I am not stating that I think the .999 representation is better. I am stating that it is what Axe uses, regardless of which representation any of us thinks is better or worse. Your constants will not be parsed correctly if you use the .255 representation.
Title: Re: Axe Q&A
Post by: Ashbad on August 05, 2011, 09:04:29 pm
Yeah, that's true.  But I think the new floating point notation thing is bad simply because how it treats it as a 1000 unit case.  I personally would suggest a different, more accurate notation that conforms to a more realistic approach, since it'll say close numbers like 255.998 and 255.999 are the same; this will throw less advanced users off more so than the concept of a 256 base-unit system.
Title: Re: Axe Q&A
Post by: fb39ca4 on August 05, 2011, 09:24:08 pm
Well, then you lose the speed advantage present in 8.8 fixed point notation.
Title: Re: Axe Q&A
Post by: Freyaday on August 05, 2011, 09:25:47 pm
How about EFF.FF ?
Title: Re: Axe Q&A
Post by: calcdude84se on August 05, 2011, 09:30:28 pm
You don't use a point if you want to do it like that, Frey. And I'm not sure if the lower nibble is signed or unsigned, but I'm pretty sure the upper nibble is. Otherwise, yeah, you can do it like that.
t0xic: what speed? The decimal->hexadecimal FP conversion is done at compile-time.
Edit: 1984th post.
Title: Re: Axe Q&A
Post by: Ashbad on August 05, 2011, 09:41:26 pm
Well, then you lose the speed advantage present in 8.8 fixed point notation.

What are you even talking about?  This is still 8.8 notation we're talking about here, just a different, more suitable form of representation :P

How about EFF.FF ?

Decent pitch idea, I'd go with that for now; though I would still prefer that the decimal notation was changed to represent 256 pieces, instead of 1000, since I find the 1000 fpart base-units rather useless since all it does is unnessicarily sugarcoat the fpart number as a thousandth, rather than a 28th piece.  All it will do in hindsight is confuse less advanced programmers into thinking axe decimal comparisons are broken, since 255.999 should not equal 255.998 in any sane situation.

Edit: yo, calcdude, watch out for big brother.
Title: Re: Axe Q&A
Post by: Runer112 on August 05, 2011, 09:49:26 pm
There is no reason for ᴇFF.FF, since that is exactly the same as ᴇFFFF. And I prefer the .999 notation for fixed point numbers. The point of the XXX.XXX support was to make fixed-point numbers easier to add as decimals for programmers more used to TI-BASIC. If you want to specify an exact fractional part, you should probably be working in hexadecimal anyways since that's more like how the number is actually stored.
Title: Re: Axe Q&A
Post by: Freyaday on August 05, 2011, 09:52:16 pm
Topic change:
What does /0 return and what does //0 return?
Title: Re: Axe Q&A
Post by: Ashbad on August 05, 2011, 09:59:16 pm
perhaps they should be packed differently as BCD or (better yet) u_int8%100.u_int8%100 numbers, so that way stupid rounding errors that make different decimals actually equal don't happen.  XX.XX notation with a 00.00 to 99.99 range would work much, much better, as it would conform to human senses better without providing a false security of a higher containing capacity of a number set than what actually exists.  If this form was truly added to make working with numbers easier, then it's got to lose some efficiency in return to make it work in a way that makes actual sense.  Considering a more realistic FP notation, human ease of use and sense of applied-workingness is worth much more than a petty dozen cycles and a handful of bytes added to routines.

Edit: programmers used to TI-BASIC not only expect a working decimal system (I totally agree with you on that), but they also expect 255.999 and 255.998 not to be equal. In a decimal sense, it makes zero sense, so you have constantly think in both a hexadecimal AND decimal perspective at the same time, which is a lot more confusing than just learning what hexidecimal and a 256 base-units system is (in fact, they'll get it a LOT faster this way).

Edit2: or even better, eliminate the XXX.XXX system, and make a similar XX.XX system where each of the 100 base-units is equal to .390625 256 base-unit units, which would mean ever one of those 10,000 would fit within the range; therefore, no round-off errors would happen, and no one gets confused.
Title: Re: Axe Q&A
Post by: selectcoaxial on August 06, 2011, 07:44:02 pm
Umm, can I ask a question?

So, I'm trying to make a list of values, much of a Pascal triangle row. I'm expecting something similar to {1 5 10 10 5 1} like in TI-BASIC, or something that is workable with to get individual byte's value later on. I'm getting 34540 whenever I run the program.

EXC returns a factorial of a number. Each value in a pascal triangle row is found out by finding n!/(k!(n-k)!) where n is the nth row, in this case 5. k is from 1 to 5. First value in that row is 5, not 1. Because k cannot be 0, I declare L1 by starting with 1.

Code: [Select]
.PASCAL
ClrHome
sub(PAS,5)
Disp L1>Dec
Return

Lbl PAS
1->{L1}
1->C
For(J,1,r1
r1-J->B
sub(EXC,r1
A->C
sub(EXC,J
C/A->C
sub(EXC,B
C/A->C
C->{L1+J}
End
Return

Lbl EXC
1->A
For(I,1,r1
A*I->A
End
Return

EDIT: I just looked at Axe Q&A first page, and the first post says GDB cannot be modified. So I've modified the code above to see whether I can use free RAM, but I still get a number instead a range of numbers.
Title: Re: Axe Q&A
Post by: Runer112 on August 06, 2011, 09:33:25 pm
Axe can display strings, characters, tokens, numbers, and hexadecimal numbers, but not a list of numbers. To display a list of numbers, you'd have to loop through them and display them one by one. The reason you're seeing 34540 is because L₁ is a pointer to an area of free memory, and 34540 happens to be the decimal value of the pointer. Try calling the following modified version of PAS, it should display the values as it calculates them.

Code: [Select]
Lbl PAS
ClrHome
For(J,0,r1
r1-J->B
sub(EXC,r1
A->C
sub(EXC,J
C/A->C
sub(EXC,B
C/A->C
C->{L1+J}
Disp C>Dec,i
.Imaginary ^
End
Return
Title: Re: Axe Q&A
Post by: selectcoaxial on August 10, 2011, 07:36:39 am
Thank you Runner. Trace's working now. Is there a routine or axe's way to display and prompt user input at the same time like Prompt in BASIC? This is currently what I'm working on. like, how can I make the cursor blinks at the same time as user input and I'm finding out a way to delete number like in Prompt in BASIC.

Also, if you have the APP Finance that comes with the calculator, the screen has a list of variables and user can scroll up and down to input number. Can Axe do this?

Code: [Select]
Lbl 001
getKey->K

If K=15
.QUIT
Return
./QUIT
End

If K=33:N*10+0->NEnd
If K=34:N*10+1->NEnd
If K=26:N*10+2->NEnd
If K=18:N*10+3->NEnd
If K=35:N*10+4->NEnd
If K=27:N*10+5->NEnd
If K=19:N*10+6->NEnd
If K=36:N*10+7->NEnd
If K=28:N*10+8->NEnd
If K=20:N*10+9->NEnd
If N<10
Output(1,1,N>Dec)
Else
Return
End
Goto 001

EDIT: Just wondering, what is main buffer and back buffer?
Title: Re: Axe Q&A
Post by: squidgetx on August 10, 2011, 09:36:59 am
Hey, selectcoaxial, let me teach you about a cool feature Axe has called inData(). It's basically like BASIC's instring()...We can use it to search for K in a list of key values, then add its position in the list -1 to N*10; if K=34, the inData piece will return 2 for example then minus 1. Here's the modified code

Code: (with indata) [Select]
Lbl 001
getKey->K

ReturnIf K=15

If K            //if K is not 0
N*10+inData(K,Data(33,34,26,18,35,27,19,36,28,20,0))-1->N   
End

If N<10
Output(1,1,N>Dec)
Else
Return
End
Goto 001

Also, to answer your other question, the main buffer is in L6, and it displays regular black/white gfx. The back buffer is in L3, and isnt displayed unless you use a variant of DispGraph^r, in which case it will display grayscale
Title: Re: Axe Q&A
Post by: selectcoaxial on August 11, 2011, 04:27:31 am
That's fantastic! Thanks Squidgetx!
Title: Re: Axe Q&A
Post by: selectcoaxial on August 12, 2011, 07:04:25 pm
This is probably very stupid to ask, but I find myself learning Axe very slowly. I read through the document and I read tutorials on Axe. But when I read codes from open source Axe programs, I have to spend a really long time to figure out what it does, most of the time, I can't figure out either. So I'd like to ask how you learned Axe at the beginning and how did you progress to this stage?
Title: Re: Axe Q&A
Post by: Ashbad on August 12, 2011, 09:35:10 pm
This is probably very stupid to ask, but I find myself learning Axe very slowly. I read through the document and I read tutorials on Axe. But when I read codes from open source Axe programs, I have to spend a really long time to figure out what it does, most of the time, I can't figure out either. So I'd like to ask how you learned Axe at the beginning and how did you progress to this stage?

Looking at other people's code is never a good idea to boot.  Everything does things differently, and very different coding styles -- I personally air on the side of using too many offset variables with expense of readability; DeepThought uses like a million different source files with local variables; Runer crams everything all in one; and so on and so forth.  It's not like C or even higher level languages where everything has a name, comments are actually used more than like three times per program (I don't like them in Axe, good comment takes up a whole screen), structures are easier to follow for readers, etc.

I suggest the best thing you can possibly do is practice.  Make games, utilities, or even test programs to see how things work.  This is very productive, even if you don't finish any of the games; you'll learn a lot.  Plus, you'll be sure to run into more questions a lot quicker (and ask them here for answers!), and therefore will know more and more over time than you would be reading other people's work.
Title: Re: Axe Q&A
Post by: Hayleia on August 13, 2011, 07:36:04 am
Well, for me, I learnt Basic by using people's code. And then, Axe came quite easily, even if the commands are different (but my optimization is zero). But learning Axe by using people's code could be difficult, I even have difficulties to read myself sometimes :P
(bad English, French I am, sry).
Title: Re: Axe Q&A
Post by: mrmprog on August 13, 2011, 11:11:54 am
Reading other people's code is tough in axe, especially if it is very optimized. A good thing to start with is reading the command list, even if you don't understand it.
Title: Re: Axe Q&A
Post by: ztrumpet on August 13, 2011, 08:54:04 pm
I learned Basic by reading through other peoples' code and through TI Basic Developer, as well as learning some things at school.  From there, Axe came pretty easily.
I recommend picking a few simple games in Axe and looking through their complete source code to see how certain things are accomplished and how they're all alike and going from there.  Good luck! :)
Title: Re: Axe Q&A
Post by: Darl181 on August 14, 2011, 11:49:08 am
Which is more optimized, While 1 or Repeat 0? Or are they the same size?
Title: Re: Axe Q&A
Post by: Runer112 on August 14, 2011, 11:51:02 am
Both are the same size: 0 bytes.
Title: Re: Axe Q&A
Post by: baptystes on August 16, 2011, 04:05:46 pm
Hey guys, sorry for my english because i am french, but can some one explain me how to use the link port, how to send some variable, files, to make a multiplayer game.
Thank's
Title: Re: Axe Q&A
Post by: calc84maniac on August 16, 2011, 04:28:20 pm
Both are the same size: 0 bytes.
They're 2-3 bytes including the End, right?
Title: Re: Axe Q&A
Post by: Runer112 on August 16, 2011, 04:31:02 pm
2 or 3 bytes with End, 4 or 5 bytes with EndIf or End!If. But While 1 and Repeat 0 themselves result in 0 bytes of compiled code. ;)
Title: Re: Axe Q&A
Post by: Freyaday on August 16, 2011, 08:32:23 pm
But that's a moot point because Axe doesn't let you leave off the end, rendering the question itself wrong.
Title: Re: Axe Q&A
Post by: Darl181 on August 16, 2011, 08:52:52 pm
...I was asking about that simgle line, not the entire loop :P
2 or 3 bytes with End, 4 or 5 bytes with EndIf or End!If. But While 1 and Repeat 0 themselves result in 0 bytes of compiled code. ;)
Ok thanks, that's what I needed.
Title: Re: Axe Q&A
Post by: Stefan Bauwens on August 18, 2011, 05:21:53 am
I have a question. I have just started in axe and I never programmed on the z80 calcs really before. I am used to in 68k basic to use matrices as a way to save map data. Something like this:
Code: [Select]
{{1,1,1,1,1,1},{1,0,0,0,0,1},{1,0,0,0,0,1},{0,0,0,0,0,0}}➝matrixBut I don't know if this is possible on the Ti-83+.
Maybe axe doesn't support it...
Also if it would be possible is there a limit, or can I have huge matrices? Thanks in advance. :)
Title: Re: Axe Q&A
Post by: FinaleTI on August 18, 2011, 09:43:05 am
I have a question. I have just started in axe and I never programmed on the z80 calcs really before. I am used to in 68k basic to use matrices as a way to save map data. Something like this:
Code: [Select]
{{1,1,1,1,1,1},{1,0,0,0,0,1},{1,0,0,0,0,1},{0,0,0,0,0,0}}➝matrixBut I don't know if this is possible on the Ti-83+.
Maybe axe doesn't support it...
Also if it would be possible is there a limit, or can I have huge matrices? Thanks in advance. :)
Well, Axe doesn't technically support matrices, everything used to store data is an array of bytes.

There are a couple ways to do it. One is to use hex:
Code: [Select]
[010101010101]
[010000000001]
[010000000001]
[000000000000]➝pointer

Another way is to use the Data() command:
Code: [Select]
Data(1,1,1,1,1,1,1,0,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0)➝pointer
The only limit to these arrays of bytes is your free memory. If you had the memory free, you could have a 128*128 map or possibly larger.

Once you've set up your array of bytes, you would read each byte like you would a cell in a matrix.
Code: [Select]
{Y*Width+X+pointer}Where Y is your Y-coordinate, X is your X-coordinate, and Width is the width of the map, and pointer is the pointer to your map data.
Title: Re: Axe Q&A
Post by: Michael_Lee on August 18, 2011, 10:13:27 am
Hey guys, sorry for my english because i am french, but can some one explain me how to use the link port, how to send some variable, files, to make a multiplayer game.
Thank's

To use the link port, use 'send' and 'get'

From the Axe documentation:
Send(BYTE,TIME)Tries to send the byte across the linkport. It will keep trying until the other calculator receives the byte or time runs out. Returns 1 if the byte was sent successfully or 0 if it timed-out. Time is in the order of microseconds.
GetChecks if the sender is trying to send anything. Returns the byte if it was received or -1 if nothing was sent. No waiting is done.

Note, however, that the two calculators have to be perfectly synchronized -- if the recieving calc doesn't use 'Get' at the same time the other calculator uses 'Send', the data won't be received.

What do you mean by 'sending variables and files'?  Do you mean while you're running an Axe program, or do you mean normally?

As far as I know, there really isn't any standard set of tricks that can help you make a multiplayer game; it's just critical that you design your program flow correctly.
I don't know how responsive sending and receiving is, so it might be a good idea to avoid any real-time multiplayer games, and instead make something that's more 'turn-based', if that makes sense.
Title: Re: Axe Q&A
Post by: Stefan Bauwens on August 18, 2011, 12:10:34 pm
I have a question. I have just started in axe and I never programmed on the z80 calcs really before. I am used to in 68k basic to use matrices as a way to save map data. Something like this:
Code: [Select]
{{1,1,1,1,1,1},{1,0,0,0,0,1},{1,0,0,0,0,1},{0,0,0,0,0,0}}➝matrixBut I don't know if this is possible on the Ti-83+.
Maybe axe doesn't support it...
Also if it would be possible is there a limit, or can I have huge matrices? Thanks in advance. :)
Well, Axe doesn't technically support matrices, everything used to store data is an array of bytes.

There are a couple ways to do it. One is to use hex:
Code: [Select]
[010101010101]
[010000000001]
[010000000001]
[000000000000]➝pointer

Another way is to use the Data() command:
Code: [Select]
Data(1,1,1,1,1,1,1,0,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0)➝pointer
The only limit to these arrays of bytes is your free memory. If you had the memory free, you could have a 128*128 map or possibly larger.

Once you've set up your array of bytes, you would read each byte like you would a cell in a matrix.
Code: [Select]
{Y*Width+X+pointer}Where Y is your Y-coordinate, X is your X-coordinate, and Width is the width of the map, and pointer is the pointer to your map data.
So If I didn't make a mistake here, this should draw (a part of the map) to fill the screen?
Code: [Select]
.0
[hexcode1]->pic0
.1
[hexcode2]

for a,0,11
for b,0,7
pt-on(a*8-8,b*8-8,{Y*Width+X+pointer}+pic0)
end
end
Thanks a lot Final Ti. :)
Title: Re: Axe Q&A
Post by: Hayleia on August 19, 2011, 12:16:39 pm
Spoiler For false:
So If I didn't make a mistake here, this should draw (a part of the map) to fill the screen?
Code: [Select]
.0
[hexcode1]->pic0
.1
[hexcode2]

for a,0,11
for b,0,7
pt-on(a*8-8,b*8-8,{Y*Width+B+pointer}+pic0)
end
end
Thanks a lot Final Ti. :)

Nope, better like this ;) (In black, your correct code. In red, your wrong code. In green, corrected code,)

.0
[hexcode1]->Pic0
.1
[hexcode2]

for a,0,11
for b,0,7
For(A,0,11
   For(B,0,7                  .not really an error but not written with the exact syntax
      pt-on(a*8-8,b*8-8,{Y*Width+X+pointer}+pic0)
      Pt-On(A*8,B*8,{Y*Width+X+Pic0}
      .you put +pointer but the pointer is Pic0 here
      .your X and Y must play with A and B according to the character's placement
   End
End

Maybe I made a mistake, I am not an uber programmer ;D

I also have a question. How do we handle 2 bytes data ??? ?
(Axe 0.5.3 user)
To have 65535 and 65535 at GDB1 and GDB1+1, do I do
Data(65535r,65535r)→GDB1
or Data(65535,65535)r→GDB1
or Data(255r,255r,255r,255r)→GDB1
etc...
and to read, I use {GDB1r} or {GDB1}r ?
Title: Re: Axe Q&A
Post by: Stefan Bauwens on August 19, 2011, 12:26:58 pm
So If I didn't make a mistake here, this should draw (a part of the map) to fill the screen?
Code: [Select]
.0
[hexcode1]->pic0
.1
[hexcode2]

for a,0,11
for b,0,7
pt-on(a*8-8,b*8-8,{Y*Width+X+pointer}+pic0)
end
end
Thanks a lot Final Ti. :)

Nope, better like this ;) (In black, your correct code. In red, your wrong code. In green, corrected code,)

.0
[hexcode1]->Pic0
.1
[hexcode2]

for a,0,11
for b,0,7
For(A,0,11
   For(B,0,7                  .not really an error but not written with the exact syntax
      pt-on(a*8-8,b*8-8,{Y*Width+X+pointer}+pic0)
      Pt-On(A*8,B*8,{Y*Width+X+Pic0}   .you put +pointer but the pointer is Pic0 here
   End
End

Thanks for correcting me. But if my map dat is stored in GDB1 then shouldn't I write: pt-on(a*8-8,b*8-8,{Y*Width+X+GDB1}+pic0)
That's the only place I put GDB1, so I think it has to be there or else it can't read it.
Title: Re: Axe Q&A
Post by: FinaleTI on August 19, 2011, 12:27:12 pm
      pt-on(a*8-8,b*8-8,{Y*Width+X+pointer}+pic0)
      Pt-On(A*8,B*8,{Y*Width+X+Pic0}   .you put +pointer but the pointer is Pic0 here
Actually, that's not correct either. That would read the data from the tile data, not the map data, which is what pointer represented.
The correct way would actually be:
Code: [Select]
Pt-On(A*8,B*8,{Y*Width+X+pointer} * 8 + Pic0)Because each tile is 8 bytes.

And a tip to Stefan Bauwens: Always close your parenthesis in Axe, because it doesn't result in more optimized code, and can cause compilation problems if you don't.
Title: Re: Axe Q&A
Post by: Hayleia on August 19, 2011, 12:31:15 pm
(°-.-) sorry, I did not read properly. I put in a spoiler so people don't get wrong by reading me.
(lol I got wrong even if I made a game based on tilemapping O.O)
Title: Re: Axe Q&A
Post by: Stefan Bauwens on August 19, 2011, 12:38:14 pm
Thanks both for the help. I just want to be sure of something so I ask this question:
Code: [Select]
[010101010101]->GDB1So "01" is 8 bytes?
Title: Re: Axe Q&A
Post by: Hayleia on August 19, 2011, 12:38:36 pm
"01" is 1 byte=8 bits (hope I am not wrong on that one)
Because each tile is 8 bytes.
...is referring to the sprites: [hexcode]→Pic0
Title: Re: Axe Q&A
Post by: Stefan Bauwens on August 19, 2011, 12:45:26 pm
But GDB1+8 will read only 2 digits?
Title: Re: Axe Q&A
Post by: Hayleia on August 19, 2011, 12:47:10 pm
No, it is an hex code. [01]=b00000001
Title: Re: Axe Q&A
Post by: Stefan Bauwens on August 19, 2011, 12:48:37 pm
No, it is an hex code. [01]=b00000001
But if "01" is one tile and my map reader has to read each tile seperate, how does he only read that one?
Title: Re: Axe Q&A
Post by: Hayleia on August 19, 2011, 12:50:37 pm
um.. I am not English so the word digit is a bit lolwut for me.
The map reader, in [01] understand the number 1, and by [FF] understands 255 if that helps.
Title: Re: Axe Q&A
Post by: Stefan Bauwens on August 19, 2011, 12:51:20 pm
Ok, thanks. :)
Title: Re: Axe Q&A
Post by: Hayleia on August 19, 2011, 12:54:50 pm
No problem. I help those who need help because I first received help when I needed.
Yay, quoting myself :w00t:
I also have a question. How do we handle 2 bytes data ??? ?
(Axe 0.5.3 user)
To have 65535 and 65535 at GDB1 and GDB1+1, do I do
Data(65535r,65535r)→GDB1
or Data(65535,65535)r→GDB1
or Data(255r,255r,255r,255r)→GDB1
etc...
and to read, I use {GDB1r} or {GDB1}r ?
Title: Re: Axe Q&A
Post by: FinaleTI on August 19, 2011, 01:13:33 pm
No problem. I help those who need help because I first received help when I needed.
Yay, quoting myself :w00t:
I also have a question. How do we handle 2 bytes data ??? ?
(Axe 0.5.3 user)
To have 65535 and 65535 at GDB1 and GDB1+1, do I do
Data(65535r,65535r)→GDB1
or Data(65535,65535)r→GDB1
or Data(255r,255r,255r,255r)→GDB1
etc...
and to read, I use {GDB1r} or {GDB1}r ?
Data(65535r,65535r)→GDB1
Is the correct way of storing 65535 and 65535 to GDB1 and GDB1+2.

You would access each number like {GDB1}r, {GDB1+2}r, etc., but you must remember that since you're dealing with 2 byte numbers, the addresses are two bytes apart.
Reading {GDB1}r and {GDB1+1}r is incorrect because while you read the first number correctly, you're reading a byte from the first and second number for your {GDB1+1}r statement, resulting in an incorrect number.

Title: Re: Axe Q&A
Post by: Hayleia on August 20, 2011, 02:26:13 am
Ok, thanks a lot :)
Title: Re: Axe Q&A
Post by: Happybobjr on August 22, 2011, 06:07:39 pm
could someone please provide me a code to check if another program is using the same code :P
poorly said :P


Like to make sure, in a 2 player game, that the other person is running the program to.
Title: Re: Axe Q&A
Post by: calcdude84se on August 22, 2011, 07:42:57 pm
could someone please provide me a code to check if another program is using the same code :P
poorly said :P


Like to make sure, in a 2 player game, that the other person is running the program to.
It's impossible to guarantee this perfectly. Moreover, it doesn't seem very necessary :/ Anyway, you could assign a random number to each of your games and have each copy send its number to the other calc, where it's checked for equality. This would mainly prevent accidents more than anything else.
Title: Re: Axe Q&A
Post by: Happybobjr on August 22, 2011, 08:21:32 pm
I already kinda have that.  my big problem comes from ti-os automatically receiving the inputs :P

thanks though.
Title: Re: Axe Q&A
Post by: Happybobjr on September 05, 2011, 10:30:06 am
How can i rotate a square section/ all of my screen 64 (90) degrees?
Title: Re: Axe Q&A
Post by: Hayleia on September 17, 2011, 02:31:25 pm
[lately noticed] page 42 [/lately noticed]

What do I write to create and read from an appvar named "A_A" (with the underscore) ?
GetCalc("appvA_A",2) didn't give me an underscore but a distorted "X" D:

EDIT: forget about my question. The answer is GetCalc("appvA"[5F]"A",2)
Title: Re: Axe Q&A
Post by: Freyaday on September 18, 2011, 05:16:56 pm
That "X" is the Greek letter Chi. Just so you know. :)
Title: Re: Axe Q&A
Post by: ztrumpet on September 18, 2011, 05:20:18 pm
How can i rotate a square section/ all of my screen 64 (90) degrees?
I suggest going through each bit of one buffer and changing the bits of another.  This would probably be done using the e command.
Title: Re: Axe Q&A
Post by: Michael_Lee on September 20, 2011, 05:51:11 pm
How can I do the equivalent of 'sub(TEST^^r,1,2,3)' using the new 'TEST(1,2,3)' function syntax?

(^^r is the small radians r).
Title: Re: Axe Q&A
Post by: Darl181 on September 21, 2011, 03:12:42 pm
Is it possible to rotate a sprite 180 degrees?  I know there's rotC flipV etc but I'd try combining them rotC(rotC(Pic1)) and it would just get jumbled :|
Title: Re: Axe Q&A
Post by: Runer112 on September 21, 2011, 03:13:43 pm
flipH(flipV(Pic1)) should work.
Title: Re: Axe Q&A
Post by: Darl181 on September 21, 2011, 03:18:00 pm
Thanks :D
So it matters what order you put them in somehow?  Because earlier I tried flipV(flipH(Pic#)) and it errored..
Title: Re: Axe Q&A
Post by: Munchor on September 24, 2011, 01:48:30 pm
Code: [Select]
Repeat getKey(15)
 .UPDATE POSITIONS
 X+H→X
 Y+V→Y

 A+C→A
 B+D→B

 .SET MAXIMUM SPEED
 If H>>256
  256→H
 End

 .SET MAXIMUM SPEED
 If (H<<-256)
  -256→H
 End

 .RIGHT FRICTION
 If A>>0
  A-1→A
 End

 .LEFT FRICTION
 If A<<0
  A+1→A
 End

End

This is not the full code of my program, it's just part of it, the part where I control the horizontal acceleration.

Horizontal Acceleration is saved on variable H, and I'm using Fixed Point (x256).

I try to give H friction, so that when the player presses the
arrow, the player stops after a bit. However, it's not really working.

Any ideas on how I can make it? Thanks
Title: Re: Axe Q&A
Post by: Builderboy on September 24, 2011, 02:10:03 pm
flipH(flipV(Pic1)) should work.

Axe says that these functions can't be used recursively D: You would need to copy the data in between each flip
Title: Re: Axe Q&A
Post by: Runer112 on September 24, 2011, 02:13:55 pm
flipH(flipV(Pic1)) should work.

Axe says that these functions can't be used recursively D: You would need to copy the data in between each flip

Look closer. :P
Title: Re: Axe Q&A
Post by: Builderboy on September 24, 2011, 02:17:26 pm
Oh interesting, so FlipH() can be used recursively?  I guess that's because it works with each byte individually huh, well very clever ^^
Title: Re: Axe Q&A
Post by: leafy on September 24, 2011, 03:36:55 pm
Code: [Select]
Repeat getKey(15)
 .UPDATE POSITIONS
 X+H→X
 Y+V→Y

 A+C→A
 B+D→B

 .SET MAXIMUM SPEED
 If H>>256
  256→H
 End

 .SET MAXIMUM SPEED
 If (H<<-256)
  -256→H
 End

 .RIGHT FRICTION
 If A>>0
  A-1→A
 End

 .LEFT FRICTION
 If A<<0
  A+1→A
 End

End

This is not the full code of my program, it's just part of it, the part where I control the horizontal acceleration.

Horizontal Acceleration is saved on variable H, and I'm using Fixed Point (x256).

I try to give H friction, so that when the player presses the
arrow, the player stops after a bit. However, it's not really working.

Any ideas on how I can make it? Thanks
1 is a bit small. Set the friction to something bigger.
Title: Re: Axe Q&A
Post by: Munchor on September 24, 2011, 03:44:48 pm
Thanks Runer leafiness, it makes perfect sense. I changed it to 12, and then I changed it to 64 (which is quite a lot). However, the player just goes on and on to the left.

I think it's because of the comparisons (signed, unsigned), I just used >> and << on all of them, I did it in a sort of random way. Am I doing it wrong?
Title: Re: Axe Q&A
Post by: squidgetx on September 24, 2011, 03:47:48 pm
What are A,B,C and D? Friction should be applied to H, the x velocity. As in
Code: [Select]
H>>0-(H<<0)->S  //get direction of velocity
If S //if we're moving
H-S->H //decrease velocity by 1 in the opposite direction
End
Code: (slightly optimized) [Select]
H<<0-(H>>0)->S
If
+H->H
End
Title: Re: Axe Q&A
Post by: Darl181 on September 24, 2011, 03:48:04 pm
Hm, it could be optimized but bleh.
How are you handling the keypresses?  And what exactly do you mean by "not really working"?


EDIT: hm ninja'd.  offtopic but how does the ninja notifier thing warn you?
Title: Re: Axe Q&A
Post by: Munchor on September 24, 2011, 04:41:22 pm
I don't optimize my code (extremely) because it makes it unreadable (in Axe).

Thanks Michael Leesquidgetx, I was confusing variable names, I managed to fix it, not with your code, but with your idea :D

edit by squid: you sure do have a tendency to mix up names :P
Title: Re: Axe Q&A
Post by: mrmprog on September 26, 2011, 10:44:46 pm
Could someone give me an example of how to store data in a program itself? For example, if I wanted to store the highscore in the program.
Title: Re: Axe Q&A
Post by: ztrumpet on September 26, 2011, 11:03:41 pm
Could someone give me an example of how to store data in a program itself? For example, if I wanted to store the highscore in the program.
You'll want to read part of this (http://ourl.ca/4129/80259) thread, starting in that location.  Good luck. :D
Title: Re: Axe Q&A
Post by: mrmprog on September 27, 2011, 10:53:05 pm
Thanks, that looks like what I need. Is there any way to do this in pure Axe, and is there any possibility of a "write-back' function in axe?
Title: Re: Axe Q&A
Post by: Runer112 on September 27, 2011, 10:58:17 pm
A far simpler way to use write-back is to compile your program for MirageOS or DoorsCS. This will require that the program be run by a shell that allows easy write-back in the form of you simply modifying data in your running program, and the shell will then write any changes back to the original copy.
Title: Re: Axe Q&A
Post by: mrmprog on September 27, 2011, 11:01:44 pm
So how would that work? Would I get a pointer to the program, then automagically find where the data is, and then edit it? I think that is what you mean, but some example code would be great.
Title: Re: Axe Q&A
Post by: Builderboy on September 27, 2011, 11:03:29 pm
well lets say you have a sprite data:

Code: [Select]
[FFFFFFFFFFFFFFFF]->Pic1
If you wanted to modify the first byte of that data, simply do:

Code: [Select]
1->{Pic1}
And as long as you are in MirageOS or Doors, writeback should be automatic, and that sprite will stay modified :)
Title: Re: Axe Q&A
Post by: ztrumpet on September 27, 2011, 11:04:09 pm
A far simpler way to use write-back is to compile your program for MirageOS or DoorsCS. This will require that the program be run by a shell that allows easy write-back in the form of you simply modifying data in your running program, and the shell will then write any changes back to the original copy.
Yes, but you can still turn writeback off.  I think it's better to force it. ;)
Title: Re: Axe Q&A
Post by: Runer112 on September 27, 2011, 11:05:34 pm
I don't think you should force write-back. If a user has write-back disabled, they probably have it off for a good reason and would be annoyed if your program ignores that they purposely disabled write-back.
Title: Re: Axe Q&A
Post by: ztrumpet on September 27, 2011, 11:19:01 pm
I don't think you should force write-back. If a user has write-back disabled, they probably have it off for a good reason and would be annoyed if your program ignores that they purposely disabled write-back.
True.  I'm just thinking about the user that doesn't know what the writeback option does and then complains about his game not saving because I've been that person before.
Title: Re: Axe Q&A
Post by: Freyaday on September 28, 2011, 04:23:15 pm
Is writeback provided by a shell or is it a flag somewhere that the OS uses?
Title: Re: Axe Q&A
Post by: squidgetx on September 28, 2011, 04:39:35 pm
Most shells have an option to enable/disable writeback. I forget about ion. Asm() technically has writeback automatically enabled since in order to run it you have to have it unarchived unless you are using zStart or DCS' homerun hook or something like that.
Title: Re: Axe Q&A
Post by: Builderboy on September 28, 2011, 04:52:58 pm
Asm() does *not* actually have write back enabled, because when the program is run, it is copied to a separate location, but never copied back, so you need to force writeback yourself.  

MirageOS automatically performs writeback on all unarchived programs, and only does writeback on archived programs if you set the option yourself
Title: Re: Axe Q&A
Post by: LincolnB on September 28, 2011, 10:50:21 pm
Does Doors CS do that as well? ^
Title: Re: Axe Q&A
Post by: Deep Toaster on September 29, 2011, 09:19:07 am
DoorsCS uses "smart writeback," where it checks if the program data actually changed and writes back if it did.
Title: Re: Axe Q&A
Post by: LincolnB on September 29, 2011, 10:39:55 am
Ok, that's cool.
Title: Re: Axe Q&A
Post by: squidgetx on September 29, 2011, 12:03:52 pm
Woops, my bad :P I just remembered that Space Dash had this issue where the sprites would change after the program quit or something because I was Exch'ing data within the program so I figured that Asm() did writeback or something (But maybe I was using MOS lol)
Title: Re: Axe Q&A
Post by: Darl181 on September 29, 2011, 09:25:58 pm
Code: [Select]
A?Pt-On(X,Y,Pic1)Is supposed to throw an error?  It seems like every time I try to do a Pt-blarg() it errors x.x
Title: Re: Axe Q&A
Post by: Quigibo on September 29, 2011, 10:19:19 pm
Code: [Select]
A?Pt-On(X,Y,Pic1)Is supposed to throw an error?  It seems like every time I try to do a Pt-blarg() it errors x.x

Yeah that should error.  That's like saying "A and Pt-On()" which doesn't make any sense since Pt-On() doesn't return a value.  In general, you can only use Axe commands that start with lowercase letters inline.  Uppercase commands have to start from a new line.
Title: Re: Axe Q&A
Post by: Darl181 on September 29, 2011, 11:21:16 pm
Ok, good to know.
Another one.  Is Buff()/Zeros()/det() in any of the menus?  I haven't been able to find it outside the catalog..
Title: Re: Axe Q&A
Post by: calc84maniac on September 29, 2011, 11:53:24 pm
Ok, good to know.
Another one.  Is Buff()/Zeros()/det() in any of the menus?  I haven't been able to find it outside the catalog..
It's in the Matrix menu.
Title: Re: Axe Q&A
Post by: Freyaday on September 30, 2011, 12:05:56 am
Why can't we abuse the ? operators?
I want to be able to do
Q?If blarg
Stuff
Q?End
Title: Re: Axe Q&A
Post by: calc84maniac on September 30, 2011, 12:13:44 am
Why can't we abuse the ? operators?
I want to be able to do
Q?If blarg
Stuff
Q?End
What exactly would that do? O_o
Title: Re: Axe Q&A
Post by: Freyaday on September 30, 2011, 12:52:57 am
Why can't we abuse the ? operators?
I want to be able to do
Q?If blarg
Stuff
Q?End
What exactly would that do? O_o
It would ignore the If statement if Q!=0, executing Stuff
Title: Re: Axe Q&A
Post by: Builderboy on September 30, 2011, 12:59:16 am
Isn't that equivalent to If Q:If Blarg:Stuff:End:End? o.O
Title: Re: Axe Q&A
Post by: Quigibo on September 30, 2011, 06:37:59 am
Theoretically, it could be abused, but it wouldn't be any more optimized than a regular if statement, just more cluttered and less readable.  I added the ? and ?? as operators specifically to avoid chains of if/while statements like If A:If B:If C:something:End:End:End should just be if A?B?C:something:End.  I don't want to allow intentionally misleading code as legal syntax when there is already a better way to represent it.
Title: Re: Axe Q&A
Post by: Freyaday on September 30, 2011, 10:09:41 am
Theoretically, it could be abused, but it wouldn't be any more optimized than a regular if statement, just more cluttered and less readable.  I added the ? and ?? as operators specifically to avoid chains of if/while statements like If A:If B:If C:something:End:End:End should just be if A?B?C:something:End.  I don't want to allow intentionally misleading code as legal syntax when there is already a better way to represent it.
Huh.
Actually, Builder, that is not what it would do.
Q?If Blarg
stuff
Q?End
Would execute stuff if Q=0, or, failing that, if Blarg!=0
Key term here is "failing that". If Q=0, Blarg could be infinity (-1, anyone?) or it could be 0, and it wouldn't matter.
Title: Re: Axe Q&A
Post by: calc84maniac on September 30, 2011, 12:22:44 pm
So in other words,
Code: [Select]
If Q=0??Blarg
stuff
End
Title: Re: Axe Q&A
Post by: Stefan Bauwens on October 02, 2011, 07:40:10 am
How must I display an expression in axe?(If this is possible)
This doesn't seem to work properly. it only displays weird signs and all.
Code: [Select]
:10->x
:text(0,0,x)
Thanks in advance. :)
Title: Re: Axe Q&A
Post by: Sorunome on October 02, 2011, 07:48:14 am
You need to do text(0,0,x>Dec
Title: Re: Axe Q&A
Post by: Deep Toaster on October 02, 2011, 12:07:15 pm
Yep, use >Dec. Otherwise it treats X as the pointer to a string, and the data at $000A probably isn't one :D
Title: Re: Axe Q&A
Post by: Stefan Bauwens on October 02, 2011, 01:03:04 pm
Thanks, it helped. :D

EDIT:I have another question.
I want to save the value of x to a string, so I can see it out of my program. The following doesn't seem to work.
Code: [Select]
:10->x
:x->str1
Title: Re: Axe Q&A
Post by: calc84maniac on October 02, 2011, 03:44:41 pm
Thanks, it helped. :D

EDIT:I have another question.
I want to save the value of x to a string, so I can see it out of my program. The following doesn't seem to work.
Code: [Select]
:10->x
:x->str1
You would have to write code to manually extract the digits, convert to tokens, and put into a TI-OS string variable.

Maybe something like this (input is in X, uses 5 bytes at L1 to temporarily store characters):
Code: [Select]
L1+5→A
0→B
While 1
  B+1→B
  X^10+'0'→{A-1→A}
EndIf X/10→X
Copy(A,GetCalc("Str1",B),B)
Title: Re: Axe Q&A
Post by: alberthrocks on October 02, 2011, 05:05:52 pm
A bunch of questions here:
1) How would I compare strings? (The equivalent of the C/C++
strcmp
) Doing
If Str1=Str2
doesn't work (and it won't compile).
2) How do I check if a program exists without using MemKit?
3) How do I check if an application exists?
4) How would I do arrays (and arrays of arrays) in Axe?
Title: Re: Axe Q&A
Post by: Sorunome on October 02, 2011, 05:14:04 pm
1. If {Str1}={Str2}
I think
Title: Re: Axe Q&A
Post by: Happybobjr on October 02, 2011, 05:18:58 pm
i am rather sure that will only check one byte equivalence.
Title: Re: Axe Q&A
Post by: Freyaday on October 02, 2011, 05:25:14 pm
As it happens, Axe has a command just for that purpose!
expr(Str1,Str2)
Title: Re: Axe Q&A
Post by: ztrumpet on October 02, 2011, 06:13:03 pm
As it happens, Axe has a command just for that purpose!
expr(Str1,Str2)
I believe you mean Equ▶String(STR1,STR2).  expr (exch) just exchanges two chunks of data and would need a third argurment telling it how much to exchange. ;)
Title: Re: Axe Q&A
Post by: Freyaday on October 02, 2011, 06:50:12 pm
As it happens, Axe has a command just for that purpose!
expr(Str1,Str2)
I believe you mean Equ▶String(STR1,STR2).  expr (exch) just exchanges two chunks of data and would need a third argurment telling it how much to exchange. ;)
Whoops, silly me and my spatial thinking; the two are right next to eachother in the catalogue and I looked at the wrong one in my head when I answered. Silly me!
Title: Re: Axe Q&A
Post by: Michael_Lee on October 02, 2011, 06:57:36 pm
To answer number 4:

There really aren't 'arrays' in Axe, but there are large chunks of memory that are kept more-or-less empty, which is the next best thing :P

'L1' is a pointer to a chunk of memory about 714 bytes long.

To assign the numbers '3', '6', '20', in the zeroth, first, and second positions, do...

Code: [Select]
3->{0+L1}
6->{1+L1}
20->{2+L1}

Here's a convenient trick to simulate an array in an array -- but only if each array inside the array is constant.

Code: [Select]
NUMBER -> {array_index * subarray_length + subarray_index + L1}

(the subarray_length starts with 1, not 0)


This is actually identical to how you do tilemaps:

Code: [Select]
{row * row_length + column + POINTER}

or...

{Y * width + X + POINTER}

If each subarray has a different length, you could perhaps make an array containing pointers to each array, although it feels a bit inception-esque to me.
Title: Re: Axe Q&A
Post by: squidgetx on October 02, 2011, 07:13:54 pm
If each subarray has a different length, you could perhaps make an array containing pointers to each array, although it feels a bit inception-esque to me.

Yup. This is how compressed and variable-length maps are dealt with.
Title: Re: Axe Q&A
Post by: Deep Toaster on October 02, 2011, 07:18:32 pm
Hope you don't mind the ad, but I have a full tutorial on arrays in Axe (http://omniurl.tk/6691/122244/) right here on Omnimaga.

The final topic? Arrays of (pointers to) arrays ;)
Title: Re: Axe Q&A
Post by: Stefan Bauwens on October 03, 2011, 04:14:09 am
Thanks, it helped. :D

EDIT:I have another question.
I want to save the value of x to a string, so I can see it out of my program. The following doesn't seem to work.
Code: [Select]
:10->x
:x->str1
You would have to write code to manually extract the digits, convert to tokens, and put into a TI-OS string variable.

Maybe something like this (input is in X, uses 5 bytes at L1 to temporarily store characters):
Code: [Select]
L1+5→A
0→B
While 1
  B+1→B
  X^10+'0'→{A-1→A}
EndIf X/10→X
Copy(A,GetCalc("Str1",B),B)
Wow, since I am a newbie to Axe i don't think i understand anything of this.
I will try to ofcourse
Title: Re: Axe Q&A
Post by: Darl181 on October 03, 2011, 10:37:36 am
Does Axe handle getKey(#) differently in Full speed mode?  It keeps bugging on me whenever I try it..
Title: Re: Axe Q&A
Post by: Sorunome on October 03, 2011, 10:41:09 am
It shouldn't. To me it works normally.
Title: Re: Axe Q&A
Post by: Darl181 on October 03, 2011, 02:35:28 pm
Normally it does for me, too, but as soon as I put a Full in my program weird junk started happening (eg. pressing MATH would quit, instead of it just being clear)

Title: Re: Axe Q&A
Post by: Sorunome on October 03, 2011, 02:41:44 pm
You need to remember, that the keys have different numbers, clear is 15.
Title: Re: Axe Q&A
Post by: FinaleTI on October 03, 2011, 03:27:08 pm
Wow, since I am a newbie to Axe i don't think i understand anything of this.
I will try to ofcourse

Here's an explanation of the code, in case you still need it.
Spoiler For Explanation:
Code: [Select]
L1+5→A         //Stores a pointer to L1+5 to A.
0→B                       //Stores 0 to B.
While 1                  //Begin loop
  B+1→B                 //Increment number length
  X^10+'0'→{A-1→A}//Divide number (X) by 10, and take the remainder. The remainder is the last digit of the number (X). Then add the remainder to the value of the character '0', to convert it the correct character. The answer is stored to the location pointed to by A, and the location pointed to by A is decremented by 1.
EndIf X/10→X         //Loop condition. Checks to see if X is still divisible by ten, and if so, divides by 10 and continues to loop. Otherwise, the loop ends, and the string is created.
Copy(A,GetCalc("Str1",B),B) //The data pointed to at A is copied to Str1 for a length of B bytes. Str1 is created being B bytes long, B being the length of the number (X).

I hope this is helpful to someone.
Title: Re: Axe Q&A
Post by: mrmprog on October 03, 2011, 05:06:15 pm
On the topic of keypresses, isn't there a bug that makes some keys confused with each other? It has happened to me before.
Title: Re: Axe Q&A
Post by: Wellen on October 03, 2011, 06:41:32 pm
A question : I've got the hex code of a picture, but how can I display it *where I want* on the screen?
Title: Re: Axe Q&A
Post by: Darl181 on October 03, 2011, 07:01:47 pm
You need to remember, that the keys have different numbers, clear is 15.
I'm aware of that, I've gotten it pretty much memorized after ~1 year of using Axe. :P  the thing is, [Math] happens to be 47 instead of 15 ;)

On the topic of keypresses, isn't there a bug that makes some keys confused with each other? It has happened to me before.
Yes there is. http://ourl.ca/7652/133708

So..is it handled differently in Full speed mode?  Is there some sort of delay while it waits for the keys, and the delay is cut short or something?
Title: Re: Axe Q&A
Post by: Deep Toaster on October 03, 2011, 10:48:39 pm
A question : I've got the hex code of a picture, but how can I display it *where I want* on the screen?
Put the width and height bytes before it and use the Bitmap() function.
Title: Re: Axe Q&A
Post by: Stefan Bauwens on October 04, 2011, 07:00:49 am
Thanks FinaleTi. I didn't need it anymore but I would like to understand it so thanks.
Don't understand it yet completely, but I will look at it and try to.  8)
Title: Re: Axe Q&A
Post by: squidgetx on October 04, 2011, 10:59:40 pm
I do believe that direct keypresses do not work correctly in fullspeed mode. switch to normal before checking for keypresses
Title: Re: Axe Q&A
Post by: Runer112 on October 04, 2011, 11:12:32 pm
I do believe that direct keypresses do not work correctly in fullspeed mode. switch to normal before checking for keypresses

I'm pretty sure that Quigibo purposely added extra delay so it would work at 15MHz.


Does Axe handle getKey(#) differently in Full speed mode?  It keeps bugging on me whenever I try it..

I can only think of two things that could be causing this. Either Axe is having problems and parsing your code incorrectly, or your calculator is running substantially faster than 15MHz and the built-in delay isn't enough. I'm guessing that it's the second case, especially if you're using wabbitemu. If so, make sure that you didn't enable the option called "Emulate 20MHz and 25MHz calculators" or "Emulate proposed hardware speeds" because having this checked would certainly cause your problem.
Title: Re: Axe Q&A
Post by: ztrumpet on October 04, 2011, 11:20:17 pm
Does Axe handle getKey(#) differently in Full speed mode?  It keeps bugging on me whenever I try it..

I can only think of two things that could be causing this. Either Axe is having problems and parsing your code incorrectly, or your calculator is running substantially faster than 15MHz and the built-in delay isn't enough. I'm guessing that it's the second case, especially if you're using wabbitemu. If so, make sure that you didn't enable the option called "Emulate 20MHz and 25MHz calculators" or "Emulate proposed hardware speeds" because having this checked would certainly cause your problem.
This being said, some calc run faster than 15MHz.  Mine, for instance runs at 16.495MHz (Revision M, tested with thepenguin's TrueSpeed program).
Title: Re: Axe Q&A
Post by: Darl181 on October 05, 2011, 03:28:05 pm
I just ran TruSpeed: 15.333 Hz, rev B.  And this is on the real calc.
Around the part that checks keypresses for the bullet shooting (which is the biggest thing bugging, among other things) I put a Normal at the beginning and a Full at the end and it still bugged ???
(tho admittedly I didn't put it around
If getKey(15)
Goto END
End

and that bugged, but still, when I press [stat] it's supposed to shoot up-right not just up :P)
Title: Re: Axe Q&A
Post by: squidgetx on October 05, 2011, 03:32:09 pm
Where did you put the Normal and Full; around the whole set of statements or inside the conditional?

I would think that you wouldn't make that kind of mistake but at this point I can't think of any other explanation lol
I'm pretty sure that Quigibo purposely added extra delay so it would work at 15MHz.
Huh, didn't know about that :P Wow, apparently that was fixed over a year ago :O Well, looks like that just shows how often I use 15mhz mode :P


Darl181 I have no idea what's going on :P
Title: Re: Axe Q&A
Post by: Quigibo on October 05, 2011, 04:09:14 pm
Apparently the delay I added is not enough, there is currently 19 T-states between the port commands not including the port commands themselves.  I think 7 are required for 6MHz so I assumed that 7*(15/6) = 17.5 I am still over the minimum.  But maybe it was 8 T-States?  Then I would need at least 20, putting me under.  I can add 3 T-States and keep the routine the same size, so I'll probably just do that.  No slow downs in games would be noticeable as a result of this, but hopefully it should solve this problem for good.
Title: Re: Axe Q&A
Post by: Darl181 on October 05, 2011, 06:27:52 pm
I'm probably missing something, but how do the Port commands relate to getKey?
Title: Re: Axe Q&A
Post by: calc84maniac on October 05, 2011, 11:36:14 pm
I'm probably missing something, but how do the Port commands relate to getKey?
Ports are an ASM construct, and are used to interface with all kinds of hardware (not just the external link ports). In this case, it is the keypad port.
Title: Re: Axe Q&A
Post by: Darl181 on October 05, 2011, 11:47:11 pm
Ah ok.  I was confused there for a bit :P

Another question.  Is it ok to have GDBs in apps if you only read from them?  Not writing, only reading.
Title: Re: Axe Q&A
Post by: Builderboy on October 06, 2011, 12:17:22 am
Yeah that's fine
Title: Re: Axe Q&A
Post by: Freyaday on October 06, 2011, 12:23:57 am
As it turns out, Axe does weird things to ports that don't correspond to actual keys.
getkey(7) O.o
Title: Re: Axe Q&A
Post by: Stefan Bauwens on October 06, 2011, 03:40:11 pm
This is not really an AXE question, but I need it while programming in axe. I noticed that while in my source code editor(on calc) I press 2nd+ON the calc goes off. When I put it back on I'm at the homescreen. First I could do Alpha+ON and then the calc would go off and when turned back on, it would be in the source code, at the place I left it. Recently this Alpha+On doesn't do anything anymore. Did I turn something off?
Title: Re: Axe Q&A
Post by: Hayleia on October 06, 2011, 03:42:44 pm
This is a DoorCS hook (if I am not wrong (or is it on+stat ???), anyway, a hook ;)) that uses APD, non real turning off, so, for example, if you started using zStart (or any other hook installer that could interfere with it), this hook could having been killed.
Title: Re: Axe Q&A
Post by: Stefan Bauwens on October 06, 2011, 03:44:08 pm
I don't have anything on my calculator except AXE. But now that I think of it I had MirageOS on my calc. Maybe it went away after I removed it?
Title: Re: Axe Q&A
Post by: Hayleia on October 06, 2011, 03:47:29 pm
Yes !! it is a Mirage OS hook !

EDIT: we have the same respect. Yes, I know, I am useless.
Title: Re: Axe Q&A
Post by: Stefan Bauwens on October 06, 2011, 03:48:17 pm
Oh well. Good to know. Thanks for the help.
Title: Re: Axe Q&A
Post by: Yeong on October 06, 2011, 06:28:46 pm
Is there a way to load string from OS?
Title: Re: Axe Q&A
Post by: calc84maniac on October 06, 2011, 06:30:24 pm
Code: [Select]
!If getCalc("Str1")→A
.ERROR
End
.A holds pointer to string of tokens
Title: Re: Axe Q&A
Post by: Yeong on October 06, 2011, 06:32:06 pm
oh.
Then how about vice versa?
Title: Re: Axe Q&A
Post by: calc84maniac on October 06, 2011, 06:37:07 pm
Code: [Select]
!If GetCalc("Str1",SIZE)→A
.ERROR
End
.A holds pointer to a new string that is SIZE bytes large
Title: Re: Axe Q&A
Post by: Wellen on October 07, 2011, 06:49:57 am
Hello, still have problems with drawing bitmaps..
I have a 40*44 picture that I translated in hexa by myself, and when I use the bitmap fonction, it doesn't display what I expect
The code :
Code: [Select]
:.A
:Data(40,44)→Pic1
:[00003A00000001E1900000079764000000719A00
:[002DFEB500002E688980002207B2800069DE6D80
:[00A803C2C00097DC9C40066233F7E006DF07F960
:[0F661C96A00D99E32D501E271CDEA02963F36760
:[34260C9D503B45F36AA03CB70C95602969FB6D60
:[46A90D2A502AD5F2EA40151776AAE014AAD52A40
:[0AA12B6BC0A955EAB90084543545405457CF5140
:[122852AB00255DB54E000AAE856D00154A440800
:[AAB1EBB500152CAA9800202612B600149A4DF000
:[0812B540000865382000082A0A80000212A80000
:[02A4040000010850000000128000000000000000
:Tangent(10,20,Pic1
:Repeat getKey
:End
What it displays :
(http://img838.imageshack.us/img838/3851/wabbitemu.png)
???

Attached the picture and its hexa code, but I'm sure it's 95% right.
Title: Re: Axe Q&A
Post by: Runer112 on October 07, 2011, 11:23:43 am
Reverse the order of the height and width bytes. ;)
Title: Re: Axe Q&A
Post by: Hayleia on October 07, 2011, 12:41:41 pm
Has anyone got a routine that wait for the user to release all keys ? Like

Lbl WLP
While getKey(0)
End
Return


but that doesn't work when I put sub(WLP). It doesn't wait for anything.
Title: Re: Axe Q&A
Post by: Wellen on October 07, 2011, 12:57:55 pm
Reverse the order of the height and width bytes. ;)
Oh my..
Thanks a lot, I read in the doc that it was width, then height.. :banghead:
 :D

Hayleia (sorry, correct name now ^^), I had the same problem, so I added a pause : (and it worked)
Code: [Select]
While getKey(0)
Pause 5
End
Title: Re: Axe Q&A
Post by: Hayleia on October 07, 2011, 01:03:08 pm
Haleyia, I had the same problem, so I added a pause :
Code: [Select]
While getKey(0)
Pause 5
End
Thanks ! It works !!! :D
Also, If you saw your respect make like a sine function, it is because I wanted to put you +1 but pressed the wrong one D: (Fixed)

Why do everyone kill my name ? D:
Title: Re: Axe Q&A
Post by: Wellen on October 07, 2011, 01:11:54 pm
It's pretty hard not to fail when spelling your name :P
Title: Re: Axe Q&A
Post by: Hayleia on October 09, 2011, 06:01:39 am
It's pretty hard not to fail when spelling your name :P
No. Just think it is like Hayley Wiliams but with IA at the end.
I hope I didn't misspelled her name :P

Another question now :P
In term of space in the compiled code. Are those methods the same ?
Code: [Select]
"test"[00]→Str1
Text(0,0,Str1)
Code: [Select]
Text(0,0,"test")
Title: Re: Axe Q&A
Post by: aeTIos on October 09, 2011, 06:21:24 am
They are the same in output, but I think you should use the first because then the data goes to the end of the program.
Tip:
Instead of
Code: [Select]
Text(x,y,"string") you can use
Code: [Select]
Text(Y*256+X):Text "String" to save space (could be outdated, and maybe you have to invert x and y in Y*256+X)
Title: Re: Axe Q&A
Post by: Hayleia on October 09, 2011, 07:01:09 am
Thanks. In fact I already use the second one but I thought about translation: using the first method would allow me to separate the main program from the text, so I could give the text file to someone who want to translate the game. So if it takes the same space it is ok.
/me now has a lot of work D:
I'll do that when I have time and when I get bored...
Title: Re: Axe Q&A
Post by: aeTIos on October 09, 2011, 09:51:48 am
Ok. Checked the optimize trick, does still work.
Title: Re: Axe Q&A
Post by: ztrumpet on October 09, 2011, 10:28:28 am
In term of space in the compiled code. Are those methods the same ?
Code: [Select]
"test"[00]→Str1
Text(0,0,Str1)
Code: [Select]
Text(0,0,"test")
No, they are not the same.  Since Axe automatically appends a [00] to the end of everything with quotes around it that you store to a location (like "test"→Str1) the code on the left will actually be one byte larger.
These two are the exact same:
Code: [Select]
"test"→Str1
Text(0,0,Str1)
Code: [Select]
Text(0,0,"test")
I hope this helped clarify things. :)
Title: Re: Axe Q&A
Post by: aeTIos on October 09, 2011, 10:32:57 am
Wow lol, didnt see that [00]
Title: Re: Axe Q&A
Post by: ztrumpet on October 09, 2011, 10:37:38 am
Tip:
Instead of
Code: [Select]
Text(x,y,"string") you can use
Code: [Select]
Text(Y*256+X):Text "String" to save space (could be outdated, and maybe you have to invert x and y in Y*256+X)
Oh, yeah, and I forgot to mention that this tip is outdated as of Axe 0.2.3 or so. ;)
Title: Re: Axe Q&A
Post by: aeTIos on October 09, 2011, 10:38:30 am
Huh? I just tried and it worked.
Title: Re: Axe Q&A
Post by: ztrumpet on October 09, 2011, 10:40:07 am
Yes, I believe they both work, but don't they produce the same sized code (or did Quigibo change this back)?
Title: Re: Axe Q&A
Post by: aeTIos on October 09, 2011, 10:46:53 am
I tested and checked filesize. I only changed the display commands, nothing in the string.
Title: Re: Axe Q&A
Post by: squidgetx on October 09, 2011, 12:31:27 pm
If the coordinates are constant you can save a lot of space. If the coordinates are separatley evaluated expressions then it doesn't matter.

(I think)
Title: Re: Axe Q&A
Post by: Runer112 on October 09, 2011, 12:47:17 pm
It's only more optimized to use Text(Y*256+X) if the two coordinates are constant.
Title: Re: Axe Q&A
Post by: ztrumpet on October 09, 2011, 01:04:23 pm
If the coordinates are constant you can save a lot of space. If the coordinates are separatley evaluated expressions then it doesn't matter.

(I think)
Ah, I didn't realize this.  Thanks!
Why isn't this auto-optimized in Axe though?
Title: Re: Axe Q&A
Post by: Runer112 on October 09, 2011, 01:06:08 pm
Because Axe is sorely lacking in constant argument optimizations. :P
Title: Re: Axe Q&A
Post by: Darl181 on October 11, 2011, 02:48:51 pm
Which would be faster/more optimized to check for?
If rand^2
or
!If rand^2
Or would they be the same?
Title: Re: Axe Q&A
Post by: Yeong on October 11, 2011, 03:03:19 pm
Is there a way to store/export program out of appvar?
Title: Re: Axe Q&A
Post by: Freyaday on October 11, 2011, 03:05:18 pm
Is there a way to store/export program out of appvar?
Like how?
Like
Copy(GetCalc("prgmWHATEVER")->S,GetCalc("appvWHATEVER",),S)
Title: Re: Axe Q&A
Post by: Yeong on October 11, 2011, 03:06:19 pm
Like making a minigame out of axe, store it to appvar, and take it out from another axe program whenever I need it.
Title: Re: Axe Q&A
Post by: Freyaday on October 11, 2011, 03:10:17 pm
O.O SMC O.O
Uh, you can use that line to create the appvar, but put a ->VAR after GetCalc("appvWHATEVER"), and then use some Asm( magic to call the program as if it were a subroutine using the value in VAR as the address
Title: Re: Axe Q&A
Post by: Yeong on October 11, 2011, 03:12:25 pm
SMC?
Title: Re: Axe Q&A
Post by: Freyaday on October 11, 2011, 03:14:18 pm
SMC?
Hover over the text.
Title: Re: Axe Q&A
Post by: Yeong on October 11, 2011, 03:20:12 pm
oh.
how does self modifying code works?
Title: Re: Axe Q&A
Post by: Freyaday on October 11, 2011, 03:20:55 pm
oh.
how does self modifying code works?
It's code that modifies itself. Yours is kinda doing that.
Title: Re: Axe Q&A
Post by: Deep Toaster on October 11, 2011, 03:43:00 pm
Which would be faster/more optimized to check for?
If rand^2
or
!If rand^2
Or would they be the same?
Exactly the same. They're two forms of conditional jumping in assembly.
Title: Re: Axe Q&A
Post by: Wellen on October 11, 2011, 03:49:01 pm
I wonder if there is a function that checks if to Datas are equals ?
I mean (sorry^^), something like this:
compare(PTR1,PTR2,SIZE), wich would return 1 if they are the same, and 0 otherweise ?
Title: Re: Axe Q&A
Post by: Deep Toaster on October 11, 2011, 03:53:30 pm
Equ>String() does that.
Title: Re: Axe Q&A
Post by: Wellen on October 11, 2011, 04:02:10 pm
Aww..
Yes but it's for 1.0.*, right ?
I'm still using 0.5.0, so what I do is

0->M
For(A,0,5
(({P+A})=({O+A}))+M->M
End

and check if M=6 or not..
or is there an easier way ?
Title: Re: Axe Q&A
Post by: Builderboy on October 11, 2011, 05:17:21 pm
The easiest way is to upgrade to 1.0.5 :) But your way works fine for your purposes
Title: Re: Axe Q&A
Post by: Freyaday on October 11, 2011, 05:26:11 pm
0.5.3 has it. It actually checks for differences, and returns the number of bytes it looked through to find that abberance. If it doesn't find a mismatch, it returns 0
Title: Re: Axe Q&A
Post by: Wellen on October 11, 2011, 05:50:19 pm
I tried with 0.5.3b
It seems Equ>String( doesn't work with files ?
I loaded an appvar into Y0, used it with another pointer in Equ>String, and Axe says : "Error : File Misuse"
Title: Re: Axe Q&A
Post by: Freyaday on October 11, 2011, 05:51:46 pm
I tried with 0.5.3b
It seems Equ>String( doesn't work with files ?
I loaded an appvar into Y0, used it with another pointer in Equ>String, and Axe says : "Error : File Misuse"
Yeah, Axe is kinda tetchy about that. There's really no way around it, other than UnArchiving it.
Title: Re: Axe Q&A
Post by: FinaleTI on October 11, 2011, 05:58:36 pm
I tried with 0.5.3b
It seems Equ>String( doesn't work with files ?
I loaded an appvar into Y0, used it with another pointer in Equ>String, and Axe says : "Error : File Misuse"
You could copy the string to a SafeRAM area, or a var in the RAM, then run the comparison from there.
Title: Re: Axe Q&A
Post by: Wellen on October 12, 2011, 04:51:36 am
And wouldn't my "method" (just do a simple For-loop) be better than unarchiving/archiving (what I'd like to avoid) and/or creating a new Data ?
Title: Re: Axe Q&A
Post by: Stefan Bauwens on October 12, 2011, 05:03:59 am
I need to have smoothscrolling for my game, and I would like to have my player always at the same point(24,40). I just don't know how to do this good. I would really appreciate the help.:D Also, I think I must use inflation by 256. I just don't know how, becuase this is scrolling? You can view my source code here: http://ourl.ca/12726/251417;topicseen#new
Title: Re: Axe Q&A
Post by: LincolnB on October 12, 2011, 10:17:20 pm
Did my post in the Grey: zContest Entry thread help, or should I explain in more depth?
Title: Re: Axe Q&A
Post by: Stefan Bauwens on October 13, 2011, 06:38:03 am
I think it will help. But if I notice that I need more help I will ask it. :)
Title: Re: Axe Q&A
Post by: Wellen on October 14, 2011, 07:00:40 am
I'm working on a little project for the zContest (i'll make a thread soon :P), that requires a password, stored in an appvar.
I'd like that appvar to be protected (so that you can't guess what is the password when you're reading it).
How could I do ?
Title: Re: Axe Q&A
Post by: aeTIos on October 14, 2011, 08:48:16 am
you could encrypt it using some random code (that of course is stored in the appvar). You can also store it backwards.
also:
Quote
-/...././/--./.-/--/.
translated: THE GAME :(
I used to knew the morse alphabet, forgot it :P
Title: Re: Axe Q&A
Post by: Wellen on October 14, 2011, 09:43:06 am
Quote
you could encrypt it using some random code (that of course is stored in the appvar)
What do you mean with 'random code' ? (I'm French, didn't understand exactly, sorry :P)


Quote
also:
Quote
-/...././/--./.-/--/.
translated: THE GAME :(
I used to knew the morse alphabet, forgot it :P
Well done !
You lost, tho ;)
Title: Re: Axe Q&A
Post by: Quigibo on October 15, 2011, 10:47:19 pm
You could use rot13 (http://en.wikipedia.org/wiki/ROT13) as an extremely simple encryption.  If you want it more secure, just make some other mapping in memory and do a lookup.  For instance:

Code: [Select]
{Data('D','A','B','C')+A-'A'}
For input character A, it maps 'A'->'D', 'B'->'A', 'C'->'B', 'D'->'C'
Title: Re: Axe Q&A
Post by: Wellen on October 16, 2011, 04:15:33 pm
Oh, sorry -_-"
Forgot to mention that the password is in fact 6 numbers...not letters. So it's not really called 'password' but 'code' yeah ? Didn't thought about that, sorry again.

But I could make a math-trick like a simple multiplication or something ?
Title: Re: Axe Q&A
Post by: Yeong on October 17, 2011, 07:09:26 am
After storing some values in Pointer, is there a way to "DelVar" it?
Every time I run the program, the Pointer still have all the values.
Title: Re: Axe Q&A
Post by: calc84maniac on October 17, 2011, 09:26:54 am
After storing some values in Pointer, is there a way to "DelVar" it?
Every time I run the program, the Pointer still have all the values.
That is both a strength and weakness of shell programs. A strength because you don't have to create an appvar for save games, a weakness because you can't keep the original data for the next run if you modified it.
Title: Re: Axe Q&A
Post by: Deep Toaster on October 17, 2011, 10:38:52 am
You can't predict whether modifications to static variables will be saved (since these "variables" are really part of the program's data itself, it all depends on whether or not the user's shell writes back programs or not). Instead, copy the initialized data to a safe RAM area like L1 and work with it there, so you never have to modify the program itself.
Title: Re: Axe Q&A
Post by: Sorunome on October 17, 2011, 12:22:55 pm
I got a question: How do you display a pic in ram to the screen?
I have this code:
Code: [Select]
:.AA
:[Pic1]
:DispGraph
:getKey{r}
Well, it doesn't display pic1......
Title: Re: Axe Q&A
Post by: Yeong on October 17, 2011, 12:33:41 pm
what I do is store Pic1 to pointer and do this: Copy(Pointer,L6,768)
Title: Re: Axe Q&A
Post by: Sorunome on October 17, 2011, 12:37:05 pm
That works, thanks! :)

I have now a other question: Why doesn't that work:
Code: [Select]
:.AA
:[Pic1]->A
:[Pic2]->B
:Copy(A,L6,768
:Copy(B,L6,768)r    //Radian r
:Repeat getKey
:Dispgraphrr     //Radian rs
:End
Well, It doesn't display the correct thing in 4-level grayscale, it jus diplays everything in Pic1 in dark gray.
Title: Re: Axe Q&A
Post by: calc84maniac on October 17, 2011, 12:54:49 pm
Try Copy(B,L3,768) instead of Copy(B,L6,768)r which actually copies backwards instead of forwards and probably corrupts stuff :P
Title: Re: Axe Q&A
Post by: Yeong on October 17, 2011, 12:56:02 pm
What was L3 again? :D
Title: Re: Axe Q&A
Post by: calc84maniac on October 17, 2011, 12:58:25 pm
What was L3 again? :D
The backbuffer
Title: Re: Axe Q&A
Post by: Yeong on October 17, 2011, 01:00:32 pm
ah. Thanks. I couldn't remember atm XP
Title: Re: Axe Q&A
Post by: Freyaday on October 17, 2011, 01:09:12 pm
there's also the really handy DispGraph(ptr),DispGraph(ptr1,ptr2)rr
Title: Re: Axe Q&A
Post by: Deep Toaster on October 17, 2011, 03:45:16 pm
It's nice because it doesn't actually copy the data to the buffer/backbuffer before displaying, making it much faster than Copy()ing then DispGraphing.
Title: Re: Axe Q&A
Post by: Yeong on October 17, 2011, 07:26:04 pm
After storing some values in Pointer, is there a way to "DelVar" it?
Every time I run the program, the Pointer still have all the values.
That is both a strength and weakness of shell programs. A strength because you don't have to create an appvar for save games, a weakness because you can't keep the original data for the next run if you modified it.
So there is no way to clear it?
trying to overwrite with Data(0,0,0,0,0,.... didn't work
Title: Re: Axe Q&A
Post by: Builderboy on October 17, 2011, 07:28:05 pm
If you have data like so:

Data(0,0,0)->GDB1

and you modify this data durring the program, but you ALWAYS want it to start out as zero, you can zero the entire thing like so:

0->{GDB1}
Fill(GDB1,Length)
Title: Re: Axe Q&A
Post by: Freyaday on October 17, 2011, 07:28:41 pm
That's because Data() is basically Buff(), but you get control over the contents.
Title: Re: Axe Q&A
Post by: Yeong on October 17, 2011, 07:31:56 pm
ah, thank you!
@Frey: that was probably what caused the ported game to not work after 1st time playing :D
Title: Re: Axe Q&A
Post by: Deep Toaster on October 17, 2011, 07:32:53 pm
Buff() is basically a shortcut for Data()/[].
Title: Re: Axe Q&A
Post by: Michael_Lee on October 18, 2011, 10:39:01 pm
Okay, I'm sure that this is just stupidity on my part, but I just can't see a bug in this.

Axe 1.0.5

Code: [Select]
.ZA

Text(0,0,F(5,6)>Dec)
Text(50,0,F(6,5)>Dec)

Text(0,10,F((6-1),(6+1))>Dec)
Text(50,10,F(6,6)-1>Dec)

Text(0,20,F(6,(5+4))>Dec)

Text(50,20,F(6,5)+F(6,4)>Dec)


Pause 5000

Lbl F
r1*r2+r1+r2
Return

Compiling halts at 57% during the first pass -- error message: "WRONG # OF ARGS".

Pressing [pgrm] jumps to the sixth 'Text'
Code: [Select]
Text(50,20,F(6,5)+F(6,4)>Dec)
                     ^

(In case anybody was wondering, I was brute-forcing a solution to an SAT problem (in my defense, I was feeling too tired to be clever)).
Title: Re: Axe Q&A
Post by: Runer112 on October 18, 2011, 11:01:50 pm
Pick that post back up and take it right on over to the bug reports thread, because that's definitely Axe's fault, not yours. It's treating +F as adding the variable F instead of noticing the opening parenthesis immediately following it and treating it as adding the return value of a function.
Title: Re: Axe Q&A
Post by: Michael_Lee on October 18, 2011, 11:12:00 pm
Okay, thanks.
Title: Re: Axe Q&A
Post by: Yeong on October 18, 2011, 11:13:45 pm
Question:what is the limit of constant's letter? I know that it must be more than 1 letter... Also, can I store decimal in constant?
Title: Re: Axe Q&A
Post by: Yeong on October 19, 2011, 08:32:35 pm
discard the question before:
Why doesn't this code work?
Code: [Select]
:.MPREV
:GetCalc("varF")->A
:GetCalc("varP")->B
:float{A}->F
:float{B}->P
:F->oAA      //o is a degree sign
:P->oBB
:freq(oAA,oBB
:Return
It compiles, but it won't produce sound.
(In my case, OS varF was 314 and OS varP was 32796)
Title: Re: Axe Q&A
Post by: Quigibo on October 19, 2011, 08:47:46 pm
That shouldn't compile so I guess its a bug then.  You can't assign a variable to a constant because, by definition, constants cannot change value throughout the life of the program.
Title: Re: Axe Q&A
Post by: Yeong on October 19, 2011, 10:44:15 pm
Oops.Wrong code XP
It should've been
Code: [Select]
:.MPREV
:GetCalc("varF")->A
:GetCalc("varP")->B
:float{A}->F
:float{B}->P
:freq(F,P
:Return
Title: Re: Axe Q&A
Post by: NecroBumpist on October 19, 2011, 10:49:15 pm
I'm curious as to what else you plan to implement, Quigibo. Just how much more can you possibly add to Axe :P ?
Title: Re: Axe Q&A
Post by: Deep Toaster on October 19, 2011, 11:08:44 pm
Objects, data typing, webserver scripting, BrainF*ck-style syntax, butterfly support./me runs
Title: Re: Axe Q&A
Post by: Yeong on October 19, 2011, 11:09:47 pm
Auto dissembling into z80 source files
*Yeong follows Deep Thought
Title: Re: Axe Q&A
Post by: Quigibo on October 20, 2011, 03:10:00 pm
I was going to keep it secret, but I'll tell you what I'm working on right now :)

Objects.  Axe currently only has one; the file (Using the Y0 - Y9 tokens).  I am creating a new object; the table (Using [A] - [J] tokens).  Its about time too, it was something I was trying to implement when I was first sketching out possible syntaxes before I started writing the parser.

A table is not a list, nor a matrix.  Its more like a SQL table if you're familiar with that.  The reason I'm able to have this structure in the first place is because I was finally able to optimize it enough given these invariants:


Iterators are nestable by the way.  This type of structure is perfect for situations where you have to manage one or more list of objects in a room or simulation.  This is exactly what you need for: Physics simulators, bullet code, collision detection, fluids, enemies, etc.  I think this will be a major major utility to coders and will bring the version up to 1.1.  Hopefully I can get everything working soon.
Title: Re: Axe Q&A
Post by: C0deH4cker on October 20, 2011, 03:19:53 pm
Wow, that looks really good! Also, i never knew about the y1-6 being file objects. guess theres still more to learn about the syntax.
Title: Re: Axe Q&A
Post by: Deep Toaster on October 20, 2011, 06:51:26 pm
Okay, wow O.O Tables sound incredibly useful.
Title: Re: Axe Q&A
Post by: ztrumpet on October 20, 2011, 06:52:51 pm
This sounds incredible!!  I can't wait to see how I can use this in the future. :D
Title: Re: Axe Q&A
Post by: Freyaday on October 20, 2011, 07:56:52 pm
Oo0, sounds good. Where are these things gonna be stored and will we have to allocate them?
Title: Re: Axe Q&A
Post by: LincolnB on October 20, 2011, 08:05:30 pm
So will future versions of Axe be completely object-oriented? O.O
Title: Re: Axe Q&A
Post by: Freyaday on October 20, 2011, 08:08:29 pm
So will future versions of Axe be completely object-oriented? O.O
Only if you want it be, I guess.
Title: Re: Axe Q&A
Post by: Yeong on October 20, 2011, 10:55:12 pm
I have a question:
so, you import OS var by doing this, right?
Code: [Select]
GetCalc("varA"->B
float{B}->A
Now, is there a way to store that A into constant?
Title: Re: Axe Q&A
Post by: calcdude84se on October 20, 2011, 11:03:44 pm
Because you get the value of A at run-time, its value is dynamic and not constant at all; by definition it is impossible, and the closest to be had is recompiling the program at every run to fix in a certain value of A.
Edit: Fixed a typo of "it's" for "its". I blame you, Internet! <_<
Title: Re: Axe Q&A
Post by: Yeong on October 20, 2011, 11:05:16 pm
ah ok. :\
Freq(won't work with imported OS var for some reason
Title: Re: Axe Q&A
Post by: calc84maniac on October 20, 2011, 11:25:01 pm
I have a question:
so, you import OS var by doing this, right?
Code: [Select]
GetCalc("varA"->B
float{B}->A
Now, is there a way to store that A into constant?
Close your parentheses properly. The pointer to the string "varA" is being stored into B rather than the result of GetCalc().
Title: Re: Axe Q&A
Post by: Yeong on October 20, 2011, 11:26:37 pm
!
Oops. Better fix that.
so after I correctly close the (), do I just do Freq(A,something
or Freq({A},something ?
Title: Re: Axe Q&A
Post by: calcdude84se on October 20, 2011, 11:28:21 pm
A itself is the value, and is not a pointer, so the version without curly braces is correct.
Title: Re: Axe Q&A
Post by: Quigibo on October 21, 2011, 05:37:47 am
I have a question:
so, you import OS var by doing this, right?
Code: [Select]
GetCalc("varA"->B
float{B}->A
Now, is there a way to store that A into constant?

To answer the original question for the general case of GetCalc(), there actually IS a way to store it to a constant: you can copy the contents of the file to a known free-ram location (assuming the data in the file will fit there).  If done correctly, this can lead to both a speed and size optimization as well as making code easier to write since there are less arguments you need to pass around.  This of course comes at the cost of overhead loading time for the copy and reduces the amount of free-ram you have left.

EDIT: This probably wasn't the question you were asking, but it should help someone I'm sure.
Title: Re: Axe Q&A
Post by: Yeong on October 21, 2011, 09:02:11 am
So I did this:
Code: [Select]
GetCalc("varF")→X
GetCalc("varP")→Y
float{X}→F
float{Y}→P
freq(F,P)
Return
but it still won't produce the sound D: (I put 314 = F and 16384 = P)
does F or P have to be less than 255?
Title: Re: Axe Q&A
Post by: squidgetx on October 21, 2011, 07:39:44 pm
I can't believe I forgot everything about freq() syntax after AxeSynth....But try it with less than 255. I'm not too famliar with float{} either- do you need the superscript r?

Quigibo: Sounds nice (the tables) Perfect for enemies, let's hope we don't get hopelessly confused people trying to use them as tilemaps LOL :P

Does anyone remember how the file object is structured? I remember it's 3 bytes large; but does oY1 point to the page number or the pointer within the page?
Title: Re: Axe Q&A
Post by: jacobly on October 21, 2011, 08:04:24 pm
Going by Axe.inc, {oY1}r is the address and {oY1+2} is the page.
So to answer your question, the pointer comes first.
Title: Re: Axe Q&A
Post by: epic7 on October 24, 2011, 08:27:02 pm
How would I make something where blocks fall from the top of the screen at different x coordinates?  I have rand^94 listed several times and stored as different variables and displayed at different times. Is there a better way to do this?
Title: Re: Axe Q&A
Post by: Michael_Lee on October 24, 2011, 08:47:21 pm
Well, assuming that you assign each block an X and Y coordinate in a buffer, you could simply do a 'rand^94' when assigning an x coordinate, then leave it alone.

Pseudo-code:
Code: [Select]
0->block_count

While game_is_running == True:
    If create_a_block == True:
        rand^94->{block_count * 2 + L1}  // X-coordinate
        0->{block_count*2 + 1 + L1}      // Y-coordinate
        block_count++
    End
   
    For(A, 0, block_count):              // or is it 'For(A, 0, block_count - 1)' ?
        {block_count*2 + 1 + L1}++       // Increment each Y-coordinate so that every block moves down
    End

    [game code here]

End

Title: Re: Axe Q&A
Post by: epic7 on October 24, 2011, 09:05:05 pm
Well, assuming that you assign each block an X and Y coordinate in a buffer, you could simply do a 'rand^94' when assigning an x coordinate, then leave it alone.


I wanted to have multiple blocks appear at the same time. I have
this listed

Code: [Select]

.Creating x

rand^94->I
rand^94->J
rand^94->K
rand^94->L
rand^94->M

.Some other stuff

.Drawing

If D<140
D+1->D
Pt-On(I,D,Pic2)
Pt-On(J,D-20,Pic2)
Pt-On(K,D-40,Pic2)
Pt-On(L,D-60,Pic2)
Pt-On(M,D-80,Pic2)
end

.More other stuff

.Checking if blocks collide with Pic1 which is located at x,y

If abs(I-X)<8
If abs(D-Y)<8
Return
End
End
If abs(J-X)<8
If abs(D-20-Y)<8
Return
End
End
If abs(K-X)<8
If abs(D-40-Y)<8
Return
End
End
If abs(L-X)<8
If abs(D-60-Y)<8
Return
End
End
If abs(M-X)<8
If abs(D-80-Y)<8
Return
End
End

Takes up a lot of space, though
Title: Re: Axe Q&A
Post by: Michael_Lee on October 24, 2011, 09:34:28 pm
Same thing, except with 100 blocks (Muhahaha).

Code: [Select]
.Number of blocks (don't exceed about 350)
100->N

.Clearing L1 (there are more efficient ways to do this,
.but I can never remember the exact syntax).
For(I,0,N*2)
    0->{L1+I}
End

While 1


    .Creating X and Y
    For(I,0,N)
        If {I*2+L1+1} > 64
            rand^94->{I*2+L1}
            0->{I*2+L1+1}
        End
    End
   
    .Some other stuff
   
    .Drawing
    For(I,0,N)
        I*2+L1->J
        Pt-On({J},{J+1},Pic2)
        {J+1}+1->{J+1}
    End
   
    .More stuff
   
    .Collision check
    For(I,0,N)
        I*2+L1->J
        If abs({J}-X)<8
            ReturnIf abs({J+1}-Y)<8
        End
    End
   
    .Obligatory emergency exit
    ReturnIf getKey(15)
End

You probably would want to lower the number of blocks + make tweaks so they don't fall down all at once.

Also, you can see that in this example I used a 'For' loop several times -- it would be generally better if you could optimize it into a single loop.

Code: [Select]
.Number of blocks (don't exceed about 350)
100->N

.Clearing L1 (there are more efficient ways to do this,
.but I can never remember the exact syntax).
For(I,0,N*2)
    0->{L1+I}
End

While 1
    .Some stuff

    For(I,0,N)
        .Creating X and Y
        If {I*2+L1+1} > 64
            rand^94->{I*2+L1}
            0->{I*2+L1+1}
        End
       
        .Drawing
        I*2+L1->J
        Pt-On({J},{J+1},Pic2)
        {J+1}+1->{J+1}
       
        .Collision Check 
        I*2+L1->J
        If abs({J}-X)<8
            ReturnIf abs({J+1}-Y)<8
        End
    End
   
    .More stuff
   
    .Obligatory emergency exit
    ReturnIf getKey(15)
End

The above code relies on pointers/free ram -- a crucial part of Axe programming.

See Deep Thought's wonderful tutorials on both:

http://www.omnimaga.org/index.php?action=articles;sa=view;article=59 (http://www.omnimaga.org/index.php?action=articles;sa=view;article=59)
http://www.omnimaga.org/index.php?action=articles;sa=view;article=61 (http://www.omnimaga.org/index.php?action=articles;sa=view;article=61)
Title: Re: Axe Q&A
Post by: epic7 on October 24, 2011, 09:39:01 pm
What do curly brackets do?
Title: Re: Axe Q&A
Post by: Netham45 on October 24, 2011, 10:08:38 pm
The curly brackets dereference a pointer.
http://eeems.omnimaga.org/Files/Resources/program%20readmes/Axe/Commands.htm#Das is the usage instructions.

Lets say you have the following expression: {L1}
L1 essentially always contains the number 0x86EC (or 34540 in base 10). This happens to be the address of a safe spot in RAM.

Now, the memory in any computer is laid out numerically. The 83+'s have each individual number equal to one byte of storage space in the calculator. That means that each number can essentially hold from 0 to 255. L1 can hold from 0-255, L1+1 can hold from 0-255.

{L1} would get you the value of the number at 0x86EC. {L1+1} would get you the value of the number at 0x86ED.

These numbers can then be used as a normal variable. For example:

1->{L1} would store 1 into 0x86EC, or L1. 2->{L1+1} would store 2 into 0x86ED, or L1+1.


Lemme know if this doesn't clear it up for you.
Title: Re: Axe Q&A
Post by: epic7 on October 24, 2011, 10:24:56 pm
Had to read it over like 5 times first since I'm half asleep right now :P.


So is L1 a list, or a number?
It holds from 0-255 numbers....L1+1 still holds 0-255?

If I used
1->{L1} it could be used as a normal variable like if I used 1->x?

Would {L1+1} be related at all to L1 or not since it is at a different adress?
Title: Re: Axe Q&A
Post by: Darl181 on October 24, 2011, 10:29:01 pm
L1 in Axe is not a list, it points to a block of data.  So, it's a "pointer". That's all the buffers are, spots of memory that tend to be empty, and are safe (for the most part) to use for data storage.

And yes, {L1} can be used as a normal variable, though it will only hold 0-255 if it's one byte.

{L1+1} is related to {L1} only that it's the byte immediately following the latter.


Hope this helps :)
Title: Re: Axe Q&A
Post by: Deep Toaster on October 24, 2011, 10:29:58 pm
Every byte on the calculator has an address, and that address is called a pointer.
Title: Re: Axe Q&A
Post by: Netham45 on October 24, 2011, 10:31:28 pm
L1 in terms of axe is a static value. It's not a list.

{L1} is one variable, {L1+1} is another, {L1+2} is another. They are all at independent addresses.

Note that it's possible to combine two addresses to form a 16-bit number, or a number from 0-65535 by using {L1}r. This would use L1 and L1+1 to store the larger number.

Edit: If you know what an array is, think of the memory as a giant array from 0x0000-0xFFFF (though obviously not all of this is writable). The brackets simply return the index in ram that you specify as a variable.
Title: Re: Axe Q&A
Post by: epic7 on October 24, 2011, 11:23:17 pm
Would this just be used for storing variables, or does it have other uses.
Title: Re: Axe Q&A
Post by: Freyaday on October 24, 2011, 11:45:56 pm
short answer: yes.
long answer: depends on what you want to do with it. That's the beauty of midlevel languages like Axe--everything is what you want it to be.
Title: Re: Axe Q&A
Post by: Happybobjr on October 24, 2011, 11:52:17 pm
Well what is really cool about it is that you can give each block an addressed X and Y
each block will take 2 bytes, one for x and one for y.
Block 1 will take memory locations {L1+0} and {L1+1}
Block 2_______________________{L1+2} and {L1+3}
Block 3_______________________{L1+4} and {L1+5}
and so on.
Since you know the location of each of these variables, you can save allot of code by jumping to the next byte.

so instead of doing
Pt-On(A,B,Pic1)
Pt-On(C,D,Pic1)
Pt-On(E,F,Pic1)
Pt-On(G,H,Pic1)
Pt-On(I,J,Pic1)
Pt-On(K,L,Pic1)
and so on...
you can do this...
    For(A,0,N)
        Pt-On({A*2+L1},{A*2+L1+1},Pic1)
    End


This will also let you easily change the number of blocks in THE GAME by just changing N
Title: Re: Axe Q&A
Post by: epic7 on October 25, 2011, 07:10:33 am
That makes sense. It looks like you could store L1 as a variable like J and then use {J} later on.
Title: Re: Axe Q&A
Post by: Happybobjr on October 25, 2011, 03:28:24 pm
not sure what you mean.

if you mean this...
"It looks like you could store L1 as a variable like J and then use {J} later on."
then No. L1 is a constant number, but you can use it's location {L1} as a variable.
____________________________________________________________________________________

if you mean this...
"It looks like you could store L1 to a variable like J and then use {J} later on."
then i would say...

well you don't need to.  L1 is a constant. (34540 if i remember correctly), I would suggest you just keep using L1.
So you can do stuff like this for further locations: {L1 + J}
Title: Re: Axe Q&A
Post by: LincolnB on October 25, 2011, 06:00:00 pm
Well, happybobjr, you can store A*10+1+L1 or whatever into J and then do {J} and it will do the same thing as {A*10+1+L1}, just easier to type.
Title: Re: Axe Q&A
Post by: epic7 on October 25, 2011, 06:48:58 pm
If you stored
{A*10+1+L1}
into J, would {J+1} be the same as {A*10+2+L1}?

Also, in
PtOn(x,y,Pic1)

If pic1 is an 8x8 sprite, what part of the sprite is located exactly at x,y?
Title: Re: Axe Q&A
Post by: Yeong on October 25, 2011, 07:10:32 pm
Quote
If you stored
{A*10+1+L1}
into J, would {J+1} be the same as {A*10+2+L1}?
No.
Quote
Also, in
PtOn(x,y,Pic1)

If pic1 is an 8x8 sprite, what part of the sprite is located exactly at x,y?
Top left corner of that sprite block.
Title: Re: Axe Q&A
Post by: calc84maniac on October 25, 2011, 08:26:08 pm
Quote
If you stored
{A*10+1+L1}
into J, would {J+1} be the same as {A*10+2+L1}?
No.
What he means by that is you'd store A*10+1+L1 into J, not {A*10+1+L1}.
Title: Re: Axe Q&A
Post by: epic7 on October 25, 2011, 08:28:33 pm
Understood :)
Title: Re: Axe Q&A
Post by: epic7 on October 27, 2011, 07:09:01 pm
What is the adantage of using a shell?
Title: Re: Axe Q&A
Post by: Michael_Lee on October 27, 2011, 07:22:37 pm
The advantage of compiling a program to run in a shell?
I'm not too sure myself, but...

1. You can give your Axe program an icon and a description that will appear when you look at it in a shell
2. DoorsCS programs can be slightly larger (by about 700 bytes, I think) then the normal maximum (although you can use Crabcake and circumvent the entire issue of memory altogether)
Title: Re: Axe Q&A
Post by: epic7 on October 28, 2011, 06:29:39 pm
Is there any way to make this work? I need it for a game where the character can level up and then have different appearances.

Code: [Select]
If G=1
[hexadecimal]->Pic1
ElseIf G=2
[different hexadecimal]->Pic1
ElseIf G=3
[different hexadecimal]->Pic1
ElseIf G=4
[different hexadecimal]->Pic1
ElseIf G=5
[different hexadecimal]->Pic1
Else
[different hexadecimal]->Pic1
end

Title: Re: Axe Q&A
Post by: Happybobjr on October 28, 2011, 06:31:37 pm
yes there is.

you need to do
[00000000000000000000000]->Pic1
then do

If g=#
[##################]->{Pic1}
elaseif g=#
[##################]->{Pic1}

.....
and so on
Title: Re: Axe Q&A
Post by: Builderboy on October 28, 2011, 06:41:37 pm
That doesn't quite work, as that is storing the pointer into Pic1, not storing the pointer as Pic1.  This will also modify your program if you use a shell like MirageOS.  Probably the best design would be something like this:

Code: [Select]
[SPRITE DATA 1]->Pic1
[SPRITE DATA 2]
[SPRITE DATA 3]
...

Pt-On(X,Y,G*8+Pic1

Where G=0 is the first sprite, G=1 is the second sprite, and so on
Title: Re: Axe Q&A
Post by: epic7 on October 28, 2011, 06:52:02 pm
That will work? What does the *8 do?
Title: Re: Axe Q&A
Post by: Builderboy on October 28, 2011, 06:53:39 pm
It increases the pointer by 8 bytes, since each sprite is only 8 bytes, it will move the pointer from the first sprite to the sprite after it.
Title: Re: Axe Q&A
Post by: Michael_Lee on October 28, 2011, 06:57:18 pm
What Builderboy's code is essentially doing is hardcoding in a list (technically a contiguous block of memory) containing data for a sprite.  Each sprite takes up exactly 8 bytes.

Edit: Ninja'd
Title: Re: Axe Q&A
Post by: Yeong on October 28, 2011, 06:58:15 pm
so if we have [0000000000000000FFFFFFFFFFFFFFFF], [0000000000000000] will be the first sprite and [FFFFFFFFFFFFFFFF] will be the 2nd sprite.
Title: Re: Axe Q&A
Post by: epic7 on October 28, 2011, 07:09:33 pm
I didnt know you could use pointer stuff with pics
Title: Re: Axe Q&A
Post by: Builderboy on October 28, 2011, 07:10:33 pm
Pointers are the only way to use sprites, as the sprite display routine takes a pointer as an argument
Title: Re: Axe Q&A
Post by: parserp on October 28, 2011, 07:55:04 pm
Is there an option to turn the calc off while in a axe program?
for example, If I were to make a password program...
Title: Re: Axe Q&A
Post by: epic7 on October 28, 2011, 08:08:08 pm
Like when you start the calculator, it shows up?
Title: Re: Axe Q&A
Post by: parserp on October 28, 2011, 08:09:19 pm
yes, precicely. (for security reasons) ;)
Title: Re: Axe Q&A
Post by: Builderboy on October 28, 2011, 08:10:30 pm
You would have to use some inline asm, as there is no default way to do it in Axe alone
Title: Re: Axe Q&A
Post by: calcdude84se on October 28, 2011, 08:11:16 pm
Also, those are two different things. One is just the ability to turn the calc off, the other is the ability to create and be invoked from OFFSCRPT.
Title: Re: Axe Q&A
Post by: epic7 on October 28, 2011, 08:11:48 pm
Well, Ti has a program that will start up prgms or apps of your choice when the calculator starts. You could use that.
Title: Re: Axe Q&A
Post by: parserp on October 28, 2011, 08:12:33 pm
dang I don't know asm :(
edit: I could use that...
but I couldn't turn it off...
Title: Re: Axe Q&A
Post by: calcdude84se on October 28, 2011, 08:13:16 pm
zStart has the ability to set a start-up program, too, and is just generally better than Startup. (I believe this is the name of TI's app)
parser: That's okay, you can take this solution.
Edit: The user will just have to turn it off him/herself.
Title: Re: Axe Q&A
Post by: Michael_Lee on October 28, 2011, 08:14:39 pm
Well, technically, you could cause a RAM clear.  That would certainly turn the calculator off.

Hell, if you detected an incorrect password, you could run through the VAT, archive everything, unarchive anything that needs to be secret, then RAM clear.
Title: Re: Axe Q&A
Post by: epic7 on October 28, 2011, 08:15:30 pm
I was going to try to make a startup program myself
Title: Re: Axe Q&A
Post by: ztrumpet on October 28, 2011, 09:23:35 pm
Is there an option to turn the calc off while in a axe program?
for example, If I were to make a password program...
I assume you want something like this: http://ourl.ca/10110/250926 (Read all of the stuff in quotes.)
If so, this is the post that contains the rest of the explanation and the code: http://ourl.ca/10110/250926
Good luck!
Title: Re: Axe Q&A
Post by: epic7 on October 28, 2011, 09:29:47 pm
Is there a way to enter text into the calculator like Input( in basic?
Title: Re: Axe Q&A
Post by: mrmprog on October 28, 2011, 09:30:51 pm
The input command works, but it is buggy. It may be better to write one of your own.
Title: Re: Axe Q&A
Post by: epic7 on October 28, 2011, 09:32:38 pm
K, then thats what ill do
Title: Re: Axe Q&A
Post by: mrmprog on October 28, 2011, 09:37:01 pm
On second thought, you could use some of the routines here (http://ourl.ca/4129), if you give the author credit. Click the link, and then search "input" to find the good stuff :)
Title: Re: Axe Q&A
Post by: epic7 on October 28, 2011, 09:43:06 pm
How would you do a Load/Save game in a game?
Title: Re: Axe Q&A
Post by: Happybobjr on October 28, 2011, 09:47:09 pm
There are two common ways.

1.  Make an app variable to hold information.
2.  change data in your program and have some random asm command at the end (can't remember it}
Title: Re: Axe Q&A
Post by: epic7 on October 28, 2011, 10:16:54 pm
I need to learn these appvar things.
Title: Re: Axe Q&A
Post by: ztrumpet on October 28, 2011, 10:53:55 pm
On second thought, you could use some of the routines here (http://ourl.ca/4129), if you give the author credit. Click the link, and then search "input" to find the good stuff :)
Yup, that's a great link.  If you don't want to search, though, you can always use the index: http://ourl.ca/7818
Title: Re: Axe Q&A
Post by: epic7 on October 28, 2011, 11:06:23 pm
I was going to use the input for a load game, so the user would type a number that would loaf the level and stuff. Or, I could use a button to do it, but I don't know how to work appvars
Title: Re: Axe Q&A
Post by: parserp on October 29, 2011, 12:11:48 am
I got started on appvars with this: http://www.omnimaga.org/index.php?action=articles;sa=view;article=58 (http://www.omnimaga.org/index.php?action=articles;sa=view;article=58)
...and this: http://ourl.ca/12627 (http://ourl.ca/12627)
(check out the source code for it. :)
Title: Re: Axe Q&A
Post by: epic7 on October 29, 2011, 11:23:40 am
Does anyone know what's wrong? When I push the arrows in the menu, nothing happens
Code: [Select]
:.ROBOGUN
:DiagnosticOff
:[FCFC000000000000]→Pic2
:[081C2A4908080808]→Pic0
:[F080800000000000]→Pic1
:[FCA0A02000000000]
:[FFFCA0A080000000]
:[FCFFFC4848484000]
:[F8FFFFF848484850]
:[F8FFFFFFFC6C6C6C]
:[Pic9]→Pic8
:Fix 5
:Repeat getKey(15)
:copy(Pic8,L6,768)
:Text(35,1,"RoboGun")
:Text(1,55,"New Game"
:Text(60,55,"Load Game"
:Pt-On(75,47,RotC(Pic0)
:Pt-On(12,48,RotCCPic0)
:If getKey(2)
:Goto N
:End
:If getKey(3)
:Goto L
:End
:DispGraph
:End
:Lbl L
:ClrDraw
:Goto 1
:Lbl N
:0→G
:1→L
:Lbl 1
:43→X
:0→M
:27→Y
:Repeat getKey(15)
:ClrDraw
:If getKey(2)
:X--
:End
:If getKey(3)
:X++
:End
:If getKey(1)
:Y++
:End
:If getKey(4)
:Y--
:End
:If getKey(48)
:0→R
:End
:If getKey(40)
:1→R
:End
:If getKey(54)
:1→F
:End
:If R
:Pt-On(X,Y,Pic1+L*8)
:Else
:Pt-On(X,Y,FlipH(Pic1+L*8)
:End
:If F
:X+4→S
:Y+1→T
:Pt-On(S,T,Pic2
:0→F
:1→M
:End
:If M
:If R
:S++
:End
:!If R
:S--
:End
:Pt-On(S,T,Pic2)
:If S=94 or S=0
:0→M
:1→F
:End
:End
:End
:Fix 4
Title: Re: Axe Q&A
Post by: mrmprog on October 29, 2011, 12:02:16 pm
I didn't look too closely, but I think you may be missing a DispGraph somewhere. I will take a deeper look later,if you want.
Title: Re: Axe Q&A
Post by: epic7 on October 29, 2011, 12:48:08 pm
Ong im stupid. :P
Title: Re: Axe Q&A
Post by: mrmprog on October 29, 2011, 12:52:13 pm
Was that it? :)
Title: Re: Axe Q&A
Post by: epic7 on October 29, 2011, 01:14:08 pm
Forgot dispgraph. Still, I have a lot of errors to ffix
Title: Re: Axe Q&A
Post by: parserp on October 29, 2011, 01:25:04 pm
dispgraph always seems to sneak out of the source... I'll catch it someday... XP
Title: Re: Axe Q&A
Post by: Hayleia on October 29, 2011, 02:59:56 pm
Yeah, I have problems with DispGraph too. I never forget it but it is always at the wrong place :P



Also, I have another problem:
I got ERR: MAX SYMBOLS
Does that mean I have too much code ? D:



EDIT: Yeah, I stole a new page to boot and parser padwan >:D
Title: Re: Axe Q&A
Post by: C0deH4cker on October 29, 2011, 03:05:37 pm
input()

btw, i wrote an axe function called BCALL(), where the only argument is the address to bcall. I made it run _powerOff successfully as well.
Title: Re: Axe Q&A
Post by: Hayleia on October 29, 2011, 03:24:42 pm
input()

btw, i wrote an axe function called BCALL(), where the only argument is the address to bcall. I made it run _powerOff successfully as well.
What ? I didn't understand your post, especially the "input()" part with nothing before and nothing after ??? but I am sure that it doesn't answer my question :P

EDIT: I just found a MAX SYMBOL thread O.O but I still didn't find the answer to my question D:
Title: Re: Axe Q&A
Post by: Builderboy on October 29, 2011, 03:31:56 pm
Max Symbols means you have over the limit of how many Pic0/GDB0/Str0 types of constants you are allowed to have.  The current version of Axe has a symbol limit of over 2000, are you updated to a version as recent as 1.0.0 or higher?
Title: Re: Axe Q&A
Post by: Hayleia on October 29, 2011, 03:36:04 pm
Max Symbols means you have over the limit of how many Pic0/GDB0/Str0 types of constants you are allowed to have.  The current version of Axe has a symbol limit of over 2000, are you updated to a version as recent as 1.0.0 or higher?
Nope. I am still using 0.5.3 because updating would make me change too much things in my code D:

...Pic0/GDB0/Str0 types of constants...
Are labels also included ? because the error happened after I added a sub(APD) (that is not a true APD)
Title: Re: Axe Q&A
Post by: Builderboy on October 29, 2011, 03:39:33 pm
What kind of things would you have to change?  Axe 1.0.0 should be mostly backwards compatible.  And yes Labels are included as well. 
Title: Re: Axe Q&A
Post by: Hayleia on October 29, 2011, 03:42:29 pm
What kind of things would you have to change?
All the GDB1→DispGraph would have to become DispGraph(GDB1). And even if my code is not optimized and do not use a lot of those, it is huge (the code) and I am lazy :P

And yes Labels are included as well. 
But once a label is added, I can put as sub(<lbl>) as I want ?
Title: Re: Axe Q&A
Post by: Builderboy on October 29, 2011, 03:44:24 pm
I believe so, but I am not sure.  And unless you want to restrict the number of symbols you use, I would recommend upgrading, as there is going to be just as much trouble trying to work around the symbol limit as there is making the small upgrades to Axe 1.0.5.  Plus, if you upgrade to 1.0.5 now, trying to compile will always bring you right to the part that needs to be changed, making it easy to find everything you need.
Title: Re: Axe Q&A
Post by: Hayleia on October 29, 2011, 03:46:55 pm
Ok, thanks a lot :)
I may consider upgrading if that allows me to use more symbols (and more functions :D)
Title: Re: Axe Q&A
Post by: Builderboy on October 29, 2011, 03:48:00 pm
Yay :) You really should upgrade, there are so many benefits of 1.0.5 ^^
Title: Re: Axe Q&A
Post by: Hayleia on October 29, 2011, 03:52:56 pm
Lol ? I just upgraded (on Wabbit, that explains my speed) and it compiled without any problems, not any Max Symbols error (:w00t:) and not any →DispGraph ??? problem (but it is slower to compile).
Anyway, IT WORKS !!! Thanks a lot for your advice !
I gave you one +1 but you posted so much that if you want more, just ask ;D
EDIT: In fact I gave you another +1 :D
Title: Re: Axe Q&A
Post by: mrmprog on October 29, 2011, 03:54:56 pm
Yeah, 1.0.5 is pretty good stuff. Now for my question: I am using a list of numbers to hold what a set of aligned sprites is.  How can I convert the position of the number in ram, to the coordinates of where the sprite should go?
Title: Re: Axe Q&A
Post by: Builderboy on October 29, 2011, 03:59:17 pm
Oh now that I think about it, Axe might have included the old syntax as well for 100% backwards compatibility :D

It also added peephole optimization, which is what makes compiling slower.  To disable this, just press Zoom instead of enter to compile a program.
Title: Re: Axe Q&A
Post by: Hayleia on October 29, 2011, 04:01:55 pm
Oh now that I think about it, Axe might have included the old syntax as well for 100% backwards compatibility :D

It also added peephole optimization, which is what makes compiling slower.  To disable this, just press Zoom instead of enter to compile a program.
Ok, good to know, thanks :D (even if I am sure I will soon forget).

Yeah, 1.0.5 is pretty good stuff. Now for my question: I am using a list of numbers to hold what a set of aligned sprites is.  How can I convert the position of the number in ram, to the coordinates of where the sprite should go?
Err I am not sure to understand your question (in fact I am sure to not understand your question XD).
After reading it 17 times, I understood (forget my lack of speed, I am French).
You have a set of sprites, and you want the program to guess where it has to display the sprite, right ?
Well, you can put your sprites at the pointer GDB1S (for example), then make another set of data at GDB1X where you put all the X coordinates, and another set of data at GDB1Y where you put all the Y coordinates.
Then, with a For loop, you do Pt-Whatever({calculus+GDB1X},{calculus+GDB1Y},{calculus+GDB1S})
I hope that answer your question :)
Title: Re: Axe Q&A
Post by: mrmprog on October 29, 2011, 04:40:36 pm
Er... Sorry, that was poorly worded. This is what I mean. I have a list of numbers in ram the numbers represent weather the sprite is nothing, or is on object. Using the position of the number in the list, I want to get the coordinates for an aligned sprite.
Example:
Data: 001002300
To get:
___@
___#
*___
Get the idea? Instead of a 3*3 grid as I have here, it needs to work with 8*12 grid for the sprites.



Title: Re: Axe Q&A
Post by: Builderboy on October 29, 2011, 04:54:09 pm
You mean a 12x8 grid right?  The answer is X=N^12  Y=N/12  where N is your number in the list.  Also for future reference, what you are describing is a simple tilemap :)
Title: Re: Axe Q&A
Post by: epic7 on October 29, 2011, 05:19:09 pm
That doesn't quite work, as that is storing the pointer into Pic1, not storing the pointer as Pic1.  This will also modify your program if you use a shell like MirageOS.  Probably the best design would be something like this:

Code: [Select]
[SPRITE DATA 1]->Pic1
[SPRITE DATA 2]
[SPRITE DATA 3]
...

Pt-On(X,Y,G*8+Pic1

Where G=0 is the first sprite, G=1 is the second sprite, and so on

It doesn't work. It just screws up the sprites.

Edit: Wait... What the heck, it works now.
Title: Re: Axe Q&A
Post by: Builderboy on October 29, 2011, 05:26:16 pm
Could you post how you implemented it?  

EDIT: Yay :) There might be some other part of your code that is intermittently messing with your graphics it would seem o.O
Title: Re: Axe Q&A
Post by: epic7 on October 29, 2011, 05:49:24 pm
When it screwed up my sprite the first time, it made it look kinda like a horse :P

I tried it and it failed, that was this morning. Then, I changed the code and fixed some unrelated errors. After I posted I  tried to get it to work again... and it worked.


The only thing I think I did differently was instead of
Pic1+G*8
I used
G*8+Pic1
Title: Re: Axe Q&A
Post by: Builderboy on October 29, 2011, 05:51:00 pm
Oh, that would do it XD Those are very very different, because Axe does its math from left to right and IGNORES pemdas!  So the first did (Pic1+G)*8, while the second does ( G*8 )+Pic1
Title: Re: Axe Q&A
Post by: epic7 on October 29, 2011, 05:55:01 pm
Oh yeah... AXE, Y U NO DO ORDER OF OPS?
Title: Re: Axe Q&A
Post by: calc84maniac on October 29, 2011, 06:15:40 pm
Axe does its math from left to right and IGNORES pemdas!
But Axe is good friends with lambdas ;D
Title: Re: Axe Q&A
Post by: Wellen on October 29, 2011, 07:11:39 pm
Appvars.. again :D

I don't know why, but when i compile the following code, and I run the program:
-first time, the appvar doesn't exist => code 1
-second time, the appvar exists => code 2
It's okay, that's what I want it to do.
But after the second time, it doesn't do anything ??? it just skips this part of the code...

Code: [Select]
!If GetCalc("appvTLKC",Y0
GetCalc("appvTLKC",6)->K             // Code 1
sub(MOD                             //
Else
Repeat M=6               //
0->M            //  Code 2 
sub(SA         //
sub(CM        //
End
End

Spoiler For the whole code:
Code: [Select]
.TILOCK
DiagnosticOff
ClrHomeClrDraw^^r
Fix 5

sub(Z

!If GetCalc("appvTLKC",Y0
GetCalc("appvTLKC",6)->K
sub(MOD
Else
Repeat M=6
0->M
sub(SA
sub(CM
End
End

.MENU

[0000070F0C0C0C1F->Pic1
[0000C0E0606060F0
[3F3F3F3F3F1F0000
[B8389838F8F00000

ClrDraw^^r

Rect(11,14,74,35
RectI(13,16,70,31
Rect(14,17,68,29
RectI(15,18,66,27
Text(17,19,"Turn off
Text(17,28,"Change my code
Text(17,37,"Quit to homescreen
19->B
16->H
4->K
fnInt(FD,6

RectI(16,B,64,7
Repeat getKey(54)
If getKey(1)+getKey(4)
RectI(16,B,64,7
B<37*getKey(1)-(B>19*getKey(4))*9+B->B
RectI(16,B,64,7
While getKey(0)
Pause 5
End
End
If getKey(54)
If B=19
Text(0,,"1
End
If B=28
Text(0,,"2
End
If B=37
Text(0,,"3
End
End
End
FnOff

Archive "appvTLKC"
LnReg
Fix 4
Return


.SAISIE DU CODE
Lbl SA
Data(0,0,0,0,0,0)->GDB0
For(theta,0,20
ClrDraw
Rect(29,45-theta,37,20
RectI(31,47-theta,33,16
Rect(48-theta,9,38,11
Rect(49-theta,10,38,11
RectI(49-theta,10,36,9
If Z
Text(21-theta,1,"Choose your new code :"
Else
Text(21-theta,1,"Please enter your code:"
End
DispGraph
End


For(theta,0,9
Text(theta>4*~5+theta*7+32->L,theta>4*9+27,theta>Dec
Line(L+4,27,L+4,44
Line(L+5,27,L+5,44
End

Line(31,34,64,34
Line(31,35,64,35
0->C+26->B+4->A
RectI(A,B,7,9

Repeat getKey(15)
If getKey
RectI(A,B,7,9
A<58*getKey(3)-(A>30*getKey(2))*7+A->A
B=26*getKey(1)-(B=35*getKey(4))*9+B->B
RectI(A,B,7,9
If getKey(56)
0->C
DrawInv
Rect(33,11,28,6
DrawInv
End
If getKey(54)
Text(C*5+33,11,B=35*5+(A-30/7)->D>Dec
D->{GDB0+C
C+1->C
End
End
DispGraph
ReturnIf C=6
End
Return



.MODIFICATION
Lbl MOD
1->Z
sub(SA
Copy(GDB0,K,6
sub(Z
sub(H
ClrDraw
Return



.VERIFICATION DU CODE
Lbl CM
For(theta,0,5
(({GDB0+theta})=({Y0+theta}))+M->M
End
sub(H

Data(44,40)->Pic1FP
[00003A00000001E1900000079764000000719A00
[002DFEB500002E688980002207B2800069DE6D80
[00A803C2C00097DC9C40066233F7E006DF07F960
[0F661C96A00D99E32D501E271CDEA02963F36760
[34260C9D503B45F36AA03CB70C95602969FB6D60
[46A90D2A502AD5F2EA40151776AAE014AAD52A40
[0AA12B6BC0A955EAB90084543545405457CF5140
[122852AB00255DB54E000AAE856D00154A440800
[AAB1EBB500152CAA9800202612B600149A4DF000
[0812B540000865382000082A0A80000212A80000
[02A4040000010850000000128000000000000000
Bitmap(28,5,Pic1FP

Text(0,57,"Scanning...
For(theta,4,45
RectI(25,theta,43,5
Text(75,57,theta-3*100/42>Dec,37>Char
DispGraph
RectI(25,theta,43,5
Pause rand^250+50
End

!If M=6
Fix 3
Rect(0,17,96,15
Text(33,18,"WARNING !
Text(23,24,"Access denied
DispGraph
Fix 2
Repeat getKey
End
End
ClrHomeClrDraw
Return


.INITIALISATION DE Z
Lbl Z
0->Z
Return



Lbl H
For(theta,0,95
Horizontal -
DispGraph
End
Return



.FOND MENU
Lbl FD
DS>(K,4)
DS>(H,16)
End
End

For(C,0,4
For(A,0,5
Pt-Off(A*16,C*16-H,Pic1)^^r
Pt-Off(A*16+8,C*16-H,Pic1+8)^^r
Pt-Off(A*16,C*16+8-H,Pic1+16)^^r
Pt-Off(A*16+8,C*16+8-H,Pic1+24)^^r
End
End
DrawInv ^^r
Rect(11,14,74,35)^^r
DrawInv ^^r
DispGraph^^r
Return
Title: Re: Axe Q&A
Post by: Builderboy on October 29, 2011, 07:14:48 pm
I think the first line GetCalc(Name,Y1) returns 0 if the file does not exist, OR if the file is in RAM.  This may not be true though, it doesn't specify in the documentation D: Try archiving the file and see if it works

EDIT: nevermind, it should return true whether or not it is archived or not.  What version of Axe are you using?
Title: Re: Axe Q&A
Post by: Wellen on October 29, 2011, 07:19:17 pm
The appvar is archived at the end of the program..

I'm using 0.5.0
Title: Re: Axe Q&A
Post by: Builderboy on October 29, 2011, 07:19:56 pm
Oh really?  Try upgrading to 1.0.5 first, maybe that will help fix some things and then we can go from there
Title: Re: Axe Q&A
Post by: Wellen on October 29, 2011, 07:34:53 pm
I tried to update to 1.0.5, but it does weird things ^^" I guess that's because 0.5.0 and 1.0.5 are very different, right ?
0.5.3b doesn't change anything compared to 0.5.0
Title: Re: Axe Q&A
Post by: Builderboy on October 29, 2011, 07:51:09 pm
The only difference is 1.0.5 has more features, everything should be backwards compatible o.O What kind of 'weird things' happen?
Title: Re: Axe Q&A
Post by: Wellen on October 30, 2011, 04:59:33 am
Here are two screenshots :
0.5.0 / 0.5.3
(http://img.removedfromgame.com/imgs/0.5.0-0.5.3.gif)

1.0.5 : it seems that the picture that scrolls fast a the beginnig is the menu picture.. So it doesn't even ask for the code, but the appvar is created ??? And RAM Cleared, wtf ???
(http://img.removedfromgame.com/imgs/1.0.5.gif)
Title: Re: Axe Q&A
Post by: Builderboy on October 30, 2011, 06:00:55 am
Hmm strange, could you post the source as an 8xp file so I can test in in wabbit myself?  There definitely are some interesting things going on here.
Title: Re: Axe Q&A
Post by: Wellen on October 30, 2011, 07:05:53 am
I attached it below  :)
Title: Re: Axe Q&A
Post by: Freyaday on October 30, 2011, 02:36:00 pm
how do I find the square root of an 8.8 number?
Title: Re: Axe Q&A
Post by: jacobly on October 30, 2011, 02:49:28 pm
If you don't care too much about accuracy, you can do √(A)∗16.
Alternatively, I wrote an 8.8 square root routine in asm... If you can give me a token to use (not √( since Axe has dibs) I could make an Axiom.
Title: Re: Axe Q&A
Post by: Builderboy on October 30, 2011, 02:54:37 pm
I attached it below  :)


Ah this looks like a bug with Axe's peephole optimizer!  Dang it, here I was telling you to upgrade and it's not even a stable build x.x In the meantime, instead of selecting your program by pressing enter, press the Zoom button instead, and everything should work like it normally does.  
Title: Re: Axe Q&A
Post by: Freyaday on October 30, 2011, 03:17:22 pm
If you don't care too much about accuracy, you can do √(A)∗16.
Alternatively, I wrote an 8.8 square root routine in asm... If you can give me a token to use (not √( since Axe has dibs) I could make an Axiom.
that would be great. Axe has lots of unuesd tokens, and I believe you can even make your own token hook if you so desire.
Title: Re: Axe Q&A
Post by: jacobly on October 30, 2011, 03:18:57 pm
I decided to use seq( since it has two letters in common with sqrt(. :P

Axiom SQRT:
  seq(a): returns the square root of the 8.8 number a in 8.8 format.
  seq(a)ʳ: returns the square root of the unsigned integer a in 8.8 format.
Title: Re: Axe Q&A
Post by: Wellen on October 30, 2011, 06:17:07 pm
Ah this looks like a bug with Axe's peephole optimizer!  Dang it, here I was telling you to upgrade and it's not even a stable build x.x In the meantime, instead of selecting your program by pressing enter, press the Zoom button instead, and everything should work like it normally does. 

Doing this, it does the same as with 0.5.0/0.5.3 ...  D:
I wrote a little program that checks if the appvar really exists, also the same method as ATILOCK : I load it into an file, and display what it points to (actually the code)
What I do in this screenshot :
-I compile ATEST
-I "zoom" A(TILOCK)
-run Tilock : it's okay
-run Test : it finds the code, it's okay
-run Tilock : it asks for the code, ok
-run Test : finds the code, ok
-run Tilock : doesn't find the appvar ??? or what else ?
(-I cry)
(http://img.removedfromgame.com/imgs/Appvar-Bug.gif)

Also, what's "zooming" ?  ::)
Title: Re: Axe Q&A
Post by: squidgetx on October 30, 2011, 10:03:00 pm
I believe your screenshot is missing an End..

Also files are in general buggy; try copying the file data to an area in RAM and reading from there.
Title: Re: Axe Q&A
Post by: Wellen on October 31, 2011, 02:28:51 pm
There is an 'End', I just didn't scroll a the bottom (you talk about ATEST's code ?)

I'll try another way if the files don't work, but I just wanna know why it doesn't work
Title: Re: Axe Q&A
Post by: epic7 on November 03, 2011, 08:16:58 pm
Will this work for load and save game?

Code: [Select]
:.Load game label
:Lbl L
:"appvMONEY"→Str0
:"appvLEVEL"→Str9
:Unarchive Str0
:Unarchive Str9
:!If GetCalc(Str9)→W or GetCalc(Str0)→E
:Goto N
:End
:{W}→G
:{E}→L
:Goto 1
:Lbl N
:. Im not sure what to put as the size
:GetCalc(Str0,64)→W
:GetCalc(Str9,32)→E
:0→{W}→{E}→G→L
:Lbl 1


:. At the end of the code...


:. The save subroutine
:Lbl SAVE
:Unarchive Str0
:Unarchive Str9
:G→{W)
:L→{E}
:Archive Str0
:Archive Str9
:Repeat getKey(9)
:ClrDraw
:Text(1,1,"Saved!")
:DispGraph
:End
:Return

Title: Re: Axe Q&A
Post by: Builderboy on November 03, 2011, 08:24:17 pm
Two things wrong with that code, but if fixed, your code does look like it will work.  Firstly:

Code: [Select]
:!If GetCalc(Str9)→W or GetCalc(Str0)→E
That does not do what you think it does, because again, Axe does not follow order of operations.  It is actually doing this:

Code: [Select]
:!If ((GetCalc(Str9)→W) or GetCalc(Str0))→E
Which is not what you want.  Adding some parenthesis in the right place can help fix this problem.  Secondly:

Code: [Select]
:0→{W}→{E}→G→L
This is a quirk of Axe, but when you do 0->{#}->A, A will now hold #, not 0.  Separating these lines will help this issue
Title: Re: Axe Q&A
Post by: epic7 on November 03, 2011, 08:27:17 pm
So use
:!If ((GetCalc(Str9)→W) or GetCalc(Str0))→E
Instead?


Title: Re: Axe Q&A
Post by: Builderboy on November 03, 2011, 08:28:15 pm
No, that was my example of what is actually happening.  You need to put parenthesis in different places in order to achieve the effect you desire.
Title: Re: Axe Q&A
Post by: epic7 on November 03, 2011, 08:32:21 pm
How would I do that then?

:!If (GetCalc(Str9)→W) or (GetCalc(Str0)→E)

or something?


Also, what is a good size to use for the appvars?
{W} will be up to several thousand
{E} will be up to 6
Title: Re: Axe Q&A
Post by: ztrumpet on November 03, 2011, 09:10:18 pm
Is there a way to Push and Pop in Axe without having to resort to Asm()?
Title: Re: Axe Q&A
Post by: Builderboy on November 03, 2011, 09:34:34 pm
How would I do that then?

:!If (GetCalc(Str9)→W) or (GetCalc(Str0)→E)

or something?


Also, what is a good size to use for the appvars?
{W} will be up to several thousand
{E} will be up to 6

That would work yes.  And when you say {W} will be up to several thousand, do you mean there is only going to be 1 number stored, and it will range from 0 to 1000 or so?

And zTrumpet, Quigibo is adding some syntax for pushing and popping, although in a slightly different way.
Title: Re: Axe Q&A
Post by: epic7 on November 03, 2011, 10:44:24 pm
One number ranging from 0 Up to maybe 5000
Title: Re: Axe Q&A
Post by: Builderboy on November 03, 2011, 11:26:01 pm
Then your appvar would only need to be 2 bytes long.  Also, if you only need to store 2 numbers, why not just have 1 appvar that is 4 bytes long instead of two 4 byte appvars?
Title: Re: Axe Q&A
Post by: aeTIos on November 04, 2011, 07:04:06 am
oooh, nice @ the push and pop!
Title: Re: Axe Q&A
Post by: epic7 on November 04, 2011, 09:08:26 pm
Then your appvar would only need to be 2 bytes long.  Also, if you only need to store 2 numbers, why not just have 1 appvar that is 4 bytes long instead of two 4 byte appvars?
Then your appvar would only need to be 2 bytes long.  Also, if you only need to store 2 numbers, why not just have 1 appvar that is 4 bytes long instead of two 4 byte appvars?

Cuz.... I don't know how to do that
Title: Re: Axe Q&A
Post by: Builderboy on November 05, 2011, 12:23:48 am
To create a 4 byte appvar, just do getCalc(Name,4)->M, after that it is a simple matter of using the pointer M to access the 1st and 2nd 2 byte numbers.  {M}r for the first number and {M+2}r for the second number.  Does that make sense?  Appvars don't hold 1 number each, but rather an amount of data that you have access to.
Title: Re: Axe Q&A
Post by: epic7 on November 05, 2011, 04:26:38 pm
Yus


What I currently have has screws up the data kinda... The money sometimes is at a random number, usually lower then what I had before
Title: Re: Axe Q&A
Post by: mrmprog on November 05, 2011, 04:40:24 pm
Are you reading the full 2 bytes?
Title: Re: Axe Q&A
Post by: epic7 on November 05, 2011, 04:57:55 pm
Idk
Title: Re: Axe Q&A
Post by: Darl181 on November 06, 2011, 11:18:10 am
So I have two objects, and I'm trying to make one object shoot a projectile at another.  How would one go about that?
(I've been trying to do this all night to no avail :P)
Title: Re: Axe Q&A
Post by: epic7 on November 06, 2011, 11:30:08 am
Make it be like a tracking missile and it would make it easy :P
Title: Re: Axe Q&A
Post by: Darl181 on November 06, 2011, 05:27:53 pm
It's not that easy, I'm thinking of an "auto-aiming" mod for Essence.
Title: Re: Axe Q&A
Post by: squidgetx on November 06, 2011, 07:57:04 pm
So I have two objects, and I'm trying to make one object shoot a projectile at another.  How would one go about that?
(I've been trying to do this all night to no avail :P)

A straight path, or a parabolic one?
Title: Re: Axe Q&A
Post by: Deep Toaster on November 06, 2011, 09:07:26 pm
Idk
{POINTER} reads a single byte (0 to 255), while {POINTER}r reads two (0 to 65,535). That might be why.
Title: Re: Axe Q&A
Post by: epic7 on November 06, 2011, 09:12:11 pm
O. My numbers are over 255.

How would I find the mini r on the calculator?
Title: Re: Axe Q&A
Post by: Deep Toaster on November 06, 2011, 09:14:09 pm
2nd+[ANGLE](APPS)>3:r
Title: Re: Axe Q&A
Post by: mrmprog on November 06, 2011, 09:17:15 pm
Was that the problem? If not, make sure that you are reading from the appvar, and not from some random place.
Title: Re: Axe Q&A
Post by: Deep Toaster on November 06, 2011, 09:18:59 pm
He was reading a two-byte number as one byte.

And on that note, remember to store it as a two-byte number too -- VALUE→{POINTER}r
Title: Re: Axe Q&A
Post by: Darl181 on November 06, 2011, 09:55:36 pm
So I have two objects, and I'm trying to make one object shoot a projectile at another.  How would one go about that?
(I've been trying to do this all night to no avail :P)
A straight path, or a parabolic one?
Straight.  Trying to not make it too complicated :P
Title: Re: Axe Q&A
Post by: Builderboy on November 06, 2011, 10:12:39 pm
Is the object you are trying to hit moving?
Title: Re: Axe Q&A
Post by: Darl181 on November 07, 2011, 10:22:11 am
No, I'm not trying to make it aim ahead.
Just taking the current X,Y coordinates of the shooting object, the current X,Y coordinates of the target, and somehow make the bullet's velocity aim at the target.
Title: Re: Axe Q&A
Post by: Builderboy on November 07, 2011, 02:21:51 pm
If X,Y is your own position, and C,D is the objects position, and A,B is the velocity of your object:

Code: [Select]
sqrt(abs(X-C)/256^2+(abs(Y-D)/256^2))->L
C-X//L->A
D-Y//L->B

If your position variables are in x256 style.

Title: Re: Axe Q&A
Post by: epic7 on November 07, 2011, 03:41:12 pm
What does *256 do?  I saw it in a program in the axe documentation but I just ignored it.
Title: Re: Axe Q&A
Post by: Darl181 on November 07, 2011, 06:15:57 pm
Technically, *256 multiplies by 256.  There's some bitwise uses etc iirc but that's pretty advanced :P
When used this way, *256 basically means that for every one pixel on the screen is 256 "virtual pixels" or something.  So, to move an object 1 pixel on the screen you'd have to add 256 to the location variable.
It's normally called inflation, and helps precision stuffs.
(/me isn't good at explaining stuff XD)

So, not-signed division in the first line, and signed in the other two?  Cool, thanks :D
Title: Re: Axe Q&A
Post by: Builderboy on November 07, 2011, 06:20:42 pm
Indeed, since square roots only return positive numbers, you only need an unsigned division in the first line ^^
Title: Re: Axe Q&A
Post by: calc84maniac on November 07, 2011, 06:25:27 pm
Well, if your positions are in *256 style, wouldn't their squares overflow? You'd have to divide by 256 before squaring, methinks.
Title: Re: Axe Q&A
Post by: Builderboy on November 07, 2011, 06:27:22 pm
D: That is a good point, i shall modify code now
Title: Re: Axe Q&A
Post by: Darl181 on November 07, 2011, 06:28:47 pm
So just to clarify (because it's acting odd for me):
X,Y = player location
C,D = target location
A,B = projectile velocity

Also since there isn't a sqrt() token, is that 2nd + x2?

EDIT: wait if there isn't any inflation will it work properly?  In the test program I made there isn't any
Title: Re: Axe Q&A
Post by: Builderboy on November 07, 2011, 06:32:14 pm
If there is no inflation, your bullets won't be able to move with enough precision.  Unless, do your bullets have x256 precision and your positions are just in regular x1 precision?
Title: Re: Axe Q&A
Post by: Darl181 on November 07, 2011, 06:38:13 pm
Before, it was x1.  I'm modding it to work with x256 all around atm to see if I can get it :P
Title: Re: Axe Q&A
Post by: Builderboy on November 07, 2011, 06:40:36 pm
Yeah because if your bullets are in x1 format, you won't have enough precision for them to move in many directions smoothly
Title: Re: Axe Q&A
Post by: squidgetx on November 07, 2011, 06:40:52 pm
Don't you need to multiply L by 256 since it's returning magnitude of the vector in pixel format rather than *256 format?
Title: Re: Axe Q&A
Post by: Darl181 on November 07, 2011, 06:43:41 pm
Still not working :\
Code incoming, will edit...
Code: [Select]
[all FFs]→Pic1
[C0C000...]→Pic2
0→X→Y→Z
12032→S
7936→S
.center of screen, x256
-1000→Θ
.lazy way of making it create bullet in first frame :P
Repeat getKey(15)
X+(getKey(3)*256)-(getKey(2)*256)→X
X+(getKey(1)*256)-(getKey(4)*256)→Y
Pt-On(X//256,Y//256,Pic1)
If ...(bullet goes off-screen)
sqrt(abs(X-S)/256^2+(abs(Y-T)/256^2))->A
S-X//A*50->A
T-Y//A*50->B
.without the *50 it was moving really slow so yeah
S→Z
T→Θ
End
U+Z→Z
V+Θ→Θ
Pt-On(Z//256,Θ//256,Pic2)
DispGraphClrDraw
End
Title: Re: Axe Q&A
Post by: Builderboy on November 07, 2011, 06:48:26 pm
Well lets say one object is 10 pixels away from another.  So XY = (0,0) and CD = (2560,0) (since we are in x256 format).  We then start the math:

Code: [Select]
Sqrt(abs(X-C)/256^2+(abs(Y-D)/256^2))->L
Sqrt(abs(0-2560)/256^2+(abs(0-0)/256^2))->L
Sqrt(10^2 + 0^2)->L
10->L

So now we have the distance in pixels between the two objects

Code: [Select]
X-C//L->A
0-2560//L->A
-2560//10->A
-256->A

So A = -256 which is a velocity of -1 pixels per frame.  If we multiplied L by 256, we would get A as a value of -1, which is much too slow to have any precision.  Since A is operating on a position that is in x256 format, it all works out in the end.  :D
Title: Re: Axe Q&A
Post by: Darl181 on November 07, 2011, 10:16:26 pm
Ok for some reason it only shoots at 45-degree angles (not horizontal or vertical), despite having x256 precision.
I've been messing around with it a bit, and it'll still only shoot at said angles away from the target ???

EDIT:
Quote
Darl181 and 19 Guests are viewing this topic.
0.o
Title: Re: Axe Q&A
Post by: Builderboy on November 07, 2011, 10:22:30 pm
Hmm could you post the code you are using?
Title: Re: Axe Q&A
Post by: Darl181 on November 07, 2011, 10:25:50 pm
Um this time I'll just bbify it :P
Quote from: Axe
.ATT1
[FFFFFFFFFFFFFFFF]→Pic1
[C0C0000000000000]→Pic2
[6090906000000000]→Pic3
0→X→Y→Z
12032→S
7936→T
~1000→theta
Repeat getKey(15)
X+(getKey(3)*256)-(getKey(2)*256)→X
Y+(getKey(1)*256)-(getKey(4)*256)→Y
Pt-On(X//256,Y//256,Pic1)
...
rand^3-1*256+S->S
(S<<6144)*256-((S>>18432)*256)+S->S
rand^3-1*256+T->T
(T<<4096)*256-((T>>12288)*256)+T->T
Pt-On(S//256-1,T//256-1,Pic3)
...

Pt-On(46,30,Pic3)
If Z>>24320 or (Z<<0) or (theta>>16128) or (theta<<0)
√(abs(X-S)/256^2+(abs(Y-T)/256^2))→B
S-X//B→U
T-Y//B→V
X→Z
Y→theta
End
U+Z→Z
V+theta→theta
Pt-On(Z//256,theta//256,Pic2)
DispGraphClrDraw
End

Generated by the BBify'r (http://clrhome.tk/resources/bbify/ (http://clrhome.tk/resources/bbify/))
Title: Re: Axe Q&A
Post by: mrmprog on November 07, 2011, 10:52:01 pm
  In a game I am making, I have a tilemap of powerups, and then a fully variable character. How would I get the value of the tile that the character is in?
Title: Re: Axe Q&A
Post by: Builderboy on November 07, 2011, 11:01:44 pm
It's because you are using the modular expression ^ instead of the squared symbol :)

EDIT: And what do you mean the value of the tile the character is in?  Do you mean the tile in the tilemap that he is standing in?
Title: Re: Axe Q&A
Post by: Freyaday on November 07, 2011, 11:51:01 pm
Darl: Here's an Axiom jacobly wrote that does 8.8 square roots. it uses the seq( token.
 http://ourl.ca/9165/257366 (http://ourl.ca/9165/257366)
Title: Re: Axe Q&A
Post by: Darl181 on November 08, 2011, 12:15:28 am
It's because you are using the modular expression ^ instead of the squared symbol :)
/me looks at above code and attached source...
So I'm supposed to use it?  *tests*

Also since there isn't a sqrt() token, is that 2nd + x2?
I was meaning the button..

EDIT:
..it works :D/me facepalms @ self
Title: Re: Axe Q&A
Post by: Builderboy on November 08, 2011, 12:18:12 am
Yes, in the source and your code, you used the ^ symbol, which in Axe means modulus, not exponent.  You need to use the squared symbol, which is on the left side of the calc above the Log button. 
Title: Re: Axe Q&A
Post by: aeTIos on November 09, 2011, 03:21:05 am
could someone explain lambdas? Ashbads tutorial doesnt really help me.
I dont know what lambdas do, the syntax, and how to use...
Title: Re: Axe Q&A
Post by: Quigibo on November 09, 2011, 05:53:20 am
Code: [Select]
:λ(EXPR)→A
Is shorthand for:

Code: [Select]
:ʟTEMP→A
:
:Lbl TEMP
:Return EXPR

With the added convenience that you don't need to create a new label name, thus you can think of lambdas as creators of unnamed functions.  This is mainly useful when you have a high order subroutine (one that takes another subroutine as an argument) that you want to pass a simple function inline instead of having to create one somewhere far away in your code and pass the reference.

For instance here is a useful high order subroutine I thought of:

Code: [Select]
:Lbl Merge
:r₁→r₆
:L₆→A
:For(768)
: (r₆)({A},{A+L₃-L₆})→{A}+1→A
:End
:Return

This subroutine "Merge" takes only one argument: A function of 2 variables.  It then applies this function to corresponding bytes of the front and back buffers and writes the result to the front buffer.  So here are some things we can pass to it:

Code: [Select]
:Merge(λ(r₁ or r₂))    ."or" the buffers together.
:Merge(λ(r₁ xor r₂))    ."xor" the buffers together.
:Merge(λ(r₁ and r₂))    ."and" the buffers together.
:Merge(λ(not(r₁) and r₂))  .some other logic
:Merge(λ(0))         .Clear the buffer
:Merge(λ(255))       .Fill the buffer with black
:Merge(λ(r₂))         .Replace front buffer with back buffer
:Merge(λ(not(r₂)))    .Replace front buffer with the inverse of the back buffer

And so on... Notice how we were able to do all these similar functions without having to re-type a ton of code with tons of separate subroutines.  Also notice how easy this was using lambdas.  The high order function are really great for repetitive code and can be used to reduce code size with only a small overhead cost in speed.
Title: Re: Axe Q&A
Post by: epic7 on November 09, 2011, 03:05:31 pm
What would be the best way to make enemys and characters not go through walls and obstacles?
Title: Re: Axe Q&A
Post by: C0deH4cker on November 09, 2011, 03:46:42 pm
Quigbo: any reason that you did {A}+1->A instead of A++? Also, can you explain the 2nd arg of (r6)() to me: {A+L3-L6}

Nvm, figured it out. A is already pointing to L6 + the current offset, so you subtract L6 to get the offset, then add L3 to make the expression return a pointer to the offset within L3.
Title: Re: Axe Q&A
Post by: parserp on November 09, 2011, 07:22:27 pm
quick question: is {L1} a 1 or 2 bye integer?
Title: Re: Axe Q&A
Post by: Darl181 on November 09, 2011, 07:45:17 pm
{L1} is one byte.
{L1}r is two bytes.
;)
Title: Re: Axe Q&A
Post by: BlakPilar on November 09, 2011, 09:19:59 pm
I've finally taken the time to learn Axe lol. My main problem, right now, is with arrays. Can they have their dimensions modified like in BASIC? E.g. go from 10 to 15 to 7? And how do I get the length of the array?
Title: Re: Axe Q&A
Post by: Deep Toaster on November 09, 2011, 09:31:55 pm
There is currently no native support for arrays -- you have to create your own format for them.
Title: Re: Axe Q&A
Post by: BlakPilar on November 09, 2011, 10:07:43 pm
Darn... So there's no way to store the data other than the Data( command?
Title: Re: Axe Q&A
Post by: Darl181 on November 09, 2011, 10:09:07 pm
I think arrays are planned (?) but atm you have to do it yourself.
Data() is one way, you could also Fill() to a L# (or a GDB you declare beforehand) or use a for() loop and store number-for-number :D
Title: Re: Axe Q&A
Post by: BlakPilar on November 09, 2011, 10:19:47 pm
Alright :/ I'll try to work around that and see what I can do. Thanks, though.
Title: Re: Axe Q&A
Post by: mrmprog on November 09, 2011, 10:21:17 pm
It is not as hard as it seems. I finished my first thing with arrays today :) I believe the Axe docs had something to say about how to use them.
Title: Re: Axe Q&A
Post by: BlakPilar on November 09, 2011, 10:22:26 pm
I know how to use them :P lol. I just wasn't sure if their dimensions could be modified. (Like 5->dim(L1) in BASIC)
Title: Re: Axe Q&A
Post by: chattahippie on November 09, 2011, 10:23:31 pm
I know how to use them :P lol. I just wasn't sure if their dimensions could be modified. (Like 5->dim(L1) in BASIC)
If you modify them yourself (recode your array)
Title: Re: Axe Q&A
Post by: BlakPilar on November 09, 2011, 10:39:19 pm
I know how to use them :P lol. I just wasn't sure if their dimensions could be modified. (Like 5->dim(L1) in BASIC)
If you modify them yourself (recode your array)
I know, that's been answered. I'm very much against hard-coding, though, so I don't want to keep doing that. I don't really plan any major projects in Axe anyway (I'm not really into calculator programming anymore), I just had some misc. programs I was playing around with.
Title: Re: Axe Q&A
Post by: epic7 on November 10, 2011, 05:04:24 pm
How would you end the program inside a subroutine instead of it returning?
Title: Re: Axe Q&A
Post by: calcdude84se on November 10, 2011, 05:07:14 pm
I believe there is a Returnr that does that. You'll want to check, though.
Do be sure that that is necessary, though. There's not often a need to forcibly terminate a program in the middle, and it can skip rather important clean-up code. Returnr's main use ought to be a last-measure force quit, or for debugging.
Title: Re: Axe Q&A
Post by: epic7 on November 10, 2011, 06:22:58 pm
My main loop is in a subroutine, and I wanted to push clear to save and quit. I guess I might just have it return to the menu.
Title: Re: Axe Q&A
Post by: Stefan Bauwens on November 11, 2011, 08:43:08 am
Okay. I was wondering how I would have to change something in a GDB(that I use as my map) during my program is busy. For example, say I break a block or something, I will wan't to change that number in the GDB to another number so when it loads the screen it's not there anymore. Any ideas?
Title: Re: Axe Q&A
Post by: Darl181 on November 11, 2011, 12:03:48 pm
Do you have a tile that isn't anything (or is, say, floor)?
Say it's zero, and the map is 12*8 (typical 8*8-tile map) and stored row-by-row...
Spoiler For code:
.if you have number for tile instead of X,Y
.say number is N
N/12→Y
N-(Y*12)→X
.X and Y are # tiles counting from zero from the left/top edges respectively
.assuming it's 1 byte/tile
0→{Y*12+X+GDB#}
Ofc variables can be changed so they don't overwrite X and Y :P
Title: Re: Axe Q&A
Post by: C0deH4cker on November 11, 2011, 11:26:02 pm
If you want to change an array's length, then just have a variable such as L be the length, and L1 be the array. then to use the array, just do:

For(A,L1,L1+L)
.Code goes here, where {A} is your array element.
End

To add an element to the end:

L++
byte->{L1+L}

To remove an element from the end:
0->{L1+L}
L--

There are ways to add/remove elements from inside an array with the copy() command, but that's more advanced.
Title: Re: Axe Q&A
Post by: Sorunome on November 12, 2011, 07:41:25 am
How can I input a string? Sorry, I somehow don't get the input command.... :S
Title: Re: Axe Q&A
Post by: Stefan Bauwens on November 12, 2011, 11:20:37 am
Do you have a tile that isn't anything (or is, say, floor)?
Say it's zero, and the map is 12*8 (typical 8*8-tile map) and stored row-by-row...
Spoiler For code:
.if you have number for tile instead of X,Y
.say number is N
N/12→Y
N-(Y*12)→X
.X and Y are # tiles counting from zero from the left/top edges respectively
.assuming it's 1 byte/tile
0→{Y*12+X+GDB#}
Ofc variables can be changed so they don't overwrite X and Y :P
So it isn't impossible to overwrite a number at a GDB at a certain point, like this:
Code: [Select]
:[01010101010101]->GDB1
:2->{2+GDB1}
That would make that GDB1=01010201010101
Or am I mistaken?
Title: Re: Axe Q&A
Post by: aeTIos on November 12, 2011, 11:22:47 am
That is possible, but that is called 'self-modifying code' or 'writeback'. The thing is, that you cannot use it in an app. The best way is copying the map to L1 or another place in RAM.
Title: Re: Axe Q&A
Post by: Stefan Bauwens on November 12, 2011, 11:24:09 am
That is possible, but that is called 'self-modifying code' or 'writeback'. The thing is, that you cannot use it in an app. The best way is copying the map to L1 or another place in RAM.
So I copy the code to GDB 2, for example and edit that one?
Title: Re: Axe Q&A
Post by: aeTIos on November 12, 2011, 11:25:32 am
Nope, you should copy it to some place in RAM that you can edit freely, then delete it afterward (My tip: use an appvar)
Title: Re: Axe Q&A
Post by: Stefan Bauwens on November 12, 2011, 11:36:10 am
Nope, you should copy it to some place in RAM that you can edit freely, then delete it afterward (My tip: use an appvar)
Okay, thanks guys. I'll look at that. :)
Title: Re: Axe Q&A
Post by: epic7 on November 12, 2011, 05:32:44 pm
Can someone fix this?

This is for character health stuff
Code: [Select]
For(P,0,C)
If abs({P*2+L1+1}-Y)<7
If abs({P*2+L1}-X)<7
E--
End
End
End
Text(40,1,"HEALTH:")
Rect(66,2,(66+(E/2)),5)
If E<1
2->N
Return
End
Title: Re: Axe Q&A
Post by: epic7 on November 13, 2011, 11:17:31 am
Fixed it nvm
Title: Re: Axe Q&A
Post by: Hayleia on November 13, 2011, 01:25:30 pm
Wait, I saw somewhere that we could quit the program with Returnr but it crashes when I try ???. I thought it might be because of CrabCake, but I don't know. Could it be ?
Title: Re: Axe Q&A
Post by: mrmprog on November 13, 2011, 01:49:43 pm
Doesn't crabcake require you to exit in a very specific manner?
Title: Re: Axe Q&A
Post by: Hayleia on November 13, 2011, 02:16:09 pm
Doesn't crabcake require you to exit in a very specific manner?
Yes, you must go to the end of the program where you put AxesOff.
But I made a label at the end with
  Lbl FIN
  AxesOff
  Returnr

And it crashed also .__.
Title: Re: Axe Q&A
Post by: epic7 on November 13, 2011, 02:18:28 pm
What is the maximum program size? I'm at 7000 bytes now.
Title: Re: Axe Q&A
Post by: mrmprog on November 13, 2011, 02:19:49 pm
What is the maximum program size? I'm at 7000 bytes now.
I think it is 8000 of code, not including data. But I am probably wrong :P
Title: Re: Axe Q&A
Post by: Hayleia on November 13, 2011, 02:21:13 pm
Yeah, about 8100, not including data, as mrmprog said.

But you can use CrabCake or Fullrene to make larger programs.


But that doesn't answer my question :P
Title: Re: Axe Q&A
Post by: Darl181 on November 13, 2011, 07:50:47 pm
Wait, I saw somewhere that we could quit the program with Returnr but it crashes when I try ???. I thought it might be because of CrabCake, but I don't know. Could it be ?
Quote from: Axe Docs
Returnr|Emergency exits the program from within any number of nested calls.
;)

What is the maximum program size? I'm at 7000 bytes now.
It's 8150-something if you're compiling for 'No Shell', 8811 otherwise.
Title: Re: Axe Q&A
Post by: ztrumpet on November 13, 2011, 07:58:24 pm
Wait, I saw somewhere that we could quit the program with Returnr but it crashes when I try ???. I thought it might be because of CrabCake, but I don't know. Could it be ?
Quote from: Axe Docs
Returnr|Emergency exits the program from within any number of nested calls.
;)

What is the maximum program size? I'm at 7000 bytes now.
It's 8150-something if you're compiling for 'No Shell', 8811 otherwise.
I believe it is 8192, but yeah, 8811 for shelled programs.
Title: Re: Axe Q&A
Post by: epic7 on November 13, 2011, 08:17:21 pm
Oh, says it on the first post :P
Title: Re: Axe Q&A
Post by: Hayleia on November 14, 2011, 01:13:15 am
Wait, I saw somewhere that we could quit the program with Returnr but it crashes when I try ???. I thought it might be because of CrabCake, but I don't know. Could it be ?
Quote from: Axe Docs
Returnr|Emergency exits the program from within any number of nested calls.
;)
Erm, I have problems translating "from within any number of nested calls" D:
In fact, I tried Returnr in a test program, and it works, but not in Pokemon, this is why I thought it might be because of CrabCake  :-\
Title: Re: Axe Q&A
Post by: DJ Omnimaga on November 14, 2011, 04:04:11 am
Wait, I saw somewhere that we could quit the program with Returnr but it crashes when I try ???. I thought it might be because of CrabCake, but I don't know. Could it be ?
Quote from: Axe Docs
Returnr|Emergency exits the program from within any number of nested calls.
;)

What is the maximum program size? I'm at 7000 bytes now.
It's 8150-something if you're compiling for 'No Shell', 8811 otherwise.
I believe it is 8192, but yeah, 8811 for shelled programs.
Unless you use Fullrene/Crabcake, which gets rid of the limit, right?
Title: Re: Axe Q&A
Post by: Darl181 on November 14, 2011, 02:53:10 pm
[/pyramid] :P
Yes.

Returnr basically is an Emergency Exit, not quitting properly but suddenly, not doing cleanup or anything.  Think of it as a "last resort" or whatever.  Usually it's better to just use Return :)

EDIT: Iirc, for "Nested calls" think "subroutines".
Title: Re: Axe Q&A
Post by: parserp on November 14, 2011, 02:55:36 pm
Unless you use Fullrene/Crabcake, which gets rid of the limit, right?
what are those?
Title: Re: Axe Q&A
Post by: DJ Omnimaga on November 14, 2011, 03:22:12 pm
They are axioms that gets rid of the 8811/8192 KB code limit, if I remember.
Title: Re: Axe Q&A
Post by: parserp on November 14, 2011, 03:23:21 pm
They are axioms that gets rid of the 8811/8192 KB code limit, if I remember.
ooh that's cool.../me checks the ticalc files for it... :D
Title: Re: Axe Q&A
Post by: epic7 on November 14, 2011, 04:24:58 pm
If I get too high I'll try Fullrene.

Can any figure out what's wrong with this?
My game has levels and it always skips level 2. Once you start it, it automatically says you win. The unique thing about level two is that it has money requirements to win it, not enemy kill requirements.

Code: [Select]
.A is for level
If A=1
.The first argument is the money requirement
GAME(0,6,0,4,3,1
ElseIf A=2
GAME(300,0,0,4,3,1
ElseIf A=3
(goes on with different args 'till A=8)
End
.Lotsa stuff
Lbl GAME
.Lotsa stuff
For(P,0,r5)
.Lotsa stuff
If (r2<J) and (r1<G) and (r3<L)
.G is the amount of money the user has
A++
G-r1->G
1->N
.Level up and return
Return
End
DispGraph
End

Title: Re: Axe Q&A
Post by: parserp on November 15, 2011, 05:11:49 pm
lol I just had to use crabcake because my program is 10 kb XD
Title: Re: Axe Q&A
Post by: Stefan Bauwens on November 16, 2011, 10:15:33 am
I'd like to know how people make their intro screen for their game.
Is it a separate picture or is it in the program? Sorry if it sounds kinda stupid but I've not really any experience with pictures on the z80, only sprites.
I mean something like this at the beginning of my game(only the title screen):
(http://img.removedfromgame.com/imgs/spackye2_final_screenshot.gif)
Thanks in advance. :)
Title: Re: Axe Q&A
Post by: MGOS on November 16, 2011, 01:15:02 pm
You need to get the picture as TI-OS-Picture-Variable (Pic0 - Pic9).

In your Axe program file you simply write:

Code: [Select]
[Pic#]->A .this puts your TI-OS-PIC# in the ram and stores the beginning address to a.

Copy(A,L6,768) .this copies the 768 bytes to the main buffer to display the picture.
Title: Re: Axe Q&A
Post by: Stefan Bauwens on November 16, 2011, 01:17:07 pm
You need to get the picture as TI-OS-Picture-Variable (Pic0 - Pic9).

In your Axe program file you simply write:

Code: [Select]
[Pic#]->A .this puts your TI-OS-PIC# in the ram and stores the beginning address to a.

Copy(A,L6,768) .this copies the 768 bytes to the main buffer to display the picture.
Thank you. :)
Title: Re: Axe Q&A
Post by: epic7 on November 16, 2011, 08:07:56 pm
If I get too high I'll try Fullrene.

Can any figure out what's wrong with this?
My game has levels and it always skips level 2. Once you start it, it automatically says you win. The unique thing about level two is that it has money requirements to win it, not enemy kill requirements.

Code: [Select]
.A is for level
If A=1
.The first argument is the money requirement
GAME(0,6,0,4,3,1
ElseIf A=2
GAME(300,0,0,4,3,1
ElseIf A=3
(goes on with different args 'till A=8)
End
.Lotsa stuff
Lbl GAME
.Lotsa stuff
For(P,0,r5)
.Lotsa stuff
If (r2<J) and (r1<G) and (r3<L)
.G is the amount of money the user has
A++
G-r1->G
1->N
.Level up and return
Return
End
DispGraph
End

Help?
Title: Re: Axe Q&A
Post by: Happybobjr on November 16, 2011, 08:21:48 pm
that isn't much to go on....  sry
Title: Re: Axe Q&A
Post by: epic7 on November 16, 2011, 08:22:20 pm
What else would you need to see?
Title: Re: Axe Q&A
Post by: Yeong on November 16, 2011, 08:45:17 pm
the whole code.
Title: Re: Axe Q&A
Post by: epic7 on November 16, 2011, 09:30:53 pm
Ok, I'll send you the whole code.
Title: Re: Axe Q&A
Post by: Stefan Bauwens on November 17, 2011, 05:28:23 am
You need to get the picture as TI-OS-Picture-Variable (Pic0 - Pic9).

In your Axe program file you simply write:

Code: [Select]
[Pic#]->A .this puts your TI-OS-PIC# in the ram and stores the beginning address to a.

Copy(A,L6,768) .this copies the 768 bytes to the main buffer to display the picture.
Thank you. :)
I've one more question:
Do I have to make a grayscale picture on my computer and then send it with ti-connect or tilp?
Title: Re: Axe Q&A
Post by: aeTIos on November 17, 2011, 07:24:23 am
For gray, you need 2 pictures then copy the 2nd buffer to L3.
You can also create pics on your calc...
Title: Re: Axe Q&A
Post by: Yeong on November 17, 2011, 07:25:48 am
if you make greyscale picture and send it with ti-connect, it will dither(?) the picture into b/w picture.
Don't do that.
Title: Re: Axe Q&A
Post by: aeTIos on November 17, 2011, 07:34:14 am
^that. Indeed, Ti-connect dithers pics. And it does that good.
Title: Re: Axe Q&A
Post by: Stefan Bauwens on November 17, 2011, 07:34:58 am
For gray, you need 2 pictures then copy the 2nd buffer to L3.
You can also create pics on your calc...
like:
Pic1->A
Pic2->B
copy(A,L6,768)
copy(B,L3,768)
dispgraph rr

Also, how do I make like that a grayscale picture on my calc?
Title: Re: Axe Q&A
Post by: aeTIos on November 17, 2011, 07:41:55 am
That is right yep
For creating a gray pic, create some program that lets you edit both buffers at one time. (and ofcourse save the 2 pics)
Title: Re: Axe Q&A
Post by: Stefan Bauwens on November 17, 2011, 07:46:43 am
That is right yep
For creating a gray pic, create some program that lets you edit both buffers at one time. (and ofcourse save the 2 pics)
Can I have 4 level grayscale(black,white,light and dark gray) or 3(black, white, gray)?
Title: Re: Axe Q&A
Post by: aeTIos on November 17, 2011, 07:48:17 am
Both. Just your choice.
EDIT:
NB: The 2 pictures represent the buffers!
Title: Re: Axe Q&A
Post by: Stefan Bauwens on November 17, 2011, 07:52:03 am
Okay thanks, I'll check that out. Do you know if there's already a program like that made to make those pics?(I'm a bit lazy :P )
EDIT:I used Sourcecoder with a png and got this:
4-level Grayscale
Code: [Select]
PART_1:
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFC3C3DBC3C3C3C3C3DFDFFF
FFC3C3DBC3C3C3C3C3DFDFFF
FFDFDBDBDBDBDFDBDBDFDFFF
FFC3DBDBC3C7C3C7C3DFDFFF
FFC3DBDBC3C7C3C7C3DFDFFF
FFFBDBDBDBDBDFDBDBDFDFFF
FFC3C1C3DBDBC3C3DBC3C3FF
FFC3C1C3DBDBC3C3DBC3C3FF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
F007FFFFFFFFFFFFFFFFE00F
F0007FFFFFFFFFFFFFFE000F
F0001FFFFFFFFFFFFFF8000F
F0001FFFFFFFFFFFFFF8000F
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFF01151771111E089880FFF
FFF01755777577EAAAB80FFF
FFF01711771551EAAA880FFF
FFF0F755777557EAAABF0FFF
FFFFF155111511EA888FFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
F00FFFFFFC4C547FFFFFF00F
F00FFFFFFD5556FFFFFFF00F
F00FFFFFFC4D56FFFFFFF00F
F00FFFFFFD5556FFFFFFF00F
FFFFFFFFFD4C46FFFFFFFFFF
FFC01FFFFFFFFFFFFFF807FF
FF001FFFFFFFFFFFFFF801FF
F8001FFFFFFFFFFFFFF8003F
F0007FFFFFFFFFFFFFFE000F
F000FFFFFFFFFFFFFFFF000F
F003FFFFFFFFFFFFFFFFC00F
F007FFFFFFFFFFFFFFFFE00F
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF

PART_2:
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFC3C3DBC3C3C3C3C3DFDFFF
FFC3C3DBC3C3C3C3C3DFDFFF
FFDFDBDBDBDBDFDBDBDFDFFF
FFC3DBDBC3C7C3C7C3DFDFFF
FFC3DBDBC3C7C3C7C3DFDFFF
FFFBDBDBDBDBDFDBDBDFDFFF
FFC3C1C3DBDBC3C3DBC3C3FF
FFC3C1C3DBDBC3C3DBC3C3FF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
F00FFFF11115E0898FFFF00F
F00FFFF7B555EAAABFFFF00F
F00FFFF1B531EAAA8FFFF00F
F00FFFFDB55DEAAABFFFF00F
FFFFFFF1B15DEA888FFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
F0001151771111E08988000F
F0001755777577EAAAB8000F
F0001711771551EAAA88000F
F000F755777557EAAABF000F
FFFFF155111511EA888FFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFF01FFFFFFFFFFFFFF80FFF
FE001FFFFFFFFFFFFFF8007F
FFF01FFFFFFFFFFFFFF80FFF
FFF03FFFFFFFFFFFFFFC0FFF
FFF0FFFFFFFFFFFFFFFF0FFF
FFF7FFFFFFFFFFFFFFFFEFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
F00FFFFFFFFFFFFFFFFFF00F
F00FFFFFFFFFFFFFFFFFF00F
F00FFFFFFFFFFFFFFFFFF00F
F00FFFFFFFFFFFFFFFFFF00F
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
It says its for Axe, but how do I use this?
Title: Re: Axe Q&A
Post by: Darl181 on November 17, 2011, 10:29:14 am
You have to manually put brackets around each line.  For some odd reason sc doesn't do them, I'm guessing because it merges Axe and BASIC tho they're completely different.
Anyway "PART_1" is the front buffer, "PART_2" is the back.
Once you put the brackets around each line (which is easier to do on a computer btw :P) you could run it through sc again to get the 8xp to send to the calc.  On the first line store a pointer, then use a Copy() or similar to copy to L6 and/or just DispGraph from there.
Title: Re: Axe Q&A
Post by: Stefan Bauwens on November 17, 2011, 10:33:48 am
You have to manually put brackets around each line.  For some odd reason sc doesn't do them, I'm guessing because it merges Axe and BASIC tho they're completely different.
Anyway "PART_1" is the front buffer, "PART_2" is the back.
Once you put the brackets around each line (which is easier to do on a computer btw :P) you could run it through sc again to get the 8xp to send to the calc.  On the first line store a pointer, then use a Copy() or similar to copy to L6 and/or just DispGraph from there.
Okay, I see, but what should I upload again trough sourcecoder? A txt file with that in?
Title: Re: Axe Q&A
Post by: Darl181 on November 17, 2011, 10:36:15 am
Just copy/paste the text into the editing window.
(same page where is has the upload box, there's the calc icons off to the side)
Title: Re: Axe Q&A
Post by: Stefan Bauwens on November 17, 2011, 10:39:36 am
Okay thanks. :) I put dispgraph rr there in also rightaway?
Title: Re: Axe Q&A
Post by: Darl181 on November 17, 2011, 10:45:28 am
Well, you'd do it something like this:
Spoiler For kind of big:
[FFFFFFFFFFFFFFFFFFFFFFFF]→GDB6
[FFFFFFFFFFFFFFFFFFFFFFFF]
[FFFFFFFFFFFFFFFFFFFFFFFF]
[FFFFFFFFFFFFFFFFFFFFFFFF]
[FFFFFFFFFFFFFFFFFFFFFFFF]
[FFFFFFFFFFFFFFFFFFFFFFFF]
[FFFFFFFFFFFFFFFFFFFFFFFF]
.etc
.same for other buffer, just a different GDB ofc

.one way..
Copy(GDB#,L6,768)
Copy(GDB#,L3,768)
.buffer modifying stuffs, such as a selector in a menu etc
Dispgraphrr

.another way..a bit weird to modify tho
DispGraph(GDB#,GDB#)rr
.(front,back)

There's prolly more ways, those are just examples but yeah :P
Title: Re: Axe Q&A
Post by: Stefan Bauwens on November 17, 2011, 10:48:05 am
Thanks a lot. :)
I'm trying it out now.
Title: Re: Axe Q&A
Post by: epic7 on November 17, 2011, 09:33:19 pm
What does "too many blocks" mean? It took me to an else if. Does it have something to do with having 17 else ifs?
Title: Re: Axe Q&A
Post by: mrmprog on November 17, 2011, 10:28:48 pm
I believe it does mean that, yes. Are they nested?
Title: Re: Axe Q&A
Post by: Quigibo on November 18, 2011, 12:23:54 am
I think even when they're not nested they still add to the block count because the end of each elseif block needs to link to the cumulative end of the entire statement.  But generally, if you're using 17 elseif statements, you're doing something wrong and you should probobly be using some kind of lookup table.  If you really do need them though, you should use a subroutine instead because it will save you tons of bytes:

Code: [Select]
:If <S1>
:  <B1>
:ElseIf <S2>
:  <B2>
:ElseIf <S3>
:  <B3>
:...

Convert this to:

Code: [Select]
:MySub()

:Lbl MySub
:If <S1>
:  <B1>
:  Return
:End
:If <S2>
:  <B2>
:  Return
:End
:If <S3>
:  <B3>
:  Return
:End
:...
Title: Re: Axe Q&A
Post by: epic7 on November 18, 2011, 04:23:04 pm
Quigibo:

I'm not sure if I need them. There for my levels. Im sure it could be simplified. Ill go get some code.

I created a new if at the 15th elseif to make it work :P
I'll probably just change it to your way unless there's an even better way to do it.

Code: [Select]
If A=1
Text(1,16,"YOU HAVE BEEN GIVEN A GUN."
Text(1,24,"GO AND TEST IT OUT."
Text(1,32,"DESTROY 2 ENEMIES")
ElseIf A=2
Text(1,16,"BATTLE MORE."
Text(1,24,"DEFEAT 6 ENEMIES"
ElseIf A=3
Text(1,16,"THERE ARE 3 ENEMIES"
Text(1,24,"THEY ARE FAST"
ElseIf A=4
Text(1,16,"THE NEW GUN IS READY"
Text(1,24,"BUY THE WEAPON FROM THE"
Text(1,32,"UPGRADE MENU"
ElseIf A=5
Text(1,16,"THERE ARE 10 GUARDS"
Text(1,24,"DEFEAT THEM TO CONTINUE"
ElseIf A=6
Text(1,16,"THIS PLACE HAS ENEMIES THAT"
Text(1,24,"WILL BE AS FAST AS YOU."
Text(1,32,"KILL 4"
ElseIf A=7
Text(1,16,"NOW, BUY THE NEXT WEAPON"
Text(1,24,"FROM THE UPGRADE MENU"
ElseIf A=8
Text(1,16,"GOOD. YOU NOW MUST KILL"
Text(1,24,"10 ENEMIES"
ElseIf A=9
Text(1,16,"UPGRADE MORE."
Text(1,24,"GET THE NEXT GUN"
ElseIf A=10
Text(1,16,"DEFEAT 10 FASTER ENEMIES"
Text(1,24,"USING YOUR NEW WEAPON."
ElseIf A=11
Text(1,16,"DEFEAT 5 MORE ENEMIES"
Text(1,24,"TO CONTINUE"
ElseIf A=12
Text(1,16,"GET THE NEXT GUN"
Text(1,24,"FROM THE UPGRADE MENU"
ElseIf A=13
Text(1,16,"DEFEAT 10 FAST ENEMIES"
Text(1,24,"THEY WILL BE AS FAST AS YOU"
ElseIf A=14
Text(1,16,"DEFEAT 5 MORE ENEMIES"
Text(1,24,"THEY'RE REALLY FAST"
End
If A=15
Text(1,16,"GET THE LAST"
Text(1,24,"FROM THE UPGRADE MENU!"
ElseIf A=16
Text(1,16,"NOW ITS NIGHT TIME."
Text(1,24,"KILL 20 ENEMIES!"
ElseIf A=17
Text(1,16,"MIDNIGHT:"
Text(1,24,"KILL EVERYTHING. ALL 35"
Text(1,32,"THEY ARE SUPER FAST"
End
Text(1,56,"Push On"
Repeat getKey(41)
If getKey(15)
Goto C
End
End
Fix 5
If A=1
GAME(0,2,0,4,3,1
ElseIf A=2
GAME(0,6,0,4,3,1
ElseIf A=3
GAME(0,3,0,4,1,1
ElseIf A=4
GAME(0,0,1,4,3,1
ElseIf A=5
GAME(0,10,1,3,3,1
ElseIf A=6
GAME(0,4,1,1,3,1
ElseIf A=7
GAME(0,0,2,3,3,1
ElseIf A=8
GAME(0,10,2,3,3,1
ElseIf A=9
GAME(0,0,3,3,3,1
ElseIf A=10
GAME(10,0,3,1,3,1
ElseIf A=11
GAME(5,0,3,2,3,1
ElseIf A=12
GAME(0,0,4,2,3,1
ElseIf A=13
GAME(10,0,4,1,3,1
ElseIf A=14
GAME(7,0,4,1,3,2
End
If A=15
GAME(0,0,5,1,3,1
ElseIf A=16
GAME(20,0,5,1,3,2
ElseIf A=17
GAME(35,0,5,1,3,3
Title: Re: Axe Q&A
Post by: Stefan Bauwens on November 18, 2011, 04:27:35 pm
I am making an axe game(http://ourl.ca/140510) and as you can see the grayscale isn't anymore so pretty when I move left/right. The screenshot doesn't show it so well.
Anyway, aeTIos said I should use interrupts. But I have no idea what it is and how to use it. So maybe someone could help me
Thanks in advance. :)
Title: Re: Axe Q&A
Post by: leafy on November 18, 2011, 04:32:41 pm
I have a bit of a problem. So I have a bunch of string pointers stored to Str1, and I'm trying to run the following code:

Text(r1,r2)
Text {W-1*2+Str1}{r}

But it works a few times, then ends up crashing. I've isolated the problem to this segment of code, so if someone could tell me why it's crashing that would be appreciated ^^ It seems to have worked all the other times I've done this.

Also is Text(x,y):Text "Strings" smaller than Text(x,y,"Strings")?

EDIT: It doesn't exactly crash, but it makes the calc turn off and quits the program.
Title: Re: Axe Q&A
Post by: Darl181 on November 20, 2011, 12:54:20 am
Am I doing this right?
"appvBLARG"→Str1
GetCalc(Str1,123)→oVAR
255→oVAR
!If oVAR-255
.if equal to 255
Disp "Yay"
Else
Disp "Noes"
End
Title: Re: Axe Q&A
Post by: leafy on November 20, 2011, 01:56:38 am
Am I doing this right?
"appvBLARG"→Str1
GetCalc(Str1,123)→oVAR
255→oVAR
!If oVAR-255
.if equal to 255
Disp "Yay"
Else
Disp "Noes"
End


I thought it would be more like

"appvBLARG"→Str1
GetCalc(Str1,123)→oVAR
255→{oVAR}
!If {oVAR}-255
Disp "Yay"
Else
Disp "Noes"
End


Since you treat appvars like areas of free RAM. I'm not certain though.
Title: Re: Axe Q&A
Post by: macweirdo on November 20, 2011, 09:42:08 am
So, say a certain person tried to make a program on their calculator in Axe, but when they made the main loop, they failed at the GetKey= statement and can't quit their program.

What should I, I mean they, do?
Title: Re: Axe Q&A
Post by: JosJuice on November 20, 2011, 10:13:45 am
So, say a certain person tried to make a program on their calculator in Axe, but when they made the main loop, they failed at the GetKey= statement and can't quit their program.

What should I, I mean they, do?
If a program cannot be exited by normal means, the best way to cancel it is to pull a battery. RAM will be cleared, but nothing else will be damaged.
Title: Re: Axe Q&A
Post by: macweirdo on November 20, 2011, 10:21:49 am
But... RAM clear?  :(

I guess that's ok except for the fact that it's effin' impossible to get anything onto a TI-Nspire via Win7 and I'll have to wait another 82 trillion years to put Axe back on.

EDIT: HAHANO, Axe is in archive 'cause it's an app! [/noob]
Title: Re: Axe Q&A
Post by: Deep Toaster on November 20, 2011, 12:50:04 pm
Also is Text(x,y):Text "Strings" smaller than Text(x,y,"Strings")?
Nope, but Text(Y*256+X):Text "Strings" is, if Y and X are constants.
So, say a certain person tried to make a program on their calculator in Axe, but when they made the main loop, they failed at the GetKey= statement and can't quit their program.
Make sure your getKey values are Axe keycodes, not BASIC keycodes: http://www.omnimaga.org/index.php?action=ezportal;sa=page;p=21
Title: Re: Axe Q&A
Post by: macweirdo on November 20, 2011, 03:15:04 pm
So, say a certain person tried to make a program on their calculator in Axe, but when they made the main loop, they failed at the GetKey= statement and can't quit their program.
Make sure your getKey values are Axe keycodes, not BASIC keycodes: http://www.omnimaga.org/index.php?action=ezportal;sa=page;p=21

Yeah, I used the Getkey^r keycodes, because I made a GETKEY program that way, and didn't notice that the Getkey^r keys are different from the GetCSC keycodes. Whoops :p

EDIT: fail quotes, that's what I get for not using Preview.
Title: Re: Axe Q&A
Post by: epic7 on November 20, 2011, 04:38:23 pm
Why is this not stickied anymore?
Title: Re: Axe Q&A
Post by: macweirdo on November 20, 2011, 04:42:46 pm
Why is this not stickied anymore?

I have no clue, but it became unstickied recently (like as of today or yesterday.)
Title: Re: Axe Q&A
Post by: ztrumpet on November 20, 2011, 05:00:47 pm
Someone must have accidently unstickied it; it only takes one erroneous click from a CoT or Admin to do so.
It's sticked again now.  Thanks for bringing the issue up.
Title: Re: Axe Q&A
Post by: Darl181 on November 20, 2011, 05:36:57 pm
Spoiler For quote:
Am I doing this right?
"appvBLARG"→Str1
GetCalc(Str1,123)→oVAR
255→oVAR
!If oVAR-255
.if equal to 255
Disp "Yay"
Else
Disp "Noes"
End


I thought it would be more like

"appvBLARG"→Str1
GetCalc(Str1,123)→oVAR
255→{oVAR}
!If {oVAR}-255
Disp "Yay"
Else
Disp "Noes"
End


Since you treat appvars like areas of free RAM. I'm not certain though.
Leafiness has it right.  However it's still giving me problems:
GetCalc(Str1,12)→oPTR
...throws ERR:INVALID TOKEN at compile time and points to the o.

Is there a way to make a custom-named variable point to an appv, prgm, etc?  Or is it basically a static pointer a la Str# or Pic#?
Title: Re: Axe Q&A
Post by: calc84maniac on November 20, 2011, 09:40:05 pm
You should only use the degree symbol when defining the location of that variable, e.g. L1+2→°PTR. Your code should actually be GetCalc(Str1,12)→PTR.
Title: Re: Axe Q&A
Post by: Darl181 on November 20, 2011, 09:46:31 pm
so the oPTR is the physical location of it, just plain PTR references the contents?
Title: Re: Axe Q&A
Post by: calc84maniac on November 20, 2011, 09:59:03 pm
so the oPTR is the physical location of it, just plain PTR references the contents?
That is correct.
Title: Re: Axe Q&A
Post by: collechess on November 21, 2011, 08:22:22 pm
How much space does

Code: [Select]
[181842424242423C]->GDB0
[01]
Str00
Str10

take?
The Str00 points to an 8 character long string, the Str10 to a 20 chararacter long string.
Title: Re: Axe Q&A
Post by: Stefan Bauwens on November 22, 2011, 06:01:06 am
I'm trying to find how to put two 'things' together. Like:
Code: [Select]
:5->A
:text(25,25,0 and A>Dec)
I want "05" printed. What must I do, if this is possible?
Thanks in advance.
Title: Re: Axe Q&A
Post by: FinaleTI on November 22, 2011, 06:04:22 am
I'm trying to find how to put two 'things' together. Like:
Code: [Select]
:5->A
:text(25,25,0 and A>Dec)
I want "05" printed. What must I do, if this is possible?
Thanks in advance.
You could try this:
Code: [Select]
Text(25,25,'0','0'+A)
It only works for single digit numbers, though.
Title: Re: Axe Q&A
Post by: epic7 on November 22, 2011, 06:45:40 am
Really? I got it to work with multidigit numbers
Using:

Text(25,25,"0",A->Dec

Also a somewhat relating question, how would you put together 2 strings and store it into a new string?
Title: Re: Axe Q&A
Post by: Stefan Bauwens on November 22, 2011, 08:50:44 am
Really? I got it to work with multidigit numbers
Using:

Text(25,25,"0",A->Dec

Also a somewhat relating question, how would you put together 2 strings and store it into a new string?
Thanks that works. I just would wanna know if i could save "05" to something. Like this:
"0",A>Dec->B
Title: Re: Axe Q&A
Post by: mrmprog on November 22, 2011, 01:48:48 pm
This comes from an IRC discussion.
Code: [Select]
:[0000000000000000....]->GDB1
:For(A,0,8)
:rand^10->{GDB1+A}
:End
Title: Re: Axe Q&A
Post by: Stefan Bauwens on November 22, 2011, 01:53:43 pm
You're my savior man. I'll try it soon. :D

EDIT: Works brilliant. :D
Title: Re: Axe Q&A
Post by: Darl181 on November 22, 2011, 10:05:13 pm
If the first two arguments of Copy() are the same, will there be any adverse effects?
Title: Re: Axe Q&A
Post by: epic7 on November 22, 2011, 10:06:42 pm
Wouldnt make sense to have any :P
Title: Re: Axe Q&A
Post by: Darl181 on November 22, 2011, 10:09:38 pm
Wouldnt make sense to have any :P
..unless it's a line of code with variable inputs, set up in a way that might have it happen. ;)
Title: Re: Axe Q&A
Post by: mrmprog on November 22, 2011, 10:11:13 pm
Wouldnt make sense to have any :P
..unless it's part of a line of code with variable inputs, set up in a way that might have it happen.
Exactly. I may use something like that myself. So will that copy itself to itself?
Title: Re: Axe Q&A
Post by: epic7 on November 22, 2011, 10:12:37 pm
Why would you want to store its self to its self when it is already its self.
Title: Re: Axe Q&A
Post by: calcdude84se on November 22, 2011, 10:16:18 pm
Indeed, nothing bad would happen. It would take just as long as otherwise, and do nothing.
One thing to be aware of, however, if you are copying to/from a variable location, is to deal with overlap properly.
For example, it should be easy to see that this code will not shift 100 bytes, but will copy one byte 100 times:
Copy(L1,L1+1,100)
Title: Re: Axe Q&A
Post by: Darl181 on November 22, 2011, 10:25:04 pm
Right, the end result is just similar. :)
Good to know, I'm optimizing stuff in Essence...can't be too careful :P
Title: Re: Axe Q&A
Post by: Builderboy on November 22, 2011, 10:35:06 pm
It's not always the same though.  If you Copy(L1,L1+1,100), it will first copy L1 into L1+1, and then L1+1 into L1+2, effectively filling L1 to L1+100 with the first element, instead of shifting. 
Title: Re: Axe Q&A
Post by: leafy on November 22, 2011, 10:35:49 pm
It's not always the same though.  If you Copy(L1,L1+1,100), it will first copy L1 into L1+1, and then L1+1 into L1+2, effectively filling L1 to L1+100 with the first element, instead of shifting. 
To fix:
Copy(L1+98,L1+99,100){r}
(I think)
Title: Re: Axe Q&A
Post by: Deep Toaster on November 22, 2011, 10:55:02 pm
It's not always the same though.  If you Copy(L1,L1+1,100), it will first copy L1 into L1+1, and then L1+1 into L1+2, effectively filling L1 to L1+100 with the first element, instead of shifting. 
To fix:
Copy(L1+98,L1+99,100){r}
(I think)
You mean Copy(L1+99,L1+100,100) :)
Title: Re: Axe Q&A
Post by: epic7 on November 22, 2011, 11:38:36 pm
To be sure of my understanding of Copy(, is
Copy(L1,L2,10)
the same as
For(A,0,9)
{L1+A}->{L2+A}
End
Title: Re: Axe Q&A
Post by: Deep Toaster on November 22, 2011, 11:49:54 pm
That's right. But the same thing happens when you use a For() loop—look at this.

As you said, this:
Quote from: Axe
Copy(L1,L1+1,10)
does essentially the same as this:
Quote from: Axe
For(A,0,9)
{A+L1}→{A+L1+1}
End
But if you take it step by step, it's really doing this:
Quote from: Axe
{L1}→{L1+1}
{L1+1}→{L1+2}
{L1+2}→{L1+3}
{L1+3}→{L1+4}
{L1+4}→{L1+5}
{L1+5}→{L1+6}
{L1+6}→{L1+7}
{L1+7}→{L1+8}
{L1+8}→{L1+9}
{L1+9}→{L1+10}
See the problem? You're copying the first byte to the second, then the second byte to the third, and so on, so in the end you're just copying the first byte to every byte after it for ten bytes. It would be doing the same as this:
Quote from: Axe
Fill(L1,10)
which isn't what we're trying to do.

If you want to just shift the whole block to the right a few bytes, you start at the end and use Copy()r. Just thought I'd make that a bit more clear :)
Title: Re: Axe Q&A
Post by: Darl181 on November 23, 2011, 12:01:26 pm
When an appvar or program is created with GetCalc(), is it necessarily filled with anything?  Or is it just whatever random stuff happens to be in that chunk of memory?
Title: Re: Axe Q&A
Post by: aeTIos on November 23, 2011, 07:53:48 pm
I always want to know that too.
Title: Re: Axe Q&A
Post by: Builderboy on November 23, 2011, 08:00:37 pm
I believe it's just filled with random junk XD
Title: Re: Axe Q&A
Post by: aeTIos on November 23, 2011, 08:22:08 pm
aww. How to fill it with zeros?
Title: Re: Axe Q&A
Post by: Builderboy on November 23, 2011, 08:48:59 pm
Use the Fill() function ;)
Title: Re: Axe Q&A
Post by: aeTIos on November 23, 2011, 08:54:02 pm
:headbang:
Forgot. I always missed zeros()
Title: Re: Axe Q&A
Post by: Builderboy on November 23, 2011, 08:56:34 pm
Zeros() is not what you want, because that will insert more empty memory into your own program, you want to use the Fill() function.
Title: Re: Axe Q&A
Post by: aeTIos on November 23, 2011, 09:01:17 pm
You are right. Eh, the syntax is fill(number, string/gdb/pic/w-e)?
Title: Re: Axe Q&A
Post by: Builderboy on November 23, 2011, 09:08:17 pm
It is all in the documentation if you want to check it out, it has lots of useful info.  The syntax is Fill(Pointer, Length) which takes the value at Pointer and extends it for Length bytes.
Title: Re: Axe Q&A
Post by: aeTIos on November 23, 2011, 09:11:06 pm
Thank you!
Title: Re: Axe Q&A
Post by: Wellen on November 24, 2011, 10:20:40 am
Can we use recursion ?
I mean, something like that :
Code: [Select]
Lbl AXE
//
code
//
If something
sub(AXE
End
Return

Another question :
in this code :
Code: [Select]
Repeat
//
code
//
If something
Goto A
End
End
Is the Goto waiting for an 'End' token as it does with Ti-Basic ?

Edit : is there a problem with the line numbering ? If I add an empty line, it's fine though (see above ;))
Title: Re: Axe Q&A
Post by: calcdude84se on November 24, 2011, 10:28:38 am
Can we use recursion ?
Yes you can. Just don't nest too many levels. Additionally, to preserve the old values of r1 to r6, which might otherwise get changed, you can use such as sub(LBL,1,2,3)r (That is, append a r)
Quote
Is the Goto waiting for an 'End' token as it does with Ti-Basic ?
You don't need an End after a Goto in TI-BASIC.
Title: Re: Axe Q&A
Post by: Hayleia on November 24, 2011, 12:42:45 pm
I have a very strange question.
Can someone give me a code to make a RAM Clear ?
Title: Re: Axe Q&A
Post by: Yeong on November 24, 2011, 12:44:56 pm
Asm(EFFC80
Title: Re: Axe Q&A
Post by: calcdude84se on November 24, 2011, 12:46:16 pm
Or just Asm(C7 ;)
Title: Re: Axe Q&A
Post by: Hayleia on November 24, 2011, 12:47:40 pm
Thanks both of you ^^
(previous message deleted to not increase my post count for nothing)
Title: Re: Axe Q&A
Post by: Wellen on November 24, 2011, 01:36:54 pm
Code: [Select]
Repeat
//
code
//
If something
Goto A
End
End
Is the Goto waiting for an 'End' token as it does with Ti-Basic ? when used in an if statement, or a loop..

Edit : is there a problem with the line numbering ? If I add an empty line, it's fine though (see above ;))
Quote
Is the Goto waiting for an 'End' token as it does with Ti-Basic ?
You don't need an End after a Goto in TI-BASIC.

I meant in that code (above) especially : the Goto is after an If token : you have an If statement, you go through the Goto, and the End of the If statement isn't reached
Do you understand what I'm trying to say ? :)
Title: Re: Axe Q&A
Post by: calcdude84se on November 24, 2011, 01:39:18 pm
If that code is Axe, then you do need the End to end the If statement. I'm probably just not entirely understanding what you're saying.
Title: Re: Axe Q&A
Post by: Hayleia on November 24, 2011, 01:46:04 pm
He meant that the calculator hit a "If" before the "Goto" and so, after going to label A, the calculator is waiting for the "End" of the initial "If". Did I understand right ?
If so, no, the calculator doesn't wait for an End (at least I never needed to put an End when doing so in my progs :P)
Title: Re: Axe Q&A
Post by: Wellen on November 24, 2011, 01:51:58 pm
He meant that the calculator hit a "If" before the "Goto" and so, after going to label A, the calculator is waiting for the "End" of the initial "If". Did I understand right ?
Yes, that's what it does in Ti-Basic, and I was wondering if it was the same in Axe.
Thank you for translating :D
Title: Re: Axe Q&A
Post by: calcdude84se on November 24, 2011, 01:57:06 pm
Ah. That's only the case if it's an If-Then, and it's to make up for the imperfections of the parser. For Axe, there's no need.
Title: Re: Axe Q&A
Post by: Wellen on November 24, 2011, 02:04:39 pm
OK, that's what I wanted to know :D

Thank you !
Title: Re: Axe Q&A
Post by: aeTIos on November 25, 2011, 06:43:35 am
Hayleia: pretty much every random hex code gives a ram clear.
Title: Re: Axe Q&A
Post by: parserp on November 25, 2011, 02:09:10 pm
is there something out there that makes it easier to scroll through source code? eg: goto the last line (or middle line) of code, rather than scrolling
Title: Re: Axe Q&A
Post by: annoyingcalc on November 25, 2011, 02:11:18 pm
is there something out there that makes it easier to scroll through source code? eg: goto the last line (or middle line) of code, rather than scrolling
http://ourl.ca/113185 scroll down to deep thoughts post
Title: Re: Axe Q&A
Post by: parserp on November 25, 2011, 02:12:06 pm
is there something out there that makes it easier to scroll through source code? eg: goto the last line (or middle line) of code, rather than scrolling
http://ourl.ca/113185 scroll down to deep thoughts post
Yay!!!! :D
Title: Re: Axe Q&A
Post by: Deep Toaster on November 25, 2011, 02:16:03 pm
Hayleia: pretty much every random hex code gives a ram clear.
Pretty much every random hex code will not cause a RAM clear. The only reason it works in TI-BASIC with AsmPrgm is because those programs never quit.
Title: Re: Axe Q&A
Post by: aeTIos on November 25, 2011, 02:20:38 pm
You are right   :-\
Title: Re: Axe Q&A
Post by: Hayleia on November 25, 2011, 02:22:12 pm
is there something out there that makes it easier to scroll through source code? eg: goto the last line (or middle line) of code, rather than scrolling
Also, if you use a 83+SE or 84+ or 84+SE or 84 pocket.fr (but not a 83+), you can install zStart and (among other amazing things) you will be able to jump to any label in your code by pressing On+Vars in the editor.
Title: Re: Axe Q&A
Post by: epic7 on November 25, 2011, 03:12:30 pm
DANG YOU 83+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Spoiler For Spoiler:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Title: Re: Axe Q&A
Post by: mrmprog on November 26, 2011, 12:58:25 pm
Which of these is faster?
Code: [Select]
:C>0+C->C
or
Code: [Select]
:If C>0
:C++
:End
Basically it comes down to an If statement, versus an expression evaluated each time.
Title: Re: Axe Q&A
Post by: AngelFish on November 26, 2011, 01:44:54 pm


I suspect that you don't really need to test if it's positive, in which case !if c would be the fastest way. Otherwise, the second one is fastest.



Title: Re: Axe Q&A
Post by: Stefan Bauwens on November 26, 2011, 03:48:08 pm
Hey guys. How do I make a white 4x8 sprite in Axe? So that if I display it on a black background(pt-off) it doesn't draw a white 8x8?
I heard something of a masked sprite, but I don't know what that is.
Thanks in advance> :)
Title: Re: Axe Q&A
Post by: leafy on November 26, 2011, 03:49:36 pm
So you'll want to create a greyscale sprite like this:

Black is where you want black
light grey is where you want white
dark grey is where you want grey
white is where you want transparency

and just Pt-Mask (under plot for some reason) with the usual arguments.
Title: Re: Axe Q&A
Post by: chattahippie on November 26, 2011, 05:06:23 pm
Which of these is faster?
Code: [Select]
:C>0+C->C
or
Code: [Select]
:If C>0
:C++
:End
Basically it comes down to an If statement, versus an expression evaluated each time.

If you are using negative numbers, use the >> operation.  If you just use >, every number except 0 will execute the code
Title: Re: Axe Q&A
Post by: Darl181 on November 26, 2011, 05:29:24 pm
Is there a faster way to xor two buffers together than with a For() loop?
Title: Re: Axe Q&A
Post by: mrmprog on November 26, 2011, 05:55:17 pm
Is there a way to draw a sprite directly to the screen?
Title: Re: Axe Q&A
Post by: Builderboy on November 26, 2011, 06:37:33 pm
Is there a faster way to xor two buffers together than with a For() loop?
No I don't believe so

Is there a way to draw a sprite directly to the screen?
Not in Axe at any rate.  One could write an axiom for it maybe, why do you want to draw a sprite to the screen only?
Title: Re: Axe Q&A
Post by: mrmprog on November 26, 2011, 07:13:00 pm
So I don't have to worry about platforms and such being erased. On the same idea, how do I draw mono "transparent" sprites?
Title: Re: Axe Q&A
Post by: Freyaday on November 27, 2011, 12:45:13 am
So I don't have to worry about platforms and such being erased. On the same idea, how do I draw mono "transparent" sprites?
I believe the command you're looking for is Pt-Mask()r
Title: Re: Axe Q&A
Post by: Stefan Bauwens on November 27, 2011, 05:41:48 am
So you'll want to create a greyscale sprite like this:

Black is where you want black
light grey is where you want white
dark grey is where you want grey
white is where you want transparency

and just Pt-Mask (under plot for some reason) with the usual arguments.
Thanks. So I must just use it like this? :
pt-mask(x,y,pic1)r(or no r?)
Title: Re: Axe Q&A
Post by: Darl181 on November 27, 2011, 11:31:24 am
I'm pretty sure it's like that, just have the second line of hex under/part of the first one.

...
Ok, I was optimizing last night and wrote down a bunch of Q's as I went.

Do the ?/?? conditionals save space in the executable in relation to conventional If loops?  How about speed?

Can they be nested?  like B?(A++5?-1→A),→A works, nvm that

Which is faster: If (commonly true) / If (sparsely true) ?

So it's optimized to put the constants at the end...what if it's like L2+2?  Would a different order influence anything?
Title: Re: Axe Q&A
Post by: parserp on November 27, 2011, 05:56:58 pm
AH!!!!!
so, swords is almost done, and the executable is 17000 bytes. I just tried compiling it into an app, but I got an Err: Memory D:
is there any way to get around this?
Title: Re: Axe Q&A
Post by: calc84maniac on November 27, 2011, 06:01:41 pm
One-page app capacity (minus the header and signature) is 16160 bytes. I guess you could either do some hardcore optimization or put some data in an external appvar.
Title: Re: Axe Q&A
Post by: parserp on November 27, 2011, 06:03:06 pm
One-page app capacity (minus the header and signature) is 16160 bytes. I guess you could either do some hardcore optimization or put some data in an external appvar.
ok then, I'll do that. :)
Title: Re: Axe Q&A
Post by: saintrunner on November 27, 2011, 06:24:35 pm
How do I put parts of a code as an appvar?
Title: Re: Axe Q&A
Post by: jacobly on November 27, 2011, 06:43:42 pm
I'm pretty sure it's like that, just have the second line of hex under/part of the first one.

...
Ok, I was optimizing last night and wrote down a bunch of Q's as I went.

Do the ?/?? conditionals save space in the executable in relation to conventional If loops?  How about speed?

Can they be nested?  like B?(A++5?-1→A),→A works, nvm that

Which is faster: If (commonly true) / If (sparsely true) ?

So it's optimized to put the constants at the end...what if it's like L2+2?  Would a different order influence anything?

1. ? and ?? are just convenience notation, so they are probably the same as If statements.
2. The speed of an If statement depends on what conditionals you use. However, for If / Else statements, the Else is generally faster due to one fewer jump. This is why I generally put the commonly true branch in the else part.
3. L₂+2 and 2+L₂ both optimize to 35388 :)
Title: Re: Axe Q&A
Post by: parserp on November 27, 2011, 06:47:38 pm
How do I put parts of a code as an appvar?
lol I was just about to ask that, I need it for some optimizations :D
does anyone have an answer?
Title: Re: Axe Q&A
Post by: Darl181 on November 27, 2011, 07:01:56 pm
If you mean something like external levels, you could create a new appvar then copy to it.
Say you have the stuff to be stored to the appvar in L1:
"appvNAME"→Str1
GetCalc(Str1,768)→P
Copy(L1,P,768)

and now you have an external appvar that has the contents of whatever was in L1 :)
Title: Re: Axe Q&A
Post by: mrmprog on November 27, 2011, 07:12:02 pm
How do I put parts of a code as an appvar?
Do you mean "run" code in an appv?
Title: Re: Axe Q&A
Post by: Builderboy on November 27, 2011, 07:12:11 pm
How do I put parts of a code as an appvar?

This is extremely difficult to get working, because of the way assembly works.  Assembly code only works at a specific location, if it is moved to anywhere else in memory, it will cause horrible crashes.  The issue with running code in an appvar, is that you need to copy that code to $959D, which is where your current program is!  It becomes a bit easier if your current program is an appvar, but even then it requires custom asm and Bcall knowledge.  I am not an expert on getting it to work, so I can't provide the details.  So the most I can say is try to fit all your code in 1 program, and use a program like Fullrene or Crabcake to surpass the execution limits. 
Title: Re: Axe Q&A
Post by: saintrunner on November 27, 2011, 07:17:40 pm
ok so what I meant was, How do I save a level in one of my games as an appvar, and how do I get it into my games main program later? In Axe?

but I figured it out
Title: Re: Axe Q&A
Post by: epic7 on November 27, 2011, 09:05:47 pm
Problem that's had me stuck for a few days:

I honestly cant find what's wrong with it D:

The beginning part that works.
Spoiler For Spoiler:
Code: (beginning) [Select]
:.AAHOOK
:DiagnosticOff
:[1028103854382828]➔Pic1
:[102A123C50B82828]
:[FFFFFFFFFFFFFFFF]➔Pic2
:1➔R−1➔H➔Q➔B➔P
:256➔X
:12288➔Y
:Fix 5
:Repeat getKey(15)
:ClrDraw
:If X∕256<<1
:256➔X
:End
:If X∕256>88
:22528➔X
:End
:If (H=0) or (H=1)
:If getKey(3)
:X+256➔X
:1➔R
:End
:If getKey(2)
:X−256➔X
:0➔R
:End
:End
:If H>40
:If getKey(2)
:0➔R
:End
:If getKey(3)
:1➔R
:End
:End
:For(A,0,11)
:Pt-On(A∗8,1,Pic2
:Pt-On(A∗8,56,Pic2)
:End
Where it starts to not work
Code: [Select]
:If (getKey(54))∗((H=0)+(H>40))∗(B=0) ;works
:If Y∕256=48 ;works
:1➔H
:Else
:2➔H
:End
:End
:If H=1 ;works
:Y−256➔Y
:If Y∕256=26
:2➔H
:End
:End
:If H=2
:X∕256➔S
:Y∕256➔T
:R➔θ
:Repeat pxl-Test(S,T) ;all this works
:T++
:If θ
:S++
:Else
:S−−
:End
:End
:If H>1
:If H≤40
:1➔P ;works
:Line(X∕256+7,Y∕256,S,T) ;this flashes on, but just once, so doesn't work much
:Else
:0➔P
:End
:If H<15
:Y+256➔Y ;doesnt work
:If θ
:X+256➔X ;but this does (1 time)
:Else
:X−256➔X
:End
:H++ ;i think this only works once.
:If Y∕256=48
:0➔H➔P➔S➔T
:10➔B
:End
:End
I cant tell if this part works or not.
Spoiler For Spoiler:
Code: [Select]
:If H≥15 and (H≤25)
:If H<21
:Y+(256−((H−15)∗25))➔Y
:Else
:Y−((H−15)∗25)➔Y
:End
:H++
:End
:If H≥25 and (H≤40)
:If θ
:X+256➔X
:Else
:X−256➔X
:End
:Y−256➔Y
:If Y∕256<9
:56➔H
:0➔P
:End
:H++
:End
:!If H≤40
:If H≤50
:H++
:If θ
:X+(384−(H−40)∗10)➔X
:Else
:X−(384+(H−40)∗10)➔X
:End
:If Y∕256<9
:56➔H
:0➔P
:End
:Y−−
:ElseIf (H≥50)∗(H≤60)
:H++
:If H<56
:Y+(256−((H−50)∗25))➔Y
:Else
:Y−((H−50)∗25)➔Y
:End
:End
:If θ
:X+256➔X
:Else
:X−256➔X
:End
:End
:If H>55
:If Y∕256<48
:Y+256➔Y
:If θ
:X+256➔X
:Else
:X−256➔X
:End
:Else
:0➔H➔S➔T
:End
:End
:End
:End
Code: [Select]
Then just
:Pt-On(X∕256,Y∕256,P∗8+Pic1)
:If B
:B−−
:End
:DispGraph
:End
(which works)
Title: Re: Axe Q&A
Post by: Builderboy on November 27, 2011, 09:09:05 pm
It would help a lot if you told us what wasn't working.  Throwing a whole bunch of code into a post and asking us what is wrong is not going to help much D:
Title: Re: Axe Q&A
Post by: epic7 on November 27, 2011, 09:14:29 pm
Good idea :P

In the middle section, the guy jumps into the air and freezes. I believe that H gets stuck at 3 even though I have an H++.
At the line,
:1➔P ;works
:Line(X∕256+7,Y∕256,S,T) ;but this only flashes on for 1 frame!

The guy is supposed to move, here
By the time it gets here, H is succesfuly at 2, so it works
(If H>1 is also here)

:If H<15
:Y+256➔Y ;doesnt work
:If θ
:X+256➔X ;but this does, but only 1 time for some reason
:Else
:X−256➔X
:End
:H++ ;This H++ only works once, to get H to 3. Its supposed to take it up to 15, though.
:If Y∕256=48 ;This is if the guy hits the ground early, but not really important right now.
:0➔H➔P➔S➔T
:10➔B
:End
:End

Afterwards, there is

:If H≥15 and (H≤25)

But I obviously cant get that to work since H gets stuck at 3 :/
I don't know if there is something preventing it from changing
Title: Re: Axe Q&A
Post by: mrmprog on November 27, 2011, 09:54:01 pm
You may have already tried this, but whenever I get stuck like that, I just slow down the main loop a ton, and then have it display the value of the var in question. Can I see a full download of the source?
Title: Re: Axe Q&A
Post by: epic7 on November 27, 2011, 10:09:25 pm
I tried exactly that ;)

I can't get to a computer right now, so I'll have to upload the calc file Tommorow. However, the full code is posted above.
Title: Re: Axe Q&A
Post by: Stefan Bauwens on November 29, 2011, 05:43:34 am
In my game I added interrupts.
I put 'it' to 6(slowest speed 118 times a second).
My interrupt label is this:
Code: [Select]
lbl m
text(doesnt matter)
dispgraphrr
But this way the grayscale is very pretty but my games goes insanely slow. Am I doing something wrong?
Title: Re: Axe Q&A
Post by: aeTIos on November 29, 2011, 08:49:53 am
Try removing your text?
Title: Re: Axe Q&A
Post by: Stefan Bauwens on November 29, 2011, 09:00:15 am
Nope :(
It helps a bit i think but moving left and right is really slow and I think it's because it has to draw a part of the map then.
Title: Re: Axe Q&A
Post by: parserp on November 29, 2011, 07:34:42 pm
random question: Is it possible to make shells in axe? how would you see if programs should be put in it, such as MirageOS? (top line of code is :: )
Title: Re: Axe Q&A
Post by: parserp on November 29, 2011, 09:07:01 pm
Sorry for doublepost, but this is urgent.
(yes I know I'm not sposed to be on right now :P)
anyway, an axe math equation is screwing up.
Note: the appvar for all my levels is stored in Y0, and they are all stored in there one after the other. (eg. Lvl1 is bytes 0-768, Lvl2 is bytes 769-1536, and so on)
Code: [Select]
:.M is the level # you are on
:If M
:0->T+768->U
:Else
:(((M-1)768)+1)->T+767->U //<------this is the only part screwing up. U gets stored fine (I think), but T is being weird.
:End
:0->C
:For(r6,T,U
:{Y0+r6}->{L3+C}
:C++
:End
but no matter what I do, It always gets the bytes for level 1, but then it includes enemies for level 2. :(
any ideas?
Title: Re: Axe Q&A
Post by: chattahippie on November 29, 2011, 09:09:16 pm
Try putting a * in there
change (M-1)768
to
(M-1)*768
Hope that helps
Title: Re: Axe Q&A
Post by: parserp on November 29, 2011, 09:10:04 pm
Try putting a * in there
change (M-1)768
to
(M-1)*768
Hope that helps
allready tried that, and then I decided to take it out and see if it worked, but it didn't. :(
Title: Re: Axe Q&A
Post by: epic7 on November 29, 2011, 09:18:53 pm
Things that really should work but don't?  O.O
SITUATION = GRAPPLER :(
According to the result of my gameplay, 3 is apparently not between 2 and 40 D:

The only difference is that I don't have a due date  >:D

But seriously.... Hope it gets fixed  ;D

I can't look at it now since I have homework still left  :banghead: :banghead:
Title: Re: Axe Q&A
Post by: parserp on November 29, 2011, 09:45:28 pm
oh wait, problem solved, thanks to runer112 :D /me is happy
Title: Re: Axe Q&A
Post by: Stefan Bauwens on November 30, 2011, 10:19:49 am
In stead of writing the following:
Code: [Select]
[0000000000000]->GDB1
[0000000000000]
[0000000000000]
[0000000000000]
[0000000000000]
[0000000000000]
[0000000000000]
[0000000000000]
I tried writing this:
Code: [Select]
[0000000000000]->GDB1
for(A,0,6)
[0000000000000]
end

But that apparently does something weird and freaks my sprites out.  ???
Can I use repeat or something else instead?
Title: Re: Axe Q&A
Post by: Hayleia on November 30, 2011, 10:24:03 am
No. None would work. You are storing static data. You can't mix code and data storing :)
The first one is the good one.
Title: Re: Axe Q&A
Post by: Stefan Bauwens on November 30, 2011, 10:27:22 am
Okay, thanks. :)
Title: Re: Axe Q&A
Post by: Darl181 on November 30, 2011, 11:40:15 am
You can also do Buff(64)→GDB1 and it'll have the same result as the first one (if you want it to be all zeroes)
Title: Re: Axe Q&A
Post by: Stefan Bauwens on November 30, 2011, 11:42:43 am
You can also do Buff(64)→GDB1 and it'll have the same result as the first one (if you want it to be all zeroes)

That's awesome. Thanks.
Title: Re: Axe Q&A
Post by: Hayleia on November 30, 2011, 12:11:39 pm
You can also do Buff(64)→GDB1 and it'll have the same result as the first one (if you want it to be all zeroes)
With this method, will the data be stored in the program or in some free ram ?
Title: Re: Axe Q&A
Post by: Yeong on November 30, 2011, 02:59:33 pm
Question: Can I do these?

1: After loading appvar to Y0, can I use them in labels like LABEL(3,5,Y0?
2: If I can't, is there an alternate way to do so?
Title: Re: Axe Q&A
Post by: Darl181 on November 30, 2011, 03:17:29 pm
You can also do Buff(64)→GDB1 and it'll have the same result as the first one (if you want it to be all zeroes)
With this method, will the data be stored in the program or in some free ram ?
It's part of the executable, the same way sprites strings etc are.

As for files, I don't remember much about them but this is in the docs:
Quote from: the docs
PROGRAM:A
:.HISCORE
:"appvMyScore"→Str1
:GetCalc(Str1,Y1)→A
:Return!If A
:Disp {Y1}r
GetCalc does NOT return a
pointer when opening a file.
Its simply non-zero if it
exists in archive and 0
otherwise.
It says beforehand that you can use them as if they were pointers in "the curly brackets and the copy command," so maybe put in the brackets?
LABEL(3,5,{Y0}r)
.file is two bytes, so using the r
Title: Re: Axe Q&A
Post by: epic7 on November 30, 2011, 05:15:14 pm
Question... What is Y0
Title: Re: Axe Q&A
Post by: Darl181 on November 30, 2011, 06:15:57 pm
When you GetCalc() to find a variable in archive, you can store a sort of pointer to a "file", or Y0-9.
Title: Re: Axe Q&A
Post by: Stefan Bauwens on December 01, 2011, 05:31:26 am
How do I save a variable to a var out of my program. Say str1?
And how can  I do the opposite too?
Title: Re: Axe Q&A
Post by: epic7 on December 01, 2011, 08:12:24 pm
I'd like to know that too ^

Does pxl-test( interfere with grayscale?
Title: Re: Axe Q&A
Post by: mrmprog on December 01, 2011, 08:13:48 pm
How do I save a variable to a var out of my program. Say str1?
And how can  I do the opposite too?
Do you mean take the data at a pointer and put in an external var?
Title: Re: Axe Q&A
Post by: Darl181 on December 01, 2011, 08:13:55 pm
pxl-Test() only tests the pixel on the given buffer (usually L6).  It doesn't test the pixels actually drawn to the screen.
Title: Re: Axe Q&A
Post by: epic7 on December 01, 2011, 08:16:43 pm
I was assuming that. I wanted to make sure :)
Title: Re: Axe Q&A
Post by: Stefan Bauwens on December 02, 2011, 01:25:54 pm
How do I save a variable to a var out of my program. Say str1?
And how can  I do the opposite too?
Do you mean take the data at a pointer and put in an external var?
I'm already helped by Buttsfredskin and JustCause.
I just had to use an appvar and stuff. If Epic7 still wants to know he can look in the logs of yesterday. There should be also a link to a pastebin that may explain it.
Title: Re: Axe Q&A
Post by: epic7 on December 02, 2011, 03:56:45 pm
What logs?
Title: Re: Axe Q&A
Post by: Darl181 on December 02, 2011, 06:16:02 pm
Well, if they're today's logs then this (http://omnomIRC.omnimaga.org/irc/EfNet/view.php?log=omnimaga.20111202).
Yesterday's logs (http://omnomIRC.omnimaga.org/irc/EfNet/view.php?log=omnimaga.20111202) :P
Title: Re: Axe Q&A
Post by: JustCause on December 02, 2011, 06:18:33 pm
How do I save a variable to a var out of my program. Say str1?
And how can  I do the opposite too?
Do you mean take the data at a pointer and put in an external var?
I'm already helped by Buttsfredskin and JustCause.
I just had to use an appvar and stuff. If Epic7 still wants to know he can look in the logs of yesterday. There should be also a link to a pastebin that may explain it.
So what are you unclear on? I'd be happy to help.
Title: Re: Axe Q&A
Post by: Stefan Bauwens on December 03, 2011, 11:07:22 am
Here's the pastebin Epic7: http://pastebin.com/DgpfUP2P
Made by Buttsfredskin iirc. :)
Title: Re: Axe Q&A
Post by: Darl181 on December 03, 2011, 04:49:48 pm
Quote from: command index http://ourl.ca/8409
GetCalc(PTR,SIZE) | Creates an OS variable who's name is pointed to in RAM and makes it Size bytes large. Returns a pointer to the start of data, or zero if there was not enough RAM. Overwrites existing variable, even if it was in archive.
So, I take it it doesn't ERR:MEMORY anymore?  Sometimes an external buffer isn't created, to interesting results 0.o

I'm pretty sure I already asked this somewhere (but can't find it :P) but how can you find out how much RAM is free?
EDIT: Found a note to self (http://ourl.ca/12891/265018) XD "Asm(EFE542) amount of free ram"
Title: Re: Axe Q&A
Post by: aeTIos on December 05, 2011, 07:12:01 am
Does that return in Ans? (I guess, but not sure since it could be >65535)
Title: Re: Axe Q&A
Post by: DrDnar on December 05, 2011, 07:29:52 am
You can't have more than 24 K of free RAM. You seem to be thinking of free archive, not free RAM. Yes, it returns in Ans. It's just a standard bcall.
Title: Re: Axe Q&A
Post by: aeTIos on December 05, 2011, 07:31:24 am
Oh lol, my bad. You are right, I was thinking of 240000 ram (best case ever )
Title: Re: Axe Q&A
Post by: DrDnar on December 05, 2011, 07:36:58 am
That's possible on the TI-89T.
Title: Re: Axe Q&A
Post by: Freyaday on December 05, 2011, 06:04:41 pm
That's possible on the TI-89T.
Which there is no Axe for. Yet./me would like to remind you that he does not have an 89 and runs from any and all dealings with assembly like the insane catboy he is
Title: Re: Axe Q&A
Post by: leafy on December 05, 2011, 09:30:29 pm
Quote from: command index http://ourl.ca/8409
GetCalc(PTR,SIZE) | Creates an OS variable who's name is pointed to in RAM and makes it Size bytes large. Returns a pointer to the start of data, or zero if there was not enough RAM. Overwrites existing variable, even if it was in archive.
So, I take it it doesn't ERR:MEMORY anymore?  Sometimes an external buffer isn't created, to interesting results 0.o

I'm pretty sure I already asked this somewhere (but can't find it :P) but how can you find out how much RAM is free?
EDIT: Found a note to self (http://ourl.ca/12891/265018) XD "Asm(EFE542) amount of free ram"

Alternatively you can just use !If GetCalc to check if your appvar was created :P
Title: Re: Axe Q&A
Post by: Happybobjr on December 07, 2011, 03:55:23 pm
anyone know when we can expect next version?
It will include a push pop function right?
Title: Re: Axe Q&A
Post by: Happybobjr on December 10, 2011, 09:57:11 pm
which is faster

x * 2 +3 ->G
x + 2 -> x
or
select( x , +2 ->x) * 2 + 3 -> G

is that even correct syntax? :P
Title: Re: Axe Q&A
Post by: ztrumpet on December 10, 2011, 09:59:17 pm
which is faster

x * 2 +3 ->G
x + 2 -> x
or
select( x , +2 ->x) * 2 + 3 -> G

is that even correct syntax? :P
I'm not sure since the command is new, but remember you could do this too:
x + 2 -> x * 2 + 1 -> G
Title: Re: Axe Q&A
Post by: Happybobjr on December 10, 2011, 10:01:18 pm
The point was to learn about the new command.  I am not using this example in my project or anything.


lol, just saw quigibos post from a couple min ago.  i am all good now :P
Title: Re: Axe Q&A
Post by: Quigibo on December 12, 2011, 12:55:41 am
Select() is one of the smallest commands at only 2 bytes.  Loading a variable takes 3.  However, the speed is slightly slower using select verses a single load, but its probably not noticeable.  You would want to optimize it like this:

Original:
X*2+3→G:X+2→X

Notice how X is loaded twice before storing to it.  Why reload it when we can just store it away in a safe place?
Select(X,*2+3→G)+2→X

So this saves 1 byte in the example.
Title: Re: Axe Q&A
Post by: Happybobjr on December 12, 2011, 06:07:43 am
ok thanks much.
Title: Re: Axe Q&A
Post by: Yeong on December 12, 2011, 07:44:36 am
Quote
Labels cannot be placed in a single argument for statement.
What does this mean?
is this mean that I can't do
Code: [Select]
:some code
:LABEL(
:some more code
this?
Title: Re: Axe Q&A
Post by: calc84maniac on December 12, 2011, 09:32:10 am
No, it means you can't do this:
Code: [Select]
For(12)
...some code...
Lbl LBL
...some code...
End
Title: Re: Axe Q&A
Post by: Sorunome on December 12, 2011, 10:30:03 am
Can someone please help me!
Well, I have a tilemap stored in a Variable in this kind of form:
Code: [Select]
[4A5F68ED->K
[34342545

etc.
(Two Hexadecimals are one tile)
Well, drawing tilemap etc. works.
But now I want to change only one single tile, so i did
Code: [Select]
[33->{K+20}And that didn't change anything.

If I don't do the K+20 in curley brackets then it overwrites the old tilemap and so that isn't a sollution.
What did I do wrong? Can someone please help me?
But Now I want to edit just one single tile
Title: Re: Axe Q&A
Post by: Darl181 on December 12, 2011, 02:35:53 pm
Do rectangles clip, or do they behave like lines?
I've prolly found this out on my own but I don't remember the result and it might have changed since ~4 months ago anyways... :P

Also I'm having some problems...I want to choose a random number that for sure is different than an initial number but sometimes it returns the same :\
Spoiler For code:

.A is any number from 0 to 10
A→B
Repeat A-B
.supposedly until A!=B, sometimes doesn't work
rand^11→A
End
It works most of the time, but sometimes (like, 1 out of 20) it chooses the same option and doesn't remedy.  Am I doing something wrong?
Title: Re: Axe Q&A
Post by: macweirdo on December 12, 2011, 06:54:19 pm
Does Dispgraph^rr or whichever one makes 4scale change either of the two buffers?
Title: Re: Axe Q&A
Post by: Builderboy on December 12, 2011, 07:22:22 pm
Do rectangles clip, or do they behave like lines?
I believe they clip properly on the right and bottom sides correctly, but not the top or left sides (probably because it doesn't treat the position coordinates as signed).

As for your random code, I tried it myself and could not replicate your error, maybe it has something to do with the surrounding code, or what you do with A and B afterwards?

Does Dispgraph^rr or whichever one makes 4scale change either of the two buffers?
None of the display routines should change any of the buffers
Title: Re: Axe Q&A
Post by: Darl181 on December 12, 2011, 10:33:14 pm
As for your random code, I tried it myself and could not replicate your error, maybe it has something to do with the surrounding code, or what you do with A and B afterwards?
I'm not sure, I'm guessing it's some weird delay stuff (maybe like the getKey stuff, but idk?)
The way I'm actually checking it (well technically I do it twice, one the above way and one another way) is I have an array of X and Y values stored one after the other in a GDB...
It chooses one set of coordinates and checks that the chosen Y-coordinate and the existing Y-coordinate differ.  Except that it seems to not work, even selecting with the same Y-coordinate thrice in a row.
I'll take a closer look at the code and see if something sticks out..
Title: Re: Axe Q&A
Post by: Builderboy on December 12, 2011, 10:37:43 pm
Make sure that all of the possible selections of Y coordinates are unique. Other than that, it would depend a lot on your code and implementation, good luck fixing the issue ^^
Title: Re: Axe Q&A
Post by: Darl181 on December 12, 2011, 10:49:57 pm
Hm...
Repeat {A+2+GDB1CRTE+1}-{L2+3}
Should I put parenthesis around the second part?/me stabs midnight coding
Edit: didn't fix :\

I've been curious about this...does If just check the last bit ("boolean"?), or does it check the entire byte?  How about !If ?
Title: Re: Axe Q&A
Post by: Sorunome on December 13, 2011, 10:33:40 am
Can someone please help me!
Well, I have a tilemap stored in a Variable in this kind of form:
Code: [Select]
[4A5F68ED->K
[34342545

etc.
(Two Hexadecimals are one tile)
Well, drawing tilemap etc. works.
But now I want to change only one single tile, so i did
Code: [Select]
[33->{K+20}And that didn't change anything.

If I don't do the K+20 in curley brackets then it overwrites the old tilemap and so that isn't a sollution.
What did I do wrong? Can someone please help me?
But Now I want to edit just one single tile
I just bump this code as it seems to me that it has been overread.
Title: Re: Axe Q&A
Post by: Builderboy on December 13, 2011, 11:31:46 am
If you store your tilemap inside of your program, the only way to directly edit it would end up modifying the original program, making any changes permanent, which might not be what you want, but can be accomplished by using

33->{K+20}

You enclosed the 33 in [] brackets, which you only do when specifying long strings of data, and strings of data can't be used in this scenario.  Alternatively, if you do not wish to overwrite your original program, I suggest copying the tilemap to a safe location like L1 and editing it from there instead of modifying it when it is in your program.
Title: Re: Axe Q&A
Post by: epic7 on December 13, 2011, 03:22:32 pm
What do I put for the pointer of a bitmap?
Title: Re: Axe Q&A
Post by: Builderboy on December 13, 2011, 04:31:27 pm
The pointer to the bitmap data that you define.  Do you know how to define bitmap data?
Title: Re: Axe Q&A
Post by: epic7 on December 13, 2011, 04:31:56 pm
Nope.
Title: Re: Axe Q&A
Post by: Builderboy on December 13, 2011, 04:32:28 pm
Did you read the commands list documentation?
Title: Re: Axe Q&A
Post by: epic7 on December 13, 2011, 04:33:22 pm
I did./me checks again to see if he missed anything

EDIT: So like [height-width-hex]->something sorta?
Title: Re: Axe Q&A
Post by: Builderboy on December 13, 2011, 04:37:40 pm
Exactly, and then after you define that data, pass the pointer to that data into the bitmap command, along with your position for the bitmap. 
Title: Re: Axe Q&A
Post by: epic7 on December 13, 2011, 04:40:00 pm
[0303(16hex)(16hex)(16hex)(16hex)(16hex)(16hex)(16hex)(16hex)(16hex)]->Pic2
Would work for a 24x24?
Title: Re: Axe Q&A
Post by: Builderboy on December 13, 2011, 04:44:23 pm
No because you just defined your height and width to be 3 pixels each.  Height and width is in pixels, not bytes.  Otherwise though, you got it.
Title: Re: Axe Q&A
Post by: Quigibo on December 13, 2011, 05:00:38 pm
Alternatively, its a little easier to define them like Data(24,24)[sprite]->Pic1 instead.  Also, a sprite with width 24 is going to have 24-bits per row (6 hex numbers).  Since the height is 24, it will have 24 sets of these.  That's 6*24 = 144 hex digits.
Title: Re: Axe Q&A
Post by: Yeong on December 13, 2011, 05:38:07 pm
Code: [Select]
:If something
:Data(.......)→Pic1
:End
:If somethingelse
:Data(.......)→Pic1
:End
Gives me a duplicate error. (and I know that it should happen)
Is there a way to get around with it?
Title: Re: Axe Q&A
Post by: calcdude84se on December 13, 2011, 05:47:03 pm
Pic1 is static. If those conditions are compile-time (They're constants), you can use the new ...If construction. If the condition can only be evaluated at run-time, however, you'll have to use a variable (This includes user-defined ones) instead of Pic1.
Title: Re: Axe Q&A
Post by: Yeong on December 13, 2011, 05:47:53 pm
ah. so Z works?
Title: Re: Axe Q&A
Post by: calcdude84se on December 13, 2011, 05:49:21 pm
Indeed, Z would work :)
Title: Re: Axe Q&A
Post by: Builderboy on December 13, 2011, 05:52:13 pm
By replacing the Pic1, you can store the pointer into a variable, just make sure to keep track of it!
Title: Re: Axe Q&A
Post by: Yeong on December 13, 2011, 05:53:09 pm
ah, ok.
Now I just wish I could have custom-named pointer/variable D:
Title: Re: Axe Q&A
Post by: Builderboy on December 13, 2011, 05:59:33 pm
Oh whoops didn't see there was another page XD But yeah, you can have named constants but not named variables, unless you use a constant as a pointer to a variable o.O
Title: Re: Axe Q&A
Post by: jacobly on December 13, 2011, 06:20:40 pm
Oh whoops didn't see there was another page XD But yeah, you can have named constants but not named variables, unless you use a constant as a pointer to a variable o.O
Ahem...
Code: [Select]
°A-2→°MYVAR
5→MYVAR
MYVAR++
MYVAR*13→MYVAR
Disp MYVAR▸Dec,i .Prints 78

Code: [Select]
:If something
:Data(.......)→Pic1
:End
:If somethingelse
:Data(.......)→Pic1
:End
Gives me a duplicate error. (and I know that it should happen)
Is there a way to get around with it?
Also, if something is a constant, you can do this in Axe 1.1.0:
Code: [Select]
:...If something
:Data(.......)→Pic1
:...
:...If somethingelse
:Data(.......)→Pic1
:...
Title: Re: Axe Q&A
Post by: Yeong on December 13, 2011, 06:22:17 pm
wait. I can have custom-named variables? sweet!
Title: Re: Axe Q&A
Post by: Builderboy on December 13, 2011, 06:27:08 pm
Oh whoops didn't see there was another page XD But yeah, you can have named constants but not named variables, unless you use a constant as a pointer to a variable o.O
Ahem...
Code: [Select]
°A-2→°MYVAR
5→MYVAR
MYVAR++
MYVAR*13→MYVAR
Disp MYVAR▸Dec,i .Prints 78

Woah  O.O When did this happen?  It doesn't look like it's in the commands list either.
Title: Re: Axe Q&A
Post by: Yeong on December 13, 2011, 06:36:09 pm
now let's abuse these .equ custom-named variables XD
Title: Re: Axe Q&A
Post by: epic7 on December 13, 2011, 06:51:37 pm
BITMAP EPIC FAIL :P

Ok, so I did this
[2424(hex-from-yeongs-program)]->Pic8
Bitmap(1,16,Pic8)
Title: Re: Axe Q&A
Post by: Builderboy on December 13, 2011, 06:53:51 pm
Is your sprite 36 by 36?  How many bytes of data did the program give you? 
Title: Re: Axe Q&A
Post by: epic7 on December 13, 2011, 06:54:30 pm
Its 24*24
Title: Re: Axe Q&A
Post by: Builderboy on December 13, 2011, 07:02:55 pm
How many bytes of data did the program give you?
Title: Re: Axe Q&A
Post by: epic7 on December 13, 2011, 07:04:15 pm
Does that mean I have to count aalll the numbers? :P D:
Title: Re: Axe Q&A
Post by: FinaleTI on December 13, 2011, 07:04:23 pm
Then you would need to start the bitmap with [1818], not [2424], since the hex value 24 is 36. The hex value 18 would be 24.
Title: Re: Axe Q&A
Post by: Builderboy on December 13, 2011, 07:05:06 pm
Does that mean I have to count aalll the numbers? :P D:

If the program returns a string just do Length(String)
Title: Re: Axe Q&A
Post by: Yeong on December 13, 2011, 09:58:37 pm
if he used my program for 24x24, it should give him a 16*9=144 hex digits (so...72 bytes)
Title: Re: Axe Q&A
Post by: aeTIos on December 14, 2011, 09:44:59 am
'nother bitmap question: Am I right that you are using a custom routine now?
Also does bitmap clip?
Title: Re: Axe Q&A
Post by: Yeong on December 14, 2011, 01:15:07 pm
I think I read that bitmap clips.
Title: Re: Axe Q&A
Post by: epic7 on December 14, 2011, 04:26:39 pm
Well, I need to find another way for 24x24s

Putting them into a pic and uploading to calc distorts it :/
Jacobly converted one of my big sprites but I don't want to bother him with another :P
Or if I write down the binary for the 576 pixels then use a hex converter, but 576 seems like a lot :P
Title: Re: Axe Q&A
Post by: parserp on December 14, 2011, 05:20:47 pm
so, If I have a set of data stored in an appvar, how would I recall it in the program with each piece of data as a specific variable?
Title: Re: Axe Q&A
Post by: epic7 on December 14, 2011, 05:24:24 pm
I think
appvBLAH->W
{W}r->A
{W+2}r->B
{W+4}r->C

I think
appvBLAH->W
{W}->A
{W+1}->B
{W+2}->C
Works with 1 byte tho


ALSO
Are tilemaps usually slow?
The speed of the program is about 25-35% the speed of what it was before <_<
Title: Re: Axe Q&A
Post by: saintrunner on December 14, 2011, 05:31:01 pm
try moving parts off the tilemap out of the main loop
Title: Re: Axe Q&A
Post by: epic7 on December 14, 2011, 05:35:36 pm
Like what?
I don't think its displaying the entire tilemap at one time, but just what will be on the screen.
Title: Re: Axe Q&A
Post by: saintrunner on December 14, 2011, 05:36:02 pm
hex code and variables
Title: Re: Axe Q&A
Post by: epic7 on December 14, 2011, 05:38:27 pm
Nope, thats out of the loop
(same conversation's going on in grappler topic :P)

I'll go get code I guess

Fill(L5,5,0)
8->{L5}
24->{L5+1}
GDB1->C
Repeat getKey(15)
   ClrDraw
   0-({L5}^8)->{L5+2}
   For(N,{L5}/8-1,{L5}/8+11)
      0-({L5+1}^8)->{L5+3}
      For(D,{L5+1}/8-1,{L5+1}/8+11
         If {D*24+N+C}->{L5+4}
            Pt-On({L5+2},{L5+3},{L5+4}-1*8+Pic0)
         End
         {L5+3}+8->{L5+3}
      End
      {L5+2}+8->{L5+2}
   End
   If getKey(41)
      {L5}++
   End

Any visible major unoptimizations?
Title: Re: Axe Q&A
Post by: saintrunner on December 14, 2011, 05:42:21 pm
that works
Title: Re: Axe Q&A
Post by: Quigibo on December 14, 2011, 05:45:52 pm
Well, I need to find another way for 24x24s

Putting them into a pic and uploading to calc distorts it :/
Jacobly converted one of my big sprites but I don't want to bother him with another :P
Or if I write down the binary for the 576 pixels then use a hex converter, but 576 seems like a lot :P

You know... its not that hard to write a converter program yourself in Axe.  Say you had 8 24x24 sprites drawn to a pic on your calculator side by side.  Let's convert the Nth picture to a 148 digit hex string in the OS Str1:

:.CONVERT
:.This number can be 0-7 to distinguish the pictures
:0→N
:
:.Read from Pic1 and create the string variable Str1
:Return!If GetCalc("Pic1")→P
:Return!If GetCalc("Str1",148)→S
:
:.Add the size bytes to the bitmap
:Copy(E1818>Hex,S,4)
:S+4→S
:
:.Use N to find the first byte of the picture
:N^4*3+(N/4*288)+P→P
:
:.Iterate through all the rows of the sprite
:For(24)
:  .Copy the 6 hex digits of 1 row to the string
:  Copy({P}rr>Hex,S,4)
:  Copy({P+2}rr>Hex,S+4,2)
:
:  .Increment the position in the picture and the string
:  S+6→S
:  P+12→P
:End



Title: Re: Axe Q&A
Post by: epic7 on December 14, 2011, 05:49:02 pm
Sounds similar to Yeong's program

:Return!If GetCalc("Str1",148)→S
Does that mean there must be a Str1?
Or does that create a str1?

Also when doing a recallpic after loading my pic, it is distorted...
It seems... stretched and makes it demented.
Dimentions 96x64.
Title: Re: Axe Q&A
Post by: Quigibo on December 14, 2011, 05:53:22 pm
That creates Str1 (because it has 2 arguments instead of 1).  But if you had less than 148 bytes of ram left on your calculator and Str1 couldn't be created, it will safely quit. :)

EDIT: Draw the picture on the computer and send it over.  It shouldn't distort anything, otherwise its probably an issue with TI-Connect or something.
Title: Re: Axe Q&A
Post by: epic7 on December 14, 2011, 05:55:59 pm
getcalc(something,bytes)
Creates a new one but
getcalc(something)
Checks its existance.

I noticed Statues' game board was a bit distorted when doing a RecallPic but was fine in Axe. So, I'll go put together that program :D
Title: Re: Axe Q&A
Post by: parserp on December 14, 2011, 06:10:23 pm
I think
appvBLAH->W
{W}r->A
{W+2}r->B
{W+4}r->C

I think
appvBLAH->W
{W}->A
{W+1}->B
{W+2}->C
Works with 1 byte tho


ALSO
Are tilemaps usually slow?
The speed of the program is about 25-35% the speed of what it was before <_<
thanks epic7.

now, is there a faster way to store data in a data( command rather than this?
Code: [Select]
:Data({L1},{L1+1},{L1+2},{L1+3}, and so on for about a hundred more variables...EDIT: problem solved via IRC. :D
Title: Re: Axe Q&A
Post by: epic7 on December 14, 2011, 07:43:15 pm
I've heard bitmap is slow.
Is it still faster than using a For( loop of 8x8 sprites?
(24x24 sprite)

I need to optimize a lot <_<
My tilemap just attached a ball and chain to my program with my ti-83+
I don't think I can optimize enough... but I'll try for some :P
Title: Re: Axe Q&A
Post by: Quigibo on December 14, 2011, 08:01:48 pm
Drawing 9 sprites in a for loop is about 20% faster than using the bitmap command, so only slightly.  However, this is the first version of that command, so there are likely to be optimizations in the future.
Title: Re: Axe Q&A
Post by: epic7 on December 14, 2011, 08:07:37 pm
Ok. At least I already optimized some, from about 0.1 sec/loop to about 0.06 sec/loop from squidgetx's guide


Title: Re: Axe Q&A
Post by: BlakPilar on December 14, 2011, 09:35:54 pm
I have a question about the Horizontal and Vertical commands. Do they shift the screen permanently (I had an assembly program do that to me once...), or does it just shift the pixels?

Also, how does one make custom variable names?
Title: Re: Axe Q&A
Post by: saintrunner on December 14, 2011, 09:37:33 pm
it moves them over one pxl at a time....and like variable A? or ABC or do you mean pic1, or pic123ABC?
Title: Re: Axe Q&A
Post by: BlakPilar on December 14, 2011, 09:57:08 pm
I know it moves them over, but I mean does it move the pixels or does it move the actual rows/columns? The ASM program I was talking about shifted my screen down so the bottom seven or so rows were displayed at the top. And for the variables I mean ABC, etc. I already knew about Pic/GDB.
Title: Re: Axe Q&A
Post by: saintrunner on December 14, 2011, 10:17:15 pm
horizontal + and- and vertical + and - move EVERYTHING on the screen (unless set to a specific buffer) by one pixel
as for  variables they can be anything you want
example:
lblHELLO

gotoHELLO

this help?
Title: Re: Axe Q&A
Post by: BlakPilar on December 14, 2011, 10:22:16 pm
Alright, I figured that. As for variables, I thought Lbl was reserved for subroutines?
Title: Re: Axe Q&A
Post by: chattahippie on December 14, 2011, 10:23:53 pm
I know it moves them over, but I mean does it move the pixels or does it move the actual rows/columns? The ASM program I was talking about shifted my screen down so the bottom seven or so rows were displayed at the top. And for the variables I mean ABC, etc. I already knew about Pic/GDB.

I do not think it does that... it just moves the buffer data around, not the physical screen.
And yes, I know what you are referring to, mathprint does that occasionally, and it's annoying

Lbls are used for subroutines/jumps :D
Title: Re: Axe Q&A
Post by: saintrunner on December 14, 2011, 10:25:14 pm
well, yes it was just an example, OH WAIT! you want just plain old variables! *face palm*  I think you can only use a-z then feta or 0-?

for the record, thats wht I meant
Title: Re: Axe Q&A
Post by: chattahippie on December 14, 2011, 10:29:42 pm
You can also store to points in data such as {L1} or {Pic23+1}, where L1 is a static pointer (Pics, GDBs, L1-6, Strs, etc) for one byte "variables" or follow the curly brackets with the ^r for 2 byte variables ( ex: {L1}^r)
Title: Re: Axe Q&A
Post by: BlakPilar on December 14, 2011, 10:33:03 pm
@chattahippie, I can't say much for MathPrint besides I was glad to get rid of it for 2.43 lol. But no, the ASM program was some "power tool" thing, if I remember correctly. Admittedly, I think it was me who told it to shift the screen.

@saintrunner, yeah, thats what I meant :P I know what Lbl/Goto are for lol. But I thought I read in the documebtation that it was possible to have variable names of up to 6 or so characters? Maybe I'm mistaken and that was subroutines...
Title: Re: Axe Q&A
Post by: saintrunner on December 14, 2011, 10:34:36 pm
Yeah I think only subroutines can have multiple figures in them
Title: Re: Axe Q&A
Post by: chattahippie on December 14, 2011, 10:34:38 pm
@chattahippie, I can't say much for MathPrint besides I was glad to get rid of it for 2.43 lol. But no, the ASM program was some "power tool" thing, if I remember correctly. Admittedly, I think it was me who told it to shift the screen.
I've used those too... but unfortunately, 2.55 forces me to use such scrolling nonsense until I remember to turn off mathprint :P

EDIT:
Code: [Select]
°A-2→°MYVAR
5→MYVAR
MYVAR++
MYVAR*13→MYVAR
Disp MYVAR▸Dec,i .Prints 78
;D
Hope that helps!
Title: Re: Axe Q&A
Post by: BlakPilar on December 14, 2011, 10:39:25 pm
Darn...
/me is now sad...
Oh well, though. Methinks it's time for arrays, then. Thanks guys.
Title: Re: Axe Q&A
Post by: epic7 on December 14, 2011, 10:46:30 pm
Is there to do this, but with bitmaps?
[...]->Pic1
[...]
[...]
Pt-On(A,B,Z*8+Pic1)
Title: Re: Axe Q&A
Post by: saintrunner on December 14, 2011, 10:53:33 pm
Darn...
/me is now sad...
Oh well, though. Methinks it's time for arrays, then. Thanks guys.

try using multiple figured variables, it might work
Title: Re: Axe Q&A
Post by: Builderboy on December 15, 2011, 04:37:03 am
Is there to do this, but with bitmaps?
[...]->Pic1
[...]
[...]
Pt-On(A,B,Z*8+Pic1)

Just replace the 8 with the size of the bitmap data in bytes
Title: Re: Axe Q&A
Post by: BlakPilar on December 15, 2011, 06:46:31 am
EDIT:
Code: [Select]
°A-2→°MYVAR
5→MYVAR
MYVAR++
MYVAR*13→MYVAR
Disp MYVAR▸Dec,i .Prints 78
;D
Hope that helps!

Woot! Thanks chattahippie!
Title: Re: Axe Q&A
Post by: epic7 on December 15, 2011, 05:11:12 pm
Is there to do this, but with bitmaps?
[...]->Pic1
[...]
[...]
Pt-On(A,B,Z*8+Pic1)

Just replace the 8 with the size of the bitmap data in bytes
What's the size of a 24x24 bitmp?
Title: Re: Axe Q&A
Post by: Builderboy on December 15, 2011, 05:53:17 pm
You entered the data into your calculator, you should know :P I do believe it amounts to 74 bytes though
Title: Re: Axe Q&A
Post by: epic7 on December 16, 2011, 06:06:50 pm
How would I combine two strings, such as
"Hello "->Str1
"World!"->Str2
.A guess
Str2->{Str1+6}
Text(1,,Str1)
.^ would that work?
Title: Re: Axe Q&A
Post by: Darl181 on December 16, 2011, 06:22:45 pm
So you're trying to display one after the other?  (not exactly sure what you're trying to do)
Something to remember is that strings are "zero-terminated", which means that when you have a string and →Str# Axe automatically puts a zero at the end so it knows when to stop displaying etc.

If you do this, a zero is put at the end:
"The Game"→Str1

If you do this, a zero is not put at the end:
"The Game"

So if you have this:
"I like to eat "
"apples and "
"bananas "
[00]

It displays all of it as one string.
(Keep in mind that it looks for the [00] at the end, tho...it'll keep displaying until it reaches one.)
Title: Re: Axe Q&A
Post by: LincolnB on December 16, 2011, 07:24:39 pm
How would I combine two strings, such as
"Hello "->Str1
"World!"->Str2
.A guess
Str2->{Str1+6}
Text(1,,Str1)
.^ would that work?

no, that just puts a pointer to Str2 in the sixth byte of data starting at Str1. You would need to set up some kind of a loop to copy single bytes of data from Str1 to Str2.
Title: Re: Axe Q&A
Post by: Quigibo on December 16, 2011, 07:34:20 pm
If you're thinking of combining strings in Axe... you're probably doing something wrong :P  Just display them one after the other.  Axe doesn't add newlines unless you specify them so its perfectly okay to do "Disp Str1,Str2" or "Text Str1,Str2" and it will print them to the screen as if they were a single string.  You never actually need to "combine them".
Title: Re: Axe Q&A
Post by: Darl181 on December 16, 2011, 07:51:15 pm
I've been meaning to ask: how does axe handle newlines in the source?
Would this program, when compiled...
Spoiler For Spoiler:
.A
[0000000000000000]→Pic1
[FFFFFFFFFFFFFFFF]

ClrHome

For(A,0,7)
Pt-On(A*8,0,Pic1+8)
End
DispGraph
...end up being bigger than this, when compiled...?
Spoiler For Spoiler:
.A
[0000000000000000FFFFFFFFFFFFFFFF]→Pic1
ClrHome
For(A,0,7)
Pt-On(A*8,0,Pic1+8)
End
DispGraph
Title: Re: Axe Q&A
Post by: Runer112 on December 16, 2011, 07:55:41 pm
That's one of the advantages of compiled languages. Larger source code does not mean larger compiled code. You can add line breaks and comments and long-named labels all you want; the compiled code will always be the same size.
Title: Re: Axe Q&A
Post by: BlakPilar on December 16, 2011, 07:57:43 pm
Is there any way to "re-declare" an array? For example, doing "Data(0,0,0)->GDB0" at one point, then doing "Data(6,3,5)->GDB0" later? Or, after the array has been declared, would I need to do something like "6->{GDB0+0}:3->{GDB0+1}:5->{GDB0+2}" to change values?
Title: Re: Axe Q&A
Post by: parserp on December 16, 2011, 08:06:08 pm
How would I learn tilemapping/scrolling for a platformer? I don't know how to adapt the ones in the tutorials section to make it work. ???
Title: Re: Axe Q&A
Post by: leafy on December 16, 2011, 08:20:53 pm
Is there any way to "re-declare" an array? For example, doing "Data(0,0,0)->GDB0" at one point, then doing "Data(6,3,5)->GDB0" later? Or, after the array has been declared, would I need to do something like "6->{GDB0+0}:3->{GDB0+1}:5->{GDB0+2}" to change values?
If your program doesn't writeback, then this is okay. It would be much easier to store values to a free RAM space, then alter them there.
Title: Re: Axe Q&A
Post by: Quigibo on December 16, 2011, 09:10:40 pm
Is there any way to "re-declare" an array? For example, doing "Data(0,0,0)->GDB0" at one point, then doing "Data(6,3,5)->GDB0" later? Or, after the array has been declared, would I need to do something like "6->{GDB0+0}:3->{GDB0+1}:5->{GDB0+2}" to change values?
If your program doesn't writeback, then this is okay. It would be much easier to store values to a free RAM space, then alter them there.
Alternatively, you can store data to a variable instead of a constant and then your can re-assign pointers all you want.
Title: Re: Axe Q&A
Post by: epic7 on December 16, 2011, 09:12:13 pm
How would I learn tilemapping/scrolling for a platformer? I don't know how to adapt the ones in the tutorials section to make it work. ???
I found it difficult to follow Yunhua's tutorial :P
I learned it from aeTIos and butts.
But, I'll show you how it works.
Title: Re: Axe Q&A
Post by: parserp on December 16, 2011, 09:12:44 pm
allright! :D
Title: Re: Axe Q&A
Post by: BlakPilar on December 16, 2011, 09:19:39 pm
If your program doesn't writeback, then this is okay. It would be much easier to store values to a free RAM space, then alter them there.
Alternatively, you can store data to a variable instead of a constant and then your can re-assign pointers all you want.
Ahh, thanks guys!
Title: Re: Axe Q&A
Post by: Darl181 on December 17, 2011, 12:48:45 pm
That's one of the advantages of compiled languages. Larger source code does not mean larger compiled code. You can add line breaks and comments and long-named labels all you want; the compiled code will always be the same size.
Cool :)
Does the same apply for If <condition>:Stuff:End versus <condition>?stuff ?
I've noticed some things don't work in the latter, such as getKey(x) for the condition and Pt-***.
Title: Re: Axe Q&A
Post by: epic7 on December 17, 2011, 12:49:25 pm
What does ? do?
Title: Re: Axe Q&A
Post by: Darl181 on December 17, 2011, 12:50:01 pm
It's basically a short version of If afaict, tho there's some differences apparently.
Title: Re: Axe Q&A
Post by: Happybobjr on December 17, 2011, 12:50:50 pm
I am prety sure it is the same.
but can be used for other optimizations because it works inline.
Title: Re: Axe Q&A
Post by: epic7 on December 17, 2011, 12:51:07 pm
*guess*
So

If getKey(2)
X--
End

Would be the same as

getKey(2)?X--

?
Title: Re: Axe Q&A
Post by: Darl181 on December 17, 2011, 12:53:23 pm
getKey(2)?X--
Evidently not, when I tried something like that it threw an error at compile-time. :/
Title: Re: Axe Q&A
Post by: epic7 on December 17, 2011, 12:54:25 pm
Ok then, so there are some differences. :P
Title: Re: Axe Q&A
Post by: Happybobjr on December 17, 2011, 12:56:22 pm
i think that is becasue X-- is a command, not a value.  Try x-1->x
Title: Re: Axe Q&A
Post by: Runer112 on December 17, 2011, 12:57:26 pm
getKey(2)?X--
Evidently not, when I tried something like that it threw an error at compile-time. :/

I get no such error, and there should be no difference between the two syntaxes. You mentioned something about Pt-X commands not working in them, and this is true, but not because of a syntax difference. It's because Axe requires that some comamnds start a line, and the Pt-X commands are among them, so you can't use them mid-line in an inline conditional.
Title: Re: Axe Q&A
Post by: epic7 on December 17, 2011, 12:58:54 pm
Any other often-used commands that can't be used with ? ?
Title: Re: Axe Q&A
Post by: chattahippie on December 17, 2011, 01:00:32 pm
A ? is an "if and only if" statement, right?
Title: Re: Axe Q&A
Post by: Runer112 on December 17, 2011, 01:01:04 pm
The general rule is, if the command token starts with a capital letter, it has to be at the start of a line.
Title: Re: Axe Q&A
Post by: epic7 on December 17, 2011, 01:03:49 pm
Like the first word of a sentence :P

Ok, I guess there is a lot of differences since there's lots of commands starting with capitals.
Title: Re: Axe Q&A
Post by: Darl181 on December 17, 2011, 01:04:50 pm
So, the compiled size is the same?

(also 84 pages :P)

Also just noticed this:
i think that is becasue X-- is a command, not a value.  Try x-1->x
That one has worked for me, even in the conditional.

(btw @epic X-getKey(2)→X would work for the example code :P)
Title: Re: Axe Q&A
Post by: Runer112 on December 17, 2011, 01:08:11 pm
Yes. X?Y produces the same code as If X : Y : End, and X?Y,Z produces the same code as If X : Y : Else : Z : End.
Title: Re: Axe Q&A
Post by: Yeong on December 19, 2011, 07:07:12 am
I have a question: why doesn't this code work? (It compiles, but it glitches on me)
0→{S}→{S+5}→{S+15}
and S is the pointer to appvar.
Title: Re: Axe Q&A
Post by: ztrumpet on December 19, 2011, 07:10:57 am
I have a question: why doesn't this code work? (It compiles, but it glitches on me)
0→{S}→{S+5}→{S+15}
and S is the pointer to appvar.
(I just had this happen to me too and I spent a couple of hours before getting Runer's help and facepalming.)

Because of the way Axe optimizes, number→{pointer} returns the pointer instead of the number.  The code equivalent to what you are doing is actually this:
:0→{S} :S→{S+5} :S+5→{S+15}
Title: Re: Axe Q&A
Post by: Yeong on December 19, 2011, 07:13:30 am
oh! D:
Thank you. Now I can optimize stuff a bit more!
(I was using 0→{S}:0→{S+5}:etc)
Title: Re: Axe Q&A
Post by: Runer112 on December 19, 2011, 11:37:24 am
If you're wondering, the optimized way to do that would be:

and 0→{→{→{S}+5}+10}
Title: Re: Axe Q&A
Post by: Freyaday on December 19, 2011, 06:03:44 pm
If you're wondering, the optimized way to do that would be:

and 0→{→{→{S}+5}+10}
I find it both scary and hilarious how unreadable that is. I can almost guarantee that optimized Axe code will elict a WTF? from the viewer. Even if you're the one that wrote it :P
Title: Re: Axe Q&A
Post by: Yeong on December 19, 2011, 08:39:44 pm
question from the former code: what does that "and" do?
Title: Re: Axe Q&A
Post by: Builderboy on December 19, 2011, 09:33:12 pm
I think it generates the number 0 without actually storing it in the program.  It basically AND's the previous value of HL with 0, which always results in 0.  Similar to how assembly optimizers often do XOR A instead of Ld A,0
Title: Re: Axe Q&A
Post by: Deep Toaster on December 19, 2011, 09:53:18 pm
Since →{} stores only the lower eight bits (one byte), it doesn't matter what the high byte of HL is as long as the low byte is zero. In other words, all we need is for the last eight bits of HL to be zero. and 0 does a bitwise AND on the last eight bits of HL, which looks like this:
     ****************     // Original value of HL; * is either 0 or 1
and         00000000     //  and 0
     ********00000000     // Final value of HL
And that's all that's needed to store one byte of zero to {S}. It's also one byte smaller than just using 0 (LD L,0 versus LD HL,0), which is why Runer112 uses it.

Clever optimization there :D
Title: Re: Axe Q&A
Post by: epic7 on December 19, 2011, 09:56:16 pm
I have a question: why doesn't this code work? (It compiles, but it glitches on me)
0→{S}→{S+5}→{S+15}
and S is the pointer to appvar.
(I just had this happen to me too and I spent a couple of hours before getting Runer's help and facepalming.)

Because of the way Axe optimizes, number→{pointer} returns the pointer instead of the number.  The code equivalent to what you are doing is actually this:
:0→{S} :S→{S+5} :S+5→{S+15}
Oh I think I've been doing that O.O
I've noticed a few bugs in my game so I'll check for those :P

For that
and 0->
Is that supposed to be more optimized than
0->
Title: Re: Axe Q&A
Post by: squidgetx on December 19, 2011, 10:43:25 pm
Only if you are storing to a one-byte value.

I need to update my guide...lool
Title: Re: Axe Q&A
Post by: Deep Toaster on December 19, 2011, 11:05:31 pm
For that
and 0->
Is that supposed to be more optimized than
0->
Explained (http://omniurl.tk/6568/218554/) right before you posted, but you probably didn't notice because it was the last post on the page. It's one byte smaller and three cycles faster (but it works only if you're doing something with one byte, as squidgetx said, such as for sin(), xor , or →{}).

You probably wouldn't notice if you just used 0, though XD
Title: Re: Axe Q&A
Post by: epic7 on December 19, 2011, 11:10:42 pm
Only if you are storing to a one-byte value.

I need to update my guide...lool
Please do. Everything I know on optimizing is from that :P
Title: Re: Axe Q&A
Post by: epic7 on December 21, 2011, 03:53:07 pm
Can Z-Test be used to go to subroutines?

Like doing
1->A
Z-Test(A,1
Disp "World" ;returns here after subroutine
Return
Lbl 1
Disp "Hello"
Return

And have it display Hello world?
Title: Re: Axe Q&A
Post by: calc84maniac on December 21, 2011, 07:25:59 pm
Try this:
Code: [Select]
0→A
DO(A)
Disp "World"
Return
Lbl DO
Z-Test(r1,1)
Return
Lbl 1
Disp "Hello"
Return
Title: Re: Axe Q&A
Post by: Darl181 on December 21, 2011, 11:04:36 pm
Ok I'm trying to figure out how to do angles.
What I'm thinking of is if some value is, say, 64 (the 256-degree equivalent of 90 degrees), it sets the x-velocity to the max and y-velocity to 0.  If that value is 128 it should set the y-vel to the max, x-vel zero, etc.

How would I go about doing this?

EDIT: answered on IRC.
.A is angle, 256 degrees
.M is max velocity
cos(A)*2**M→(x-vel)

Then determine Y-velocity based on that.
Title: Re: Axe Q&A
Post by: Builderboy on December 21, 2011, 11:33:16 pm
Cos(angle) for the X velocity and Sin(angle) for the Y velocity?
Title: Re: Axe Q&A
Post by: Darl181 on December 21, 2011, 11:35:06 pm
Hm that makes sense actually..I was thinking it might be something really simple like this but didn't know what it would be :P
tho I prolly should have known after taking algebra II...idk :\
Title: Re: Axe Q&A
Post by: calc84maniac on December 21, 2011, 11:50:03 pm
Rather than computing Y velocity based on X velocity, it might be better to just do sin(A)*2**M→(y-vel)
Title: Re: Axe Q&A
Post by: jacobly on December 22, 2011, 12:12:23 am
Here is an example program that might help:
Code: [Select]
:.VELOCITY
:192→θ .begin facing up
:0.0→V .begin stationary
:47.0→X .begin in the middle
:31.0→Y
:Repeat getKey(15)
:getKey(4)-getKey(1)+V→V .press up/down to speed up/slow down
:getKey(3)-getKey(2)+θ→θ .press left/right to turn left/turn right
:cos(θ)*2**V+X^96.0→X .use V and θ to change position
:sin(θ)*2**V+Y^64.0→Y
:Pxl-On(X/256,Y/256)
:DispGraphClrDraw
:End
Title: Re: Axe Q&A
Post by: Yeong on December 30, 2011, 01:29:48 pm
is there a way to shift the portion of the buffer? (Rectangular region will be fine.)
Title: Re: Axe Q&A
Post by: ztrumpet on December 30, 2011, 02:50:54 pm
Are you talking at an arbitrary spot, or can it be in multiples of 8 pixels in the X direction?  It's quite easy if the X can be in multiples of 8, but a little more difficult if you need to mask off parts of bits.
Title: Re: Axe Q&A
Post by: MGOS on December 31, 2011, 08:25:09 am
Another question about number input:

I need a function in my program that checks if a number key from 1 - 8 is pressed. It should return the a value between 1 and 8, or 0 if none of them is pressed. I already looked at the number input routine, but it isn't that what I need.
Would you recommend a LUT, a mathematical way or only some Ifs and Elses?
Title: Re: Axe Q&A
Post by: ztrumpet on December 31, 2011, 11:20:48 am
I recommend using inData.  Yesterday I wrote some code to do the exact thing you talk about, only with the numbers 0 through 9, and it looks like this:

While 1
EndIf inData(getKey,Data(33,34,26,18,35,27,19,36,28,20,0))->r1


This gives you the number of the key pressed plus one, stored in r1.  If my condensed code doesn't make sense to you, here's an uncompressed version:

Data(33,34,26,18,35,27,19,36,28,20,0)->GDB0
While 1
getKey->K
inData(K,GDB0)->r1
EndIf r1


You could easily modify it to suit your needs, and while you do it I hope you figure out how it works.  InData is a very useful and powerful command, though it is a bit advanced. If you need more help with it, check out this post: http://ourl.ca/4129/114828

Edit:  In response to your question, I am using a LUT, but accessing it through InData for some great space savings (assuming you use InData more than once or twice in your program).
Title: Re: Axe Q&A
Post by: MGOS on December 31, 2011, 11:52:30 am
Wow, this is exactly what I needed - thanks!

But how can I handle the other possible keypresses? Should I change everything to getkey->K and check the other possibilities with the inData, or can I leave the getkey()?

This
Code: [Select]
Repeat getkey(15)
getkey->K
inData(K,Number-Possibilities)->N
if N<9 + N
do number stuff
elseif getkey(whatever)
do other stuff
elseif getkey(whatever)
do other stuff
End
End
Or that:
Code: [Select]
0->K
Repeat K=15
getkey->K
inData(K,All Possibilities)->N
if N<9 + N
do number stuff
elseif N=whatever
do other stuff
elseif N=whatever
do other stuff
End
End
Title: Re: Axe Q&A
Post by: ztrumpet on December 31, 2011, 12:17:27 pm
It depends.  What are you using this for?  If this is for a menu or text input, I'd go with getKey, but if this is for part of the main engine for a game I'd go with getKey(#) and make eight of them in If statements.
Title: Re: Axe Q&A
Post by: MGOS on December 31, 2011, 12:32:32 pm
It's more like an editor, so I think getkey->K is good for this. But if I used both functions, would they still work both fine?
Title: Re: Axe Q&A
Post by: ztrumpet on December 31, 2011, 01:05:52 pm
It's more like an editor, so I think getkey->K is good for this. But if I used both functions, would they still work both fine?
They'd work fine, but I'd stick to one or the other for a more standard appearance.
I think getKey->K is the best solution too.

Good luck with the editor.
Title: Re: Axe Q&A
Post by: Darl181 on December 31, 2011, 01:37:21 pm
Ok I have a feeling I'd be able to firgure this out myself, but it would prolly take a while since I don't remember much from math :P

Anyway, so I have a projectile flying at (S,T) with an angle, Z.  If Z is zero it faces straight down, 256 degrees, etc.
I have an enemy at, say, (X,Y).  How would I check which side of the projectile the enemy is on (right or left), related to the projectile's angle?
Title: Re: Axe Q&A
Post by: jacobly on December 31, 2011, 02:06:55 pm
Data(33,34,26,18,35,27,19,36,28,20)->GDB0
While 1
getKey->K
inData(K,GDB0)->r1
EndIf r1

Data(33,34,26,18,35,27,19,36,28,20,0)->GDB0
While 1
getKey->K
inData(K,GDB0)->r1
EndIf r1

Fixed.

Ok I have a feeling I'd be able to firgure this out myself, but it would prolly take a while since I don't remember much from math :P

Anyway, so I have a projectile flying at (S,T) with an angle, Z.  If Z is zero it faces straight down, 256 degrees, etc.
I have an enemy at, say, (X,Y).  How would I check which side of the projectile the enemy is on (right or left), related to the projectile's angle?
tan⁻¹(S-X,T-Y)-Z^256<128 should be true if the projectile needs to rotate in the positive direction.
tan⁻¹(S-X,T-Y)-Ze0 is optimized but returns the opposite.
Title: Re: Axe Q&A
Post by: ztrumpet on December 31, 2011, 02:25:52 pm
Data(33,34,26,18,35,27,19,36,28,20)->GDB0
While 1
getKey->K
inData(K,GDB0)->r1
EndIf r1

Data(33,34,26,18,35,27,19,36,28,20,0)->GDB0
While 1
getKey->K
inData(K,GDB0)->r1
EndIf r1

Fixed.
Good catch.  Thank you!
Title: Re: Axe Q&A
Post by: Builderboy on December 31, 2011, 03:33:05 pm
tan⁻¹(S-X,T-Y)-Z^256<128 should be true if the projectile needs to rotate in the positive direction.
tan⁻¹(S-X,T-Y)-Ze0 is optimized but returns the opposite.
If you had the X and Y velocity (we'll call A,B) instead of an angle, you could ditch the slow trigonometry and use cross products instead!

Code: [Select]
X-S*B-(Y-T*A)<<0
Title: Re: Axe Q&A
Post by: BlakPilar on January 06, 2012, 10:14:36 pm
How does Axe handle sprites whose lengths are greater than 16? For example, if I had [AA00AA00AA00AA0032BB32BB32BB32BB] would it be displayed horizontally as two sprites, vertically as two sprites, or some other way completely?
Title: Re: Axe Q&A
Post by: Darl181 on January 06, 2012, 10:18:13 pm
Pt-*() displays the next 8 bytes after the pointer.  So, if you wanted that to display them, one after the other, you would have to display it 8 bytes at a time:
[AA00AA00AA00AA0032BB32BB32BB32BB]→Pic1
.stuff, etc
Pt-On(X,Y,Pic1)
Pt-On(X+8,Y,Pic1+8)


Title: Re: Axe Q&A
Post by: BlakPilar on January 06, 2012, 10:40:45 pm
Ahh, okay. So [AA00AA00AA00AA0032BB32BB32BB32BB] is equivalent to [AA00AA00AA00AA00][32BB32BB32BB32BB]?
Title: Re: Axe Q&A
Post by: Builderboy on January 06, 2012, 10:57:20 pm
If two calculators were connected via linkport and both running Axe programs, and 1 calculator wrote 1 into the Port, and the other wrote a 2 into the port, what would each calculator read the port as?  I know the result can be determined by some sort of binary combination of the two numbers but I can't remember which.
Title: Re: Axe Q&A
Post by: Darl181 on January 06, 2012, 11:07:01 pm
So [AA00AA00AA00AA0032BB32BB32BB32BB] is equivalent to [AA00AA00AA00AA00][32BB32BB32BB32BB]?
Yes.
Title: Re: Axe Q&A
Post by: jacobly on January 07, 2012, 10:24:50 am
If two calculators were connected via linkport and both running Axe programs, and 1 calculator wrote 1 into the Port, and the other wrote a 2 into the port, what would each calculator read the port as?
0

I know the result can be determined by some sort of binary combination of the two numbers but I can't remember which.
(A or B) xor 3 or equivalently 3-(A or B)
Title: Re: Axe Q&A
Post by: parserp on January 08, 2012, 01:04:53 am
Does axe have buffer support for text? Cause I can't do:

Code: [Select]
:Text(X,Y,"Stuff"[sup]r[/sup]
Title: Re: Axe Q&A
Post by: Darl181 on January 08, 2012, 01:07:27 am
No, Text() can only write to L6.  It's hard-coded into the routine.
Title: Re: Axe Q&A
Post by: parserp on January 08, 2012, 01:09:23 am
No, Text() can only write to L6.  It's hard-coded into the routine.
Dang. I'll have to do some tricky buffer copying. :)
Title: Re: Axe Q&A
Post by: Quigibo on January 08, 2012, 03:34:17 am
Blame TI for that.  If you want to draw directly to the back-buffer, you'd have to make your own font routine, which is easy, but takes forever to get all those letter/number/symbol sprites as well as a lot of space in the program itself.  But sometimes a kick-ass font can really improve a game's look! :D
Title: Re: Axe Q&A
Post by: Darl181 on January 08, 2012, 03:19:15 pm
With Z-Select, does it Goto the label or does it run it as a subroutine?
Title: Re: Axe Q&A
Post by: Builderboy on January 08, 2012, 07:44:45 pm
I know the result can be determined by some sort of binary combination of the two numbers but I can't remember which.
(A or B) xor 3 or equivalently 3-(A or B)
Wait so even if both calculators input the same number to Port (0 and 0 say), they would each read the inverse of that number (3) ?  That's weird D:

With Z-Select, does it Goto the label or does it run it as a subroutine?
It Goto's the Label
Title: Re: Axe Q&A
Post by: Happybobjr on January 08, 2012, 10:29:55 pm
That sounds useful!
what do you mean the inverse?
Title: Re: Axe Q&A
Post by: Builderboy on January 08, 2012, 10:45:29 pm
Binary inverse, as in all the bits get flipped.  The result read depends on how Axe treats the output of the Port, as well as how the Ports interact.  I was under the impression there was some sort of logical equation, but I also thought that if both calcs agreed on an output number, the input read would be equal to that number.
Title: Re: Axe Q&A
Post by: parserp on January 09, 2012, 08:09:55 pm
Do you have to do something special to write to a GDB?
I tried using this one line in my code and I got an ERR:UNDEFINED

Copy(L1,GDB1,768)
Title: Re: Axe Q&A
Post by: Builderboy on January 09, 2012, 08:45:32 pm
You don't need to do anything special (unless you are writing an app, in which case it won't work) but you need to have GDB1 defined already.  Do you?
Title: Re: Axe Q&A
Post by: Yeong on January 09, 2012, 08:49:32 pm
I thought L1 was smaller than 768 bytes?
Title: Re: Axe Q&A
Post by: epic7 on January 09, 2012, 08:50:31 pm
L1 is 714 bytes says the axe commands list.
Title: Re: Axe Q&A
Post by: ztrumpet on January 09, 2012, 09:07:30 pm
I thought L1 was smaller than 768 bytes?
If you first Realloc the variables it makes L1 768 bytes.  Perhaps he did that.
Title: Re: Axe Q&A
Post by: chattahippie on January 09, 2012, 10:12:33 pm
No, Text() can only write to L6.  It's hard-coded into the routine.
Dang. I'll have to do some tricky buffer copying. :)

DispGraph(L3, L6)r should work unless Axe doesn't allow the buffers to be switched
Title: Re: Axe Q&A
Post by: Darl181 on January 09, 2012, 10:14:38 pm
That should work.
The only other way I can think of is to have l6 blank, write the text, and copy the buffer to L3 or something.
Title: Re: Axe Q&A
Post by: parserp on January 09, 2012, 10:34:05 pm
You don't need to do anything special (unless you are writing an app, in which case it won't work) but you need to have GDB1 defined already.  Do you?
I don't think so, what do I have to do to make it defined?
Title: Re: Axe Q&A
Post by: leafy on January 09, 2012, 10:35:54 pm
Buff(768)->GDB1, or something like that.
Title: Re: Axe Q&A
Post by: Deep Toaster on January 09, 2012, 10:37:47 pm
Anything that ends in →GDB1 defines GDB1 (a pointer).
Title: Re: Axe Q&A
Post by: parserp on January 09, 2012, 10:38:08 pm

Buff(768)->GDB1, or something like that.
Anything that ends in →GDB1 defines GDB1 (a pointer).
ah, ok.
thanks. :D
Title: Re: Axe Q&A
Post by: Builderboy on January 09, 2012, 10:49:16 pm
Just make sure that you define GDB1 with having enough memory, because if you do something like [0000]->GDB1 and then try to copy 768 bytes into GDB1, you will end up overwriting a whole bunch of data, since GDB1 is not being resized
Title: Re: Axe Q&A
Post by: parserp on January 12, 2012, 10:16:01 pm
which is faster?

this:
Code: [Select]
:Rect(0,0,96,64)
:RectI(1,1,94,62)

or this:
Code: [Select]
:Rect(0,0,94,62
:For(J,1,94
:For(K,1,62
:Pxl-Off(J,K
:End
:End

^^^note that I'm trying to get a border around the screen. I'm not worried about size, just speed.
Title: Re: Axe Q&A
Post by: chattahippie on January 12, 2012, 10:45:47 pm
I would use
Code: [Select]
RectI(0,,+96,-32)
RectI(1,,+93,-32)
Title: Re: Axe Q&A
Post by: Builderboy on January 12, 2012, 10:50:21 pm
which is faster?

this:
Code: [Select]
:Rect(0,0,96,64)
:RectI(1,1,94,62)

or this:
Code: [Select]
:Rect(0,0,94,62
:For(J,1,94
:For(K,1,62
:Pxl-Off(J,K
:End
:End

^^^note that I'm trying to get a border around the screen. I'm not worried about size, just speed.

The first would be much faster.  Also, chattahippie that code you posted doesn't do the same thing.  Yours creates an empty rectangle with inverted borders.  Parser's code creates a white rectangle with filled borders.
Title: Re: Axe Q&A
Post by: chattahippie on January 12, 2012, 10:53:26 pm
The first would be much faster.  Also, chattahippie that code you posted doesn't do the same thing.  Yours creates an empty rectangle with inverted borders.  Parser's code creates a white rectangle with filled borders.
True, I was assuming parser was starting from a blank screen
Title: Re: Axe Q&A
Post by: Runer112 on January 12, 2012, 11:47:43 pm
You started out pretty good with 68,006 cycles

Rect(0,0,96,64)
RectI(1,1,94,62)


Then you went way in the wrong direction with 2,614,503 cycles D:

Rect(0,0,96,64)
For(J,1,94)
For(K,1,62)
Pxl-Off(J,K)
End
End


And here's my Runer-optimized™ speed/size blend, coming in at 16,303 cycles; that's faster than ClrDraw! :evillaugh:

ᴇ80FF→{L₆+11}ʳ
Copy(L₆+11,-1,11)ʳ
Copy(,L₆+756,12)
ᴇ0100→{L₆+22}ʳ
Copy(L₆+22,-1,9)ʳ
Copy(-1,+12,61*12)
Title: Re: Axe Q&A
Post by: C0deH4cker on January 13, 2012, 04:47:09 pm
Super fast and completely obfuscated. Classic Runer-optimizedTM unreadable axe code.
Title: Re: Axe Q&A
Post by: parserp on January 13, 2012, 04:54:44 pm
Wow thanks guys O.O

also, I like the Runer-optimizedTM unreadable code. :D
Title: Re: Axe Q&A
Post by: Freyaday on January 13, 2012, 06:54:46 pm
Runer, quick, I need a white rectangle with a 2px black border!
Title: Re: Axe Q&A
Post by: Runer112 on January 13, 2012, 06:56:26 pm
ᴇC0FF→{L₆+23}ʳ
Copy(L₆+23,-1,23)ʳ
Copy(,L₆+744,24)
ᴇ0300→{L₆+34}ʳ
Copy(L₆+34,-1,9)ʳ
Copy(-1,+12,59*12)
Title: Re: Axe Q&A
Post by: leafy on January 13, 2012, 06:58:31 pm
Runer! Quick! How does that even work?
Title: Re: Axe Q&A
Post by: Runer112 on January 13, 2012, 07:08:46 pm
.Draw a byte of top border (88-95,1)
.Draw a byte of left border (0-7,2)
ᴇC0FF→{L₆+23}ʳ

.Copy byte (88-95,1) of top border to draw rest of top border (0-87,1) and (0-95,0)
Copy(L₆+23,-1,23)ʳ

.Copy byte (0-7,0) of top border to draw bottom border (0-95,62) and (0-95,63)
Copy(,L₆+744,24)

.Draw byte of right border (94-95,2)
.Draw byte of middle (80-93,2)
ᴇ0300→{L₆+34}ʳ

.Copy byte (80-87,2) of middle to rest of third row middle (8-79,2)
Copy(L₆+34,-1,9)ʳ

.Copy third row (0-95,2) to fourth through sixty-second rows (0-95,3-61)
Copy(-1,+12,59*12)
Title: Re: Axe Q&A
Post by: C0deH4cker on January 13, 2012, 07:21:13 pm
 *.*

I understand it sort of now that youve explained it, but i must say that im shocked that you can come up with code like this.
Title: Re: Axe Q&A
Post by: Freyaday on January 13, 2012, 09:16:17 pm
/me is in Awe
Title: Re: Axe Q&A
Post by: chattahippie on January 15, 2012, 04:51:10 pm
Can you optimize:
Code: [Select]
X*4->Y
!If Y=4
.stuff
End
to:
Code: [Select]
X*4->Y
!If =4
.stuff
End
Title: Re: Axe Q&A
Post by: Runer112 on January 15, 2012, 04:54:12 pm
Yes, that is a perfectly valid optimization. However, with the introduction of the peephole optimizer in Axe 1.0, Axe will perform simple optimizations like that automatically so you don't have to. ;)
Title: Re: Axe Q&A
Post by: Darl181 on January 15, 2012, 08:48:10 pm
Is Axe supposed to check for pairing of types of parenthesis?  Because I had a bug because of an on-calc typo of something like If {A}=2 or ({A}=5) or ((A}=8) and it compiled without error.
Title: Re: Axe Q&A
Post by: Quigibo on January 15, 2012, 10:22:18 pm
Yeah this is more of a "Be lazy on purpose to make the parsing simpler with less error checking".  The right parentheis ) and } are identical in nearly every situation.  However, left parenthesis ( and { are obviously different.  When I said nearly, sometimes Axe checks for a specific kind of parenthesis so don't abuse this.  Also I could add error checking in later versions if there is ever ambiguity.

EDIT: For your specific example, the left parenthesis was the typo so it didn't work the way I presume you expected it to.
Title: Re: Axe Q&A
Post by: shmibs on January 27, 2012, 02:04:03 am
is there any way to draw a single column of pixels that's faster than drawing the same column with Pt-On(?
Title: Re: Axe Q&A
Post by: Hayleia on January 27, 2012, 12:02:52 pm
is there any way to draw a single column of pixels that's faster than drawing the same column with Pt-On(?
Maybe with a rectangle like Rect(X,0,96,1) or something (and if I didn't do any mistake) ?
Or maybe I didn't understand the question right -.-°

Also, I can't remember but do Bitmap clip ? Nvm, it does since 1.1.0
Title: Re: Axe Q&A
Post by: turiqwalrus on January 27, 2012, 12:12:50 pm
well, bitmap wouldn't help as much because we want is to be fast :P

and yes, I believe so.
Title: Re: Axe Q&A
Post by: Hayleia on January 27, 2012, 12:15:04 pm
Yes, but it is said here (http://ourl.ca/4060/270084)
Quote
Redesigned Bitmap() command is clipped, faster, and works with any buffer.
So it should be ok :)
Title: Re: Axe Q&A
Post by: jacobly on January 27, 2012, 12:25:09 pm
is there any way to draw a single column of pixels that's faster than drawing the same column with Pt-On(?
If you already use Rect( somewhere else, then you should use Rect(X,0,+1,63).
If you already use Line( somewhere else, then you should use Line(X,0,X,63).
If you use both, then I guess the above Rect( command is slightly smaller.
Also, it seems that Rect( is 47 cycles faster (about how long it takes to subtract two variables).
Title: Re: Axe Q&A
Post by: Runer112 on January 27, 2012, 12:48:16 pm
Rect() is a good amount faster at drawing horizontal or vertical lines than Line(). Pretty much, you'd only not want to use Rect() if speed is not critically important and you already use Line() in your program, but not Rect(). This would save some size by not having to include the 113-byte rectangle routine.

Method   Speed (cycles)   Code size (bytes)   Routine size (bytes)
Rect(X, and 0,+1, or 255)331514113
Line(X, and 0,X,63)609417140
Title: Re: Axe Q&A
Post by: zero44 on January 27, 2012, 02:21:44 pm
I already asked this question in another topic, but how can we simply use the port commands to easily send and receive datas to/from  another calculator ?
And does it works between two different types of calcs, like 83+ & 84+SE ?
Title: Re: Axe Q&A
Post by: Builderboy on January 27, 2012, 03:38:19 pm
What kind of data are we talking about?  Axe has built in Send() and Get() commands for sending bytes over the link port, but anything that was restricted to only using Port() to send bytes would basically be rewriting those commands.  Why do you need to use the Port command instead of using the Send() and Get() commands? 

Oh and the link port communication works across all Ti83+ through Ti84+SE if I remember correctly.
Title: Re: Axe Q&A
Post by: Darl181 on January 28, 2012, 05:12:06 pm
So I want to use SMC to store high scores directly into a program, in a way that they'll remain after writeback.  How many bytes into the program would I write to not be editing the wrong part?
Or would simply writing to a static pointer i.e. GDB1 work?
Title: Re: Axe Q&A
Post by: Builderboy on January 28, 2012, 05:22:02 pm
writing to a static pointer would be the only way to safely write to your own program data, and that's as simple as, well, writing to the static pointer! ;D Just know that programs don't always get written back.  Homescreen games do not get written back, and Mirage/Doors games only get written back based on a user setting.  Appvars would be my way to go, any reason you don't want to use them?
Title: Re: Axe Q&A
Post by: Yeong on January 28, 2012, 07:48:51 pm
I just looked at parser's rectangle drawing stuff, and I'm just curious.
How many cycles does this take? This still draws rectangle.
DrawInv
RectI(1,1,94,62
Title: Re: Axe Q&A
Post by: Darl181 on January 31, 2012, 11:23:02 pm
Not sure, runer made a topic somewhere about the size/speed of the commands tho.
http://ourl.ca/8693 (attached pdfs)


When using Disp or Text, is there a command to have it display negative numbers properly?  Ie instead of displaying 32768 (or 32767?) it would display -1, etc.

Also is there a way to get the current pen location?  How about on the homescreen?
Title: Re: Axe Q&A
Post by: jacobly on January 31, 2012, 11:43:05 pm
To display a signed number, you can do:
Code: [Select]
:Lbl DspSI
:!If r₁≥≥0
:−r₁➔r₁
:Disp '⁻'▸Char
:End
:Disp r₁▸Dec
:Return

As for the cursor and pen locations, it's usually easier to keep track of them yourself. If you really need to get them, I guess you could do this:
Code: [Select]
:{ᴇ844B} .cursor row
:{ᴇ844C} .cursor column
:{ᴇ86D8} .pen row
:{ᴇ86D7} .pen column
Title: Re: Axe Q&A
Post by: Freyaday on February 01, 2012, 09:18:40 pm
Darl, if you really wanted to do smc, you'd have to put some extra space in your program, GetCalc("prgmSMC")->N and then look for the last C9h in the file.
Title: Re: Axe Q&A
Post by: Builderboy on February 01, 2012, 09:33:09 pm
Freyaday I'm unsure of what you mean?  All he has to do in order to do SMC in Axe is modify data already inserted into Axe.  Any old [Hex]->GDB0 will do, as long as the shell supports writeback.
Title: Re: Axe Q&A
Post by: Deep Toaster on February 02, 2012, 07:27:38 pm
If the shell doesn't support writeback or if the user is running from the home screen (and the program isn't archived), you can ensure SMC by saving once to the pointer and then to the same pointer relative to the original copy of the program (the one not being run).

To do that, you'd first have to find the original copy. It's best to do it at the very beginning of your program, because there you can take advantage of the fact that the program name is stored at an address called OP1 ($8478), so this will work regardless of whether the user renames it. Use this as the first line of your program:
Quote from: Axe
GetCalc(E8478)-E9D93→P
This finds the original copy of the currently running program, then subtracts $9D93; this number is where the running copy of the program is located, so P now holds the difference in address between the two programs.

Then, where you want SMC, you save to the local pointer (in the running copy, so it works with shells with writeback enabled) and to the appropriate spot in the original copy. For example, if you wanted to save 256 to a POINTER, you'd use something like this:
Quote from: Axe
256→{POINTER}r
256→{POINTER+GDB1)r
Spoiler For Optimizations:
Quote from: Axe
256→{GDB1}r→{P+GDB1)r
That line only works if the local pointer you're storing to—in this case GDB1—is constant, and you're storing two bytes. Otherwise, if you're storing to a two-byte variable address, use something like this:
Quote from: Axe
256→{A}r→{+P-1)r
The optimized version for a one-byte variable address, either variable or constant, is this:
Quote from: Axe
256→{POINTER}→{+P)
Title: Re: Axe Q&A
Post by: Builderboy on February 02, 2012, 07:40:00 pm
All this works only if the program isn't being run from archive though, correct?
Title: Re: Axe Q&A
Post by: calc84maniac on February 02, 2012, 10:17:57 pm
All this works only if the program isn't being run from archive though, correct?
That's true, but in that case you can check if GetCalc() fails.
Title: Re: Axe Q&A
Post by: Builderboy on February 02, 2012, 10:32:10 pm
In general though, it's good to let the user decide through the settings of their shell whether or not they want writeback in their own programs right?
Title: Re: Axe Q&A
Post by: Deep Toaster on February 02, 2012, 11:04:03 pm
In general though, it's good to let the user decide through the settings of their shell whether or not they want writeback in their own programs right?
My post is actually to make it work when people run the program from the homescreen, which would never write anything back otherwise since it makes a copy of the program to run. Shells almost always write back any program that's in RAM, anyway, and whether it writes back when the program's archived is still up to the user.
All this works only if the program isn't being run from archive though, correct?
That's true, but in that case you can check if GetCalc() fails.
I never check for that because unless the program's over 32 KB long, it would do anything since it's probably not writing to RAM. I guess it would help to tell the user that the modification failed, though.
Title: Re: Axe Q&A
Post by: Freyaday on February 02, 2012, 11:34:34 pm
My solution was w/o relying on shells and instead relied on a whole lot of stupid (on my part). I'm gonna go over there in that corner and beat myself with some SMC now.
Title: Re: Axe Q&A
Post by: parserp on February 03, 2012, 12:17:27 am
How would you get the size of an appvar?
such as:
Code: [Select]
GetCalc("appvSTUFF",Y0)
[see what the size of the appvar is]
Title: Re: Axe Q&A
Post by: Runer112 on February 03, 2012, 12:18:02 am
{Y0-2}r
Title: Re: Axe Q&A
Post by: parserp on February 03, 2012, 12:27:08 am
O.o I never thought it would be so easy. Thanks! :D
Title: Re: Axe Q&A
Post by: Deep Toaster on February 06, 2012, 03:32:23 pm
You would never have known it unless someone told you :) The two bytes before the data of all variables is its size information, which in the case of programs, appvars, strings, and equations is in bytes.
Title: Re: Axe Q&A
Post by: Dvorak227 on February 07, 2012, 10:01:40 pm
What is the most convenient way to time events in axe?  Like with the timing of framerate and keypress functions.  I guess what I am asking is is there a means of timing which is independent of the program, that is, is not slown (slowed?) down or sped up by varying amount of code to be executed?
Title: Re: Axe Q&A
Post by: Builderboy on February 07, 2012, 10:04:40 pm
You would want to look into interrupts, which allow your program to call a subroutine at regular intervals independently of what your own program is doing :D
Title: Re: Axe Q&A
Post by: Dvorak227 on February 08, 2012, 07:53:27 pm
Thanks, I'll see what they can do. :) Another thing I was wondering was if there is a way to access the calculators clock and use that as a means of timing, freeing up L2's dataspace. Is there a reference-able-by-pointer clock variable somewhere?
Title: Re: Axe Q&A
Post by: Builderboy on February 08, 2012, 08:14:52 pm
I don't know of any myself, as the crystal timers are Ti84 only, and they are only accessible by Port access, which would take some custom assembly code.  Another option would be to analyze what is causing your program to run at different speeds, and use that to your advantage.  If it is a case where different numbers of objects are causing your program to run at different speeds, you can use the number of objects as a crude estimate for how long each frame of simulation is taking.  What specifically is causing your program to run at different speeds?
Title: Re: Axe Q&A
Post by: Dvorak227 on February 09, 2012, 09:12:37 pm
Ah yea, I didn't think of that alternative.  A sprites apparent speed was being affected by code run during a key press.  I think I'm going to want to use L2 for data, so I'll see how this option works out.  Thanks for the help :)
Title: Re: Axe Q&A
Post by: Dvorak227 on February 10, 2012, 06:40:55 pm
The copy command, it doesn't perhaps work to shift data, like one byte over, does it?  Probably have to make a temporary copy, no?
Title: Re: Axe Q&A
Post by: leafy on February 10, 2012, 06:48:54 pm
Copy(r1,r1+1,length){^r}

IIRC where r1 is the end of the array
Title: Re: Axe Q&A
Post by: Dvorak227 on February 10, 2012, 06:56:08 pm
*facepalm*  Didn't see that command there!  Sorry for the bother :-\
Title: Re: Axe Q&A
Post by: Dvorak227 on February 12, 2012, 03:05:51 pm
I've been having some* trouble with the copy command.  At least I think it's the copy command.  Does it have any bugs or quirks that would cause unexpected behavior?  like not being able to use it in a subroutine, or use custom named variables within the command, etc? 
Title: Re: Axe Q&A
Post by: Darl181 on February 12, 2012, 03:06:53 pm
For the Copy() command and some similar to it (Fill Exch etc), you don't need to use the curly brackets for pointers.  Afaict everything else is normal tho.
Title: Re: Axe Q&A
Post by: Builderboy on February 12, 2012, 04:01:22 pm
I've been having some* trouble with the copy command.  At least I think it's the copy command.  Does it have any bugs or quirks that would cause unexpected behavior?  like not being able to use it in a subroutine, or use custom named variables within the command, etc? 
Post the context in which you are using it, maybe we can see what might be going wrong.
Title: Re: Axe Q&A
Post by: Dvorak227 on February 12, 2012, 05:49:52 pm
Code: [Select]
12->SizeX
8->SizeY
copy(SizeX*SizeY->P-1+L1->N,N+SizeX,P)[sup]r[/sup]
Fill(L1,SizeX,2)

What I want it to do is shift the tilemap data at L1 SizeX bytes to the right.  It doesn't appear to do this... and exiting after running this bit of code in my program causes the home screen to glitch up (it displays input characters not where they should be, if it displays them at all), until I enter and exit a selection menu (like the program menu).  Some of my other attempts at it have resulted in ram clears :(  The screen does not glitch if that code is commented out.  What is going on? ???
Title: Re: Axe Q&A
Post by: Builderboy on February 12, 2012, 06:08:25 pm
The way copy(A,B,L)r works, is you copy from location A to location B, then you copy from location A-1 to B-1, and so on for L times.  Is this the behavior you were expecting or were you expecting it to go forwards?  From the looks of your code, you will eventually be copying to addresses that come before L1, which is probably causing the errors you are experiencing.  I tried it myself without custom variables and it crashed for me too.
Title: Re: Axe Q&A
Post by: Dvorak227 on February 12, 2012, 06:27:22 pm
hmm...  that is the way I thought it worked, but am I copying to addresses before L1?  Replacing the variables with numbers:

Code: [Select]
copy(95+L1,107+L1,96)r

As I understand it, or as I don't understand it, from location 95+L1-95 to 107+L1-95 is the last write the command performs.  But least it crashed for you too (I'm not crazy! :w00t:)
Title: Re: Axe Q&A
Post by: DJ Omnimaga on February 12, 2012, 06:31:20 pm
On an off-topic note welcome to the forums. May you have more success than me in Axe programming ;D
Title: Re: Axe Q&A
Post by: Dvorak227 on February 12, 2012, 06:36:57 pm
Hey thanks! But I don't think I'm that good yet.
Title: Re: Axe Q&A
Post by: Builderboy on February 12, 2012, 06:47:50 pm
I can't figure out what is going wrong >.< You might want to hop over to the bug reports and see if anybody familiar with the inner workings of the Copy() function can help figure out what is going wrong.
Title: Re: Axe Q&A
Post by: ZippyDee on February 12, 2012, 06:48:36 pm
I can't figure out what is going wrong >.< You might want to hop over to the bug reports and see if anybody familiar with the inner workings of the Copy() function can help figure out what is going wrong.
Check the bug reports. Runer just posted the issue.
Title: Re: Axe Q&A
Post by: DJ Omnimaga on February 12, 2012, 06:58:47 pm
Hey thanks! But I don't think I'm that good yet.
Oh I meant I only ever finished 2 games in Axe and they were Avalanche/Tunnel type clones. :P You'll most likely get further than that :)
Title: Re: Axe Q&A
Post by: Dvorak227 on February 12, 2012, 07:07:42 pm
That was fast, thanks ZippyD.  Although I don't know what he is talking about specifically.  Glad that it was noticed.  Would downgrading to axe 1.0.4 work as a temporary fix?

@ DJ_O:  I hope to with my current project, but methinks you should give it another try!
Title: Re: Axe Q&A
Post by: DJ Omnimaga on February 12, 2012, 07:11:59 pm
Yeah I just kinda lost the patience with programming over the years, since I was more into game design than programming. D: I guess after 10 years I just kinda lost interest and went back into music. But we never know one day. :P
Title: Re: Axe Q&A
Post by: Runer112 on February 12, 2012, 07:15:34 pm
As a temporary fix, I would suggest putting a +1 before the variable in the final argument, like this:

Copy(SizeX*SizeY→P-1+L1→N,N+SizeX,+1P)r

I know it looks strange, but the issue is a faulty optimization that relies on the final argument being just a variable, so putting in that +1 avoids the optimization with minimal size cost (1 byte). And yes, that is valid syntax. Axe has very loose syntax rules. ;)
Title: Re: Axe Q&A
Post by: Happybobjr on February 12, 2012, 07:17:48 pm
or just press zoom while compiling would work, wouldn't it?

then he wouldn't have to remember about removing that after axe is fixed.
Title: Re: Axe Q&A
Post by: Dvorak227 on February 12, 2012, 08:07:47 pm
well, it's not crashing, but I don't think it's working either...  Now is this one my fault?

EDIT:  Downgraded to 1.0.4 for now, appears to be working.  Thanks for the help, all :)
Title: Re: Axe Q&A
Post by: parserp on February 16, 2012, 05:35:01 pm
A random question that I have been wondering:

does the peephole optimizer optimize stuff like this?

Code: [Select]
:A-(-[negative]2)->A
Title: Re: Axe Q&A
Post by: Darl181 on February 16, 2012, 08:44:52 pm
Was the problem of Pause 0 freezing the calc for 30-something seconds ever fixed, or does it still act like Pause 65536?
Title: Re: Axe Q&A
Post by: jacobly on February 16, 2012, 09:00:48 pm
A random question that I have been wondering:

does the peephole optimizer optimize stuff like this?

Code: [Select]
:A-(-[negative]2)->A

Axe already optimizes something like A−⁻2➔A even without peephole opts :D
(As long as you leave off the parenthesis)

Was the problem of Pause 0 freezing the calc for 30-something seconds ever fixed, or does it still act like Pause 65536?

Yes, Pause 0 acts like Pause 65536. You can avoid this by doing something such as
Code: [Select]
:If A
:Pause
:End
or if you use it multiple times
Code: [Select]
:Lbl Pause
:Return!If
:Pause
:Return
Title: Re: Axe Q&A
Post by: Quigibo on February 17, 2012, 05:03:03 am
Was the problem of Pause 0 freezing the calc for 30-something seconds ever fixed, or does it still act like Pause 65536?
Thanks for bringing that up!  I agree that its annoying, and so I have finally fixed the problem :)  However, as a result, the timing of the pause has changed slightly.  In the new pause, 0 is like the old 1, 1 is like the old 2, etc.  Basically, it pauses one more unit longer than before, which is usually unnoticeable and so you won't have to change your code.
Title: Re: Axe Q&A
Post by: Darl181 on February 17, 2012, 10:38:43 am
Great! :D

Another q: How long does a Pause need to be to let the key delay settle down?  I have While getKey(0):End (with a newline instead of a colon ofc) as part of a menu and sometimes it skips options :/
Title: Re: Axe Q&A
Post by: Runer112 on February 17, 2012, 11:22:49 am
For menus, I think you would be better off using getKey or even getKeyr to detect keypresses. With these commands, keys except the arrow keys (and DEL I believe, but that's not really important) would only register once per physical keypress, and the arrow keys will repeat like how they do in OS contexts.

Although if you want to go with the getKey() method, I would go along the guideline that Pause 1800 approximately equals one second at 6MHz and Pause 4500 approximately equals one second at 15MHz. Alternatively, after handling a keypress, wait for all keys to be released before waiting for the next keypress:

Code: [Select]
While 1
.WAIT FOR KEYS TO BE RELEASED
End!If getKey(0)
While 1
.WAIT FOR A KEYPRESS
EndIf getKey(0)
Title: Re: Axe Q&A
Post by: MGOS on February 18, 2012, 11:19:28 am
Questions about interrupts:
Are the interrupt calls depending on the length of the interrupt function? So if the time of execution of an interrupt is longer than the time beetween the interrupts, will then the current interrupt abort, will the program skip the next interupt or will it be executed right after it is finished?

Secondly, why stops the counter in this program on a real calculator (the program still runs until you press clear), but on the emulator in counts forever?
Code: [Select]
FnOn
Fix 5
0->C
fnInt(IN,0)
ClrDraw
Repeat getkey(15)
  Text(0,0,C>Dec
  DispGraph
End
LnReg
Fix 4
Return

Lbl IN
  C++
Return
Title: Re: Axe Q&A
Post by: Yeong on February 18, 2012, 11:23:50 am
Question:
Is there a way to "jump" to other program from the other program?
Title: Re: Axe Q&A
Post by: chattahippie on February 18, 2012, 12:22:09 pm
Yeah, there is! (http://ourl.ca/15239)
Title: Re: Axe Q&A
Post by: MGOS on February 20, 2012, 01:12:34 pm
Is there a there an arbitary exponentiation operator in axe, or just with 2 as base?
Title: Re: Axe Q&A
Post by: aeTIos on February 20, 2012, 01:13:12 pm
no, just do 2*2*2*2 (as many times as ya want)
Title: Re: Axe Q&A
Post by: MGOS on February 20, 2012, 01:14:23 pm
Ok, then I have to do things differently, 'cause the base is 3/4 and the power/exponent is a variable.
Title: Re: Axe Q&A
Post by: aeTIos on February 20, 2012, 01:16:40 pm
Hm.
Code: [Select]
[base]->A->C
[exponent]->B
for(theta,0,B)
A*C->C
end
that'll do it but watch out with numbers over 65535.
Title: Re: Axe Q&A
Post by: MGOS on February 20, 2012, 01:23:56 pm
Yeah, that's the way I thought about too.
Title: Re: Axe Q&A
Post by: Darl181 on February 22, 2012, 11:46:22 am
Can I GetCalc() to the same file twice and not have any weird stuff happen?  Also if I know for a fact that the var exists can I just do GetCalc(Str0,Y1) to correct where it points after unarchiving and re-archiving it?

Edit: nvm, answered my own q's, both yes
I guess sc messed something up again, I typed it in myself and it worked perfectly unlike before :/
Title: Re: Axe Q&A
Post by: Deep Toaster on February 27, 2012, 10:38:54 pm
Are the interrupt calls depending on the length of the interrupt function? So if the time of execution of an interrupt is longer than the time beetween the interrupts, will then the current interrupt abort, will the program skip the next interupt or will it be executed right after it is finished?
Nope, and that's why interrupts can't take too long, or else it'll keep firing interrupt after interrupt and never return to the program.
Title: Re: Axe Q&A
Post by: MGOS on February 28, 2012, 01:56:03 am
Nope, and that's why interrupts can't take too long, or else it'll keep firing interrupt after interrupt and never return to the program.
Ok... I tried this and I could abort the program with long interrupts... maybe it was just luck  ::)

Still, has somebody a solution for my other question?
Title: Re: Axe Q&A
Post by: Quigibo on February 28, 2012, 02:48:20 am
@MGOS
Well first of all, if I assume n is positive, (3/4)^n is going to be less than 1.  So I believe it is a fair assumption that you want a fixed point output.  Given this, we can start be rewriting it as (0.75^n).  Raising a number to a power is just multiplying it over and over so you can simply perform the nieve method of starting with 1.0->A and for n times do A**0.75->A.  You can also take the more optimized approach of successive squaring which only takes log(n) multiplications.  If n is negative, its the same algorithm, but you use (4/3) or (1.333) as the base.
Title: Re: Axe Q&A
Post by: MGOS on February 28, 2012, 10:30:41 am
@Quigibo:
I found another solution with a 240 byte LUT, which is a lot faster and other calculation can be integrated as well without taking any more memory.

Btw, I didn't think about that question, I thought about the program example with the interrupts were the counter suddenly stops...
Title: Re: Axe Q&A
Post by: TI-Over9000 on March 02, 2012, 12:28:22 pm
Q: how did Axe get its name?  My friend programs in axe and it looks really cool and I want to learn.  I have been learning for a while but my friend is not very good at it.
Title: Re: Axe Q&A
Post by: Yeong on March 04, 2012, 12:34:32 pm
I'm just wondering, but is there a way to compile axe from the program?
Title: Re: Axe Q&A
Post by: Hayleia on March 04, 2012, 12:35:28 pm
Yes if you use zStart.
There is even an option "Compile, launch and come back to the editor".
Title: Re: Axe Q&A
Post by: Yeong on March 04, 2012, 12:36:19 pm
I meant without any shells and stuff. D:
Title: Re: Axe Q&A
Post by: Darl181 on March 04, 2012, 12:43:26 pm
If you mean compile just after quitting from the editor, then no; Axe can't do that on its own.
As mentioned Zstart can do that sort of thing, tho.
Title: Re: Axe Q&A
Post by: Deep Toaster on March 04, 2012, 04:29:13 pm
If you mean making a program that makes Axe compile a program, that's possible (there must be an entry point because zStart does it, anyway).

You should ask Quigibo (or someone who's done it, like thepenguin77) about it.
Title: Re: Axe Q&A
Post by: MGOS on March 05, 2012, 12:49:33 am
Just because I'm curios and this is quite odd, but is it possible to edit the bits of a variable using the Pxl-Command on arbitary buffers?
For example we want A to be 10000100, can we do
Code: [Select]
0->A
Pxl-On(0,0,°A)
Pxl-On(5,0,°A)
???

I know this isn't very efficient, but can you do that?
Title: Re: Axe Q&A
Post by: Quigibo on March 05, 2012, 03:45:19 am
Yes, I believe that should work, that's a cool application for pixel buffering :)  Keep in mind that numbers are stored little endian though and so the "pixel coordinates" for X in 0-7 are actually the low byte and 8-15 is the high byte.
Title: Re: Axe Q&A
Post by: MGOS on March 05, 2012, 10:00:48 am
Yes, I believe that should work, that's a cool application for pixel buffering :)  Keep in mind that numbers are stored little endian though and so the "pixel coordinates" for X in 0-7 are actually the low byte and 8-15 is the high byte.
Ok, thanks. I came up with this idea planning a maze generator were setting bits of variables is necessary, but I just go with adding numbers each time.
Title: Re: Axe Q&A
Post by: C0deH4cker on March 05, 2012, 07:29:19 pm
Use eulers 'e' to access individual bits. You can also use bit masking combined with shifting left/right (* or / by 2) to read/write bits.
Title: Re: Axe Q&A
Post by: Builderboy on March 05, 2012, 08:00:49 pm
Use eulers 'e' to access individual bits. You can also use bit masking combined with shifting left/right (* or / by 2) to read/write bits.
You can only use e to read bytes, not write.  His method was a way to set, reset, and toggle individual bits in an intuitive way that didn't require masking :D
Title: Re: Axe Q&A
Post by: parserp on March 06, 2012, 05:29:21 pm
With the new method of absorbing appvars into executables, could you store a high score or data into the program without a appvar? Like, assuming that I have a 3 byte pre-prepared appvar in archive, could I do stuff like this?

Code: [Select]
:[appvData]->Z
:If <new highscore>
:A->Z
:End



EDIT: This doesn't seem to work, it just gives me random crap.
Code: [Select]
:.SAV
:[appvSwords2]->Z
:Repeat getKey(15)
:ClrHome
:Disp {Z}
:{Z}-(getKey(1))+(getKey(4))->{Z}
:Pause 200
:End
Title: Re: Axe Q&A
Post by: LincolnB on March 06, 2012, 05:52:13 pm
Also relating to absorbing appvars, this is kind of an obscure feature, but it would be nice to be able to absorb only certain sections of appvars. Like say [appvAAPPVAR]<<10<<100 to absorb bytes 10 through 100 of appvAAPPVAR
Title: Re: Axe Q&A
Post by: Deep Toaster on March 06, 2012, 07:54:57 pm
Also relating to absorbing appvars, this is kind of an obscure feature, but it would be nice to be able to absorb only certain sections of appvars. Like say [appvAAPPVAR]<<10<<100 to absorb bytes 10 through 100 of appvAAPPVAR
I can actually see that feature being very useful for pics—absorbing a certain number of rows from a Pic variable.
Title: Re: Axe Q&A
Post by: Quigibo on March 10, 2012, 03:26:36 pm
Pic automatically do that, you just have to change the size of the pic.  Pictures are not limited to heights of 95 and 96, but can actually have any height.  If you send a picture with a smaller or larger height, Axe will import it correctly.  For appvars, I don't think that is really very useful.  If you have an appvar, you probably made it yourself/on a computer.  Why would it be formatted such that you only need part of it?  You could just have 2 appvars, one with the part you want to import, the other without it.
Title: Re: Axe Q&A
Post by: Deep Toaster on March 10, 2012, 06:37:20 pm
Pic automatically do that, you just have to change the size of the pic.
Oh, I didn't know that. Does it work with tilemap importing too, as in importing the largest multiple of eight rows that fits?
Title: Re: Axe Q&A
Post by: Darl181 on March 11, 2012, 08:35:42 pm
I'm using a custom-named variable as a pointer.  In my experience I haven't had to put curly brackets around it like you have to do with normal variables.
How do I modify what part of the ram it points to?  Not the byte itself but the location of it.

Also is it possible to have one-byte custom variables, and if there's a way then putting r after it all the time then how?
Title: Re: Axe Q&A
Post by: Builderboy on March 11, 2012, 08:41:13 pm
As far as I know, if you use a custom named variable, it is impossible to modify the location it points to, as it is treated as a constant pointer.  It is also impossible to have only a single byte custom variable as far as I know.
Title: Re: Axe Q&A
Post by: Darl181 on March 11, 2012, 08:43:31 pm
Would it work to modify the pointer itself then?
(ie if I did L1→oName would modifying {L1}r work)
Title: Re: Axe Q&A
Post by: Builderboy on March 11, 2012, 08:46:41 pm
That wouldn't be modifying the pointer, you would be modifying the byte at L1.  Like I said, custom variables are treated like precompiled constants, so their location is hardcoded into your program and not modifiable.  If you want a pointer that can be moved to point to many different locations, you will have to use a variable as a pointer.
Title: Re: Axe Q&A
Post by: parserp on March 12, 2012, 10:18:57 pm
Why does sin(1) return 3 and sin(3) return 11?
Title: Re: Axe Q&A
Post by: Yeong on March 12, 2012, 10:19:55 pm
base 4? :P
at least, it looks like it.
Title: Re: Axe Q&A
Post by: Deep Toaster on March 12, 2012, 10:39:06 pm
Why does sin(1) return 3 and sin(3) return 11?
What should it return? Remember period is 256 and range is [-127,127].
Title: Re: Axe Q&A
Post by: leafy on March 12, 2012, 11:49:11 pm
Why does sin(1) return 3 and sin(3) return 11?
Axe doesn't use the standard degrees system - it returns a value between -127 and 127.
Title: Re: Axe Q&A
Post by: aeTIos on March 13, 2012, 07:57:35 am
you got ninja'd
Title: Re: Axe Q&A
Post by: Darl181 on March 13, 2012, 09:56:03 pm
I went into Essence's source code, and found the part that doesn't work right at 15mHz.
Spoiler For ZSHOOT:
Quote from: code
..
C=2 or or(C=6)?0→E,1→E
{C+GDB0BA}→A

 // Suspecting this line..
!If (getKey(30)+(getKey(31))+(getKey(32))+(getKey(38))+(getKey(40))+(getKey(46))+(getKey(47))+(getKey(48))-1)

U*10+Bul→r1
{C+GDB0BQ}→Q
E*8+X→{r1}r
.X+(8*(C!=2))->{r1}^^r
E*8+Y→{r1+2}r
.Y+(8*(C!=2))->{r1+2}^^r

 // ...or these
getKey(32)*2+(getKey(30)*2)-(getKey(48)*2)-(getKey(46)*2)+(getKey(31)*3)-(getKey(47)*3)→F*A→{r1+4}r
getKey(30)*2+(getKey(46)*2)-(getKey(32)*2)-(getKey(48)*2)+(getKey(38)*3)-(getKey(40)*3)→G*A→{r1+6}r

If Opt
If {Opt}
!If (C=1)+(C=5)
rand^3-1*8+{r1}r→{r1}r
rand^3-1*8+{r1+2}r→{r1+2}r
.SWITCHED^
F*4+{r1+4}r→{r1+4}r
G*4+{r1+6}r→{r1+6}r
End
Else
C!=1*S+{r1+4}r+(rand^3)-1→{r1+4}r
C!=1*T+{r1+6}r+(rand^3)-1→{r1+6}r
End
End
C→{r1+8}
{C+GDB0XP}→{r1+9}
!If C-6
F*9+{r1}r→{r1}r
G*9+{r1+2}r→{r1+2}r
End
!If C-1
{r1+4}r*6+{r1}r→{r1}r
{r1+6}r*6+{r1+2}r→{r1+2}r
End
U++
End
Would there be a way to make this work at Full speed, and keep it somewhat as-is?  (or some more-optimized way :P)
Title: Re: Axe Q&A
Post by: aeTIos on March 15, 2012, 04:24:55 am
What is going wrong?
Title: Re: Axe Q&A
Post by: Darl181 on March 15, 2012, 10:40:01 am
When that code is ran at 15mHz, the keys in some part or another don't detect properly and/or get mixed around.  I've been suspecting key delays, but I'm also told that getKey always goes in 6mHz :/  At 6 it runs fine, but I'll end up using the Full speed.
Also I can't use getKey=# , that messes up when you press an arrow key.

I'm seeing some possible optimizations in the code, but I'm wondering if I'll have to slow it down rather than speed it up to get it to work...
Title: Re: Axe Q&A
Post by: aeTIos on March 16, 2012, 11:08:05 am
Just try to run the getkey code in 6mhz and see if that works
Title: Re: Axe Q&A
Post by: Darl181 on March 16, 2012, 06:30:43 pm
I've tried that..the keys sort of work but there's some mix-ups between the keys, or the calc thinking there's other keys pressed aside from the normal problems. (ie pressing [sin] and nothing else makes the calc think both [sin] and [^] are pressed)

Is there some operation that can be done inline to slow it down, maybe allow for the delay to do its job (better at least :P)?
Title: Re: Axe Q&A
Post by: aeTIos on March 17, 2012, 10:27:57 am
Idk, it has to do with reading the port.
Title: Re: Axe Q&A
Post by: Quigibo on March 17, 2012, 06:27:42 pm
As far as I know, if you use a custom named variable, it is impossible to modify the location it points to, as it is treated as a constant pointer.  It is also impossible to have only a single byte custom variable as far as I know.

Actually, you can have a single byte variable with custom names just as you can do with the regular variables.  Using the r modifier after the variable name treats it as a single byte value rather than a 2 byte value.
Title: Re: Axe Q&A
Post by: ccadem on March 17, 2012, 07:27:07 pm
Where can I find a good, basic Axe tutorial?
Title: Re: Axe Q&A
Post by: Deep Toaster on March 17, 2012, 08:02:19 pm
The best one so far (unless you're a French speaker) is still the Documentation.pdf file included with Axe.
Title: Re: Axe Q&A
Post by: mrmprog on March 20, 2012, 01:21:44 pm
In a game I am making, the AI needs to be able to tell how far away it is from the nearest black pixel, in each of the 4 directions. Could anyone write an extremly fast routine to acomplish this?
Title: Re: Axe Q&A
Post by: Builderboy on March 20, 2012, 01:28:09 pm
Code: [Select]
Lbl Black
0->r3
Repeat pxl-test(r1+r3++,r2+r3) or pxl-test(r1-r3,r2+r3) or pxl-test(r1+r3,r2-r3) or pxl-test(r1-r3,r2-r3)
End
Return

That should work and be pretty fast too, although it will get slower as the enemy moves far away from other black pixels.  Would your level design warrant searching by steps larger than 1?
Title: Re: Axe Q&A
Post by: Darl181 on March 20, 2012, 02:34:06 pm
So, files (Y1 etc) work in Copy() right?

Also say I getCalc(...)→{L1+8}r.  In a Copy statement, do I tell it L1+8 or do I somehow specify that it's two bytes?  Or does it default to two-byte values?
Title: Re: Axe Q&A
Post by: Builderboy on March 20, 2012, 03:27:07 pm
So, files (Y1 etc) work in Copy() right?

Also say I getCalc(...)→{L1+8}r.  In a Copy statement, do I tell it L1+8 or do I somehow specify that it's two bytes?  Or does it default to two-byte values?

Yes Files work in a copy statement, but what do you mean by your second question?  The copy statement copies a certain number of bytes from one location to another
Title: Re: Axe Q&A
Post by: Darl181 on March 20, 2012, 08:06:09 pm
So, files (Y1 etc) work in Copy() right?

Also say I getCalc(...)→{L1+8}r.  In a Copy statement, do I tell it L1+8 or do I somehow specify that it's two bytes?  Or does it default to two-byte values?

Yes Files work in a copy statement, but what do you mean by your second question?  The copy statement copies a certain number of bytes from one location to another
Hm, how about "What's the syntax for how I do the L# pointer?"  Basically how do I tell it that it's a two-byte pointer and not a one-byte pointer.
By "location", I'm guessing that defaults to two bytes?  Not sure tho.
Title: Re: Axe Q&A
Post by: Builderboy on March 20, 2012, 08:12:31 pm
How do you tell what that what is a two byte pointer?  Pointers in general are usually two bytes, and both {#} and {#}r can use two byte pointers.  Maybe post the code you are trying to get to work?
Title: Re: Axe Q&A
Post by: Darl181 on March 20, 2012, 08:15:39 pm
Don't have the full code atm, but it's like
Copy(Y1,L1+15,672)
I'm wondering if typing it like that would treat L1+15 as a two-byte pointer, rather than literally L1+15.
Title: Re: Axe Q&A
Post by: calcdude84se on March 20, 2012, 09:57:14 pm
Copy(Y1,L1+15,672) will copy 672 bytes from Y1 to L1. Under normal cases, this means that {Y1+X} will now equal {L1+X} for any X between 0 and 671.
What I think you are afraid that that code might do would be expressed by Copy(Y1,{L1+15}r,672)
Title: Re: Axe Q&A
Post by: Darl181 on March 21, 2012, 06:40:08 pm
Another, unrelated...
How far does the VAR++ / VAR-- syntax stretch?
I tried to optimize
{L2+10}++
If {L2+10}=8

to
!If {L2+10}++-8
And it didn't return true when it should in the context I'm using it :P though it did compile without error.
Putting parenthesis around {L2+10}++ didn't have the statement working either.  Also tried !If {L2+10}---255 (it's one byte) but it didn't do much.

I'm guessing it's peepholed anyways, but it makes for smaller source and faster typing.
The syntax appears kind of weird, but should this work?
Title: Re: Axe Q&A
Post by: jacobly on March 21, 2012, 06:48:05 pm
Another, unrelated...
How far does the VAR++ / VAR-- syntax stretch?
I tried to optimize
{L2+10}++
If {L2+10}=8

to
!If {L2+10}++-8
And it didn't return true when it should in the context I'm using it :P though it did compile without error.
Putting parenthesis around {L2+10}++ didn't have the statement working either.  Also tried !If {L2+10}---255 (it's one byte) but it didn't do much.

I'm guessing it's peepholed anyways, but it makes for smaller source and faster typing.
The syntax appears kind of weird, but should this work?

The only time that the ++ or -- syntax ever returns the new value is for constant two-byte memory locations (including 2-byte variables).  What you want is: !If {{L2+10}++}-8
Title: Re: Axe Q&A
Post by: Deep Toaster on March 21, 2012, 06:52:46 pm
Hope this helps. Everything applies to -- as well. (Thanks to jacobly for correcting me on that second row.)
Syntax
Operation
Returns
Notes
{constant}r++Increments the two-byte value at constant pointer constant by oneNew value of {constant}rExactly identical to {constant}r+1→{constant}r
{variable}r++Increments the two-byte value at variable pointer variable by onevariable+1 if the new value of {variable}r is a multiple of 256, variable otherwise
{constant}++ or {variable}++Increments the one-byte value at pointer constant or variable by oneconstant or variableBoth constant and variable pointer expressions are treated the same way for one-byte increments
{constant}rr++ or {variable}rr++Increments the big-endian two-byte value at pointer constant or variable by onevariable if the new value of {constant}rr or {variable}rr is a multiple of 256, variable+1 otherwiseBoth constant and variable pointer expressions are treated the same way for big-endian increments
Title: Re: Axe Q&A
Post by: MGOS on April 02, 2012, 08:11:30 am
For my project I need a flood-fill function. Is it possible to have such a recursive routine for the whole screen or will this lead to stack overflow?
Click here for an explanation what the function does. (http://inventwithpython.com/blog/2011/08/11/recursion-explained-with-the-flood-fill-algorithm-and-zombies-and-cats/)

EDIT: I found that with the search http://ourl.ca/7869 but it doesn't really help me, the routine causes my calc to crash.
Title: Re: Axe Q&A
Post by: Deep Toaster on April 02, 2012, 06:32:57 pm
It will almost definitely overflow the stack in a very short amount of time (and that's probably why the routine you linked to crashes).

A better alternative (that works) is a queue algorithm (http://en.wikipedia.org/wiki/Flood_fill#Alternative_implementations). It uses a queue (like an array) to hold the list of points to test, instead of recursively calling a function that can quickly fill up the hardware stack.
Title: Re: Axe Q&A
Post by: MGOS on April 03, 2012, 03:43:33 am
That's what I did... first I gave the program the 714 bytes L1 which sucked, then a 5kB Buffer which kinda works, but not 100%.

(A,B) are the coordinates of the "Paint bucket"
(P,Q) are the coordinates the stack returns (given is a 5000B large Buffer, so 2500 coordinates should fit in)
Code: [Select]
0->S
PUS(A,B)
While S
POP()
Pxl-On(P,Q)
If P-95
PUS(P+1,Q)
End
If P
PUS(P-1,Q)
End
If Q-63
PUS(P,Q+1)
End
If Q
PUS(P,Q+1)
End
End
Return

Lbl PUS
ReturnIf pxl-Test(r1,r2)
If S<2500
r1->{S*2+GBD1}
r2->{S*2+GBD1+1}
S++
End
Return
Lbl POP
S--
{S*2+GBD1}->P
{S*2+GBD1+1}->Q
Return

File is attached

The number displayd at the end tells how often there was a stack overflow.
Title: Re: Axe Q&A
Post by: Builderboy on April 03, 2012, 03:47:32 am
There was a floodfill routine posted earlier that used no extra memory and so can never cause a crash, but I can't find the link anymore D:
Title: Re: Axe Q&A
Post by: MGOS on April 03, 2012, 04:38:46 am
There was a floodfill routine posted earlier that used no extra memory and so can never cause a crash, but I can't find the link anymore D:

That's a bummer.
Title: Re: Axe Q&A
Post by: chattahippie on April 03, 2012, 06:42:52 am
Here's one jacobly made

http://ourl.ca/151805 (http://ourl.ca/151805)
Title: Re: Axe Q&A
Post by: MGOS on April 03, 2012, 08:03:58 am
Here's one jacobly made

http://ourl.ca/151805 (http://ourl.ca/151805)

Wow... that one's cool. now I'm wondering if I should stick with the tough work of converting it to axe or think of another solution by myself.

Edit: I rewrote my algorithm that it needs only a second 768 B buffer like Xeda wrote, but it is d*mn slow (because of the search algorithm I used)

Screeny at 4x speed:
Title: Re: Axe Q&A
Post by: Yeong on April 05, 2012, 01:31:45 pm
Why won't this code work?

Code: [Select]
"Pic0Pic1Pic2Pic3Pic4Pic5Pic6Pic7Pic8Pic9"→Z
"Pic1"→I
GetCalc("varP")→Q
float{Q}→P
{Z+P}→{I}

For some reason, it seems like string I doesn't change. Why is that?
Title: Re: Axe Q&A
Post by: jacobly on April 05, 2012, 03:47:53 pm
"Pic0" is actually 3 bytes long (not including the terminating 0).

Since the first two bytes are always the same, you could do:
Code: [Select]
"Pic0Pic1Pic2Pic3Pic4Pic5Pic6Pic7Pic8Pic9"→Z
"Pic1"→I
GetCalc("varP")→Q
float{Q}→P
{P*3+Z+2}→{I+2}

But an even better method would be:
Code: [Select]
"Pic1"→I
GetCalc("varP")→Q
float{Q}→P
(P?-1,9)→{I+2} .Pic1-Pic9 is 0-8, and Pic0 is 9.

Edit: Not enough parentheses. Also, that's subtract 1, not negative 1.
Title: Re: Axe Q&A
Post by: Yeong on April 05, 2012, 03:49:29 pm
Ah. I never knew that Pic1 was 3 bytes O.o
Thanks a bunch.
EDIT: also, will I be able to use 0 as pic0? because that seems more reasonable to me.
Title: Re: Axe Q&A
Post by: jacobly on April 05, 2012, 04:09:35 pm
That's what the code does: it converts an input from 0-9 to the internal representation of that Pic. So if you type in a 0 it will give you the pointer to Pic0 (represented internally as a 9).
Title: Re: Axe Q&A
Post by: Runer112 on April 05, 2012, 05:17:25 pm
I know you didn't ask for this, but I'm just going to provide a few tips about how to improve the code:

Code: [Select]
"Pic1"→Str1                 .Use static instead of varaible data pointers
                            . whenever possible, they are more optimized
!If GetCalc("varP")         .Error handling is important!
 .Handle error
 .Return or Goto somewhere
End
(float{}??10)-1→{2+Str1}    .Omits storing and reloading the value returned by GetCalc()
                            . and restructures the conditional to omit the else branch
Title: Re: Axe Q&A
Post by: Yeong on April 05, 2012, 07:55:49 pm
So, here's my code. :D

Code: [Select]
:.AATEST
:"Pic1"→I
:GetCalc("uP")→J
:fPart(J}→K
:K?-1,9→{I+2}
:UnArchiveI
:GetCalc(I)→Q
:conj(Q,{L6},768
:DispGraph
:ArchiveI
:GetCalc("Str1")→V
:GetCalc("uA")→M
:GetCalc("uB")→N
:GetCalc("uH")→O
:GetCalc("uW")→P
:fPart(M}→A
:fPart(N}→B
:fPart(O}→H
:fPart(P}→W
:
:"0123456789ABCDEF"→T
:0→θ
:For(D,0,H/8-1
:For(C,0,W/8-1
:For(F,0,7
:8*pxl-Test(8*C+A→Z,8*D+B+F→Y)
:+(4*pxl-Test(Z+1,Y))
:+(2*pxl-Test(Z+2,Y))
:+pxl-Test(Z+3,Y)
:→U
:{T+U}→{V+θ}
:8*pxl-Test(Z+4,Y)
:+(4*pxl-Test(Z+5,Y))
:+(2*pxl-Test(Z+6,Y))
:+pxl-Test(Z+7,Y)
:→U
:{T+U}→{V+θ+1}
:θ+2→θ
:End
:End:End

Yeah, I know I takes a lot of var from OS :P
But that aside, the problem is that no matter the OSVar P is, it still shows Pic1. What did I do wrong? (problem probably comes from the first few lines of the code)
Title: Re: Axe Q&A
Post by: Runer112 on April 05, 2012, 08:25:15 pm
The issue is the line with the inline conditional. It's not treated as TI-BASIC experience may suggest, like this:
(K?-1,9)→{I+2}

It's treated like this:
K?(-1),(9→{I+2})

So with your current code, P=0 will select Pic0, but no other values of P have any effect because the store statement is not executed. To fix this, add the parentheses as shown in the first line of code. Alternatively, use the code I suggested in my previous post since it's more optimized anyway. ;)
Title: Re: Axe Q&A
Post by: Yeong on April 05, 2012, 08:28:16 pm
oh. O.O
Thanks for the solution. :D
also, what's the difference of using Str1 and A? (Static and variable)
Title: Re: Axe Q&A
Post by: Runer112 on April 05, 2012, 08:37:15 pm
Depending upon usage, there are quite a few differences between using static pointers (constants) and variables. Most can simply be summarized with the fact that constants are more optimized. To cite the two examples from your code:
"Pic1"→I = 3 bytes (not counting the size of the string data)
→{I+2} = 8 bytes

Whereas with a constant:
"Pic1"→Str1 = 0 bytes (not counting the size of the string data)
→{Str1+2} = 4 bytes

I also just realized that the second code statement can be further optimized by making the store a full 2-byte store. It may sound counter-intuitive that saving 2 bytes instead of 1 byte is actually smaller, but it works out this way because Axe works with 2-byte values and the conversion to a 1-byte value costs a byte when storing to a constant address.
Note: You shouldn't always convert 1-byte stores to a constant address into 2-byte stores to save size, as many times, overwriting the second byte at the store address is undesired. However, in this case you'll end up overwriting a 0 with another 0, so it doesn't matter
Title: Re: Axe Q&A
Post by: Yeong on April 05, 2012, 08:40:17 pm
I'm sorry, but I didn't quite get what you're saying. D:
Title: Re: Axe Q&A
Post by: Runer112 on April 05, 2012, 08:42:58 pm
Using a constant pointer like Str1 instead of a variable pointer like A is an optimization technique. Both methods will produce the same end results. But if you use a constant, your code will be smaller and faster.
Title: Re: Axe Q&A
Post by: Yeong on April 05, 2012, 08:43:59 pm
ah, ok. :D
I was stuck on where you mentioned something about 2 byte storing.
Title: Re: Axe Q&A
Post by: Deep Toaster on April 05, 2012, 08:46:24 pm
A static variable is the same as a number to Axe, so 0→{L6}r is exactly the same as 0→{37696}r to Axe.

Variables are really shortcuts for {POINTER}r, so 0→A is exactly the same as 0→{°A}r is exactly the same as 0→{34852}r.

So if you were to do 0→{A}r, what you're really doing is  0→{{34852}r}r. That's why it's less optimized.

EDIT: Ninja'd.
Title: Re: Axe Q&A
Post by: mrmprog on April 07, 2012, 10:57:23 pm
What is the fastest way to count the black pixels in an 8*8 area?
Title: Re: Axe Q&A
Post by: leafy on April 07, 2012, 11:40:45 pm
I suppose you could use bit arithmetic with a pointer to a Pt-Get('ed sprite. I'm not too clear on how that would work though.
Title: Re: Axe Q&A
Post by: jacobly on April 08, 2012, 12:45:57 am
Code: [Select]
:Lbl Count
:0→r3
:pt-Get(r1,r2)
:For(8)
:{→r1}
:While
:Select(,r3ʳ++) and (-1) .subtract not negative
:End
:r1+1
:End
:Return r3
Title: Re: Axe Q&A
Post by: calcdude84se on April 08, 2012, 11:49:22 am
I suppose you could use bit arithmetic with a pointer to a Pt-Get('ed sprite. I'm not too clear on how that would work though.
If it's byte-aligned, he could even work with the bytes directly, instead of using Pt-Get(. With that said, the fastest way to find the number of set bits in a byte (which is a necessary part of this) is almost certainly a look-up table. Yes, it's 256 bytes, but it's far faster than any bit arithmetic you can do.
Title: Re: Axe Q&A
Post by: mrmprog on April 08, 2012, 02:08:20 pm
Thanks. I have another one:If I have four numbers, and one will be zero, what is the fastest way to find the next smallest number?
Title: Re: Axe Q&A
Post by: calcdude84se on April 08, 2012, 04:06:10 pm
If exactly one number will be zero and the numbers aren't sorted in any way, I'm pretty sure the best way is to go through them with a variable containing the minimum value, while ignoring zeroes.
Here, for example, is some code that will give the minimum non-zero value in the first 100 bytes of L1 in M (And -1 if they're all 0):
Code: [Select]
-1->M
L1->X
For(100
If ({X}->V<M)?V=/=0
V->M
End
X++
End
There's probably a more optimized way to write that, but it should work.
If there could be more than one zero, the essence of what you have to do is have a flag that records whether you've already encountered one zero.
Edit: Runer112 wins by far. The method I've proposed would work better across lots of values (perhaps at least 10) than across 4.
Title: Re: Axe Q&A
Post by: Runer112 on April 08, 2012, 11:47:21 pm
If it's only four numbers, the fastest way would be a couple of nested min() commands, like this.

Code: [Select]
min(min(A-1,B-1),min(C-1,D-1))+1

EDIT: Actually, I'm not entirely sure if this will work how you want it to. It depends whether or not you want 0 as a result if two or more of the values are 0. For instance, if the numbers were 0, 0, 1, 2, this routine would return 1.
Title: Re: Axe Q&A
Post by: parserp on April 16, 2012, 09:57:10 pm
(http://img.removedfromgame.com/imgs/tempicon.jpg)

How do I achieve this? (program image and text)
Title: Re: Axe Q&A
Post by: Yeong on April 16, 2012, 09:58:36 pm
I'm pretty sure you can do the image with one of the axe command that I don't remember. (Something like #Image or something?)
but text, I have no clue.
Title: Re: Axe Q&A
Post by: Runer112 on April 16, 2012, 10:02:54 pm
To quote the documentation:

Quote from: Documentation.pdf
The next thing you absolutely need is an Axe Header. You must start the first line with a
period, which is a comment in Axe, followed by the name you want for the compiled
program. If you want a program description, you can type a space and then the
description on that same line, but this is optional. In the above example your program
might look like this:

Code: [Select]
PROGRAM:MARIOSRC
:.MARIO A fun platformer
:

And to quote the commands list:

Quote
#Icon(HEX) Key: identity()   Tells the parser to replace the default icon with the new icon. The icon must be 64 hex characters long.
Title: Re: Axe Q&A
Post by: parserp on April 16, 2012, 10:04:14 pm
Ah. That makes sense. Thanks! :D
Title: Re: Axe Q&A
Post by: Hayleia on April 22, 2012, 10:48:26 am
When I say {L1+200+A}, is L1+200 calculated when parsing or when executing ?
Title: Re: Axe Q&A
Post by: Deep Toaster on April 22, 2012, 11:38:06 am
Axe calculates it when compiling. (You can optimize it more as {A+L1+200}, by the way. Always put constants after.)
Title: Re: Axe Q&A
Post by: Hayleia on April 22, 2012, 11:40:15 am
Axe calculates it when compiling. (You can optimize it more as {A+L1+200}, by the way. Always put constants after.)
Ok thanks :)
(and for putting constants after, I do it for little pieces of code like A+3→A but I always forget it otherwise -.-°)
Title: Re: Axe Q&A
Post by: Hayleia on April 25, 2012, 02:34:12 am
Hayleia:
A and 1
A^2
Which one is the lightest/fastest ?



Runer112 (I don't remember exactly):
and 1 is smallest and fastest but doesn't touch the highest byte.



aeTIos:
What is the "and" equivalent of ^2 then ?


(That would be great if aeTIos and Runer112 posted their answers back :) (Moreover, I may have written wrong things))


Hayleia, edit

There is sub(LBL,arg) and sub(LBLr,arg).
There is LBL(arg). But is LBLr(arg) valid ??

How much space does calling "stdDev(PTR,N)" take ??
How much space does calling "sub(LBLr,arg)" take ??
Title: Re: Axe Q&A
Post by: Runer112 on April 25, 2012, 08:32:15 pm
aeTIos:
What is the "and" equivalent of ^2 then ?

and 1 pretty much is the equivalent of ^2; and 2 just doesn't set the high byte to 0, and is thus 2 bytes smaller and 7 cycles faster. Or you could use the full 16-bit bitwise AND, ·1, which results in the exact same compiled code as ^2.

There is sub(LBL,arg) and sub(LBLr,arg).
There is LBL(arg). But is LBLr(arg) valid ??

I would imagine that LBL(args)r doesn't exist because parsing that would require look-ahead parsing to detect the r before the arguments are parsed, but LBLr(args) seems like it could be implemented. Not sure why it isn't yet.

How much space does calling "stdDev(PTR,N)" take ??
How much space does calling "sub(LBLr,arg)" take ??

Excluding PTR and N of course, the stdDev(PTR,N) call takes 4 bytes, plus 14 bytes for the routine itself.
Again excluding the arguments, sub(LBLr,args) takes a pretty substantial 12 bytes per argument, plus 3 bytes for the call. Unless you absolutely must have a recursive function, I suggest avoiding this, as this costs an extra 9 bytes per argument.
Title: Re: Axe Q&A
Post by: Hayleia on May 01, 2012, 11:28:15 am
Ok, new question :P

When I do
__________________________________

Text(0,0,"text")
...
some more code here
...
Text(0,6,"text")
.the same "text" word as before
__________________________________

Is "text" stored once in memory or twice ?
Title: Re: Axe Q&A
Post by: MGOS on May 01, 2012, 11:35:00 am
Twice (or as often you use it). To prevent that, you can do
Code: [Select]
"text"->str1
...
text(0,0,str1)
...
text(0,6,str1)
Title: Re: Axe Q&A
Post by: Hayleia on May 01, 2012, 12:46:14 pm
Twice (or as often you use it). To prevent that, you can do
Code: [Select]
"text"->str1
...
text(0,0,str1)
...
text(0,6,str1)
I know how to prevent it, I am just lazy and wanted to know if I had to prevent it or no :P
Title: Re: Axe Q&A
Post by: Hayleia on May 03, 2012, 01:01:20 pm
(double posting after a little while)

How do we end a conditionnal comment ? with "..." or "...End", like
   this   or this
   ...If CST   ...If CST
   code   code
   ...End   ...
?
Title: Re: Axe Q&A
Post by: kindermoumoute on May 03, 2012, 02:44:09 pm
If °CONST=83, Code1 is compiled, else Code2.
Code: [Select]
:83->°CONST
:
:...If °CONST=83
:.Code1
:...Else
:.Code2
:...End
Title: Re: Axe Q&A
Post by: Sorunome on May 03, 2012, 02:56:02 pm
What's the sense of using comment ifs?
I mean, you could just make it normal, I don't think it compiles different on other calcs....
Title: Re: Axe Q&A
Post by: Hayleia on May 03, 2012, 02:56:33 pm
I was just asking for the End, but thanks anyway :)
Title: Re: Axe Q&A
Post by: Runer112 on May 03, 2012, 04:49:07 pm
If °CONST=83, Code1 is compiled, else Code2.
Code: [Select]
:83->°CONST
:
:...If °CONST=83
:.Code1
:...Else
:.Code2
:...End

If you tried to compile that, Axe would throw an error. :P There is no End to end conditional comments, you just end blocks like you would end any conditional comment:

Code: [Select]
:...If CONSTANT_EXPRESSION
:.Code goes here
:...Else
:.Other code goes here
:...





What's the sense of using comment ifs?
I mean, you could just make it normal, I don't think it compiles different on other calcs....

You are correct that the code doesn't compile differently on different calculator models on its own. But you can make it compile differently by changing the value of a constant, allowing you to quickly and easily change what code is compiled. This is useful for Axe libraries, creating multiple compiled variations of your program, and testing your programs, among other things. For instance, you could put blocks like this in your program:

Code: [Select]
...If °DEBUG
ClrHome
Disp A►Dec,i,B►Dec,i,C►Dec
getKeyʳ
...

And then simply change the value of the constant °DEBUG before compiling to allow you to turn debugging output on and off. The advantage over a normal If statement is that, if °DEBUG equals 0, the debugging code is not included in the compiled program, which is good if you have 500 bytes of debugging code and you don't want it bloating your official program release.
Title: Re: Axe Q&A
Post by: Hayleia on May 04, 2012, 12:57:46 am
There is no Else or End with conditional comments
???
Commands.html says that "Else" is possible.
But thanks for telling me how to end those conditional comments :)
Title: Re: Axe Q&A
Post by: Runer112 on May 04, 2012, 01:00:26 am
Oops, I wasn't correctly remembering my previous experience with conditional comments. Yes, ...Else works. What had me confused is that I remembered ...ElseIf not working and I must have grouped the two together in my mind.
Title: Re: Axe Q&A
Post by: parserp on May 07, 2012, 03:45:10 pm
If I have 8 chars stored in L1, and I want to copy them to str0+1, the following code works in a normal program, but not in an app.
Code: [Select]
:Copy(L1,Str0+1,8)

Why is that?
Title: Re: Axe Q&A
Post by: Runer112 on May 07, 2012, 03:59:16 pm
I'm guessing you are defining Str0 to be a pointer to a block of data set aside inside of your executable, perhaps like this:

Buff(10)→Str0

This works fine for programs, as they are run from RAM so the 10-byte block of data is contained inside of the program in RAM. But applications are run from ROM, which you probably know stands for read-only memory. And as the name suggests, you cannot* write data to ROM, so attempting to write data back to Str0, which is part of your application in ROM, will fail.

The solution for applications is to use a section of safe RAM or an appvar to hold any data that will be modified.


* Data can be written to ROM, but it's through a complicated method of interfacing with the flash chip that usually involves backing up a whole 64KB of data, erasing the original 64KB of data, and then copying the 64KB back to its original location with the desired changes made.
Title: Re: Axe Q&A
Post by: parserp on May 07, 2012, 04:10:27 pm
O.O That is exactly what I was doing. Now it makes sense. Thanks! :D
Spoiler For Spoiler:
/me nominates Runer112 the official omnimaga mind reader :P
Title: Re: Axe Q&A
Post by: Hayleia on May 08, 2012, 01:47:21 am
Me again, with my conditional comments :P
The problem with ending a conditional comment with "..." is that if I do the code 1 (below), the parser would understand the code 2 (below)

     Code 1:
code
...If Const
code
...
code
...
code
...
etc

     Code 2:
code
...If Const
code
...
code
...
code
...
etc

If the conditional comment ended with "...End", the parser would know the difference between a beginning and an end.
So would it be possible to change this in Axe, so that we end a conditional comment with "...End" ?
Title: Re: Axe Q&A
Post by: C0deH4cker on May 14, 2012, 07:21:27 pm
Can recursive functions be created in Axe? Like a simple fibonacci sequence generator or factorial function?
Title: Re: Axe Q&A
Post by: Deep Toaster on May 14, 2012, 10:11:25 pm
You can, but it's not recommended because each nested call takes space on the stack, and going too deep leaves you with a nice stack overflow.
Title: Re: Axe Q&A
Post by: C0deH4cker on May 14, 2012, 11:28:07 pm
For some reason, even a simple factorial program did not work correctly for me.

Code: [Select]
Lbl Fact
If r1 <= 1
1:Return
End
r1*Fact(r1-1):Return

Can somebody post a working sample?
Title: Re: Axe Q&A
Post by: Deep Toaster on May 15, 2012, 12:11:39 am
How big are the numbers you're testing with?

EDIT: In your code, r1 gets overwritten. You need to call FACT as sub(FACTr,r1-1).
Title: Re: Axe Q&A
Post by: Runer112 on May 15, 2012, 12:45:58 am
For some reason, even a simple factorial program did not work correctly for me.

Code: [Select]
Lbl Fact
If r1 <= 1
1:Return
End
r1*Fact(r1-1):Return

Can somebody post a working sample?

Your routine worked fine for me. :) Just note that, for factorials of numbers larger than 8, the calculation will overflow so the result returned will be incorrect.

EDIT: In your code, r1 gets overwritten. You need to call FACT as sub(FACTr,r1-1).

Actually this is not the case. Once *Fact( is reached, the first r1 has already been pushed onto the stack.



And because I can't resist optimizing, here is a very optimized recursive factorial function I came up with, weighing in at 17 bytes. ;D

Code: [Select]
Lbl Fact
!If
Return +1
End
Return *(-1Fact())
Title: Re: Axe Q&A
Post by: C0deH4cker on May 15, 2012, 03:48:52 pm
Lol thanks! And youre right, my way did work, but i was typing it on here from memory and also working it out in my head when i typed it, so i typed a correct version instead.


My Fibonacci program just causes a RAM Clear, probably due to a stack overflow. Z80 processors aren't very good with recursion, are they?
Title: Re: Axe Q&A
Post by: Builderboy on May 15, 2012, 04:08:47 pm
They are fine with recursion, it just takes a lot of memory the way Axe does it, since it backs up all 6 variables each time you call the routine
Title: Re: Axe Q&A
Post by: Runer112 on May 15, 2012, 04:26:09 pm
They are fine with recursion, it just takes a lot of memory the way Axe does it, since it backs up all 6 variables each time you call the routine

Nope, Axe only backs up the function variables that you would overwrite with the call. So something like sub(LBLr,A) only pushes 2 words onto the stack, the previous value of r1 and the return address (required for any function call).

My Fibonacci program just causes a RAM Clear, probably due to a stack overflow. Z80 processors aren't very good with recursion, are they?

That depends how deep you need to recurse. The OS has allocated 400 bytes for the stack, which gives you space for 200 stack entries. You can expect about 20 of these to be in use when your program is run, so you have an allowance of roughly 180 stack entries. That's about 90 recursive calls with one argument, 60 recursive calls with two arguments, etc. So as long as you don't overflow the stack, the z80 is fine at recursion. Overflow the stack, and expect a RAM clear.
Title: Re: Axe Q&A
Post by: Builderboy on May 15, 2012, 04:31:55 pm
Oh that's good!  However, some functions like fibonacci might be easy to implement with recursion, but they they are incredibly inefficient >.<
Title: Re: Axe Q&A
Post by: C0deH4cker on May 16, 2012, 10:50:35 pm
Yeah. I could easily write it without recursion (I wrote a fibonacci function in asm before), but recursion is just easier, and I think it is more fun due to the different method of thinking required for programming recursively.
Title: Re: Axe Q&A
Post by: piston on May 25, 2012, 12:04:10 pm
Where can I find the Freq() function?
Also what do the green Key:Sinreq mean? Is that supposed to be an indication as to where i can find Freq() ?
Title: Re: Axe Q&A
Post by: Hayleia on May 25, 2012, 12:34:50 pm
Where can I find the Freq() function?
Also what do the green Key:Sinreq mean? Is that supposed to be an indication as to where i can find Freq() ?
Yes in fact Axe replaced the Sinreg token by a custom Freq token. It means that the Freq function is at the same place as Sinreg.
So what you would have to do is [2nd],[0],[S] then scroll down until you find the Freq/Sinreg token :)
Be sure to have launched Axe at least once so that the hook is installed. Else, Freq would appear as Sinreg.

Also, welcome on the forums, you can introduce yourself here (http://www.omnimaga.org/index.php?board=10.0)
Title: Re: Axe Q&A
Post by: MGOS on May 25, 2012, 03:39:02 pm
The fastest way to access SinReg/Freq is pressing STAT, Right, Up (I know because I used it in many of my sound programs)
Title: Re: Axe Q&A
Post by: Hayleia on May 26, 2012, 12:55:58 am
Thanks for the tip :)
The only program in which I used Freq was done through TI-Convert so I just had to type Freq :P
But it is easier to go to the catalog when you don't know where a command is (and if you know which token it replaces)

edit: 1024th post *.*
Title: Re: Axe Q&A
Post by: Deep Toaster on May 26, 2012, 12:56:52 am
Thanks for the tip :)
The only program in which I used Freq was done through TI-Convert so I just had to type Freq :P
But it is easier to go to the catalog when you don't know where a command is (and if you know which token it replaces)
That must have taken a long time to scroll, especially if you can't jump to the first letter O.O
Title: Re: Axe Q&A
Post by: Hayleia on May 26, 2012, 01:00:43 am
Thanks for the tip :)
The only program in which I used Freq was done through TI-Convert so I just had to type Freq :P
But it is easier to go to the catalog when you don't know where a command is (and if you know which token it replaces)
That must have taken a long time to scroll, especially if you can't jump to the first letter O.O
Well he knew that Freq started with an S (← lol) so he could have jumped to the S.
But yeah, I tried it and Sinreg is not that close from the first S token :(
Title: Re: Axe Q&A
Post by: aeTIos on May 28, 2012, 10:54:33 am
beh its super easy to find in the menus.
Title: Re: Axe Q&A
Post by: squidgetx on June 06, 2012, 10:11:02 pm
So when you use Text(Y*256+X) to set the pen cursor, you're storing a 2 byte value somewhere right? Where is that somewhere? And if not, is it still possible to access this value?
Title: Re: Axe Q&A
Post by: Hayleia on June 07, 2012, 12:55:36 am
I think Text(...) sets curRow and curCol so the adress would be 844Bh (and 844Ch next).
Correct me if I am wrong
Title: Re: Axe Q&A
Post by: Deep Toaster on June 07, 2012, 02:23:41 pm
I think Text(...) sets curRow and curCol so the adress would be 844Bh (and 844Ch next).
Output(NUM) sets curRow and curCol (home screen cursor position). Text(NUM) sets penCol and penRow (notice the order is backwards for whatever reason), which control starting points for drawing commands.

penCol is $86D7 (low byte, X coordinate) and penRow is $86D8 (high byte, Y coordinate).
Title: Re: Axe Q&A
Post by: Hayleia on June 10, 2012, 08:32:46 am
Is it possible to only shift the 8 bottom rows of a buffer ?
Like "Horizontal - " but only for the 8 last rows ?

(At worst, I could copy them somewhere and use some Bitmapping to pseudo-shift them)
Nope, I tried this and it is too slow D:
Title: Re: Axe Q&A
Post by: MGOS on June 10, 2012, 08:58:26 am
I think you'd have to write your own routine for that.
It's quite slow but you could copy the last 8 rows of the buffer to another buffer, shift that and copy it back.

example with L6 and L3 (if you use them for something else you'd have to use other buffers)
Code: [Select]
Copy(L6+672,L3,96)
Horizontal -(L3)    //or Horizontal -r
Copy(L3,L6+672,96)
Title: Re: Axe Q&A
Post by: Hayleia on June 10, 2012, 10:19:11 am
I think you'd have to write your own routine for that.
It's quite slow but you could copy the last 8 rows of the buffer to another buffer, shift that and copy it back.

example with L6 and L3 (if you use them for something else you'd have to use other buffers)
Code: [Select]
Copy(L6+672,L3,96)
Horizontal -(L3)    //or Horizontal -r
Copy(L3,L6+672,96)
Yes, I tried this. The main problem is that I wanted to shift two buffers so it was very slow.
Moreover, what I tried was an optimized version of yours that only needed one copy instead of two, but it was still slow as hell D:
But nevermind, I found a way to avoid having to shift two buffers in my program ;)
Title: Re: Axe Q&A
Post by: Darl181 on June 10, 2012, 12:35:07 pm
I remember getting some runercode to shift the buffers, tho iirc it started from the top instead of the bottom.
I can't find the stuff in the irc logs, I guess I'll check my etherpads and stuff to see if they're in the chatlogs/code.
Title: Re: Axe Q&A
Post by: shmibs on June 15, 2012, 09:52:01 am
is there some way that only part of a file could be copied over when reading from the archive?
Title: Re: Axe Q&A
Post by: squidgetx on June 15, 2012, 12:04:11 pm
What do you mean, "copied"? When you GetCalc() a file, all that happens is that a pointer (2 bytes) and a mem bank ID (1 byte) are stored to an area in memory (oYn) to where the archived file resides. No copying is done unless you use the Copy()/conj() command, and there you can choose exactly how many bytes you want to copy.
Title: Re: Axe Q&A
Post by: Stefan Bauwens on June 21, 2012, 05:13:00 am
If I'm using 4-level greyscale, can I copy the screen and recall it in my main loop. For example:
:Line(0,0,95,0)
:Line(0,0,95,0)r
(^black line)
:rect(1,1,94,63)r
(^light grey rectangle)
:some other sprites
:StorePic
:repeat getkey(15)
:clrdrawrr
:recallpic
dispgraphrr
:end

I've seen storepic and recallpic in the Axe documentation but they seem to copy to the backbuffer, which I guess would ruin the greyscale.
I also saw StoreGdB but I'm not sure what it does.

So, does anyone know if this is even possible? Thanks a lot in advance :)

EDIT:Jacobly already helped me(in chat). Im using Buff( command to store the screen in GDB and with the Copy( command I copy it to the buffers. So thanks jacobly :)
Title: Re: Axe Q&A
Post by: parserp on June 21, 2012, 08:47:53 pm
What are the dangers of exiting a program without restoring the fonts or interrupts?
Title: Re: Axe Q&A
Post by: shmibs on June 21, 2012, 08:52:02 pm
if you don't change the fonts, the danger is that the fonts won't be changed, until something else changes them. nothing bad should happen of it. as for interrupts, the OS's interrupts won't be reinstated, or something like that, and you can expect crashes, i believe.
Title: Re: Axe Q&A
Post by: MGOS on June 22, 2012, 12:21:57 am
The fonts won't affect the Calc that much, it only looks weird at first, until it is restored. Interrupts will always lead to a crash if not reinstalled.
Title: Re: Axe Q&A
Post by: shmibs on June 23, 2012, 08:09:35 pm
is there some way to access the f register directly from axe to get the value of a flag?/me wants to use bcall(_EnoughMem) as inline hex
Title: Re: Axe Q&A
Post by: Deep Toaster on June 23, 2012, 08:45:49 pm
There are ways to get the contents of the F register, but almost no one ever has to do it.

Instead, try this: Asm(EFFD42ED62) will return zero if there's enough RAM and a non-zero value if there isn't. (Specifically, it returns $FFFF, but the point is that it's not zero.)
Quote from: Axe
768
Asm(EFFD42ED62)
If
Disp "Not enough RAM!"
Else
Disp "768 bytes available!"
End
Spoiler For Explanation:
Quote from: Z80 Assembly
    bcall(_EnoughMem)
    sbc HL, HL
EDIT: Just realized how much I overthought this. Cut out four bytes, but note that the order is reversed (zero means enough RAM, negative one means there isn't).
Title: Re: Axe Q&A
Post by: shmibs on June 23, 2012, 10:14:25 pm
thanks =D
EDIT:
i was trying to use this, along with _InsertMem, to increase the size of an appvar, but what i have keeps crashing. the size check isn't working, and it just plows on past a safe length. what am i doing wrong here?

Code: [Select]
GetCalc("appvA")->theta
0
Repeat
1
Asm(EFFD42ED62) ;check if there is one at least one byte of free ram
If ; if there is not
1 ;1 is stored to hl
Else
theta
Asm(545D) ;ld d,h : ld e,l
Asm(210100) ;ld hl,1
Asm(EF42F7) ;bcall(_InsertMem)
{theta-2}r++ ;increase size bytes
0:End
End
Title: Re: Axe Q&A
Post by: Deep Toaster on June 24, 2012, 12:21:51 am
I haven't figured out your bug, but why are you adding a single byte at a time? _MemChk (http://wikiti.brandonw.net/index.php?title=83Plus:BCALLs:42E5) returns the amount of free RAM you have remaining.
Title: Re: Axe Q&A
Post by: shmibs on June 24, 2012, 12:45:49 am
i figured it out./me was typing in the address for _InsertMem backwards
it's Asm(EFF742)
Title: Re: Axe Q&A
Post by: danny90444 on June 26, 2012, 03:27:52 pm
Could someone explain what axioms are and how to make/use them ?(in axe parser) Also , could someone explain how to make icons?

And also what "IRC" and "ASCII" mean or stand for ?
Title: Re: Axe Q&A
Post by: parserp on June 26, 2012, 04:22:58 pm
For Icons, use #Icon. (key: identity) It is 64 hex characters long, for a 16*16 image.

IRC is Internet Relay Chat
ASCII is the American Standard Code for Information Interchange, a character encoding type thing. en.wikipedia.org/wiki/ASCII (http://en.wikipedia.org/wiki/ASCII)
Title: Re: Axe Q&A
Post by: Deep Toaster on June 26, 2012, 04:23:30 pm
Axioms are libraries, basically extensions to the Axe language to create new commands. For example, if you were using thepenguin77's Fullrene Axiom, Fcdf( would be a valid command in your program. Axioms are written in assembly, because the idea is to create more native commands for Axe.

Set an icon for your program with the #Icon( directive (it's the identity( token, found under the MATRX MATH menu). It takes 64 characters of hexadecimal characters representing the icon. (The documentation has a nice description of images as hex data.)

IRC is just Internet Relay Chat, a really common instant-messaging protocol (like AIM, but with a much longer history and much more versatile). It's nothing specific to Axe or Omnimaga—just google it and you'll find a ton of info.

ASCII usually refers to the character set (the set of all characters ... not sure how to put it beyond that). Technically it's a specific set of 256 characters, the American Standard character set (just google ASCII), but we often use it to refer to "ASCII graphics," like games made entirely on the home screen.
Title: Re: Axe Q&A
Post by: aeTIos on June 26, 2012, 04:45:44 pm
You got ninja'd on the last 2 ones.
Title: Re: Axe Q&A
Post by: parserp on June 27, 2012, 02:32:43 pm
(This question is directed toward Deep Thought, but if anybody could answer it, that would be great)

I was trying to figure out how to save a highscore within the program, rather than in an appvar, so I looked at the snakecaster source to try to figure it out.
I'm pretty sure that I got everything else working, except for this one line of code.
Code: [Select]
:GetCalc(E8478)+GDB3-E9D93->Q     //Where E is the little E on calc (2ND + , )
This is what 'gets' the highscore at the beginning of the program, but I'm unsure of exactly what all the stuff is for. (and why it's not working for me)
Title: Re: Axe Q&A
Post by: aeTIos on June 27, 2012, 02:44:07 pm
Well, what I would do is creating a str/gdb/pic (w/e) and store the highscore in that since when you write to a string/ w/e ya chose (basically it's the same) you use writeback. I have never really used it, tho.
Title: Re: Axe Q&A
Post by: parserp on June 27, 2012, 02:54:10 pm
Well, what I would do is creating a str/gdb/pic (w/e) and store the highscore in that since when you write to a string/ w/e ya chose (basically it's the same) you use writeback. I have never really used it, tho.
That's currently what it's using, it stores the highscore to GDB3 if i'm not mistaken. I could do it some other way, but the only thing holding me back is how to tell if it is the user's first time running the program, and then to initalize the data respectively, or don't if it isn't their first time.
Title: Re: Axe Q&A
Post by: leafy on June 27, 2012, 03:57:58 pm
(This question is directed toward Deep Thought, but if anybody could answer it, that would be great)

I was trying to figure out how to save a highscore within the program, rather than in an appvar, so I looked at the snakecaster source to try to figure it out.
I'm pretty sure that I got everything else working, except for this one line of code.
Code: [Select]
:GetCalc(E8478)+GDB3-E9D93->Q     //Where E is the little E on calc (2ND + , )
This is what 'gets' the highscore at the beginning of the program, but I'm unsure of exactly what all the stuff is for. (and why it's not working for me)

If I recall correctly Deep Thought said it was just a fancy optimization. You can still easily just reference GDB3 the normal way.
Title: Re: Axe Q&A
Post by: calcdude84se on June 27, 2012, 04:55:55 pm
When the TI-OS runs an ASM program, it copies it to $9D95 and deletes the copy when it's done. Thus, any changes to the running copy don't do anything. What Deep's code does is find the original program (not the running copy) and get the address of the high score from there.
Note that this has the possibility of not working as intended when running from a shell.
If you're curious how Deep's code works, here's a quick outline:
GetCalc( takes the address of a string with a variable name and returns the address of the variable's data. When the TI-OS runs a program, the name of the program is copied to OP1, whose address is $8478. GDB3-E9D93 is the offset to the high-score value from the start of the ASM program header. This is added to the address given by GetCalc(, and the sum is the location of the high-score value in the original copy of the program.
Title: Re: Axe Q&A
Post by: parserp on June 27, 2012, 07:24:24 pm
If I recall correctly Deep Thought said it was just a fancy optimization. You can still easily just reference GDB3 the normal way.
If I did do that, wouldn't it not work because of
When the TI-OS runs an ASM program, it copies it to $9D95 and deletes the copy when its done. Thus, any changes to the running copy don't do anything.
this? ^^^
GDB3-E9D93 is the offset to the high-score value from the start of the ASM program header.
So, in my program, I would need a different offset, right? And how would I figure that offset out?
Title: Re: Axe Q&A
Post by: calcdude84se on June 27, 2012, 09:41:59 pm
A shell manages this for you; you change it in the running copy and the change gets copied back. Most people will at least have Ion, if not MirageOS, DCS, zStart, or something else. Just use GDB3 or whatever the equivalent is in you program.
If for some reason you want it to work without a shell (and not to work with a shell), to get the appropriate offset you just select the appropriate address (i.e., replace GDB3 with whatever is applicable); that's it.
Title: Re: Axe Q&A
Post by: parserp on June 27, 2012, 11:07:24 pm
So basically, the fancy GetCalc statement is just to save the highscore in both the origional copy and the temporary RAM copy? (So that whichever one is copied back to the original program, the highscore still saves) ?
Title: Re: Axe Q&A
Post by: calcdude84se on June 27, 2012, 11:59:28 pm
The "fancy GetCalc statement" calculates the corresponding address in the original. So yes, it can be used to update in the original, and you can also update in the running copy. There shouldn't be a need to always keep the two in sync, though.
I'm not sure how this works when running from a shell. I'm under the impression that most shells will copy (from Archive) or move (from RAM) the program to the appropriate location, and this would yield the program's (or the copy's, if from Archive) name in OP1. Thus, it will just update in-place. However, I'm not sure if this is documented, so unless you can confirm it in Ion, MirageOS, DoorsCS, etc., it would be best not to have code like Deep's in shell versions.
Title: Re: Axe Q&A
Post by: Hayleia on July 02, 2012, 03:19:55 pm
Is it possible to write to the back buffer ?
Like Text(X,Y,PTR,L3) (not in the commands)
or Text(X,Y,PTR)r (not in the commands)
or Fix 51 // Text(X,Y,PTR) (not in the commands)
or with any routine you have ?
Title: Re: Axe Q&A
Post by: MGOS on July 02, 2012, 03:27:06 pm
Is it possible to write to the back buffer ?
Like Text(X,Y,PTR,L3) (not in the commands)
or Text(X,Y,PTR)r (not in the commands)
or Fix 51 // Text(X,Y,PTR) (not in the commands)
or with any routine you have ?
Sadly, no. The text command is an OS routine by TI, so it isn't possible to write text to any other buffer than the main. You have to write it to the front buffer and copy the part you want to the back buffer. If it is a whole line, the copy() function is the right one, otherwise you might have to make your one routine or use the pt-Get() function several times (lot of size and takes some time).
The last possibility would be to use your own font and just 'sprite' it there.
Title: Re: Axe Q&A
Post by: Hayleia on July 02, 2012, 03:32:00 pm
Is it possible to write to the back buffer ?
Like Text(X,Y,PTR,L3) (not in the commands)
or Text(X,Y,PTR)r (not in the commands)
or Fix 51 // Text(X,Y,PTR) (not in the commands)
or with any routine you have ?
Sadly, no. The text command is an OS routine by TI, so it isn't possible to write text to any other buffer than the main. You have to write it to the front buffer and copy the part you want to the back buffer. If it is a whole line, the copy() function is the right one, otherwise you might have to make your one routine or use the pt-Get() function several times (lot of size and takes some time).
The last possibility would be to use your own font and just 'sprite' it there.
Ok. Then could an Axiom be written to add a fast text routine that would support any buffer ?
Title: Re: Axe Q&A
Post by: aeTIos on July 02, 2012, 03:34:04 pm
You don't even need an axiom for that. I wrote text routines that were as fast as the OS routine in plain axe. (tho I'm not doing it for ya, sorry: I hate creating 255 sprites for the single purpose of a text routine :p)
Title: Re: Axe Q&A
Post by: Hayleia on July 02, 2012, 03:37:58 pm
You don't even need an axiom for that. I wrote text routines that were as fast as the OS routine in plain axe. (tho I'm not doing it for ya, sorry: I hate creating 255 sprites for the single purpose of a text routine :p)
Yes, but why making it as fast as the OS routine when it can be faster ? ;)
And an Axiom would be perfect. It could have all the options everyone could want :)
Title: Re: Axe Q&A
Post by: leafy on July 02, 2012, 03:57:54 pm
I think the reason this hasn't been done already is the huge size it would take to store all the letter sprites that aren't built into the OS; I brought it up with Runer once or twice and he might be able to help you out.
Title: Re: Axe Q&A
Post by: parserp on July 02, 2012, 04:00:13 pm
Actually I asked that same question earlier in this thread. ^.^

This is what Quigibo said:

Blame TI for that.  If you want to draw directly to the back-buffer, you'd have to make your own font routine, which is easy, but takes forever to get all those letter/number/symbol sprites as well as a lot of space in the program itself.  But sometimes a kick-ass font can really improve a game's look! :D
Title: Re: Axe Q&A
Post by: calcdude84se on July 02, 2012, 04:56:12 pm
Wouldn't it be possible to get the font sprites directly from the OS? I have no idea where they are located in the OS ROM, but they're surely there.
Title: Re: Axe Q&A
Post by: Deep Toaster on July 02, 2012, 07:34:12 pm
Qwerty.55 asked that question here (http://ourl.ca/7301/124885), but apparently the font sprites are stored at different places in different OS versions, so it's not very useful.
Title: Re: Axe Q&A
Post by: shmibs on July 03, 2012, 09:31:39 am
what with the lack of inverse trig functions, what is the best way to determine the angle (0-255) from one point to another on an x,y plane?
Title: Re: Axe Q&A
Post by: leafy on July 03, 2012, 09:47:02 am
There's a tricky way using dot products, but Iambian wrote a much more accurate arctan Axiom that you could check out.
Title: Re: Axe Q&A
Post by: shmibs on July 03, 2012, 10:15:08 am
what dot-product method is there? all i can think of is cos(theta) = (u dot v)/(||u|| ||v||), and that would still need arccos

and thanks =)/me goes to check it out that axiom

edit, i found the axiom, but it's compiled as an 8xp rather than 8xv, what do?
http://ourl.ca/14229
Title: Re: Axe Q&A
Post by: squidgetx on July 03, 2012, 10:57:34 am
Doesn't Axe have a built in tan-1 routine?
Title: Re: Axe Q&A
Post by: shmibs on July 03, 2012, 11:05:07 am
X_X
yes, it does.
Title: Re: Axe Q&A
Post by: Builderboy on July 03, 2012, 10:31:20 pm
what dot-product method is there? all i can think of is cos(theta) = (u dot v)/(||u|| ||v||), and that would still need arccos

It depends on what you need the angle for.  Sometimes you can use vector arithmetic to speed things up, but sometimes not.  What did you need the angle for?
Title: Re: Axe Q&A
Post by: shmibs on July 04, 2012, 12:52:14 am
i was using it for determining the angle from those enemy tanks to the player tank here (http://ourl.ca/16518), and ended up using the built in tan^-1 method
out of curiosity, though, what other things do you mean?
Title: Re: Axe Q&A
Post by: Builderboy on July 04, 2012, 03:17:19 am
One example that I've used it for is the aiming of a rocket.  The rocket rotates right if the target is to the right, and rotates left if the target is to the left.  You could use Tan^-1 to find the angle between them, but using the cross product is so much faster :D

Code: [Select]
If dx*vy - dy*vx < 0
  turnLeft
Else
  turnRight
End

Where dx/dy is the X and Y distance between you and your target, and vx/vy is your X and Y velocity.

EDIT: It IS the cross product.  The dot product will return positive if your velocity and your displacement are within 90 degrees of each other, which is not what we want.
Title: Re: Axe Q&A
Post by: squidgetx on July 04, 2012, 02:19:36 pm
Oh, my bad. I saw dx*vy-dy*vx and was like, wait, "cross product magnitude doesn't look like that at all, that looks more like dot product" but then I realized that that's a specialized form for cross product where the z component is 0 :P
Title: Re: Axe Q&A
Post by: Builderboy on July 04, 2012, 02:29:54 pm
Exactly :D It technically is returning a vector, it's just that the vector is pointing into or out of the screen :P
Title: Re: Axe Q&A
Post by: Hayleia on July 09, 2012, 11:09:22 am
Would it be possible to have equates ?
I mean that for example if I write this
   test equ {V+17}
each time the parser hits the word "test", it replaces it with "{V+17}" before translating it into asm.

(note that here, V+17→°test would not work since V+17 is not constant)
Title: Re: Axe Q&A
Post by: Deep Toaster on July 09, 2012, 12:20:29 pm
If you're using {V+17} so much that you need an equate for it, you should probably either assign it to a variable (if it doesn't change much) or create a subroutine for it (if it changes all the time).
Title: Re: Axe Q&A
Post by: Hayleia on July 09, 2012, 12:33:41 pm
In fact, V is the main pointer of an appvar and I have a lot of {V+1},{V+2},...{V+17}...{V+96} etc, and I may forget what each one is referring to. This is why I asked for equates, not only for {V+17}. And I thought about the subroutine but there would be two solutions with this: make the routine return V+17 so I have to do {Rout()} which is a bit ugly, or make two routines with one that would read and the other that would store, which is a bit too much.
For now, my solution is to store the number after the V+ into a constant with a logic name so for apples (for example) I can do {V+°Apple} to read or write to the right byte. But an equate would be even more efficient.
Title: Re: Axe Q&A
Post by: Deep Toaster on July 09, 2012, 12:43:18 pm
It would be very inefficient in terms of the code it produces, if I understand what you mean (meaning every time you use the equate, Axe inserts {V+17}, which I'd think is something like eight bytes).

EDIT: Oh, I see, that way if FOO translated to {V+17}, you could do something like 23→FOO and FOO→X and both would be valid statements.

It would still be no different than using {V+17} everywhere though, since FOO wouldn't actually exist. It'd be more like a macro than anything.
Title: Re: Axe Q&A
Post by: Hayleia on July 09, 2012, 12:57:14 pm
EDIT: Oh, I see, that way if FOO translated to {V+17}, you could do something like 23→FOO and FOO→X and both would be valid statements.

It would still be no different than using {V+17} everywhere though, since FOO wouldn't actually exist. It'd be more like a macro than anything.
Yes that's it. It would not save space in any way. It is just so I can easily see who is who in my appvar. Because I have wood, stone and apples (among others) and having this
   {V+17}^^r equ wood
   {V+19}^^r equ stone
   {V+21}^^r equ apple
would be of a great help for me to understand my code easier. So would it be possible ?
Title: Re: Axe Q&A
Post by: Deep Toaster on July 09, 2012, 01:03:28 pm
You can ask for a feature request here (http://ourl.ca/4057).
Title: Re: Axe Q&A
Post by: shmibs on July 09, 2012, 01:05:10 pm
just use subroutines. {SUB()}:Lbl SUB is perfectly valid, and works for both storing and recalling. in your case it will be slightly slower and the exact same size as writing it inline, though (plus extra for the subroutine itself), so i guess i see your point.
Title: Re: Axe Q&A
Post by: Deep Toaster on July 09, 2012, 01:13:53 pm
If he uses the subroutine more than twice it'll actually make his program smaller (I think, haven't tested it). Would be slower though (subroutines are always slower than inline code, aren't they?).
Title: Re: Axe Q&A
Post by: Hayleia on July 09, 2012, 01:14:53 pm
just use subroutines. {SUB()}:Lbl SUB is perfectly valid, and works for both storing and recalling. in your case it will be slightly slower and the exact same size as writing it inline, though (plus extra for the subroutine itself), so i guess i see your point.
Yeah, I guess I am going to do that. But you have to admit that {Wood()} is more ugly than just Wood ;)
Title: Re: Axe Q&A
Post by: shmibs on July 09, 2012, 01:59:45 pm
deep, adding two numbers and calling a subroutine come out to be the same size. if his subroutine was more complex, it would save size, but in this particular case it just slows things down.
EDIT: nevermind, he's adding a variable and a constant rather than two constants, so it will be -2n+5 butes smaller, meaning anything past two calls saves space
Title: Re: Axe Q&A
Post by: Hayleia on July 11, 2012, 11:19:33 am
Pt-Mask draws on the two buffers to get 3 shades of grey.
Is there an equivalent to get 4 shades or is it necessary to use two Pt-Off ?
Title: Re: Axe Q&A
Post by: MGOS on July 11, 2012, 11:29:26 am
Pt-Mask draws on the two buffers to get 3 shades of grey.
Is there an equivalent to get 4 shades or is it necessary to use two Pt-Off ?
No there isn't. But the reason Pt-Mask has only 3-level gray is that the fourth color/combination is transparent, so you don't need to have always square shapes.
Title: Re: Axe Q&A
Post by: Hayleia on July 11, 2012, 11:32:33 am
Pt-Mask draws on the two buffers to get 3 shades of grey.
Is there an equivalent to get 4 shades or is it necessary to use two Pt-Off ?
No there isn't. But the reason Pt-Mask has only 3-level gray is that the fourth color/combination is transparent, so you don't need to have always square shapes.
Ok, thanks.

Wait, for 4 shades, is it like this ?
L3,L6
 0,0 → white
 0,1 → dark grey
 1,0 → light grey
 1,1 → black
Title: Re: Axe Q&A
Post by: leafy on July 11, 2012, 12:21:31 pm
Pt-Mask draws on the two buffers to get 3 shades of grey.
Is there an equivalent to get 4 shades or is it necessary to use two Pt-Off ?
No there isn't. But the reason Pt-Mask has only 3-level gray is that the fourth color/combination is transparent, so you don't need to have always square shapes.
Ok, thanks.

Wait, for 4 shades, is it like this ?
L3,L6
 0,0 → white
 0,1 → dark grey
 1,0 → light grey
 1,1 → black
Indeed.
Title: Re: Axe Q&A
Post by: Hayleia on July 13, 2012, 09:15:25 am
Now I have a new question and it seems very stupid to me because if the answer was yes, it would probably be in the Commands.
Is there free RAM available elsewhere than in L1,L2,L3,L4,L5,L6 ?
(for example, I heard about "missing RAM pages", so there should be "available RAM pages" too somewhere)
Title: Re: Axe Q&A
Post by: Runer112 on July 13, 2012, 10:59:54 am
thepenguin77 made a very nice list of all static RAM locations that can be used by an assembly program without resulting in an instant crash if OS interrupts or some basic B_CALLs are used. It lists what will not work or what will corrupt your data if each section is used, and how to properly restore each section upon exiting so the OS will function properly.

This list can be found here (http://ourl.ca/16406).

Regarding extra RAM pages, I would imagine a large reason why their access isn't a built-in Axe feature is because they do not exist on the 83+BE, and Axe is quite faithful to ensuring that all programs using the standard commands will work on all 83+ and 84+ calculators.
Title: Re: Axe Q&A
Post by: Hayleia on July 13, 2012, 02:04:17 pm
thepenguin77 made a very nice list of all static RAM locations that can be used by an assembly program without resulting in an instant crash if OS interrupts or some basic B_CALLs are used. It lists what will not work or what will corrupt your data if each section is used, and how to properly restore each section upon exiting so the OS will function properly.

This list can be found here (http://ourl.ca/16406).

Regarding extra RAM pages, I would imagine a large reason why their access isn't a built-in Axe feature is because they do not exist on the 83+BE, and Axe is quite faithful to ensuring that all programs using the standard commands will work on all 83+ and 84+ calculators.
Ok, thanks, I'll look at it :)
Title: Re: Axe Q&A
Post by: Hayleia on July 16, 2012, 01:19:49 pm
Can constants be declared this way ?
  18→°Var1
  +1→°Var3


Or at least like this ?
  18→°Var1+1→°Var3
Title: Re: Axe Q&A
Post by: Runer112 on July 16, 2012, 02:13:23 pm
Constants cannot be declared the first way because starting a line with an operator results in the assumption that what precedes the line can be anything, not just a constant. Constants also cannot be declared the second way, although because there's no line separating them, I feel like support for that could be added easily enough. Neither of those methods save space in the executable since constant definitions don't consume any physical data, but I can see how the second one would be useful for saving space in the source program. Maybe you should take that on over to the Features Wishlist. :)
Title: Re: Axe Q&A
Post by: Hayleia on July 16, 2012, 03:03:11 pm
but I can see how the second one would be useful for saving space in the source program.
Not only. In fact, I have I am declaring a sequel of pointers. And in case I forgot to declare one, I would just need to insert a +1→°Var2 between the Var1 and the Var3. Same if I finally want to change the order of my pointers but still want them to be right next to each other.

Maybe you should take that on over to the Features Wishlist. :)
Done :)
Title: Re: Axe Q&A
Post by: Hayleia on August 07, 2012, 03:11:10 am
Does compiling happen at 15 MHz for capable models or is it always at 6 MHz ?
Title: Re: Axe Q&A
Post by: Deep Toaster on August 09, 2012, 10:28:08 am
Yes, Axe uses 15 MHz when it's available.
Title: Re: Axe Q&A
Post by: Hayleia on September 07, 2012, 10:54:50 am
Does the fnInt(LBL,FREQ) function first disable all interrupts before enabling the LBL interrupt ?

If no, what should I do to support several enabled interrupts (if possible) ?
Title: Re: Axe Q&A
Post by: nikitouzz on November 11, 2012, 04:05:26 pm
there will be a new version of the axis or 1.1.2 final is the one?
Title: Re: Axe Q&A
Post by: squidgetx on November 11, 2012, 05:21:40 pm
Hayleia, (lol this question is from sept), I'm pretty sure you can only have one interrupt on at a time.

Nikitouzz, Runer112 is working on a new patched/optimized version of Axe. If he ever finishes it, there might be an update (or if Quigibo comes back =/)
Title: Re: Axe Q&A
Post by: Eiyeron on November 22, 2012, 07:09:49 am
Could we get Axe speedier?
Title: Re: Axe Q&A
Post by: Runer112 on November 26, 2012, 03:17:26 pm
Could we get Axe speedier?

Do you mean speed of compiled programs, which can now be improved with the #ExprOn directive I just added with Axe 1.2.0? :P Or do you mean the compiling process? Because I think to speed up the compiler, it will more or less have to be entirely rewritten, which is a large task. That's not to say that I don't plan on doing it, it would probably just take a fair bit of time.
Title: Re: Axe Q&A
Post by: shmibs on November 26, 2012, 05:03:08 pm
/me thinks that the compiler itself is plenty fast enough as it is, and that time would be better spent elsewhere.
even when constantly compiling apps, the speed isn't really an annoyance
Title: Re: Axe Q&A
Post by: squidgetx on November 26, 2012, 07:18:53 pm
I still say that drawing the progress bar does something to make the compiler slower (and that it would be nice to have an option to disable it)...Quigibo rejected that thought last time I brought it up saying it takes no more time than displaying the percent progress. But that doesn't mean that it doesn't slow it down though, amiright? It still takes up time to draw the thing. (and I feel like the compiler was noticeably speedier before the progress bar's introduction)
Title: Re: Axe Q&A
Post by: Builderboy on November 26, 2012, 07:38:42 pm
Squidgetx it is true that it does slow it down a small amount, but I imagine Quigibo didn't implement disabling it because it would barely make a difference even in some of the longest of compiles.  My guess is that even if you were compiling for a full app, it wouldn't even add a second of compile time, although Runer will have to report back.
Title: Re: Axe Q&A
Post by: Deep Toaster on November 26, 2012, 09:17:48 pm
For me at least, what made Axe seem considerably slower when the progress bar was introduced is the new lag-time between hitting ENTER and the screen updating (in the compile menu), which wasn't there before.

On the other hand, it did seem to compile slower than before (I'm on a TI-83 Plus so it's a lot easier to notice).
Title: Re: Axe Q&A
Post by: shmibs on November 27, 2012, 01:54:38 pm
well, there were a lot of other things added around the same time, so the compiler itself increasing in complexity could probably account for the majority of the slowdown.
Title: Re: Axe Q&A
Post by: Freyaday on November 27, 2012, 07:54:13 pm
Well, I know of one display increase that could be implemented: The Numbers for Size continue to update after the first pass.
The size of the program doesn't change after the first pass.
Title: Re: Axe Q&A
Post by: 133794m3r on December 20, 2012, 08:45:13 pm
I heard that Axe uses the last 54bytes of L1 for the A-Z+Theta variables for programs? Is this true? Also how volatile is the L2? It says "low", but, if I'm storing some data in it, it should be safe during the execution of the subroutine right? The whole reason I'm even thinking about using L2 is because of that thing I heard about the last54bytes of L1. I need 768bytes of ram in total for my range encoder(256 for the symbols,512 for the counters), but that's just the "maximum", it could be less than that. But, I don't want to needlessly fill some variables and take up even more ram(already looking at 2-3k at the peak...), so even more ram used seems kinda crazy to me... I'd like to use "safe/free" ram instead of the available ram for the program, as I expect(hope) that people will use the range encoder/decoder for their data compression needs.
Title: Re: Axe Q&A
Post by: leafy on December 20, 2012, 08:50:04 pm
Axe no longer uses the last 54 bytes as of Axe 1.2.0, so feel free to use L1 to 768 bytes. L2 is more or less stable for the first 800 bytes or so, but remember to run ClrDraw(L2) at the end of your program. Volatility doesn't refer to whether or not your data will get messed up during the program runtime, it refers to how screwed up bits of your OS will get after you quit out of the program (L2 has the chance of messing up tables and such).
Title: Re: Axe Q&A
Post by: 133794m3r on December 20, 2012, 09:02:43 pm
Axe no longer uses the last 54 bytes as of Axe 1.2.0, so feel free to use L1 to 768 bytes. L2 is more or less stable for the first 800 bytes or so, but remember to run ClrDraw(L2) at the end of your program. Volatility doesn't refer to whether or not your data will get messed up during the program runtime, it refers to how screwed up bits of your OS will get after you quit out of the program (L2 has the chance of messing up tables and such).

Ah OK, that's really good to know then. And hmm that's itneresting about L2 as it says only 512bytes, but anyway thanks for the information.  I'd upvote or thank, or whatever they call it on here but I can't seem to find it... Now onto finishing up the range encoder!(Worst case scenario, estimated as a reduction of ~16% on 768byte thing.)
Title: Re: Axe Q&A
Post by: squidgetx on December 20, 2012, 09:21:20 pm
I think that Axe moved A-Z a few versions ago; L1 is 768 bytes. Also, L2 is perfectly safe, I think now just as safe as L1 in 1.2.1 (used to be interrupts used that area, but no more).

Edit: Actually, i just remembered that MirageOS uses L2 for its custom interrupts. Used to be you could put an FnOff at the beginning of your program to disable MOS interrupts, but I don't know if that still works (I'm 60% sure that it should)

For some reason the TI docs list L2 (statVars) as being only 531 bytes, but other areas of free ram start right after where L2 ends for at least a few hundred more bytes, so basically L2 is a lot bigger than 531 bytes.

Edit2: L2 points to 871 bytes of free ram, but you may have to zero (using Fill or something) the extra 340 bytes of RAM starting at 8C4D at the end of your program. Source: http://ourl.ca/16406
Title: Re: Axe Q&A
Post by: Sorunome on December 20, 2012, 09:23:33 pm
According to the readme:
 ​L₁: 768 bytes (​saveSScreen) Volatility: LOW
 ​L₂: 531 bytes (​statVars) Volatility: LOW (Some shells, including MirageOS, use this for mostly non-vital storage)
Title: Re: Axe Q&A
Post by: Deep Toaster on December 20, 2012, 10:47:36 pm
Axe no longer uses the last 54 bytes as of Axe 1.2.0, so feel free to use L1 to 768 bytes. L2 is more or less stable for the first 800 bytes or so, but remember to run ClrDraw(L2) at the end of your program. Volatility doesn't refer to whether or not your data will get messed up during the program runtime, it refers to how screwed up bits of your OS will get after you quit out of the program (L2 has the chance of messing up tables and such).
Ah OK, that's really good to know then. And hmm that's itneresting about L2 as it says only 512bytes, but anyway thanks for the information.  I'd upvote or thank, or whatever they call it on here but I can't seem to find it... Now onto finishing up the range encoder!(Worst case scenario, estimated as a reduction of ~16% on 768byte thing.)
It says only 531 bytes, but according to Runer the data after it isn't terribly important to the operating system, so you have about 800 bytes to mess around with.
Title: Re: Axe Q&A
Post by: Sorunome on February 28, 2013, 08:24:23 pm
How do I convert a string with only one element into a char to get the ASCII number representing it?
Title: Re: Axe Q&A
Post by: Runer112 on February 28, 2013, 08:34:24 pm
Just read the first and only character of the string: {ptr}. :P
Title: Re: Axe Q&A
Post by: Sorunome on February 28, 2013, 08:35:44 pm
Oh, why didn't I think of that >.<
Thanks for helping anyways ;)

EDIT: Is there a way to convert a number to a string?
Title: Re: Axe Q&A
Post by: Builderboy on February 28, 2013, 11:17:39 pm
To convert a single digit to a single character is pretty simple, you simply do # + '0'.  Converting a multi digit number into a string is simply a matter of going through the number digit by digit and  converting each digit to a character.
Title: Re: Axe Q&A
Post by: Sorunome on February 28, 2013, 11:18:35 pm
Thanks, jacobly already helped me via skype, I just thought that there's maybe a built-in function or a easier way ;)
Title: Re: Axe Q&A
Post by: Caustic on April 07, 2013, 03:07:20 am
Do forgive me if this has already been asked... couldn't search and it's becoming increasinfrrrftgly urgent. posting on a phone is hard enough.

What follows is a simple code sample that I don't understand why it refuses to run:

Nothing after setting up the interrupt is ran. The comments are results of some troubleshooting. Anything I change after ".Main" and the following "Return" is completely ignored during runtime. I commented out the pause in the Interrupt subroutine to see if it made any difference...
Code: [Select]
.AA
ClrDrawrr
Rect(0,0,32,32)r
fnInt(A,6)

.Main
Repeat getKey(0)
End
LnReg
Return

Lbl A
.Pause 75
DispGraphr
Title: Re: Axe Q&A
Post by: Runer112 on April 07, 2013, 03:10:26 am
Perhaps the Repeat loop ends immediately because it's getting reached while you're still holding down the button that launched the program? Try changing the key value so it won't detect the ENTER/2nd key.

EDIT: Also, if you're using Axe 1.2.1, it's recommended that you use the safer LnRegr rather than LnReg to turn off custom interrupts.
Title: Re: Axe Q&A
Post by: Caustic on April 07, 2013, 03:19:08 am
I doubt it, because I have to remove the batteries every time I execute this. Thanks for the tip on LnRegr

Edit:It's probably an Axe bug because I tried a few code samples for "perfect" grayscale that all seem to work fine. But I want to understand why my own test didn't work in the interest of preventing this problem on a larger scale.
Title: Re: Axe Q&A
Post by: Runer112 on April 07, 2013, 03:32:40 am
Oh silly me, I see the problem. The issue is that your interrupt takes longer to execute than the amount of time between interrupt timer requests, so as soon as one interrupt call finishes, another is made. To fix this, you probably want to add some code to your interrupt that results in the body of the interrupt, in this case the DispGraphr, only being executed on some interrupt calls. One simple way to do this is with a counter that only executes the actual body of the interrupt every fixed number of interrupt calls. Here's a common way to do it:

Code: [Select]
..
1→I         .The counter
fnInt(A,0)  .I increased the interrupt speed for more counter precision
..
Lbl A
DS<(I,4)    .Only execute the body every 4 interrupt calls; play with this amount
DispGraphʳ
End
Return      .Axe automatically adds a final return if you don't, but it's still good practice to include it
Title: Re: Axe Q&A
Post by: Caustic on April 07, 2013, 03:45:22 am
Alright. Just to clarify, if the interrupting routine lasts longer than the timer (I.e Pause 3000) will there be some sort of queue of interrupt calls? Trying to execute dispGraph at 60Hz sharp is quite a pain in Axe...
Title: Re: Axe Q&A
Post by: Runer112 on April 07, 2013, 03:51:37 am
There won't exactly be a queue. Only one timer request can be "waiting", but as soon as the interrupt finishes, the timer request will be acknowledged and the interrupt will recur. So you won't get a stack build-up and overflow of waiting calls, but you will get an infinite loop of your interrupt running over and over.

And yes, executing interrupts at exact frequencies is a pain in Axe. But unfortunately there isn't much the language can do about it, because it's restricted to the limited number of speed settings the timer hardware provides. There are no exact multiples of 60Hz so you can't get it exactly, and the fastest speed is about 1000Hz so it's hard to get it almost exactly as well.
Title: Re: Axe Q&A
Post by: Caustic on April 07, 2013, 05:08:04 am
How long does Pause 1 actually last?
Title: Re: Axe Q&A
Post by: TIfanx1999 on April 07, 2013, 05:17:32 am

And yes, executing interrupts at exact frequencies is a pain in Axe.

i keep misreading this as "pain in the axe" :p
Title: Re: Axe Q&A
Post by: Runer112 on April 07, 2013, 12:24:04 pm
How long does Pause 1 actually last?

This is one of the reasons I took it upon myself to start documenting the size and speed of Axe commands. If you open up Commands.html, select one of the "Show size and speed for" buttons, and find Pause, you will see that it takes approximately 3349*n cycles. The calculator normally runs at 6MHz, so you can figure out the time if you like.

However, that formula is not quite accurate, especially for small values of n. If (on a desktop browser) you hover your mouse over the speed information, you'll get a messy formula that exactly describes the number of cycles Pause takes. In the case of Pause 1, it's actually very hard to determine. Pause basically runs a loop inside of a loop, with the outer loop running the number of times you specify. But Paues was really designed for larger values where a small difference of one or two thousand cycles wouldn't matter, so for the sake of size optimization, on the first outer loop iteration, the inner loop iterates a number of times according to whatever value happened to be sitting in one of the CPU registers at the time. This first outer loop iteration, which in the case of Pause 1 is the only outer loop iteration, can run anywhere from 8 to 3349 cycles; all the following outer loop iterations will run at exactly 3349 cycles. You'd need to look at the disassembly of the code leading up to the Pause command and determine what value will be held in the b register (and sometimes it cannot even be determined) to know how long the first iteration will take, but that's probably overkill for now.

If you want to pause for a very small, precise amount of time, I would suggest something like the following:
Code: [Select]
For(N)
End
This block of code just executes an empty loop N times, and it will do so at about 13 cycles per iteration.
Title: Re: Axe Q&A
Post by: Caustic on April 07, 2013, 01:14:42 pm
Incredible, thank you for addressing all my questions. I really spent the whole day scratching my head over grayscale.
*Tosses over ambitious 4 level grayscale RPG-adventure-harvestmoon-simcity-eveonline game into bin.

I wonder if programming asm on calc is practical enough, I don't really feel like using a modern computer to assist me...
I'm sure I can find it if I could actually search the forums, because the native search bar here is disabled for me. :(
Title: Re: Axe Q&A
Post by: Runer112 on April 07, 2013, 01:27:47 pm
If you're interested in on-calc assembly coding, probably the best tool for that is Mimas (http://www.ticalc.org/archives/files/fileinfo/431/43140.html).
Title: Re: Axe Q&A
Post by: Streetwalrus on April 07, 2013, 01:39:53 pm
Also to search : http://megapowers.net/v/search.htm
Forum search is completely disabled because of lag. It was really slow anyway. ;)
Title: Re: Axe Q&A
Post by: Caustic on April 07, 2013, 02:03:41 pm
Also to search : http://megapowers.net/v/search.htm
Forum search is completely disabled because of lag. It was really slow anyway. ;)

Love at first sight, thanks for the link, runner, though you got ninja'd by a certain search engine. Dp forgove the strange order of the paragraph. You may blame the creators of the search egine for amking a terrible operating system. I cant even read what Imm writimg stm. Thanks for the suggestion by I just used some Google syntax to do it. It wasn't that I couldn't search the forums, it was just a hassle to switch tabs on a plastic brick that makes my calculator feel like one of IBM'S supercalcs... er comps, whatever the difference is.
If you're interested in on-calc assembly coding, probably the best tool for that is Mimas (http://www.ticalc.org/archives/files/fileinfo/431/43140.html).
Title: Re: Axe Q&A
Post by: TIfanx1999 on April 08, 2013, 04:54:55 am
There is also <a href=http://ourl.ca/14654/274550>ASMDREAM</a> for writing ASM programs on calc. You might want to give it a look as well. ;)
*Edit* you could also go the route Xeda does and write the programs out in hex. :P
Title: Re: Axe Q&A
Post by: calc84maniac on April 08, 2013, 07:46:18 pm
If you want to pause for a very small, precise amount of time, I would suggest something like the following:
Code: [Select]
For(N)
End
This block of code just executes an empty loop N times, and it will do so at about 13 cycles per iteration.
Does the push bc \ pop bc get auto-optimized or something?
Title: Re: Axe Q&A
Post by: Runer112 on April 08, 2013, 07:47:00 pm
If you want to pause for a very small, precise amount of time, I would suggest something like the following:
Code: [Select]
For(N)
End
This block of code just executes an empty loop N times, and it will do so at about 13 cycles per iteration.
Does the push bc \ pop bc get auto-optimized or something?

Indeed it does. Axe isn't great at optimizing, but it isn't terrible either. :P
Title: Re: Axe Q&A
Post by: Caustic on April 11, 2013, 02:17:12 pm
Right now I'm making (yet another, but even "yet another" is taken) shmup bullet hell game. I'm quite impressed with the amount of data Axe can handle at once, but I've hit a dead end. I think I tackled the initial problem of storing bullet data like how anyone would, in the safe RAM areas, every 6 bytes account for one bullet, as x, y, dx and dy. Enough of boring you with things you are well familiar with, how do I search for empty 2-byte elements in a buffer? Or to solve (and ruin) my solution, what is the most effective way of replacing bullets that have gone offscreen with newer bullets?

Right now, my main loop involves going through every six bytes in the designated buffers, adding dy dx to x and y, and finally check if it's out of screen, and making it zero. The loop ignores data when x + y = 0.

If I need to elaborate further for your benefit, do ask.
Title: Re: Axe Q&A
Post by: Runer112 on April 11, 2013, 02:29:56 pm
There's a pretty ingenious (at least I thought so when I learned it years ago) way to handle this. Keep track of the total number of bullets with some variable. When you add a bullet, increase the bullet total and put the new bullet at the end of the list of bullets, which should be at the memory location old_total*6+list_start. This all probably seems pretty standard. But the trick is in bullet removal: decrease the bullet total and move the data for the last bullet in the list into the position of the bullet that was just removed. In Axe, the code for that might look something like this:

Code: [Select]
.Deletes the bullet at index r₁ (0-indexed)
.Updates bullet total N
Lbl Del
Copy(N--*6+<list_start>,r₁*6+<list_start>,6)
Return
Title: Re: Axe Q&A
Post by: Caustic on April 11, 2013, 02:40:49 pm
There's a pretty ingenious (at least I thought so when I learned it years ago) way to handle this. Keep track of the total number of bullets with some variable. When you add a bullet, increase the bullet total and put the new bullet at the end of the list of bullets, which should be at the memory location old_total*6+list_start. This all probably seems pretty standard. But the trick is in bullet removal: decrease the bullet total and move the data for the last bullet in the list into the position of the bullet that was just removed. In Axe, the code for that might look something like this:

Code: [Select]
.Deletes the bullet at index r₁ (0-indexed)
.Updates bullet total N
Lbl Del
Copy(N--*6+<list_start>,r₁*6+<list_start>,6)
Return

Thank you so so much for your quick reply, as always. But I feel so cheap having such an obvious (albeit impressive and practical) solution spoonfed to me... ;_; it's figuring out these solutions that make programming such a wonderful experience.

Thanks again, anyhow. O(^^O)

Edit: Modern Smartphones are so good at the one or two things they should do, like typing a forum post without subtly sneaking a typo or two in.
Title: Re: Axe Q&A
Post by: rampadc on May 01, 2013, 03:30:45 am
Quick question, is there a way to loop through static variables? For example, I have 19 sprites Pic00, Pic01, Pic02,...,Pic18, and I'd like to display them horizontally across the screen (until it reaches the edge and go to the next column).

I've read somewhere that you can use
Code: [Select]
For(I,0,18)
Pt-On(X,Y,Pic00+I)
End

But all I got is the first sprite pressed down and spread across the screen (think of butter or shift drag in MSPaint).
Title: Re: Axe Q&A
Post by: Runer112 on May 01, 2013, 03:36:08 am
Axe includes data in programs in the same order you enter it. What this means is that if you enter the data for 19 sprites contiguously, they will end up in the compiled program in that same order with no gaps between their data. Knowing that each monochrome 8x8 sprite is 8 bytes large, each consecutive sprite must then be exactly 8 bytes in memory after the one before it. So you can access the Ith sprite (0-indexed) with I*8+Pic00.
Title: Re: Axe Q&A
Post by: Streetwalrus on May 01, 2013, 03:36:17 am
A sprite is 8 bytes so you'd do :
For(I,0,18)
Pt-On(X,Y,I*8+Pic00)
Y+8->Y
.Wrap to the next column :
If Y>58
X+8->X
0->Y
End
End

Also note that you don't need to name all the sprites since they're continuous data.

Edit : Ninja'd by Runer, but I gave you the code. :P

And welcome to Omni ! Have some peanuts :
!peanuts
Title: Re: Axe Q&A
Post by: rampadc on May 01, 2013, 03:44:21 am
Thank you Runner and thanks for the tip Walker!
Title: Re: Axe Q&A
Post by: Hayleia on May 01, 2013, 03:52:54 am
Quick question, is there a way to loop through static variables? For example, I have 19 sprites Pic00, Pic01, Pic02,...,Pic18, and I'd like to display them horizontally across the screen (until it reaches the edge and go to the next column).

I've read somewhere that you can use
Code: [Select]
For(I,0,18)
Pt-On(X,Y,Pic00+I)
End

But all I got is the first sprite pressed down and spread across the screen (think of butter or shift drag in MSPaint).
You already got the answer, but I wanted to precise some things. I think that your problem comes from the fact you said "static variables".
First of all, what can a static variable be ? Is is static or variable ? :P
But most of all, your data is not to be treated as variables, static or not, but as bytes, pointed by pointers. This is why when you have a bunch of 8x8 sprites, the first one is pointed by some pointer P, and the second one is pointed by P+8 (as Runer and StreetWalker said), because it is 8 bytes after the beginning of the first sprite in your data.
Title: Re: Axe Q&A
Post by: rampadc on May 01, 2013, 07:28:57 am
Noted. I need some help with displaying some sprites. I'm getting some pixels turned on. It's random. For each compilation pixels get turned on randomly.

(http://i44.tinypic.com/5ecrgk.jpg)

Code: [Select]
.CONC

.Setup sprites
[FFFFFFFFFFFFFFFFFF81BD959D8581FFFF81A19DA1BD81FFFF81BDA5BDA181FFFF81BDBD858581FFFF8191BD919181FFFF81A199998581FFFF81BDBDBD9981FFFF81BDA5A59981FFFF81A599A5A581FFFF81BDBDBDA581FFFF81A5BDBDBD81FFFF818199998181FFFF8199A5A59981FFFF81BD9D8D8581FFFF81BDB9B1A181FFFF81858D9DBD81FFFF81A1B1B9BD81FFFF81BD99999981FF]->Pic0

DiagnosticOff
ClrHome

.DRAW
0->X:0->Y
For(I,0,35)
If X>88
0->X
Y+8->Y
End
Pt-On(X,Y,I*8+Pic0)
X+8->X
End
DispGraph

.LOOP TILL ENTER
Repeat getKey(9)

End
Title: Re: Axe Q&A
Post by: Hayleia on May 01, 2013, 07:38:55 am
Try replacing your ClrHome with a ClrDraw.
What ClrHome does is clearing the screen, while ClrDraw clears the main buffer, where all your drawings go, and which is copied to the screen with the DispGraph. So if you don't clear it at the beginning of your program, chances are that you are drawing to a buffer that is not empty.
Title: Re: Axe Q&A
Post by: Streetwalrus on May 01, 2013, 09:00:07 am
Code: [Select]
[FFFFFFFFFFFFFFFFFF81BD959D8581FFFF81A19DA1BD81FFFF81BDA5BDA181FFFF81BDBD858581FFFF8191BD919181FFFF81A199998581FFFF81BDBDBD9981FFFF81BDA5A59981FFFF81A599A5A581FFFF81BDBDBDA581FFFF81A5BDBDBD81FFFF818199998181FFFF8199A5A59981FFFF81BD9D8D8581FFFF81BDB9B1A181FFFF81858D9DBD81FFFF81A1B1B9BD81FFFF81BD99999981FF]->Pic0
Ouch. You should do that :
Code: [Select]
[sprite1]->Pic0
[sprite2]
...
[sprite18]
That'd be much more readable and easier to edit. ;)
Title: Re: Axe Q&A
Post by: rampadc on May 01, 2013, 09:31:04 am
I've tried ClrDraw and ClrDrawrr both didn't work.
Title: Re: Axe Q&A
Post by: TheMachine02 on May 01, 2013, 09:59:05 am
you have 18 spirites, no ?

If yes, then change the 35 in the for() to 17

I think pxl random appears because you draw undefined spirites
Title: Re: Axe Q&A
Post by: rampadc on May 01, 2013, 10:53:47 am
Thanks. I'm not sure why I put 35 there.
Title: Re: Axe Q&A
Post by: leafy on May 01, 2013, 10:59:52 am
Quick question, is there a way to loop through static variables? For example, I have 19 sprites Pic00, Pic01, Pic02,...,Pic18, and I'd like to display them horizontally across the screen (until it reaches the edge and go to the next column).

Code: [Select]
For(I,0,11)
Pt-On(I*8,0,I*8+Pic00)
End
Title: Re: Axe Q&A
Post by: Joshuasm32 on May 01, 2013, 05:17:12 pm
I would like to learn Axe...  However, I can't find a complete tutorial and every program that I try to make throws an error while compiling.   :w00t:  Can anybody help, PLEASE?
Title: Re: Axe Q&A
Post by: Runer112 on May 01, 2013, 05:21:44 pm
I would advise fully reading through the Documentation.pdf file included in Axe releases, for starters. It's far from a total guidebook, but it covers a lot of the basics and walks through code examples for common tasks.
Title: Re: Axe Q&A
Post by: Joshuasm32 on May 01, 2013, 05:23:46 pm
Thank you!   ;D
Title: Re: Axe Q&A
Post by: TheBassetHound on May 06, 2013, 10:12:32 pm
N00B QUESTION ALERT:
read with cation as this may cause serious to fatal n00bism.

What is axe???? I'd like to learn...

(p.s. How do you get spoilers in replies?)
:w00t:
Title: Re: Axe Q&A
Post by: blue_bear_94 on May 06, 2013, 10:16:11 pm
N00B QUESTION ALERT:
read with cation as this may cause serious to fatal n00bism.

What is axe???? I'd like to learn...

(p.s. How do you get spoilers in replies?)
:w00t:
It's a compiled language for the 83+/84+ series. What this means is that Axe code gets compiled into machine code using an app. The advantage of using Axe over assembly is the lower learning curve.
Title: Re: Axe Q&A
Post by: Joshuasm32 on May 07, 2013, 05:03:48 pm
Spoiler For Spoiler:
To do a spoiler in a post, use the "Sp" button in the post module, or type:

[ s p o i l e r ]  (INSERT TEXT HERE)  [ / s p o i l e r ]
Title: Re: Axe Q&A
Post by: TheBassetHound on May 07, 2013, 09:18:02 pm
Spoiler For Spoiler:
Aha, some HTML! (Still need to learn... XD)
Thanks! :thumbsup:
Title: Re: Axe Q&A
Post by: Streetwalrus on May 08, 2013, 03:46:22 am
That's not HTML but BBcode. Allowing users to input HTML is a security breach.
Title: Re: Axe Q&A
Post by: Darl181 on May 18, 2013, 01:11:20 pm
I've seen countless optimizations with this, but never completely understood it myself..

How exactly is hl handled throughout loops? Does For(I,#,#) change it every iteration? Or do all loops leave hl untouched when execution goes back to the start?
Title: Re: Axe Q&A
Post by: Runer112 on May 18, 2013, 06:38:42 pm
The line after For(VAR,START,END) will hold the value of END-VAR for the current iteration. You can use this to optimize if you'd like, just keep in mind that this could potentially change in the future.

I can't say I've seen optimizations involving the use of this value... I have, however, made many optimizations using For(CONST), as this doesn't even affect HL. But be wary that For(VAR/EXPR) will load VAR/EXPR into HL at the start of the first iteration, but not after that.
Title: Re: Axe Q&A
Post by: Ft.lou on June 21, 2013, 07:42:56 am
Can someone explain the conditional comment for me?
Can i use a variable in the conditional comment?
THX
Title: Re: Axe Q&A
Post by: Hayleia on June 21, 2013, 07:55:49 am
You can't use a variable in a conditionnal comment. It is described in the readme that the argument must be a constant (or a test involving only constants, which is a constant in some way).

It can be useful for example (other examples can be found but I give this one) if you want to make two versions of your program: one for regular 83+ and one for the 15 MHz calcs. Then just do your code like that:

.PROGRAM
XXX→°Model

<put some code here>

...If °Model=83
<put here the code for the regular 83+>
...Else
<put here the code for 15MHz models>
...End

<put some code here>

Then, to compile the 83+ version, replace XXX with 83 and compile, and to compile the 15MHz version, replace XXX with 84 and compile. If °Model=83, only the code for the regular 83+ will be parsed, and the contrary if you put 84.
And since the compiler tests °Model when compiling and not when launching the program, you can't use a variable there.
Title: Re: Axe Q&A
Post by: Ft.lou on June 21, 2013, 08:21:47 am
Thanks for help! I understand now.. :)
Title: Appvars
Post by: BlackCode on August 26, 2013, 12:53:03 am
Alright, I need some help with appvars.  I don't actually have my calc right now, but this is about what my code looks like.
Code: [Select]
getcalc("appvMAP,10")->A
For(X,0,9)
0->{A+X}
End
1->{A}
For(X,0,9)
Output(0,0,{X+A}>Dec)
End

Obviously not complete or optimized, I'm just trying to get used to appvars.  My issue is that I've stored 0s and 1s to the appvar, yet it outputs values from between 0 and 255.  Any ideas why its doing this?  I assume I'm either writing to it incorrectly or reading incorrectly, but I can't figure it out.
Title: Re: Axe Q&A
Post by: Runer112 on August 26, 2013, 01:04:49 am
Hmm... being able to see the real code could be helpful. I believe there are some copying errors in that code, like the size argument of GetCalc() being inside the quotation marks and the value outputs all overwriting each other. :P But even with these errors fixed, I don't see anything critically wrong that would be causing what you got.
Title: Re: Axe Q&A
Post by: BlackCode on August 26, 2013, 01:16:31 am
Hmm... being able to see the real code could be helpful. I believe there are some copying errors in that code, like the size argument of GetCalc() being inside the quotation marks and the value outputs all overwriting each other. :P

If by outputs overwriting eachother you mean they all go to 0,0, than yea they do.  I just stuck a pause 500 in there so I could see each number.  As for the quotation marks, I just realized I didn't have them like that, not sure why I thought I did...
Title: Re: Axe Q&A
Post by: Hayleia on August 26, 2013, 03:52:18 am
Also, that doesn't solve any problem, but you may want to check the Fill command out instead of using a For loop to set a bunch of bytes at 0.
Now your code seems to work on Wabbit (once I put the quotes at the right place), I don't see any problem, it displays a 1 then zeroes.
Also be sure that the appv is the appv token, and not a "a" followed by a "p", ...
Title: Re: Axe Q&A
Post by: BlackCode on August 26, 2013, 06:13:32 pm
Also, that doesn't solve any problem, but you may want to check the Fill command out instead of using a For loop to set a bunch of bytes at 0.
Now your code seems to work on Wabbit (once I put the quotes at the right place), I don't see any problem, it displays a 1 then zeroes.
Also be sure that the appv is the appv token, and not a "a" followed by a "p", ...

*Facedesk*. Realized in math today that I had been reading the code as I thought I wrote it, not as I actually did, silly typos fixed, and it works well now.  Thanks for attempting to help though :P

On an unrelated note, is there a better way to handle input from getkey than a bunch if if/elseif? 
Title: Re: Axe Q&A
Post by: Streetwalrus on August 28, 2013, 12:54:17 pm
Yes with a For loop.
Title: Re: Axe Q&A
Post by: BlackCode on August 28, 2013, 08:44:15 pm
Yes with a For loop.
While I do appreciate any help...I have no idea how a for loop could possibly improve handling of getkey routines.  Could you perhaps elaborate on how to use it?  (Not the for loop, I can use those fine, using it for a better input routine).
Title: Re: Axe Q&A
Post by: Hayleia on August 29, 2013, 03:26:48 am
Well, since you didn't say what you used the getKey for, we can't really tell how to improve your input. A For loop helps sometimes and doesn't some other times.
For example, if you want F1 to increment {L1+1}, F2 to increment {L1+2}, ... F5 to increment {L1+5}, then you can see the For loop appear by itself.
But if the actions od the keys are really different, maybe using some ElseIf is better. Just learn how to optimize the ElseIf.

If A=0

ElseIf A=1

ElseIf A=2

ElseIf A=3

ElseIf A=4

End


can be optimized as

!If A

Else!If -1

Else!If -1

Else!If -1

Else!If -1

End
Title: Re: Axe Q&A
Post by: BlackCode on September 27, 2013, 10:13:20 pm
Anyone have any methods for better grayscale?  I'm currently using Hayleia's method, but even after extensive calibration I still get light diagonal lines running down (these are called scanlines right?). The best I've gotten is a loop with Pause(22), but this makes it impossible to do anything else.  Just using four level grayscale.
Title: Re: Axe Q&A
Post by: Runer112 on September 27, 2013, 10:14:19 pm
/me points to GrayLib (http://ourl.ca/19498)
Title: Re: Axe Q&A
Post by: BlackCode on September 28, 2013, 12:43:51 am
That was easier than I expected...thank you.
Title: Re: Axe Q&A
Post by: Hayleia on November 02, 2013, 06:09:28 am
What does inData return (when not 0) ? The position of the first occurrence ? Of the last one ? Of a random one ?
Title: Re: Axe Q&A
Post by: Runer112 on November 02, 2013, 12:58:48 pm
Well this is awkward... inData(BYTE,PTR) returns the position of the first occurrence, while the new inData(BYTE,PTR,SIZE) returns the position of the last occurrence. That was done for extreme optimization purposes, and I don't think I ever considered the case where it would be used on data that contains the same byte multiple times... But that case is definitely one that it should handle, and you would then expect it to return the position of the first occurrence, wouldn't you...

Can you get away with it searching backwards for now? I can try to help implement a solution if you want.
Title: Re: Axe Q&A
Post by: Hayleia on November 02, 2013, 02:04:13 pm
Lol, I understand your choices but you should add this to the commands.html so people don't think they do the same. And for now, I don't need it to give me the first occurrence nor the last one, but a random one lol. I guess this won't be a feature anytime soon.

Thanks for the reply and for the update anyway :)
Title: Re: Axe Q&A
Post by: ppaannzzeerr on November 25, 2013, 05:51:33 am
Why can't I find my prgms in Axe? There're a number of prgms in my TI84 SE, but there is nothing shown on the Axe.
Tip:My Axe is 1.2.2
Title: Re: Axe Q&A
Post by: Matrefeytontias on November 25, 2013, 08:25:04 am
Did you start your programs with a dot and the name of your executable ?
Title: Re: Axe Q&A
Post by: ClrDraw on November 25, 2013, 11:11:37 am
The name after the dot also has to start with a capital letter, if it starts with a lowercase or a number it won't show up.
Title: Re: Axe Q&A
Post by: Hayleia on November 27, 2013, 12:58:35 am
The question was asked on a French forum (http://espace-ti.forumactif.com/t1056-axe-spritedt-encore-un-editeur-de-plus) where people for some reason don't want to come here even though this is where they'll get the most accurate answers about Axe.

So anyway, here is the question: is it possible to change the size of an appvar ?
Note, I assume the answer is "yes" and the real question is "how ?" :P
Title: Re: Axe Q&A
Post by: Runer112 on November 27, 2013, 01:00:38 am
The answer is probably MemKit.


Quote from: MemKit readme
---------------------------------------------------------------------------------------------
New(PTR,OFS,SIZ)    Arguments: PTR = Pointer to start of program/appvar (from getcalc).
                               OFS = Offset in program to add memory
                               SIZ = Size of memory to insert
                    Returns: 0 if it failed, non-zero if it succeeded.
                    Description: Attempts to inflate the size of a program/appvar
---------------------------------------------------------------------------------------------
Delete(PTR,OFS,SIZ) Arguments: PTR = Pointer to start of program/appvar (from getcalc).
                               OFS = Offset in program to start deleting memory
                               SIZ = Size of memory to delete
                    Returns: 0 if it failed, non-zero if it succeeded.
                    Description: Attempts to shrink the size of a program/appvar
---------------------------------------------------------------------------------------------

Title: Re: Axe Q&A
Post by: Hayleia on November 27, 2013, 01:37:29 am
Lol weird, I used MemKit before, I remembered that it had this feature, went to the readme before asking you the question but didn't find the answer O.O
I guess I must have read only the first line of each section or something like that -.-

Thanks :)
Title: Re: Axe Q&A
Post by: BlackCode on December 18, 2013, 08:20:50 pm
More random questions...
What would be the best way to get text() functionality without actually using the command (speed reasons)?  My first thought is to just tilemap the screen and have sprites be letters.  However, depending on how many different characters I use, this could end up being a lot of sprites to define.  Are there any better methods out there?
Title: Re: Axe Q&A
Post by: ClrDraw on December 18, 2013, 09:51:53 pm
I would imagine the text command is faster looping through a map :-\ you have Fix 5 in your program right? Cause if your putting your text on the buffer and using dispgraph once at the end then it isn't that slow.

EDIT: 200 posts  :)
Title: Re: Axe Q&A
Post by: Matrefeytontias on December 19, 2013, 02:00:07 am
More random questions...
What would be the best way to get text() functionality without actually using the command (speed reasons)?  My first thought is to just tilemap the screen and have sprites be letters.  However, depending on how many different characters I use, this could end up being a lot of sprites to define.  Are there any better methods out there?

You don't need to tilemal the screen, just advances your text cursor as you write letters to the screen. It remains the fastest solution AFAIK.

I would imagine the text command is faster looping through a map :-\ you have Fix 5 in your program right? Cause if your putting your text on the buffer and using dispgraph once at the end then it isn't that slow.
Not as slow, but still very slow. This is due to the OS's _vPutS routine.
Title: Re: Axe Q&A
Post by: Hayleia on December 19, 2013, 02:04:34 am
I don't know if it is any faster (I use that Axiom but never have programs where Text commands eat a lot of time) but Jacobly wrote an Axiom (http://ourl.ca/16517) to have more flexibility with text commands. It might be faster since it doesn't use TI's routines.
Title: Re: Axe Q&A
Post by: Eiyeron on December 19, 2013, 06:49:48 am
It is faster. Nice thing to use.
Title: Re: Axe Q&A
Post by: Hayleia on December 31, 2013, 12:18:43 pm
Answering here a question that was asked on IRC.

This code is totally useless and unoptimized (on purpose so it is more understandable) but you get the idea.

.A
Data(9,6,3,0,0,0,0,0,8,5,2,0,0,0,0,0,7,4,1)->Pic1

Fix 5
ClrDraw

While 1
 DispGraph
 getKey->K
 If K>17 and (K<37)
  Text(0,0,{K-18+Pic1}>Dec)
 End
EndIf getKey(15)
Title: Re: Axe Q&A
Post by: TheMachine02 on December 31, 2013, 01:20:49 pm
Does someone willing to create a pretty hard routine ?

The goal is to do a clipped line routine with both x,y in range [-5000],[5000] ; I've tried but overflow is beating me all time ...  :P
Title: Re: Axe Q&A
Post by: Hayleia on December 31, 2013, 01:27:26 pm
Maybe you can try to "reduce" coordinates by finding the middle of the line and only drawing the half of it that has a part on the screen ?
Title: Re: Axe Q&A
Post by: Hayleia on January 15, 2014, 11:13:51 am
I just got a stupid idea. Why not make an early version of Axe for CSE that would be exactly the same as the current Axe, but with changed DispGraph (and DispGraphr and caetera) so that it displays a stretched L6 (and L3 and caetera) on the screen ?
Title: Re: Axe Q&A
Post by: Eiyeron on January 15, 2014, 11:50:54 am
Becauses I think it depends on many free RAM areas that will crash the CSE if they're moved/erased.
Title: Re: Axe Q&A
Post by: Matrefeytontias on January 15, 2014, 11:54:19 am
Not necessarily ... all free RAM areas that exist on the monochrome z80 calcs also are free RAM areas on the color one, and all are at least as large if not larger (afaik). It's really up to Runer112 I guess.
Title: Re: Axe Q&A
Post by: Hayleia on January 15, 2014, 11:55:36 am
And from what I understood, extra RAM pages are back, so at worst, copy all sensitive RAM there when launching the program then copy it back where it should be when quitting.
Title: Re: Axe Q&A
Post by: Runer112 on January 15, 2014, 09:03:21 pm
I just got a stupid idea. Why not make an early version of Axe for CSE that would be exactly the same as the current Axe, but with changed DispGraph (and DispGraphr and caetera) so that it displays a stretched L6 (and L3 and caetera) on the screen ?

(A) While a full-screen update on the non-color calculators takes about 1/100th of a second and almost everything that uses it relies on it being fast, a full-screen update on the color calcs takes about 1/5th of a second, (B) probably other things I can't think of right now, and (C) why not just use a non-color calculator in that case.

I do promise that I'd like to get a color version of Axe done eventually, but my time right now is superbly limited. I'm working 45 hours a week. x.x
Title: Re: Axe Q&A
Post by: Hayleia on January 16, 2014, 02:18:00 am
(A) While a full-screen update on the non-color calculators takes about 1/100th of a second and almost everything that uses it relies on it being fast, a full-screen update on the color calcs takes about 1/5th of a second
Yeah but we could cheat with some frameskip and with the double-pixel trick. Moreover, some coders (like matref and I, or Builderboy and others) still have the possibility to trigger the 15MHz mode to get more speed on the CSE without losing any compatibility this time, so our programs of course will have speed issues, but also some speed gains.
Also that depends on the program you are porting because I don't think AudaciTI will have too much issues with refreshing since nothing happens on the screen except menus :P

(C) why not just use a non-color calculator in that case.
That's not for me, that's for people like MacBernick or dreamdragon who only have a CSE and may want games on it. So of course, giving them the old games is not the best to do, but that can help them wait.
Title: Re: Re: Axe Q&A
Post by: DJ Omnimaga on January 16, 2014, 07:35:52 am
The CSE will not have L3 and L6 for temp LCD buffers. 128 KB of RAM isn't even enough to store 320x240 (2 bytes) of data. While we could use 160x120, it would still be so much data to copy around that using any buffer other than the hidden half of the LCD GRAM would greatly slow programs down.

I think Axe should use buffers in a similar way to XLIBC as an option, but let you change the offset of the GRAM start/end and its buffer so that it's not an huge PITA to make a side-scroller.
Title: Re: Axe Q&A
Post by: Hayleia on January 16, 2014, 09:26:26 am
The CSE will not have L3 and L6 for temp LCD buffers. 128 KB of RAM isn't even enough to store 320x240 (2 bytes) of data.
But we are not talking about storing 320x240 bytes of data, still 768. We are asking to for 94x64 monochrome support, like somehow a "retro-compatibility mode".
Title: Re: Axe Q&A
Post by: Runer112 on January 16, 2014, 09:41:20 pm
(A) While a full-screen update on the non-color calculators takes about 1/100th of a second and almost everything that uses it relies on it being fast, a full-screen update on the color calcs takes about 1/5th of a second
Yeah but we could cheat with some frameskip and with the double-pixel trick. Moreover, some coders (like matref and I, or Builderboy and others) still have the possibility to trigger the 15MHz mode to get more speed on the CSE without losing any compatibility this time, so our programs of course will have speed issues, but also some speed gains.
Also that depends on the program you are porting because I don't think AudaciTI will have too much issues with refreshing since nothing happens on the screen except menus :P

Unfortunately, these points are not really valid. The ~5Hz screen update rate I cited is with 15MHz mode enabled already. If you tried frameskip, considering most non-color games probably run at 20-60fps, you'd be skipping anywhere from 75% to 90% of frames, which is very poor. And finally, it doesn't really matter how few differences there are between frames, because DispGraph has always been a full-frame resend command and can't really be modified to (efficiently) perform incremental updates.
Title: Re: Axe Q&A
Post by: ClrDraw on January 18, 2014, 09:40:09 pm
So with an 8 by 8 sprite you use Pt-Change() to draw it inverted. How do you do that with a 16 by 16?
Title: Re: Axe Q&A
Post by: calcdude84se on January 18, 2014, 11:59:53 pm
So with an 8 by 8 sprite you use Pt-Change() to draw it inverted. How do you do that with a 16 by 16?
Since Axe doesn't have any 16x16 sprite routines (at least as far as I could tell according to the official documentation), you have to do it by drawing four 8x8 sprites. So if Pic1 is the top-left corner of the 16x16 sprite, Pic1+8 is the top-right, +16 the bottom-left, and +24 the bottom-right, then you'd want to do something like this (assuming drawing to X,Y):
Code: [Select]
Pt-Change(X,Y,Pic1)
Pt-Change(X+8,Y,Pic1+8)
Pt-Change(X,Y+8,Pic1+16)
Pt-Change(X+8,Y+8,Pic1+24)
Title: Re: Axe Q&A
Post by: ClrDraw on January 20, 2014, 10:33:33 am
Okay, thanks. One more question, how do I name my own variables? not static variables, but stuff I can change like A,B,C, etc (just different names).
Title: Re: Axe Q&A
Post by: Hayleia on January 20, 2014, 10:42:54 am
Choose a pointer to a safe RAM area with a length of two bytes or more, for example L1, then do L1→°Lolwat. Now Lolwat is a variable you can use. You can also do L1+2→°Wattouat or [0000]→°Meh. The last solution is not a good idea since it will trigger writeback and won't work in apps, but if you already use all safe RAM areas, you might want to do this.
Title: Re: Axe Q&A
Post by: Hayleia on February 05, 2014, 01:32:50 am
Quick question: are min and max signed or unsigned ?
(does min(~1,0) return 0 because 0<65535 or ~1 because ~1<0 ?)
Title: Re: Axe Q&A
Post by: TheMachine02 on February 05, 2014, 01:50:46 am
there is two version of min/max :

one unsigned :

Code: [Select]
min(0,-1) .return 0 (0<65535)
max(-1,0) .return -1

and one signed (with the r modifier):

Code: [Select]
min(-1,5)r   .return -1
max(-8,9)r  .return 9
Title: Re: Axe Q&A
Post by: Hayleia on February 05, 2014, 11:50:31 am
Ok, thanks for the answer :)
Title: Re: Axe Q&A
Post by: Matrefeytontias on February 16, 2014, 05:35:04 am
I'm writing an axiom and want to put the address of a function of the axiom in a variable. Currently what I do is :
Code: [Select]
.db REP_ABS
 .org $-1
 ld hl, sub_axiom10
 ld (someVar), hl
But it doesn't seem to work : when in the Axe code I replace somevar by the axiom function itself it works. I have REP_ABS = $49. What am I doing wrong ?

EDIT : solved on IRC, I had to use REP_NEXT ($7F). I thought I tried it already.
Title: Re: Axe Q&A
Post by: TheMachine02 on February 19, 2014, 11:52:44 am
Does using #ExprOn in a program affect axiom too ?
I mean, if an axiom use the axe multiplication and the program calling axiom command have #ExprOn, does the multiplication will be optimize for speed too ?
Title: Re: Axe Q&A
Post by: Runer112 on February 19, 2014, 08:27:32 pm
Does using #ExprOn in a program affect axiom too ?
I mean, if an axiom use the axe multiplication and the program calling axiom command have #ExprOn, does the multiplication will be optimize for speed too ?

That's a good question... Honestly, I'm not sure. If I had to guess, I'd say that because of how Axioms are parsed, it would depend on the optimization state at the end of the main source program. Either that, or it simply ignores the optimization state (although if you use multiplication yourself in a speed-optimized block, that should force the Axiom to as well).
Title: Re: Axe Q&A
Post by: Matrefeytontias on February 21, 2014, 10:18:11 am
Isn't there a way to,simply call sub_mulFast instead of sub_mul ? Apparently axioms always compile in #ExprOff mode, no matter what the state of optimization is when they are parsed.
Title: Re: Axe Q&A
Post by: Runer112 on February 21, 2014, 06:07:16 pm
Isn't there a way to,simply call sub_mulFast instead of sub_mul ? Apparently axioms always compile in #ExprOff mode, no matter what the state of optimization is when they are parsed.

No, Axioms can't explicitly call the fast version of the command. And yes, a quick test seems to suggest that subroutines referenced by Axioms will default to the slow version. However, it also seems that my suspicion that using a native Axe command that calls the underlying subroutine in an #ExprOn section somewhere does result in the Axiom referencing the fast version, so I guess having a dummy call in the Axe source to a command that uses the underlying subroutine would be a workaround.

I'm not sure if this is a problem that is reasonably fixable, but I'll look into a more permanent solution.
Title: Re: Axe Q&A
Post by: Matrefeytontias on February 21, 2014, 07:58:30 pm
So I would do like a dummy multiplication at the start of the #ExprOn block ? Like :

:#ExprOn
:A*B
:.rest of the code


Is that it ?
Title: Re: Axe Q&A
Post by: ClrDraw on March 08, 2014, 07:21:54 pm
I'm making a new game and need to make the attached picture into a giant bitmap for my Axe source. Is there any way to do this that won't take me an hour?
Title: Re: Axe Q&A
Post by: Runer112 on March 08, 2014, 07:24:37 pm
I would recommend SourceCoder (http://sc.cemetech.net/). Simply upload the image and voila, tons of output formats, one of which should be plain black-and-white image hex.
Title: Re: Axe Q&A
Post by: Matrefeytontias on March 08, 2014, 07:27:51 pm
You can convert it to a .8xi file with TI-Screen Capture (see TI-Connect/Tools) and send it to your calc. From there,  include [PicX]->Y, where PicX is whatever Pic variable you stored your bitmap in, and Y any Axe variable or static pointer. You'll need the said Pic variable every time you'll compile your program, but you can archive it. It's exactly the same as typing it in in hex, just a hundred times less annoying.
Title: Re: Axe Q&A
Post by: Hayleia on March 09, 2014, 04:51:14 am
It's still a bit annoying because you "only have" 10 Pic variables (notice the quotes, I know we can have more but TI-Screen Capture can't use the unofficial ones) so you can't have tons of projects with images on your calc.

The image converter is the only thing I use in SourceCoder but I find it very useful. There are two downsides to it, one being that you can't use it without an internet connection, and the other one being that your image now uses 1536 bytes in your source code instead of 768. But you don't use any variable so you can't have unlimited projects (if we forget the limited memory of your calc).

Something to get rid of all downsides could be to use TI-Screen Capture to convert as a Pic, then use TokenIDE and Wabbitemu to quickly coin a program that converts the Pic into an appvar. This way, no need for an internet connection, a bit more than 768 bytes but far from 1536 and unlimited names :)
It just takes time the first time you write the Pic→Appv program, but it takes like 1 minute and only the first time.
Title: Re: Axe Q&A
Post by: ClrDraw on March 09, 2014, 11:44:33 am

Quote
I would recommend SourceCoder (http://sc.cemetech.net/). Simply upload the image and voila, tons of output formats, one of which should be plain black-and-white image hex.
Thank you runner, that did it.

Quote
You can convert it to a .8xi file with TI-Screen Capture (see TI-Connect/Tools) and send it to your calc. From there,  include [PicX]->Y, where PicX is whatever Pic variable you stored your bitmap in, and Y any Axe variable or static pointer. You'll need the said Pic variable every time you'll compile your program, but you can archive it. It's exactly the same as typing it in in hex, just a hundred times less annoying.
This would be really nice because it would save space, but it doesn't work when I try. After I store it to my variable, do I use the bitmap command?


Quote
Something to get rid of all downsides could be to use TI-Screen Capture to convert as a Pic, then use TokenIDE and Wabbitemu to quickly coin a program that converts the Pic into an appvar.
That's a smart idea; you could get as many pics as you need and not be limited to ten.
Title: Re: Axe Q&A
Post by: Matrefeytontias on March 09, 2014, 12:00:04 pm
Quote
You can convert it to a .8xi file with TI-Screen Capture (see TI-Connect/Tools) and send it to your calc. From there,  include [PicX]->Y, where PicX is whatever Pic variable you stored your bitmap in, and Y any Axe variable or static pointer. You'll need the said Pic variable every time you'll compile your program, but you can archive it. It's exactly the same as typing it in in hex, just a hundred times less annoying.
This would be really nice because it would save space, but it doesn't work when I try. After I store it to my variable, do I use the bitmap command?
Since it's a classical image, you can do DispGraph(pointerToThePic) to display it immediately, or Copy(pointerToThePic) to copy it to L6. Bitmap() won't work since you need a header.

How does it not work ? Does it compile at least ?
Title: Re: Axe Q&A
Post by: ClrDraw on March 09, 2014, 12:11:56 pm
Thank you, that fixed it. However I have a problem with SourceCoder  :/  it exported my pic into pic1 but it's shifted... The code is correct and working, but SourceCoder exports my pic wrong.
Code: [Select]
.RUN
ClrDraw
DispGraph([Pic1])
Repeat getkey(15)
End
Title: Re: Axe Q&A
Post by: Matrefeytontias on March 09, 2014, 12:14:30 pm
You might want to ask KermM about that. I never used SourceCoder for fullscreen images.
Title: Re: Axe Q&A
Post by: ClrDraw on March 09, 2014, 12:17:20 pm
It's fixed now. Instead of importing a bmp and exporting 8xi, I imported a png instead. But yeah, I'll tell him. And thank you  :)
Title: Re: Axe Q&A
Post by: ClrDraw on March 12, 2014, 11:43:48 am
I need to implement a timer in my game (don't step the white tile) and want to do so with interrupts. How would I do this? I've tried learning from the documentation but my code always crashes.


I'd like to make it so that it stores the seconds in D and hundredths of seconds in E.
Title: Re: Axe Q&A
Post by: Hayleia on March 13, 2014, 09:59:24 am
I noticed when using MirageOS (I do that sometimes) that some programs by thepenguin77 have an icon. However, they seem to be compiled for Ion since zStart alone can run them. So could the Ion header used when compiling for Ion accept MirageOS icons ?
Title: Re: Axe Q&A
Post by: Sorunome on March 13, 2014, 01:34:37 pm
I thought the Ion header doesn't support an image icon ???
Title: Re: Axe Q&A
Post by: Hayleia on March 13, 2014, 03:16:01 pm
Well that's the point, I think there might be a possibility for it to support icons, so I am asking whether I am wrong (and I had MirageOS on my calc without knowing it, it can happen -.-) or if that header could be implemented ;)
Title: Re: Axe Q&A
Post by: Matrefeytontias on March 14, 2014, 02:00:58 am
The Ion header is just a jump to label followed by a description IIRC. So if you add an image after the said description, I'm pretty confident MirageOS will display it.
Title: Re: Axe Q&A
Post by: Hayleia on March 14, 2014, 02:04:16 am
Well then why not add the support for #Icon() when compiling for Ion ? This way we can make programs that everyone can run (compiled for Ion) and with an Icon in case it's ran through MirageOS or DoorsCS.
Title: Re: Axe Q&A
Post by: Matrefeytontias on March 14, 2014, 02:07:31 am
I guess it's because it's not the way the creator of Ion intended the Ion header. Try inputting an Ion header with an image with Asm( and see if it works.
Title: Re: Axe Q&A
Post by: Aspiring on March 29, 2014, 01:23:48 pm
This question has probably already been asked but... is there any way to run a line of basic code in axe?  If some other app like mirage os or doors cs is required I don't mind.  I want this so I can access basic functions that are added by apps like omnicalc and some others.
Title: Re: Axe Q&A
Post by: aeTIos on March 29, 2014, 01:44:56 pm
There sure is! I, however, have to look up how to do that.
Title: Re: Axe Q&A
Post by: Aspiring on March 29, 2014, 02:08:50 pm
Ok I found this Asm(E7FDCB08CEEF9B4AFDCB088E) but it only executes programs in the program menu but I was hoping that I could execute a string instead.  :/   Maybe I could create a string and copy it to a temporary program and execute that.
Title: Re: Axe Q&A
Post by: Hayleia on March 29, 2014, 04:35:46 pm
I found that this code you mentionned here is mentionned here (http://www.omnimaga.org/axe-language/axe-how-to-execute-basic-programs/) and can run "the program you want" if you put a pointer to the name of the program in hl.
Title: Re: Axe Q&A
Post by: ClrDraw on March 29, 2014, 05:00:28 pm
Do the input and prompt commands still work when run through axe?
Title: Re: Axe Q&A
Post by: shmibs on March 30, 2014, 02:35:16 am
Ok I found this Asm(E7FDCB08CEEF9B4AFDCB088E) but it only executes programs in the program menu but I was hoping that I could execute a string instead.  :/   Maybe I could create a string and copy it to a temporary program and execute that.

you sure can! take a look at this old post (http://www.omnimaga.org/axe-language/external-vars-tutorial/msg152571/#msg152571) to get an idea of how managing OS variables can be done from within axe.
Do the input and prompt commands still work when run through axe?

the BASIC commands input and prompt store values into OS variables. if you know how to access those variables from axe (see above), you could use them to get values. however, doing so is honestly a lot more work than just writing your own input command, as you'd have to generate a program to run, execute it, convert  from OS floats to integer values for any numbers you want, and then delete the program afterwards. if you want a quick example of how one might go about making an input routine for axe, take a look at this topic (http://www.omnimaga.org/axe-language/input/msg311470/#msg311470).
Title: Re: Axe Q&A
Post by: josh landers on March 30, 2014, 02:40:39 pm
Wait are you trying to execute the name of your program useing that asm code?
If so just use the following
Code: [Select]
:"prgmA"
:asm(hexcode here)
Title: Re: Axe Q&A
Post by: NikProgrammer on April 22, 2014, 03:35:07 am
Hello, I'm new here and I need some help of authorized personal:). Ok, first, I'm afraid of overwriting something important in my TI 83's memory. How can I avoid this? And second... I was coding in TI-Basic for a few months and after those few months there was nothing new to learn from YouTube, so I decided to learn the Axe language. Now, I'm totaly confused and just want to know how I can store a number in a variable and keep it after quitting the program?
P.S.: Sorry for my english.
Title: Re: Axe Q&A
Post by: Streetwalrus on April 22, 2014, 03:44:46 am
Hello, I'm new here and I need some help of authorized personal:). Ok, first, I'm afraid of overwriting something important in my TI 83's memory.
If you have a TI-83 it will be hard to use Axe on it. :P
J/k, also it won't overwrite anything.
Title: Re: Axe Q&A
Post by: NikProgrammer on April 22, 2014, 04:49:23 am
It's a 83+☺
Title: Re: Axe Q&A
Post by: Streetwalrus on April 22, 2014, 05:02:17 am
I understood, it was just a joke. :P
It won't overwrite anything but you still have the potential of losing data so make sure everything is archived and backup on your computer often.
Title: Re: Axe Q&A
Post by: NikProgrammer on April 22, 2014, 05:41:05 am
Most of my stuff is archived and I backuped yesterday. But I still cannot keep numbers after executing and quitting a program:(
Title: Re: Axe Q&A
Post by: Streetwalrus on April 22, 2014, 05:45:33 am
I'm too lazy to explain atm. :P This should help though : http://www.omnimaga.org/axe-language/external-vars-tutorial/
Title: Re: Axe Q&A
Post by: Runer112 on April 22, 2014, 12:36:03 pm
If you haven't already, you can check out pages 14-16 of the Documentation.pdf file included in the Axe download (check out the rest of it, too!). It covers the basics of reading and writing to external variables, and includes a simple example of how to retrieve/save a high score value in an external variable.

One thing it doesn't really mention is that it's a good idea to make sure saved data is archived before exiting, so it will persist through accidental RAM clears. You can do this simply with the Archive (http://axe.eeems.ca/Commands.html#externalVariablesCommands) command (and then you'll probably want to UnArchive it when your game starts).
Title: Re: Axe Q&A
Post by: NikProgrammer on April 22, 2014, 12:40:15 pm
For example the following menu brings me always to the quit:

Code: [Select]
:.Lowrcase
:DiagnosticOff
:Lbl 00
:ClrHome
:3->A
:Output(0,1,"Lowercase")
:Output(2,3,"On")
:Output(2,4,"Off")
:Output(2,5,"Quit")
:2->B
:While 1
:Pause 200
:Output(1,A,">")
:Output(1,B,"   ")
:If getKey(1)
:A->B
:A+1->A
:End
:If getKey(4)
:A->B
:A-1->A
:End
:If A>5
:3->A
:5->B
:End
:If A=3
:If getKey(9)
:Goto ON
:End
:End
:If A=4
:If getKey(9)
:Goto OF
:End
:End
:If A=5
:If getKey(9)
:Goto ST
:End
:End
:End
:Lbl ST
:ClrHome
:Return
:Lbl ON
:Asm(FDCB24DEC9)
:ClrHome
:Disp "On"
:Pause 3000
:Goto 00
:Lbl OF
:Asm(FDCB249EC9)
:ClrHome
:Disp "Off"
:Goto 00
Title: Re: Axe Q&A
Post by: josh landers on April 22, 2014, 12:47:22 pm
Edit: removed quote.
The C9 is what is getting you...
Code: [Select]
:Asm(FDCB249EC9)You should be able to get it to work if you remove the C9
Title: Re: Axe Q&A
Post by: NikProgrammer on April 22, 2014, 12:50:49 pm
Ok thanks... I cannot hex, I learned this from YouTube, I supose C9 Stops the program?
Title: Re: Axe Q&A
Post by: josh landers on April 22, 2014, 12:54:03 pm
Ask Xeda, she knows quite a bit about the opt-codes.
Title: Re: Axe Q&A
Post by: TheMachine02 on April 22, 2014, 12:57:40 pm
C9 is the equivalent of the assembly "ret" command, wich is the equivalent of the axe command "return".
It indeed stop the program and give the control back to the OS if it is not use in a routine or such.
Title: Re: Axe Q&A
Post by: aeTIos on April 22, 2014, 01:02:28 pm
However, your program should be doing what it should do. It only won't give you feedback.
Title: Re: Axe Q&A
Post by: Sorunome on April 22, 2014, 01:52:46 pm
Ugh, i got a little problem with axes Copy().
I have the following (relevant hex in bold):
Copy([2D0100001D2D1D000A00],L5,10)

And right after that, when i check the value of {L5+7}^r it is 2560.

Any clue what is going on here? O.O
Title: Re: Axe Q&A
Post by: aeTIos on April 22, 2014, 01:55:38 pm
Yup. Little endian going on. You need to reverse the bits.
Title: Re: Axe Q&A
Post by: Sorunome on April 22, 2014, 02:05:46 pm
Yup, that was it, thanks a lot! :D
Title: Re: Axe Q&A
Post by: Hayleia on April 22, 2014, 02:10:41 pm
Yup. Little endian going on. You need to reverse the bits.
*bytes. You don't have to reverse everything, just the two bytes ;)
Title: Re: Axe Q&A
Post by: NikProgrammer on April 22, 2014, 02:14:40 pm
Maybe I need some more information about pointers. If I type in: [BlaBla hex]->Pic 1 and then Pt-on(x,y,Pic 1+Z, what will happen then?
Title: Re: Axe Q&A
Post by: Sorunome on April 22, 2014, 02:16:31 pm
A pointer is a number that points to some location in RAM.
With [hex]->Pic1 you create a pointer, Pic1, that points to the location in ram where that hex is stored.
So Pic1 can be treated just like a number.
Let's say you want the second byte pointing to that pointer, you need to look one byte later in RAM, thus you do Pic1+1
Title: Re: Axe Q&A
Post by: Hayleia on April 22, 2014, 02:18:05 pm
It will draw the sprite pointed by Pc1+Z ;)
Basically, if you do for example
[some hex]→Pic1
[same hex]
And then Pt-Off(0,,A++^8+Pic1) in a loop, it produces interesting results ;)

You can also use that as an "array of sprites", like
[first sprite]→Pic1
[second sprite]
[etc]
Then the Ith sprite can be displayed with Pt-Off(X,Y,I*8+Pic1)
Title: Re: Axe Q&A
Post by: NikProgrammer on April 22, 2014, 02:48:42 pm
I think that I understand everything except of the Pt-Off(0,A++^8+Pic1
Title: Re: Axe Q&A
Post by: Sorunome on April 22, 2014, 05:42:10 pm
Ok, so I'm trying to get the user to press second and release it and pause the code until said thing happens.
I tried to things without success :(

Code: [Select]
:While 1
:EndIf getKey(54)
:While 1
:EndIf getKey(54)=0

Code: [Select]
:While 1
:EndIf getKey(54)
:While 1
:End!If getKey(54)
They should both work IMO, any ideas?

EDIT: Putting a Pause 6 into the loops made it work, why do you need a pause in the loops, though?
Title: Re: Axe Q&A
Post by: Streetwalrus on April 22, 2014, 07:29:59 pm
I think it's a keyboard delay issue. Pause 5 always worked for me but nothing never did.
Keep in mind we have a nice cpu but all the hardware TI added is slow so io is affected a lot. :/
Title: Re: Axe Q&A
Post by: Hayleia on April 23, 2014, 03:00:01 am
I think the Pause is only needed in the second loop.

I think that I understand everything except of the Pt-Off(0,A++^8+Pic1
Except if you have a real 83+ (I mean not a new 83+.fr which is a 84+SE), I'd advise to close parentheses, brackets, etc. Keeping them open doesn't optimize anything in the compiled program and is just asking for bugs from the compiler (even though the compiler should work, but it's better not to tempt it) ;)
I also see you didn't try my code because I made a typo when writing (forgot a ","), so it actually didn't do anything :P
I corrected it in my post.

Now, what does it do ?
Well, this
[001122334455667788]

is the same as this
[00]
[11]
[2233]
[445566]
[77][88]

It doesn't seem interesting that way, I know, I am just pointing (pun intended) out that you can write your data the way you want.

Now, this
[001122334455667788]→Pic1
[001122334455667788]

is the same as this
[00]→Pic1
[112233445566778800] .this is pointed by Pic1+1
[1122334455667788]

and the same as this too
[0011]→Pic1
[223344556677880011] .this is pointed by Pic1+2
[22334455667788]

etc.
And Pt-Off(0,,A++^8+Pic1) displays the sprite pointed by Pic1, then the one pointed by Pic1+1, ... then the one pointed by Pic1+7 and then we go back to Pic1.

Do you see better what it does ? ;)
(or was it just the typo that prevented you from seeing it ? :P)
Title: Re: Axe Q&A
Post by: NikProgrammer on April 23, 2014, 03:51:32 am
I really tried the code and it really did nothing, because of that I said that I do not understand this part.
Now I understand it, thank you!

––– merged double post –––

I have a grey Sprite. Should it do that?
Title: Re: Axe Q&A
Post by: TheCoder1998 on April 23, 2014, 04:01:38 am
please don't double post :P
you can edit a previous post by clicking the modify button


also, you should introduce yourself here: http://www.omnimaga.org/introduce-yourself!/
Title: Re: Axe Q&A
Post by: NikProgrammer on April 23, 2014, 04:02:29 am
It cuts my messages after (right before) a smily ???
Title: Re: Axe Q&A
Post by: TheCoder1998 on April 23, 2014, 04:03:49 am
what do you mean?
Title: Re: Axe Q&A
Post by: NikProgrammer on April 23, 2014, 04:06:02 am
Now I removed the smilys and you see the whole messages:)
Title: Re: Axe Q&A
Post by: TheCoder1998 on April 23, 2014, 06:42:21 am
i really don't understand what you are talking about...

what message are you talking about?
Title: Re: Axe Q&A
Post by: NikProgrammer on April 23, 2014, 01:03:46 pm
The replies or posts or mails or however you call it.
Title: Re: Axe Q&A
Post by: TheCoder1998 on April 23, 2014, 01:38:25 pm
which ones are you referring to?
Title: Re: Axe Q&A
Post by: NikProgrammer on April 24, 2014, 05:04:12 am
The doublepost.
Title: Re: Axe Q&A
Post by: Sorunome on April 24, 2014, 05:37:22 am
So yeah, appvariables....
I want to have them in archive (of course), and I wonder if it is possible, instead of un-archiving it, to create a copy of it in ram, leaving the original in archive?
Title: Re: Axe Q&A
Post by: Streetwalrus on April 24, 2014, 05:44:04 am
Of course you can. You can get read access by using files with getcalc(name,file). Then if you want speed, write access or sprites you can create a new tempvar and copy() your content there.
Title: Re: Axe Q&A
Post by: TheMachine02 on April 24, 2014, 05:45:08 am
yes, that is possible. You can use file.
 
For example, let say you have appvDATA in archive, and you want a copy in ram.
You can do :
Code: [Select]
GetCalc("appvDATA",Y0)
.Y0 is the function token, it specifie the file you want to put the appv in. You have 10 file (Y0-Y9)
{Y0-2}r->A
.A will hold the size of the appv, stored 2 byte before the start of the appv.
.Next line will create a temporary vars (delete at the exit) with the size of the appv
 GetCalc("tmpDATATMP",A)->P
 Copy(Y0,P,A)
.this is allowed, but not everything can be done with file. (like 0->{Y0}r)
.P is now the pointer to appv.

In this code, I didn't check if all process succed in there task, but you most likely want to check the return value of GetCalc (0 if there is an error)
Also, when you want to store back your appv, you should be able to use Copy(P,Y0,A) (but I am not sure of this) (and based on the fact that A and P are not destroyed)
 
EDIT :  [-.-]~
Title: Re: Axe Q&A
Post by: Sorunome on April 24, 2014, 05:47:05 am
GetCalc returned 0 for me if the appvar was in Archive IIRC....
Wait, i didn't use that function symbol, what is it for? O.O
Title: Re: Axe Q&A
Post by: TheMachine02 on April 24, 2014, 05:51:17 am
It specify the file you want to put your appv in.
It is logical the getcalc return you 0 if the appv was in archive, since it couldn't read it.
Title: Re: Axe Q&A
Post by: Sorunome on April 24, 2014, 05:55:16 am
It is working, thanks!
Why couldn't i find this in the docs, though :P
Title: Re: Axe Q&A
Post by: TheMachine02 on April 24, 2014, 05:58:12 am
there is a tuto about external file, and it is also talking about file here : http://www.omnimaga.org/axe-language/external-vars-tutorial/msg152571/#msg152571 (http://www.omnimaga.org/axe-language/external-vars-tutorial/msg152571/#msg152571)
Title: Re: Axe Q&A
Post by: Streetwalrus on April 24, 2014, 01:09:10 pm
Also it's in the PDF IIRC. :P There's actually more than Y0-9 but they have different purposes that I don't remember exactly and they're not in the doc, only in the changelog. By the way that works for reading from RAM, so it's quite versatile. ;)
Title: Re: Axe Q&A
Post by: Runer112 on April 24, 2014, 06:04:08 pm
Also it's in the PDF IIRC. :P There's actually more than Y0-9 but they have different purposes that I don't remember exactly and they're not in the doc, only in the changelog.

Yeah. You can use Y1T and Y2T for variables in RAM (not using the file syntax, just normal like GetCalc(...)→Y1T), and if the variable is moved, the pointers will be adjusted to continue to point to the same offset into the variable. Unfortunately, there can only be two of them, because TI (somewhat reasonably) decided to only support two.
Title: Re: Axe Q&A
Post by: Streetwalrus on April 24, 2014, 07:19:20 pm
Oh wow is that actually a TI feature ? I guess they sometime have a genius idea and make useful things. Now I wish it is fast enough. <_<
Title: Re: Axe Q&A
Post by: Sorunome on April 25, 2014, 05:02:32 pm
Ok, now i have a For( loop behaving VERY oddly:
I have the for loop so that it modifies stuff, based on how a pointer is set
Code: [Select]
For(C,0,{GDB2})
4*C+GDB2->E
<stuff with E>
End
This does none of the modifications while the following does the first one:
Code: [Select]
For(C,0,{GDB2})
4*C+GDB2->E
4*0+GDB2->E
<stuff with E>
End
Which makes absolutely no sense to me as in the first run C will be equal to 0 and it should be able to do the first one.
It might be worthy to mention that I compile as an app.

EDIT: I just copied GDB2 now to some free ram before using it and it worked, I take it that you have to do so because I compile as an app?
Title: Re: Axe Q&A
Post by: Hayleia on April 25, 2014, 05:46:01 pm
Well you can't (at least not that easily) store in Flash, which is exactly what you are doing when writing ->{Bleh+GDB2} when you compile as an app (and after declaring GDB2 as a pointer to somewhere in your executable).

Also, always (when you can obviously, not always always) put constants at the end. I mean, write C*4 and not 4*C.
Title: Re: Axe Q&A
Post by: Sorunome on April 25, 2014, 05:50:16 pm
I was only reading off of it.
Title: Re: Axe Q&A
Post by: Runer112 on April 25, 2014, 05:56:55 pm
I can't immediately see any reason why that would be behaving oddly. It might matter what the "stuff with E" is.

Also, since applications aren't modifiable, {GB2} can only be a constant. Why not pull out whatever value it holds as a constant?
Title: Re: Axe Q&A
Post by: Sorunome on April 25, 2014, 06:01:53 pm
the stuff is this:
nib{E+1*2+1}->D
({L5+11} and D=D and ({L5+10}>=nib{E+q*2}) and (N={E}))?{E+3}->{L4+{E+2}}

And that way it is easier to me to modify my data when compiling, and also gives me the easy opportunity to move said data out of the app.
Title: Re: Axe Q&A
Post by: NikProgrammer on April 25, 2014, 06:42:53 pm
Sorry that I'm breaking in but I have a question: I do a normal program in axe and can compile as 'No shell'. Why it says not enough ROM if I try to compile this program as an App? :D
Title: Re: Axe Q&A
Post by: Sorunome on April 26, 2014, 03:53:52 am
Apps can only be up to 16384 bytes large.
Title: Re: Axe Q&A
Post by: NikProgrammer on April 26, 2014, 07:00:02 am
It is less than 2000 bytes large...
Title: Re: Axe Q&A
Post by: Sorunome on April 26, 2014, 07:16:57 am
Well, you also need at least 16384 bytes of free ROM, no matter the program size
Title: Re: Axe Q&A
Post by: Runer112 on April 26, 2014, 07:37:47 am
the stuff is this:
nib{E+1*2+1}->D
({L5+11} and D=D and ({L5+10}>=nib{E+q*2}) and (N={E}))?{E+3}->{L4+{E+2}}

Yup, the issue is in the "stuff with E". To read data from inside your program/application, you want to use nib{}r. The nib{} command with no modifier always reads from the $8000-$FFFF address range (RAM), whereas the command with the modifier always reads from whichever range your code resides in: still $8000-$FFFF for programs, but $0000-$7FFF for applications.
Title: Re: Axe Q&A
Post by: Hayleia on April 26, 2014, 08:36:37 am
It is less than 2000 bytes large...
What Sorunome means is that apps are always 16384 bytes (we are talking about one page apps, the ones Axe can produce), so if you have more than 16384 bytes in your code, it will not compile, and if you have less than 16384 bytes, it will compile into a 16384 bytes app so you need 16384 bytes of free space.
Title: Re: Axe Q&A
Post by: NikProgrammer on April 26, 2014, 03:07:24 pm
I understood nothing :P
Title: Re: Axe Q&A
Post by: Sorunome on April 26, 2014, 03:54:39 pm
Go to [2ND] -> [+] -> [2], and there it says how much ARC FREE you have. That must be at least 16384 bytes.
Title: Re: Axe Q&A
Post by: NikProgrammer on April 26, 2014, 04:01:06 pm
There is enough arc and I know the memory edit menu :D, I did not understand the nib() part...
Title: Re: Axe Q&A
Post by: Sorunome on April 26, 2014, 04:58:01 pm
Oh, that was in awnser to me (which i somehow failed to see x.x thank you Runer).
Well, you know how with {} you can fetch a byte, ie 8 bit, off of ram, with nib{} you can fetch a nibble, ie 4bit, off of ram.
Title: Re: Axe Q&A
Post by: NikProgrammer on April 27, 2014, 05:09:34 am
Ah, sorry then :)
Yes, thanks for the answers!
Title: Re: Axe Q&A
Post by: NikProgrammer on May 01, 2014, 12:55:18 pm
One more question: How do I make pxl-test() in Axe parser?
Title: Re: Axe Q&A
Post by: Hayleia on May 01, 2014, 01:00:50 pm
Maybe with pxl-test(X,Y) ? ;)
Have a look at Commands.html (in the zip where you find Axe), it is full of useful information :)
Title: Re: Axe Q&A
Post by: Sorunome on May 01, 2014, 01:24:02 pm
Here is also a online version of Commands.html:
http://axe.eeems.ca/Commands.html
Title: Re: Axe Q&A
Post by: NikProgrammer on May 02, 2014, 03:10:18 am
For some reason, my pxl-test gave me an error...
Title: Re: Axe Q&A
Post by: Hayleia on May 02, 2014, 03:12:56 am
Can we have the source code (at least the line with pxl-test and some lines around like the loop it is in) ?
Title: Re: Axe Q&A
Post by: NikProgrammer on May 03, 2014, 03:25:45 am
I don't have the program anymore, but this was a normal pxl-test and the error was "Invalid token"...
Title: Re: Axe Q&A
Post by: Sorunome on May 03, 2014, 05:50:00 am
did you hit the prgm key to see if it actually jumped to the pxl-test line?
Invalid Token is some form of syntax error.
Title: Re: Axe Q&A
Post by: NikProgrammer on May 04, 2014, 01:46:45 pm
Of course I jumped to the pxl-test line:) How could I know otherwise that it's the pxl-test?:)
Title: Re: Axe Q&A
Post by: Sorunome on May 04, 2014, 01:52:18 pm
well, as it is false syntax we'd need your actual line of code to be able to debug
Title: Re: Axe Q&A
Post by: NikProgrammer on May 06, 2014, 11:49:20 am
I really don't have the program anymore... Sorry...

And I just remember it didn't work, but not the line or something like that.



Can I use the BASIC Tools (Download form Ti-calc.org)library if I have installed Axe?
Title: Re: Axe Q&A
Post by: ordelore on June 16, 2014, 06:49:07 pm
How could I extract the beginning part of a string?
eg: Str1="PTR 8,5"
I want to know that the first three characters are PTR.
Title: Re: Axe Q&A
Post by: Matrefeytontias on June 16, 2014, 06:57:32 pm
There's a command for that. See the Miscellaneous part of commands.html.
Title: Re: Axe Q&A
Post by: Runer112 on June 16, 2014, 08:59:36 pm
Do you actually need to extract the first three characters as a substring, or are you merely interested in checking if it starts with a specific three-character-long string?



If it's the latter, Matrefeytontias is partially correct in suggesting that there's a command for that. The Equ►String() (http://axe.eeems.ca/Commands.html#dataProcessingCommands) command checks if two strings passed as arguments are equal, returning zero if so and nonzero otherwise. The reason why he's only partially correct is because, as you can see from that description, the command isn't made to check if one string starts with another. But if you're comfortable using the technically undefined return value when the strings aren't equal, you can check this. With the current implementation, when the two strings differ, the return value is actually a pointer to the first character in the second string that differs from the character at the same position in the first string. So the following code would work to check if a string starts with "PTR", but isn't guaranteed to work in future versions of Axe:

Code: [Select]
"PTR"→Str0
!If Equ►String(<string>,Str0)?-3-Str0
.Starts with "PTR"
End

For reference, the second line is an optimized version of:
If (Equ►String(<string>,Str0)=0) or (Equ►String(<string>, Str0)=(Str0+3)).



If it's the former, extracting a substring of predetermined length is somewhat straightforward, despite Axe lacking a built-in substring command. Extracting a substring simply comes down to copying the characters you want to a new area of memory and making sure the new substring data ends with a null terminator byte. So to extract a 3-byte substring from the front of a string, you'd need to reserve 4 bytes of memory and copy it, perhaps like this:

Code: [Select]
Copy(<string>,L₁,3)
0→{L₁+3}
.Substring at L₁

Spoiler For More information about statically allocating/reserving memory:
There are three primary options:
  • Allocate the buffer inside the program with something like Buff(256)→Str0. Note that this will not work if you compile your code as an application, and that Buff( is really the det( token renamed.
  • Allocate the buffer externally by using a free static RAM reference like L1 in place of Str0, or make Str0 refer to the reference, like L1→Str0. As long as you can find the free RAM space for it, this is generally the preferred option. Note that you do not perform any active allocation; the "allocation" simply entails making a note that nothing else should be trying to use that area of RAM at the same time.
  • Allocate the buffer externally by asking the OS to allocate space for the buffer at runtime, like GetCalc("tmpBUF",256)→S. Note that since this is allocated at runtime, you have to save the reference in a variable instead of a static pointer like Str0. This may also fail if the space cannot be allocated due to not having enough free user RAM (in which case S will be zero), a problem which does not affect the other two options. tmp is really the w token (2nd+9), added in Axe 1.2.0, which results in the variable automatically being deleted when your program finishes.
Title: Re: Axe Q&A
Post by: TheMachine02 on July 02, 2014, 11:36:23 am
Does any axe command make use of the asm_flag at iy+33 ? I was wondering that, cause I want to use a flag field in an axiom, and it is the simpler way to do so.

EDIT : Streetwalrus answered to my question  :D

EDIT by Runer112: To clarify, the answer was no.
Title: Re: Axe Q&A
Post by: Hayleia on July 09, 2014, 02:31:42 am
I don't know if I already asked but when I went through some pages of that topic, I didn't find that question so I guess I didn't ask ?

Would it be possible to have less syntax restrictions ? Example:
Copy(L6,Copy(L3,L6,96),192)

This example is something stupid I just coined but you get the idea.
This is currently impossible to write, "Cannot use here". But what if that's what I want to write and I know what I am doing ? Because I can understand that beginners could get problems writing this kind of stuff, but they would not write that kind of stuff so those restrictions are only annoying non-beginners.
Title: Re: Axe Q&A
Post by: aeTIos on July 09, 2014, 02:35:16 am
Do I see some screen scrolling code? :P
Title: Re: Axe Q&A
Post by: Hayleia on July 09, 2014, 02:37:38 am
If that's screen scrolling code, I didn't make it on purpose. But I don't think it is (or at least, if it's partially, it's not complete).
Title: Re: Axe Q&A
Post by: aeTIos on July 09, 2014, 02:38:30 am
I just realized. I don't know why I thought that :P
Title: Re: Axe Q&A
Post by: ClrDraw on September 29, 2014, 12:39:20 pm
Is there any way to garbage collect in axe? My current program has to archive programs a lot and I want it to automatically garbage collect when necessary (like DoorsCS does).


Also, is there a way to change the size of a program without creating a new program and copying the old?


Thank in advance for your help  :)
Title: Re: Axe Q&A
Post by: Hayleia on September 29, 2014, 02:56:52 pm
Is there any way to garbage collect in axe? My current program has to archive programs a lot and I want it to automatically garbage collect when necessary (like DoorsCS does).
I think this is done automatically in the "Archive" command. When necessary, the "GarbageCollect ? Yes/No" menu appears. I am not sure though but I think.

Also, is there a way to change the size of a program without creating a new program and copying the old?
This can be done with MEMKIT (included in the zip) if your program is unarchived.
Title: Re: Axe Q&A
Post by: ClrDraw on September 29, 2014, 09:54:52 pm
I think this is done automatically in the "Archive" command. When necessary, the "GarbageCollect ? Yes/No" menu appears. I am not sure though but I think.
It brings up the menu. I want a way to skip the menu (because it messes up if the user clicks no) and garbage collect on its own :/

This can be done with MEMKIT (included in the zip) if your program is unarchived.
Hmm, I guess no way if its archived then?
Title: Re: Axe Q&A
Post by: ClrDraw on October 01, 2014, 09:30:22 am
Bump.
Anybody know? This is the only thing holding up my project.
Title: Re: Axe Q&A
Post by: Matrefeytontias on October 01, 2014, 10:22:11 am
It's not possible unless you use ASM. And even so, I don't know how you could do it ; you should ask KermM.
Title: Re: Axe Q&A
Post by: DJ Omnimaga on October 01, 2014, 10:38:12 am
Couldn't you just keep your programs in archive then copy them over to RAM or read them directly? Or is that impossible in Axe too?


Garbage collecting every minute is bad anyway (although in some cases there is no other alternative) because the battery bill gets ridiculous.
Title: Re: Axe Q&A
Post by: Runer112 on October 01, 2014, 11:00:05 am
It brings up the menu. I want a way to skip the menu (because it messes up if the user clicks no) and garbage collect on its own :/

There may be a way to bypass the menu and force a garbage collection. But the menu has good reason to exist because, although uncommon, there are valid reasons why a user would want to avoid garbage collection. So I would not recommend trying to force a garbage collect without the user's confirmation. If the user says no, that means they'd rather your program, as you said, "mess up" rather than a garbage collection occur. You can at least ensure that your program "messes up" gracefully, though.


Hmm, I guess no way if its archived then?

Although there may be weird edge cases where it is possible to safely resize a variable in place in archive, this should generally be considered impossible to do. Unarchiving, resizing, and then re-archiving a variable is the simplest way to resize an archived variable.

As a side note: if your project design involves treating archived variables as anything but read-only data, you might need to redesign your project.
Title: Re: Axe Q&A
Post by: DJ Omnimaga on October 01, 2014, 11:05:07 am
Yeah if you don't force GC just make sure that if the user says no, either intentionally or by being impatient and mashing up the ENTER button non-stop while the program loads, that his calculator will not be permanently bricked or anything. But I think you have more chances to brick your calc in long terms by constantly garbage collecting than by refusing to garbage collect in the middle of a game/program, because the Flash chip can only be rewritten between 100,000 and 2,000,000 times, according to some people.
Title: Re: Axe Q&A
Post by: ClrDraw on October 02, 2014, 11:26:22 pm
Ah okay, thank you for the help everyone. I understand GC better now.
Title: Re: Axe Q&A
Post by: ClrDraw on October 23, 2014, 12:51:07 am
New question. Am I doing something wrong or did I just find an error with Axe? The following is a very simplified version of some code I'm working on.

Code: [Select]
.ERROR
ClrHome
While 1
ReturnIf getKey(41)
ClrHome
If getKey(26)
Disp ,"[2] key pressed."
End
If getKey(28)
Disp ,"[8] key pressed."
End
Pause 300
End

The program should display "[8] key pressed" when 8 is pressed and "[2] key pressed" when two is pressed. Here's the problem: if you hold the up arrow and left arrow while pressing either 8 or 2 (not both at the same time), the program thinks that both were pressed (and displays "[2] key pressed [8] key pressed")...
Title: Re: Axe Q&A
Post by: Matrefeytontias on October 23, 2014, 02:06:09 am
This is a well-known electric problem. The thing is that in the keypad cardboard, some keys were accidentally made dependent, so that when some keys are pressed together, pressing one certain key will make another key "pressed".
Title: Re: Axe Q&A
Post by: Hayleia on October 23, 2014, 02:38:39 am
Here (http://www.omnimaga.org/other-calculator-discussion-and-news/key-group-check-program/) is a program that helps you check that the key combinations you choose don't have this problem. Basically press keys on the keyboard and check on screen that only the keys you pressed are detected.
Title: Re: Axe Q&A
Post by: ClrDraw on October 24, 2014, 09:46:38 pm
Texas Instruments, I hate you so much...  :P

Thanks for the link Hayeia.
Title: Re: Axe Q&A
Post by: Happybobjr on November 06, 2014, 04:22:39 pm
ok so here I have a question.

Can you safely edit a program you are running.

for example:
[0000]->pic0 .2bytes
5->{pic0}
3->{pic0+1}

Would this modify your code do that pic0 would be [0503] on next run?

I would test this, but changing something outside the general scope can be dangerous if you don't know what you're doing (like I).
Title: Re: Axe Q&A
Post by: Sorunome on November 06, 2014, 04:43:34 pm
Yes, just make sure that that only works if you do NOT compile it as an app and that you would change program code if you were to accidentally write too far than you setted your area
Title: Re: Axe Q&A
Post by: Builderboy on November 06, 2014, 05:22:01 pm
Yes, just make sure that that only works if you do NOT compile it as an app and that you would change program code if you were to accidentally write too far than you setted your area

Note that it does NOT work if you use the Asm() command to run the program from the homescreen.  When a program is run it is copied to a new location in memory to be executed, after the program is finished the TiOS does NOT copy it back, and so changes made to the program will not be saved.  If you use a shell such as DoorsCS or MirageOS however, they will copy the changes back to the original files location (possibly also if the program is in archive too!) and the changes will be saved. 
Title: Re: Axe Q&A
Post by: Happybobjr on November 06, 2014, 05:24:54 pm
So the only dangers are
a) Program will not save if without shell
b) it can break your calc if in an app?

How would i go about writing a code checking if its an app?
Title: Re: Axe Q&A
Post by: Sorunome on November 06, 2014, 05:27:41 pm
Nah in an app the changes just won't take effect
Title: Re: Axe Q&A
Post by: parserp on November 11, 2014, 10:27:22 pm
When compiling a large program in Axe, I get an error of 'APP TOO BIG' around 16,500 bytes or so. I'm compiling for MirageOS and NOT an app, so I'm not sure why it has a problem with this?

EDIT: I'm using 1.1.2
Title: Re: Axe Q&A
Post by: Hayleia on November 12, 2014, 12:48:37 am
This has been reported and fixed (you'd have posted 1 day later it would have been one year ago exactly :P) here (http://www.omnimaga.org/the-axe-parser-project/bug-reports/msg367215/#msg367215). The dev build also fixes some other bugs you have not come into so upgrading is recommended ;)
Title: Re: Axe Q&A
Post by: Sorunome on November 12, 2014, 12:49:48 am
Well apps can be max 16384 bytes large
Title: Re: Axe Q&A
Post by: Hayleia on November 12, 2014, 12:50:51 am
Well apps can be max 16384 bytes large
He's not compiling as an app, that's the problem.
Title: Re: Axe Q&A
Post by: parserp on November 12, 2014, 01:12:16 am
This has been reported and fixed (you'd have posted 1 day later it would have been one year ago exactly :P) here (http://www.omnimaga.org/the-axe-parser-project/bug-reports/msg367215/#msg367215). The dev build also fixes some other bugs you have not come into so upgrading is recommended ;)
Awesome, works like a charm. Thanks!
Title: Re: Axe Q&A
Post by: jimbo1qaz on November 12, 2014, 01:23:21 am
How do I get 3/4-level grayscale to not flicker? Interrupts?
If I use both at once, how do I get it to not flicker?
What is recommended way to get higher-levels grayscale?
Title: Re: Axe Q&A
Post by: aeTIos on November 12, 2014, 05:44:12 am
That's a bunch of questions at once. In general it's quite hard to get flickerless grayscale in axe but using interrupts can be a good idea as I've seen that used in various axe and asm programs. You'd have to wait for somebody more knowledgeable than me to really answer your question tho.
Welcome to Omnimaga by the way. You should introduce yourself (http://www.omnimaga.org/introduce-yourself!/)!
Title: Re: Axe Q&A
Post by: Sorunome on November 12, 2014, 10:05:16 am
How do I get 3/4-level grayscale to not flicker? Interrupts?
If I use both at once, how do I get it to not flicker?
What is recommended way to get higher-levels grayscale?
You can achieve awesome grayscale with runers GrayLib (http://www.omnimaga.org/ti-z80-calculator-projects/(axe-library)-graylib-(nearly)-perfect-grayscale/)
Title: Re: Axe Q&A
Post by: jimbo1qaz on November 12, 2014, 07:45:47 pm
OK I'll look into graylib.
How do I get many-level grayscale? I currently have two 4-level's I switch between every other frame, creating a period of 6. And it turns out I currently have 7-level grayscale using only 3 buffers, which is the maximum possible with a period of 6. Yay!
Is it possible to do even better, say even more colors? Will it flicker horribly?
How do I minimize flickering, with, say 7-level? As in distribute the "pulses" to maximize "frequency", so it's not on for 3 frames and off for the next 3, but instead switches every other frame? I'm not sure how my current solution behaves regarding pulse distribution.
Title: Re: Axe Q&A
Post by: Sorunome on November 13, 2014, 08:12:52 am
there has already been done up to 16-level grayscale but you can like forget interaction on so many levels, only display a pic and that's it :P
Title: Re: Axe Q&A
Post by: Eiyeron on November 13, 2014, 05:25:35 pm
As long as your screne can handle it and render it without too much flicking, you can go with as much shades as you want. 3/4 shades are common because they only takes a second buffer and because common visual tricks helped the illusion to work even with fast graphical changes. With too much shades (and so buffers), you could have bad "aliasing" or "motion blur" problems as it's shown on the GrayLib's Pokemon demo where an option exists to avoid these problems when scrolling.
Title: Re: Axe Q&A
Post by: pimathbrainiac on November 13, 2014, 05:33:21 pm
OK I'll look into graylib.
How do I get many-level grayscale? I currently have two 4-level's I switch between every other frame, creating a period of 6. And it turns out I currently have 7-level grayscale using only 3 buffers, which is the maximum possible with a period of 6. Yay!
Is it possible to do even better, say even more colors? Will it flicker horribly?
How do I minimize flickering, with, say 7-level? As in distribute the "pulses" to maximize "frequency", so it's not on for 3 frames and off for the next 3, but instead switches every other frame? I'm not sure how my current solution behaves regarding pulse distribution.

I made a library for 8 level here (http://www.omnimaga.org/ti-z80-calculator-projects/g8lib-8-level-grayscale-lib-for-axe!). It's not the best, but it is fairly good, imo.
Title: Re: Axe Q&A
Post by: Michael Pang on March 07, 2015, 09:16:31 pm
Is it possible to dynamically truncate/expand an os ram variable's size? Or is it necessary to create a new one and copy over?
Title: Re: Axe Q&A
Post by: Runer112 on March 07, 2015, 09:21:31 pm
It's possible with the MemKit Axiom included in the Tools folder of the Axe download. The commands you're looking for are the somewhat poorly-named New and Delete commands. If the included readme doesn't explain them well enough and you have questions about them after looking at it, just ask.
Title: Re: Axe Q&A
Post by: Michael Pang on March 10, 2015, 09:25:49 am
Where can I find a list of all the axioms? There was an axiom thread in the axe parser section but it looks like it's outdated and missing a lot of axioms.
Title: Re: Axe Q&A
Post by: Michael Pang on March 12, 2015, 09:58:55 pm
Any help here? I still haven't been able to find a comprehensive list of axioms :(
Title: Re: Axe Q&A
Post by: Runer112 on March 12, 2015, 11:34:11 pm
How's this (https://www.omnimaga.org/the-axe-parser-project/axe-library-axiom-and-tool-collection/)? I went a bit overboard, but I figured if I was going to search around for every Axiom, I may as well search for other useful things at the same time to create the ultimate resource list.
Title: Re: Axe Q&A
Post by: Alex Twigg on March 16, 2015, 06:44:53 pm
Two questions, first how do you install Axioms. And being new to axe (only experience with other languages with other languages are Ti-Basic and very little Java Script) is there any GOOD tutorials out there? All I have done is googled axe parser tutorial and clrhome's pictures do not load and i cant find the complete on at cemtech. Thanks
Title: Re: Axe Q&A
Post by: Runer112 on March 16, 2015, 07:03:59 pm
@Alex Twigg You don't really need to install Axioms, just send them to your calculator and include them in a program with #Axiom(NAME) (really the AsmComp() token). As for a tutorial, it's a bit short and out of date, but the one included with Axe, called Documentation.pdf, is still one of the best. There's also an exhaustive, up-to-date command list called Commands.html.

But the most exhaustive tutorial by far, made by kindermoumoute and Matrefeytontias, is available here (http://openclassrooms.com/courses/l-axe-parser) (you may need to make a free account to see it). However, it is in French, so you either have to know French or try your best to deciper what an online translation service makes of it. If you use Chrome, you can translate a page by right-clicking and selecting "Translate to English." And I'd recommend still looking at the original French version for some things, like code blocks, because the translation process screws up some formatting.
Title: Re: Axe Q&A
Post by: Alex Twigg on March 16, 2015, 08:49:25 pm
Thanks I will check it out :). I tried to send usbpad8x (appVar) and but my calc wouldn't accept it (this Axiom turns your calc into a key board but i'm pretty sure you have heard of it) it said that the OS did not recognize it or something :(. Thanks for the help.
Title: Re: Axe Q&A
Post by: Runer112 on March 16, 2015, 08:53:46 pm
@Alex Twigg What file did you try to send? The correct file should be a .8xv (or maybe .8xp) file.
Title: Re: Axe Q&A
Post by: Alex Twigg on March 17, 2015, 03:37:50 pm
@Runer112 I sent the appVar. The files included were assemble(A batch file), Axe(config file), AXEKEY8X(sample prog for Axiom, I also put this on calc), tokenhook(config file), usbpad8x(the one I sent this is an appVar), and usbpad8x.asm(you can guess what file type that is). So did I send the right ones? I even tried re-downloading my OS (2.55MP). Thanks for the help :) :) :) :)



The AXEKEY8X when I tried to compile said it did not have the Axiom so I think it is just an sample prog TY :).

EDIT (Eeems): Merged double post
Title: Re: Axe Q&A
Post by: Eeems on March 17, 2015, 03:47:39 pm
Hey Alex Just an fyi, edit your posts instead of adding a second post. Adding a second post like that is called double posting and it's a bit of a no-no around here.
Thanks!
Title: Re: Axe Q&A
Post by: Alex Twigg on March 17, 2015, 03:55:24 pm
Will do sorry I am new (I didn't know you could re-edit your post srry) :)
Title: Re: Axe Q&A
Post by: Axe Programmer on April 01, 2015, 07:58:24 am
Alrighty guys, quick question. I was creating an awesome physics program in axe and everything waas going great until suddenly out of the blue, when I compiled my program and ran it, it said ERR:invalid. It compiled perfectly, but everytime I ran the program it would give me that error. I tried compiling my program as an app, then it gave the error "Undocumented" in the middle of my compile. I pressed 2 so I could see where the error was, and it took me to the first line of text in the program. I deleted the text thinking it would solve the problem, but no. When I compiled it as an application again, it gave me the error in the middle of my compile as "Undocumented". I pressed 2 again and it took me to the next line of text. I keep on deleting text but everytime I compile it gives me an error. PLEASE HELP!!!!!!!!!!!!!!

Thanks
Axe Programmer
Title: Re: Axe Q&A
Post by: Sorunome on April 01, 2015, 02:14:43 pm
Hey Axe Programmer, are you using the latest axe version? (1.2.2a) If not, you can get it here: http://ourl.ca/4060/364694
Title: Re: Axe Q&A
Post by: Axe Programmer on April 01, 2015, 06:22:58 pm
Yes I am using the latest version, as a matter of fact it  worked perfect on my friend's ti84 calc but it won't work on my ti 84. We both have the latest OS and axe version. Do you think it is just my calc? What could be wrong with it? I already restored my memory and wipe my calc. Didn't help at all. Is it a glitch? Axe problem?
Title: Re: Axe Q&A
Post by: Runer112 on April 01, 2015, 06:29:25 pm
The next time you get a strange error, try pressing the STAT key and relaying back that glob of data. It should ideally give me a good chance of figuring out what's wrong.
Title: Re: Axe Q&A
Post by: Axe Programmer on April 01, 2015, 08:14:36 pm
Alright thanks, another question tho. How do I create a name string for an application? Like I know you would use "prgmABC" for the program ABC so what name string would I use to access an application on the calculator?
Title: Re: Axe Q&A
Post by: Digital on April 01, 2015, 08:17:12 pm
as well as i know are applications impossinle to access
Title: Re: Axe Q&A
Post by: Axe Programmer on April 13, 2015, 12:53:53 pm
Alright thanks, but I am having another problem. Now that I am finished with the application that I made in Axe I want to be able to transfer it to other calculators. The only problem is that when I transfer the app, it gives me the error:VALIDATION. What does this mean and how can it be fixed? I tried transfering to all possible models of the TI-83s and TI-84s. Nothing works! ???
Title: Re: Axe Q&A
Post by: Matrefeytontias on April 13, 2015, 01:30:04 pm
Applications created by Axe are not "signed" - that means you can't transfer it to other calcs because their OS won't find the app's signature. To sign it, you have to transfer it to your PC, sign it using for example RabbitSign, which is included in the Axe zip file, and send it back to your calc, after what you'll be able to transfer it without any problem.
Title: Re: Axe Q&A
Post by: Axe Programmer on April 13, 2015, 01:35:47 pm
THANK YOU!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Title: Re: Axe Q&A
Post by: Axe Programmer on April 13, 2015, 01:56:42 pm
Hey guys is there a way to edit axe programs on a computer? My program is over 15000 bytes and its a pain to scroll to the bottom every time. I already have an emulator on my computer to run the program, i just need to know how to edit the whole thing in a large document in order for me to program it faster.
Title: Re: Axe Q&A
Post by: Runer112 on April 13, 2015, 02:48:11 pm
I recently made a mega-post (https://www.omnimaga.org/the-axe-parser-project/axe-library-axiom-and-tool-collection/msg400041/#msg400041) of every good Axe coding tool I know about. Here's an excerpt that should interest you:

IDE
  • SourceCoder (http://www.cemetech.net/sc/) : Browser-based TI-BASIC editor and image converter. Directly links with jsTIfied.
  • ★ TokenIDE (http://www.ticalc.org/archives/files/fileinfo/433/43315.html) ★ Windows-based TI-BASIC editor with an Axe token set and sprite/image editor. Works on Linux with Mono.
  • IES (http://clrhome.org/ies/) : Browser-based TI-BASIC editor with an Axe token set and simple picture editor.
Title: Re: Axe Q&A
Post by: Axe Programmer on April 20, 2015, 03:51:56 pm
Thank you! And since this is a Q&A I will be asking a ton of questions lol. Is there a hex code or command in Axe to receive the amount of ram left currently on your calculator and store it to a variable? Thanks in advance.
Title: Re: Axe Q&A
Post by: Digital on April 20, 2015, 04:37:08 pm
feel free to ask ;) if you have bigger problems or questions make a new thread in the axe subforum.
with asm() you can insert these hexcodes (called asm opcodes) into your programm. I think the asm code you need is
Code: [Select]
asm(EFE542EF9247EF5641EFBF4AC9)store the value to a variable and display it as a decimal:
Code: [Select]
->A
Disp A›Dec

I wrote this from my mind and I'm don't know whether this is correct. (but I think so)

also here is a list of some asm codes, but watch out the tutorial isn't about axe:http://tibasicdev.wikidot.com/hexcodes#toc52
Title: Re: Axe Q&A
Post by: Axe Programmer on April 20, 2015, 04:48:56 pm
thanks! this helped a lot!
Title: Re: Axe Q&A
Post by: Runer112 on April 20, 2015, 04:53:18 pm
That looks like a snippet intended for use by a BASIC program. In Axe, the snippet becomes much simpler, as it's just the system call with no wrapper logic needed: Asm(EFE542).
Title: Re: Axe Q&A
Post by: Digital on April 20, 2015, 05:13:31 pm
for the axe use of asm codes look here: https://www.omnimaga.org/ti-basic-language/zeda%27s-hex-codes/60/
(i remembered that thread but I didn't remebered the link)
Title: Re: Axe Q&A
Post by: c4ooo on April 30, 2015, 07:18:05 am
I have some questions about random numbers in axe:
1) how do I seed the random numbers generator?
2) once seeded will the rng always return the same stream of numbers?
Title: Re: Axe Q&A
Post by: Sorunome on April 30, 2015, 08:02:16 am
You, as in the programmer, doesn't seed the random number generator, that happens automatically.

If two seeds were to be identical then, yes, the number stream would be the same
EDIT: Trust Runer on this, i just used basic comp sci knowledge to answer, to which that timer would theoretically count towards the seed
EDIT2: Just listen to Runer
Title: Re: Axe Q&A
Post by: Runer112 on April 30, 2015, 08:55:09 am
1) how do I seed the random numbers generator?

You could theoretically set the seed, as the seed value does exist at a fixed location in memory. But this is relatively pointless, because...

2) once seeded will the rng always return the same stream of numbers?

No. Axe's PRNG is not deterministic, as it uses both a time source and a pseudorandom memory read as sources of entropy for every number generated.

This has always bothered me, really... would people be interested in it being replaced with a deterministic PRNG?
Title: Re: Axe Q&A
Post by: c4ooo on April 30, 2015, 03:46:56 pm
-snip-
This has always bothered me, really... would people be interested in it being replaced with a deterministic PRNG?
Well I might need it for a sandbox game prototype ime working on. You now, seeds.
But yea thanks  :thumbsup:
Title: Re: Axe Q&A
Post by: animaaron on April 30, 2015, 05:41:21 pm
I don't understand what the r1 pointers (found under the vars>polar menu) are used for
Title: Re: Axe Q&A
Post by: Runer112 on April 30, 2015, 06:15:05 pm
I don't understand what the r1 pointers (found under the vars>polar menu) are used for

Those are the variables that function arguments are stored in. For instance, Func(A,B,C) is effectively syntactic sugar for A→r₁:B→r₂:C→r₃:Func().
Title: Re: Axe Q&A
Post by: c4ooo on May 07, 2015, 11:16:13 am
Two questions
1) how many cpu  Cycles does it take to read a byte from a file like {y1}
And doing exp》{y1}  automaticallysagves it to the appvar that very instance right?
Title: Re: Axe Q&A
Post by: Runer112 on May 07, 2015, 11:29:57 am
1) how many cpu  Cycles does it take to read a byte from a file like {y1}

About 200 cycles. For reference, it only takes 14 cycles to read a byte from RAM. So if you're going to read this data often and are worried about speed, you should consider migrating this data to RAM.

And doing exp》{y1}  automaticallysagves it to the appvar that very instance right?

Is supposed to be , the store operator? In that case, I hope Axe would throw an error if you tried to compile that, as you cannot (for most intents and purposes) write data directly to archive.

Combining your two questions together, it sounds like you're planning on doing many read/write operations to an appvar. In that case, you should probably UnArchive it to work on it and Archive it when done.
Title: Re: Axe Q&A
Post by: Haobo on May 07, 2015, 11:54:49 am
When reading from archive, does it disable interrupts as well?
Also, is there a really fast way to get a user to input a variable? It takes too long to make one from scratch every time.
Title: Re: Axe Q&A
Post by: c4ooo on May 07, 2015, 03:46:36 pm
-snip-
Alright. The only problem is that the data imd working with will likely be bigger then the amount of ram. Well actually it probably won't, but it will be very close. So i decided that the best thing to do would be to keep the data in a buffer temporarily, and when a different sector is required, to write the buffer back to the archive and load the new data. The "data" is a tile map for a minecraft clone, so there is a lot. Is there any way i can keep the var archived and still use my buffer approach?
When reading from archive, does it disable interrupts as well?
I believe so as interrupt based greyscale has to be reloaded after the file-IO in my project imd working on. Idk if the culprit is the archive / unarchive command thou.
Title: Re: Axe Q&A
Post by: Runer112 on May 07, 2015, 06:52:22 pm
When reading from archive, does it disable interrupts as well?

No, reading a byte/word from an archived pointer doesn't disable interrupts.

Also, is there a really fast way to get a user to input a variable? It takes too long to make one from scratch every time.

For string input, you can sometimes get away with the input command. But that reads a string of tokens instead of characters, which is often a problem. You can convert it to characters with the Detokenize axiom (https://www.omnimaga.org/the-axe-parser-project/(axiom)-detokenize-routine-for-axe-input-command/msg330077/#msg330077), though.

For numerical input, there's no built-in. So you do have to do it yourself.

Is there any way i can keep the var archived and still use my buffer approach?

No. Keeping it archived means reads are still slow. And even if you did manage to speed up the archive reads, you still couldn't write back changes.

When reading from archive, does it disable interrupts as well?
I believe so as interrupt based greyscale has to be reloaded after the file-IO in my project imd working on. Idk if the culprit is the archive / unarchive command thou.

I wouldn't really call the mass data movement commands "reading from archive," but the Copy() from flash, Archive, and UnArchive commands probably kill custom interrupts. They may also disable OS interrupts.
Title: Re: Axe Q&A
Post by: c4ooo on May 07, 2015, 07:09:57 pm
No. Keeping it archived means reads are still slow. And even if you did manage to speed up the archive reads, you still couldn't write back
So no matter what what I am forced to store a copy to ram? :'( come on runer use don't you use your magic to come up with anything?  ??? :'( :'( couse keeping a 32*384 tile map in ram just seems wastfull...
NB: this message is not meant  to be offensive or make fun of runer in any way.  At the time of posting i was feeling hopeless and lost because what i had in mind won't be possible.  :P
Title: Re: Axe Q&A
Post by: Matrefeytontias on May 08, 2015, 03:22:41 am
Instead of being rude, just use your brain and understand that it is reading from archive that is slow, and that there's nothing you can do about it. It seems wasteful ? Too bad, you can only do that.
Title: Re: Axe Q&A
Post by: c4ooo on May 08, 2015, 07:02:04 am
Instead of being rude, just use your brain and understand that it is reading from archive that is slow, and that there's nothing you can do about it. It seems wasteful ? Too bad, you can only do that.
Umm i was not trying to be rude... i was sad that you that was the only thing you can do... notice the cry emicons... If you think it was rude, then i apologize.
Edit: can i not show of my emotions without being "rude"?
Edit2: ime not going to -1 you because that will just start a flame war, but the "use your brain and understand" part was also rude  :-\ Just because i am restively new to non-ti-basic, and i still think that there is a way to achieve what i was trying to do does not make me stupid as you suggest with your "use your brain and understand" comment. Furthermore, considering the fact that i am  relatively new to non-ti-basic, i will always be unsure until i ether me or someone else makes it happen, or i just give up.
Title: Re: Axe Q&A
Post by: Matrefeytontias on May 08, 2015, 12:56:37 pm
Well, I recognize I was rude myself, sorry about that. That may be because English is not my native language, but the way you said
Quote
come on runer use don't you use your magic to come up with anything?
just sounded to me like "come on Runer if you're so clever why don't you have a solution for this ?". I understand now that that is not the case so I apologize for my wording.

It's okay to be new at things or to be slow to understand. It's just the way it was said that bothered me, not the content itself. Again, sorry about that. I shall remove that -1.
Title: Re: Axe Q&A
Post by: c4ooo on May 08, 2015, 04:13:54 pm
-snip-
Thanks you kind sir, i understand why you would have thought i was trying to insult runer. I am going to add a footnote to my post ATM to prevent further misinterpretation.
Edit: and yes I know perfectly well that all software and hardware has limitations.
Title: Re: Axe Q&A
Post by: Haobo on May 10, 2015, 02:51:48 am
When using getKey^^r, are interrupts still working?
Title: Re: Axe Q&A
Post by: Sorunome on May 10, 2015, 04:35:49 am
When using getKey^^r, are interrupts still working?
As far as I know not, if you use interrupts you have to manage without that.
Title: Re: Axe Q&A
Post by: ISSOtm on May 10, 2015, 11:35:15 am
Interrupts are on, as the "run indicator" is active while using getKey^^r (tried it)
Title: Re: Axe Q&A
Post by: Haobo on May 12, 2015, 03:46:51 pm
Are you not supposed to load a file onto an existing file? Like, if I put appvHELLO to [Y2] and then do appvHELLO2 to [Y2], does it break some stuff, because when I tried to read another file in [Y1], it doesn't work anymore, program crashes after having the run indicator turn on and then pressing any button.
Title: Re: Axe Q&A
Post by: Runer112 on May 12, 2015, 03:48:58 pm
Are you not supposed to load a file onto an existing file? Like, if I put appvHELLO to [Y2] and then do appvHELLO2 to [Y2], does it break some stuff, because when I tried to read another file in [Y1], it doesn't work anymore, program crashes after having the run indicator turn on and then pressing any button.

I don't believe this should cause any issues. Unless, of course, other parts of your code still expect the old variable to be pointed to by Y2.
Title: Re: Axe Q&A
Post by: Ivoah on May 14, 2015, 09:29:59 pm
What's the best way to get nice audio in Axe? I've heard that the Freq( command isn't great.
Title: Re: Axe Q&A
Post by: Runer112 on May 14, 2015, 09:44:55 pm
There's no simple way to produce "nice" audio. At least, not without heavy, very specialized assembly code that would only run on the 84+. Such code doesn't really fit into Axe as a built-in, and that's not even considering the fact that "nice" audio has only ever been implemented by a few people.

If one such individual knows what they're doing, they could theoretically make an Axiom/library for it.
Title: Re: Axe Q&A
Post by: Ivoah on May 14, 2015, 09:47:00 pm
There's no simple way to produce "nice" audio. At least, not without heavy, very specialized assembly code that would only run on the 84+. Such code doesn't really fit into Axe as a built-in, and that's not even considering the fact that "nice" audio has only ever been implemented by a few people.

If one such individual knows what they're doing, they could theoretically make an Axiom/library for it.

No one has made an Axiom for that? That's surprising.
Title: Re: Axe Q&A
Post by: Runer112 on May 14, 2015, 09:51:10 pm
It's pretty unsurprising, really. Only a few people have the existing knowledge of how to make a good audio engine, Axiom development isn't exactly very popular, and the Axiom system is better suited for simple commands that user code calls when needed rather than orchestrating a whole engine that has to run in parallel with user code.
Title: Re: Axe Q&A
Post by: c4ooo on May 27, 2015, 07:17:02 pm
If i do something like foo->{L1}^r, will the low byte of foo be stored to L2 or L2+1?
Title: Re: Axe Q&A
Post by: Runer112 on May 27, 2015, 07:25:04 pm
The low byte is stored to the pointer and the high byte is stored to the pointer plus one. (This data ordering in memory is formally known as little-endian)
Title: Re: Axe Q&A
Post by: coops on June 25, 2015, 11:16:51 am
Is there a way to flip masked sprites? When I try to flip something ( Pt-Mask(x,y,flipV(Pic0)) ) it comes out wrong.

Title: Re: Axe Q&A
Post by: c4ooo on June 25, 2015, 11:37:33 am
Is there a way to flip masked sprites? When I try to flip something ( Pt-Mask(x,y,flipV(Pic0)) ) it comes out wrong.
 
The problem is that maked sprites have two layers, each 8 bytes. FlipV() can only flip one layer. You will have to flip each layer individually, storing the output to a buffer and then doing Pt-mask on that buffer. The code will be something like this:
Code: [Select]
Copy(flipV(pic0),L1,8) .flip layer 1 and copy to buffer L1
Copy(flipV(pic0+8),L1+8,8) .flip layer 2 and copy to buffer L1+8
Pt-Mask(x,y,L1)
Note that this will overwrite any data you may be storing in L1 throu L1+16
Title: Re: Axe Q&A
Post by: TIfanx1999 on July 16, 2015, 12:39:49 am
There's no simple way to produce "nice" audio. At least, not without heavy, very specialized assembly code that would only run on the 84+. Such code doesn't really fit into Axe as a built-in, and that's not even considering the fact that "nice" audio has only ever been implemented by a few people.

If one such individual knows what they're doing, they could theoretically make an Axiom/library for it.

No one has made an Axiom for that? That's surprising.

I know this response is a bit late, but sound has a pretty small userbase in programs. Most people will never use it even if it is possible.
Title: Re: Axe Q&A
Post by: c4ooo on August 15, 2015, 02:52:05 pm
I must axe you a question  ;D does the increment operated follow the left to right order of ops exactly? I mean will something like if foo=x++ increment x first and then compare, or the opposite? (In my case foo is a number of arithmetics)
Title: Re: Axe Q&A
Post by: Haobo on August 16, 2015, 08:43:51 am
I must axe you a question  ;D does the increment operated follow the left to right order of ops exactly? I mean will something like if foo=x++ increment x first and then compare, or the opposite? (In my case foo is a number of arithmetics)


In most of axe, since there is not exact documentation and that it does not follow order of operations, most things you just need to test to see if it works or not. (Btw, it wouldn't even compile, just throw an invalid token error)
Title: Re: Axe Q&A
Post by: c4ooo on August 16, 2015, 11:22:30 am
I must axe you a question  ;D does the increment operated follow the left to right order of ops exactly? I mean will something like if foo=x++ increment x first and then compare, or the opposite? (In my case foo is a number of arithmetics)


In most of axe, since there is not exact documentation and that it does not follow order of operations, most things you just need to test to see if it works or not. (Btw, it wouldn't even compile, just throw an invalid token error)

"(foo=x)++ will make no sense, so ++ has to happen first" -runer112 over irc. it does seems to work ;)
Title: Re: Axe Q&A
Post by: E37 on October 27, 2015, 07:04:13 pm
On a different subject, I noticed that the Text( command behaved weirdly when performed off screen.
Could this just be my bad code or is it something else?

Also, what exactly does #Relloc( do? (I know it moves the location of something, but why would you want to do that?)
Title: Re: Axe Q&A
Post by: Runer112 on October 27, 2015, 08:07:07 pm
On a different subject, I noticed that the Text( command behaved weirdly when performed off screen.
Could this just be my bad code or is it something else?

You noticed correctly. Text printing is handled by the OS, which may freak out when attempting to print text offscreen. It's up to the programmer to make sure that the text they print is not offscreen.

Also, what exactly does #Relloc( do? (I know it moves the location of something, but why would you want to do that?)

It redefines the address at which the automatically-defined A-θ variables exist in memory. It's only rarely useful to advanced programmers who need to use the variable's default location in memory for something else, as this allows them to move the variables somewhere else that they know is free.
Title: Re: Axe Q&A
Post by: Hayleia on October 28, 2015, 04:02:17 am
Now that I think of it. I never used #Realloc because I use custom variables (and because before that, I was a noob) but would Realloc also move a custom variable if it is defined from a default one ? I mean something like °A→°Custom, then #Realloc(L3), would this make °Custom equal to L3 from now on ?
Title: Re: Axe Q&A
Post by: Runer112 on October 28, 2015, 09:10:27 am
Now that I think of it. I never used #Realloc because I use custom variables (and because before that, I was a noob) but would Realloc also move a custom variable if it is defined from a default one ? I mean something like °A→°Custom, then #Realloc(L3), would this make °Custom equal to L3 from now on ?

No. Constant assignments are strict, not lazy, meaning they're resolved to a value immediately.
Title: Re: Axe Q&A
Post by: c4ooo on October 30, 2015, 06:22:38 pm
You noticed correctly. Text printing is handled by the OS, which may freak out when attempting to print text offscreen. It's up to the programmer to make sure that the text they print is not offscreen.
I hate that. It would be much easier if the OS handled the screen text itself, and IMO, much more optimized to. (Compare the OS having some code like If((x=(x+char.length))>=screen.width) return; vs the programer having to come up with some hacky code :P
Furthermore, (at least according to tom scott), no proper text culling caused a security flaw where one could crash someone else's iOS device by sending arabic chars.
Title: Re: Axe Q&A
Post by: Sorunome on October 31, 2015, 04:24:50 am
That text crashing was due to how arabic text width may get smaller with more chars, so not a possibility here ;)
Title: Re: Axe Q&A
Post by: c4ooo on October 31, 2015, 04:45:57 pm
That text crashing was due to how arabic text width may get smaller with more chars, so not a possibility here ;)
That is what I meant- when the string was truncated to fit on the screen, it got bigger and went even farther of the screen ;) Unless I misunderstood something :P
Title: Re: Axe Q&A
Post by: E37 on November 03, 2015, 07:07:35 pm
Does anyone know if writing to archive is bad for the memory?
I have heard that repeatedly writing to archive will eventually damage it.

On a different subject, how do programs like Doors find the names of all the programs (and how can I do that in Axe)?
Title: Re: Axe Q&A
Post by: c4ooo on November 03, 2015, 07:26:13 pm
Does anyone know if writing to archive is bad for the memory?
I have heard that repeatedly writing to archive will eventually damage it.

On a different subject, how do programs like Doors find the names of all the programs (and how can I do that in Axe)?
The flash memory wears down after about 100000 writes to it. Reading does not damage it though.

Doors and other programs (like the axe *compiler itself :P ) get a list of programs by reading from the vat, which is basicly a large list of files, their types, as well as their location in ram/flash. You can either read from it directly, or use the memkit axiom, provided in the download file. Memkit is easy to use with commands like Load() and Next().
Title: Re: Axe Q&A
Post by: Runer112 on November 03, 2015, 07:29:42 pm
Does anyone know if writing to archive is bad for the memory?
I have heard that repeatedly writing to archive will eventually damage it.

Over a long period of time, yes. Flash memory will eventually start failing to hold data after a lot of writes have been performed. For a calculator, I'm going to make a very rough guess of 10,000 garbage collects, although it could easily be off by a factor of 10 in either direction.

On a different subject, how do programs like Doors find the names of all the programs (and how can I do that in Axe)?

This is done by scanning the Variable Allocation Table (VAT). This can be done in pure Axe, as demonstrated in this brief tutorial (https://www.omnimaga.org/axe-language/vat-tutorial/). However, it's easier to use an Axiom for this, of which there are two. One is bundled in the Axe download under Tools\MemKit, and another can be grabbed here (https://www.omnimaga.org/axe-language/sort-by-alphabetical-order/msg340684/#msg340684). The latter is nicer in that it produces results alphabetically, although it does so with the same OS calls used to do things like populate the program menu so it could potentially be rather slow with a lot of variables.
Title: Re: Axe Q&A
Post by: E37 on November 05, 2015, 04:10:11 pm
Is it possible for a pointer to move itself as in A +10 -> A?
I am using A as the pointer to a program.
I am trying to be able to read programs longer than 2^16 bytes.
Title: Re: Axe Q&A
Post by: Runer112 on November 05, 2015, 04:26:03 pm
Is it possible for a pointer to move itself as in A +10 -> A?
I am using A as the pointer to a program.

I don't understand what you mean by a pointer "moving itself," but A+10→A is certainly valid and increases the value of the A variable by 10. And if you were using the value of A as a pointer, then you've "moved" the pointer (more accurately, you've changed the location pointed to).

I am trying to be able to read programs longer than 2^16 bytes.

Variables on the calculator cannot be larger than 2^16 bytes = 64KB, and there's only up to about 24KB of free RAM. So I'm not sure what you're getting at here. If you did want to be able to edit large programs, you'd have to store it in smaller pieces.
Title: Re: Axe Q&A
Post by: E37 on November 05, 2015, 04:30:47 pm
I was afraid that pointers couldn't exceed 2^16 from the start of data.
Thanks!

Edit: i thought for some reason that 2 to the 16th was about 6300 instead of 63000.
Title: Re: Axe Q&A
Post by: E37 on November 17, 2015, 05:51:50 pm
I have been hunting around and I can't seem to fine a good tutorial on how to use the VAT.
Can anyone give me a good tutorial? (I got lost at reading backward)

Also, does anyone have a list of all the OS memory location? (like the VAT is E9830 and E982E and the text pen is E86D7 and E86D8)
Thanks!  ;D
Title: Re: Axe Q&A
Post by: Runer112 on November 17, 2015, 07:44:13 pm
I have been hunting around and I can't seem to fine a good tutorial on how to use the VAT.
Can anyone give me a good tutorial? (I got lost at reading backward)

I mentioned this tutorial (https://www.omnimaga.org/axe-language/vat-tutorial/) in a response (https://www.omnimaga.org/axe-language/axe-qa/msg402716/#msg402716) to an earlier post of yours (https://www.omnimaga.org/axe-language/axe-qa/msg402713/#msg402713), which gives a rough overview of the structure of the VAT and how you might scan through it with Axe. And I think I mentioned it before and you didn't seem too interested, but either the official MemKit axiom found in the Axe download or the alphabetical MemKit axiom (https://www.omnimaga.org/axe-language/sort-by-alphabetical-order/msg340684/#msg340684) can provide this functionality for you.

Also, does anyone have a list of all the OS memory location? (like the VAT is E9830 and E982E and the text pen is E86D7 and E86D8)
Thanks!  ;D

The most complete list is found in the equates file (http://brandonw.net/calcstuff/ti83plus.txt) used by assembly programs; search for "RAM equates" for the relevant section. It doesn't document what they all mean, and there isn't really such a documentation. WikiTI (http://wikiti.brandonw.net/index.php?title=Category:83Plus:RAM:By_Name) documents a few, but I've never found this particularly useful. Information about how RAM areas are used is generally found paired with documentation of system calls that interact with them.
Title: Re: Axe Q&A
Post by: E37 on November 18, 2015, 03:09:05 pm
I'm sorry if I came over as rude, I have had a rough week.
For some reason I completely missed the VAT tutorial link the first time - it is really useful.
And... if my comments seem a bit random that is because I am just collecting information - I like to be ready for any project I think up!
Title: Re: Axe Q&A
Post by: nabako on November 20, 2015, 12:50:33 pm
What is the proper way to send data from one calculator to another?
The Command List says "Send(" can send a byte, which is a number 0-(2^8)-1, but when I try to send a Variable and get the Variable with "Get->A"
A doesn't have the value that was sended.

I did loop Get, until A≠-1 but A wont change...
Title: Re: Axe Q&A
Post by: Runer112 on November 20, 2015, 01:06:54 pm
What is the proper way to send data from one calculator to another?
The Command List says "Send(" can send a byte, which is a number 0-(2^8)-1, but when I try to send a Variable and get the Variable with "Get->A"
A doesn't have the value that was sended.

I did loop Get, until A≠-1 but A wont change...

First question: what kind of link cable are you using? Because Axe can only send data over the serial port, not the mini USB port.

If you are using a serial link cable, though, sending data should certainly be possible. In this case, could you post the relevant code? Sending data between calculators can be a bit finnicky in terms of synchronization, which is usually why link code doesn't work.
Title: Re: Axe Q&A
Post by: nabako on November 20, 2015, 02:21:11 pm
I did use the mini USB port.
And I have to use the mini USB because the guys wnating to play the game(thats what im trying to create)
only have the mini USB link cable.

Is there really no way to send any data with that cable?
Title: Re: Axe Q&A
Post by: Runer112 on November 20, 2015, 02:57:21 pm
I did use the mini USB port.
And I have to use the mini USB because the guys wnating to play the game(thats what im trying to create)
only have the mini USB link cable.

Is there really no way to send any data with that cable?

It's certainly physically possible to send data with that cable, as the OS does it. But as far as I'm aware, the OS doesn't expose its code for this. At least, not in a useful manner. And USB is more complicated than a simple serial transfer, and nobody has implemented their own code for calc-to-calc USB transfers.
Title: Re: Axe Q&A
Post by: nabako on November 21, 2015, 05:56:05 am
Guess I'll be using TI-Basic then.
Anyways, thank you for the quick help :)
Title: Re: Axe Q&A
Post by: c4ooo on November 22, 2015, 11:28:59 am
Is there a tutorial for getting ans if it is a list/other var? TBh, idk what the ans var is called in the VAT :P
Title: Re: Axe Q&A
Post by: E37 on November 22, 2015, 01:13:25 pm
Sorry to interrupt with a different question, but when I display a token, it displays the basic token.
Like instead of displaying #Axiom( is displays AsmComp(.
Is there an easy way to display Axe tokens instead (probably by intercepting whatever Axe sends to the basic editor)?
Also, is there a way to call the OS's catalog? (I don't want to make my own.)
Title: Re: Axe Q&A
Post by: c4ooo on November 27, 2015, 04:51:06 pm
How can i convert, in axe, a wavelength (Freq() uses wavelengths, right? :P ) into a string like "C4" or "C4♭" and back?
Title: Re: Axe Q&A
Post by: Runer112 on November 28, 2015, 12:51:31 pm
How can i convert, in axe, a wavelength (Freq() uses wavelengths, right? :P ) into a string like "C4" or "C4♭" and back?

There's nothing particularly special about doing this in Axe compared to any other language. I'd imagine the part that might be a bit tricky is knowing what WAVE arguments to Freq(WAVE,TIME) correspond to what notes. If a calculator is running at normal speed (~6MHz), then this should be roughly 64000/x, where x is the desired frequency in Hz. You'd probably want to calculate these values for an octave or every note ahead of time and store them in a table.

As for converting to/from strings, that's certainly no different than how it would be done in any other language. If you call C0 the lowest note, then a note's index in a full note table is contributed to by octave*12, C=0, D=2, E=4, F=5, G=7, A=9, B=11, sharp=1, and flat=-1. If you're only storing one octave of data, then omit the octave*12 part and just multiply or divide the WAVE value for a note by 2 for every octave offset.
Title: Re: Axe Q&A
Post by: c4ooo on November 30, 2015, 02:49:04 pm
Is there a tutorial for getting ans if it is a list/other var? TBh, idk what the ans var is called in the VAT :P
To document an answer to my own question, you can get a ptr to the ans var by doing getCalc([00720000]. To load the type of the var ans into hl (axe 'ans'), do (in asm) bcall(_RclAns) \ and $1F \ ld h, 0 \ ld l, a, or Asm(CDD74AE61F260065) in hex.
The types are:
00=real, 01=list, 02=Matrix, 03=Zedaforgot, 04=String, 0C=complex, oD=complex list

If my asm is wrong someone please correct it. Zeda is the one who gave me the types list :)

Sorry to interrupt with a different question, but when I display a token, it displays the basic token.
Like instead of displaying #Axiom( is displays AsmComp(.
Is there an easy way to display Axe tokens instead (probably by intercepting whatever Axe sends to the basic editor)?
Also, is there a way to call the OS's catalog? (I don't want to make my own.)
I dont know how you call the catalog, but i when you do, the axe tokens should be there ;)
@E37
Title: Re: Axe Q&A
Post by: E37 on December 01, 2015, 07:55:28 pm
Thanks, I know zStart's small font program editor calls the OS's menus because they are in large font.
The tokens I was discussing referred to when they were displayed with the Text( command.
For reference I am still making my own small font program editor because zStart's is a little buggy (and to say I did).
I have made all the menus but the catalog and vars and I really don't want to rewrite the catalog (my menu code reads a list of tokens in a program which lets me create custom menus just by modifying the program).
Sorry for being unclear.
Title: Re: Axe Q&A
Post by: Runer112 on December 01, 2015, 10:13:27 pm
Sorry to interrupt with a different question, but when I display a token, it displays the basic token.
Like instead of displaying #Axiom( is displays AsmComp(.
Is there an easy way to display Axe tokens instead (probably by intercepting whatever Axe sends to the basic editor)?
Also, is there a way to call the OS's catalog? (I don't want to make my own.)

For the record, I haven't answered either of these questions because they're beyond both my knowledge and the capabilities of native Axe. You might have better luck asking these questions framed as assembly questions in the appropriate place. The ASM board (https://www.omnimaga.org/asm-language/) isn't particulatly active, though, so you may want to try Cemetech's equivalent (https://www.cemetech.net/forum/viewforum.php?f=16) (or both).

Regarding your first question, I believe the main issue is that the token hook isn't normally invoked when displaying tokens in a running assembly program. I don't know how to solve this, but if you do eventually solve it, be aware that Axe's token hook will only replace tokens if cxCurApp is $83 (and, with Axe 1.3.0, if the token hook is enabled in the options menu).
Title: Re: Axe Q&A
Post by: E37 on December 06, 2015, 12:52:24 pm
Oh... Darn.
To continue my long string of questions I can't seem to find the memory address of the BASIC graph.
I assume I can treat it as just another buffer.
It isn't really important I am just curious how some asm programs edit the graph.
Title: Re: Axe Q&A
Post by: Runer112 on December 06, 2015, 02:37:32 pm
To continue my long string of questions I can't seem to find the memory address of the BASIC graph.
I assume I can treat it as just another buffer.
It isn't really important I am just curious how some asm programs edit the graph.

The graph screen buffer used by BASIC and the OS is called plotSScreen in the equate file, which is equivalent to Axe's L6, and is found at $9340.

Because many OS drawing routines operate (exclusively) on this buffer, most notably text drawing, assembly programmers generally use this as their graphics buffer. And if an assembly program doesn't explicitly mark the graph as dirty by setting the graphDraw flag, then the OS will happily retain and display whatever was in plotSScreen the next time you view the graph screen.

However, it seems that the effect of this flag was not known to most assembly programmers, so most assembly programs that don't leave an image intended to be preserved in plotSScreen still don't set this flag. And seeing garbage or the last frame of whatever assembly program ran last the next time you use the graph screen is somewhat annoying. So modern shells (at least, DoorsCS and zStart) step in and set this flag themselves, expecting that most programs run through them would have done so had their programmers known about it. But if you run an assembly program from the home screen without any shell's home screen hook enabled, you can still preserve an image.

In conclusion, an assembly program can put its own image in the graph buffer and simply not set the graphDraw flag to "request" that the OS preserve the image, but due to many programs historically doing this unintentionally, modern shells set the flag themselves to request that the OS clear the image.
Title: Re: Axe Q&A
Post by: E37 on December 06, 2015, 03:58:40 pm
It works!
I finally understand why each of the free ram variables have a name under them!
Since L5 (textShadow) is 128 bytes each one should holds a value for each number on the screen!
And it is corrupted by ClearHome because ClearHome is the same as Fill(L5,128,0) and the same is true for L6 and ClearDraw
(My life has meaning now)

Is all of my information correct (I posted as soon as I saw this because I was excited)
Thanks SO much!  ;D
(increases karma)
Title: Re: Axe Q&A
Post by: Runer112 on December 06, 2015, 04:06:45 pm
It works!
I finally understand why each of the free ram variables have a name under them!
Since L5 (textShadow) is 128 bytes each one should holds a value for each number on the screen!
And it is corrupted by ClearHome because ClearHome is the same as Fill(L5,128,0) and the same is true for L6 and ClearDraw
(My life has meaning now)

Is all of my information correct (I posted as soon as I saw this because I was excited)
Thanks SO much!  ;D
(increases karma)

Yes, all your information is correct. I always thought the wording in the command list about how certain things "corrupt" was rather strange, but you've got it.
Title: Re: Axe Q&A
Post by: E37 on December 07, 2015, 09:29:38 pm
Is there an equivalent of pop and push for axe?

Realloc( doesn't seem to do anything.
Title: Re: Axe Q&A
Post by: Runer112 on December 09, 2015, 11:32:15 am
Is there an equivalent of pop and push for axe?

In general, there isn't. And this is for a number of reasons. To name a few: it's too low level of a concept to belong in a compiled language; checking if pushes match pops could prove tricky; the compiler uses the stack for its own purposes and would often interfere with the user trying to use the stack; and, although Axe isn't currently good enough, a good optimizing compiler would use the stack like you're imagining anyways.

However, when posed with requests like this long ago, Quigibo thought of a great implementation for simpler cases that avoids all these problems. Select(A,B) is a command that simply returns A. Each arguments to a built-in Axe command/function except the last is saved by being pushed onto the stack, so A is pushed onto the stack after being evaluated. You can then perform any single expression in B, the result of which is kept in hl. Finally the body of the command is executed, which simply performs pop hl to restore the value of the first argument.

Realloc( doesn't seem to do anything.

If you mean it doesn't correspond to any compiled code, that's correct. It redefines the pointers to the letter variables, and changing these compile-time values doesn't result in any runtime code.

If you mean it literally doesn't do anything, then that's a bug. But it seems to work for me in both Axe 1.2.2 and 1.3.0.
Title: Re: Axe Q&A
Post by: E37 on December 09, 2015, 05:19:14 pm
I meant that Relloc( didn't seem to perform a function like pop or push.
I was just curious if there was a way to reuse letter variables.
Title: Re: Axe Q&A
Post by: Runer112 on December 09, 2015, 05:49:17 pm
I was just curious if there was a way to reuse letter variables.

Reallocating the letter variables does give you a full new set of variables backed by different memory (provided you used a location that doesn't overlap with the default). But if you want extra variables, I would suggest instead making use of named constants/variables. You can define a constant like L1→°MyVar, and then for the rest of the program, MyVar will be a variable stored at L1. You can do anything with it that you can do with a letter variable.
Title: Re: Axe Q&A
Post by: E37 on December 09, 2015, 06:38:03 pm
Hrm... Relloc(A) gives an error.
I know how to make constants I just don't want to type more than I have to.

Is there a way to access the OS's unused spaces?
When I downgraded from 2.55 the new os took up 200k less space.
Is there a way to access this unused space (my available archive didn't go up when I downgraded)
Thanks!
Title: Re: Axe Q&A
Post by: Runer112 on December 09, 2015, 07:10:32 pm
Hrm... Relloc(A) gives an error.

You're redefining the base pointer for the letter variables, which should be a constant, and A is not a constant.

Is there a way to access the OS's unused spaces?
When I downgraded from 2.55 the new os took up 200k less space.
Is there a way to access this unused space (my available archive didn't go up when I downgraded)

I'm not sure where you got the 200KB number from; if you're referring to the fact that the 8xu file is larger, those files are roughly twice as large as they would be on an actual calcluator and they contain varying amounts of filler blank data, so don't trust their file size differences to tell you much. Regardless, you didn't see your available archive space change because there's a fixed size allocated for the OS for simplicity and compatibility reasons. A "larger" OS will simply take up more of this space. It won't eat into archived variable and application storage.

Theoretically, you could store data in the unused space allocated for the OS, but not in any way that the OS would be able to recognize variables or applications. You'd essentially be patching the OS. And unless you've got a really good reason to be doing so, you probably shouldn't be patching the OS.
Title: Re: Axe Q&A
Post by: E37 on December 13, 2015, 02:36:03 pm
While debugging my program editor I opened a weird file (it uses the VAT to select a file) and it contained my last entry.
After experimenting with it I found that I could access it with a Getcalc([0523]) -> var and that modifying it did indeed modify the OS's last entry. (It seems to use tokens to store data.)
Is there a way to execute this modified entry so I can use the OS's math or run a program? (or just reset my ram)
I love poking into places that I shouldn't!  :angel:
Title: Re: Axe Q&A
Post by: Runer112 on December 13, 2015, 02:58:38 pm
While debugging my program editor I opened a weird file (it uses the VAT to select a file) and it contained my last entry.
After experimenting with it I found that I could access it with a Getcalc([0523]) -> var and that modifying it did indeed modify the OS's last entry. (It seems to use tokens to store data.)
Is there a way to execute this modified entry so I can use the OS's math or run a program? (or just reset my ram)
I love poking into places that I shouldn't!  :angel:

As it seems you have discovered, the home screen entry is implemented as a specially named program that you edit directly on the home screen, and it is executed when you press enter. But outside of this program's special connection to the home screen, there's really nothing special about it. You can do anything with it that you can do with any other program.

However, I'm not aware of any way to execute BASIC programs (which is more or less what the home screen entry is) from Axe.
Title: Re: Axe Q&A
Post by: E37 on December 13, 2015, 04:42:05 pm
Is there any useful uses of it?
I am assuming that the OS has a flag for whether the enter key is pressed on the home screen.
It there a way I can "activate the flag" and execute anything it has.
I am looking for a way to implement floating point math (It doesn't have to be fast) into my editor as a feature.
Basically I am tired of quitting my program to do a math operation on the home screen. (and I don't want to do long math in my head)
Thanks!
(the whole home screen is a program thing BLEW MY MIND! I thought [0523] was just a data file)
Title: Re: Axe Q&A
Post by: Runer112 on December 13, 2015, 06:02:27 pm
Is there any useful uses of it?
I am assuming that the OS has a flag for whether the enter key is pressed on the home screen.
It there a way I can "activate the flag" and execute anything it has.
I am looking for a way to implement floating point math (It doesn't have to be fast) into my editor as a feature.
Basically I am tired of quitting my program to do a math operation on the home screen. (and I don't want to do long math in my head)
Thanks!
(the whole home screen is a program thing BLEW MY MIND)

However you'd end up doing such a thing, you'd need some things beyond the capabilities of pure Axe. My inclination would be to let the user select a line, or some more specific selection, and then press a button to request that it be replaced with its evaluation. I've never done anything like this before, but it might work something like this (DISCLAIMER: COMPLETELY UNTESTED):
Title: Re: Axe Q&A
Post by: E37 on January 12, 2016, 03:11:44 pm
Is there a way to re-size an appvar? I was hoping to just use x -> {ptr-2}r but that didn't work.
(I know about making a new one and copying, but My appvar can get bigger than half of max RAM)
Thanks!
Title: Re: Axe Q&A
Post by: E37 on January 12, 2016, 04:20:36 pm
I may wind up using memkit...
Title: Re: Axe Q&A
Post by: Runer112 on January 12, 2016, 05:02:55 pm
Is there a way to re-size an appvar? I was hoping to just use x -> {ptr-2}r but that didn't work.
(I know about making a new one and copying, but My appvar can get bigger than half of max RAM)
Thanks!

In pure Axe, not really.

I may wind up using memkit...

Probably a good idea. MemKit's functions like should really be Axe built-ins, but for whatever reason, it's always hung around as an axiom.
Title: Re: Axe Q&A
Post by: E37 on January 12, 2016, 05:21:03 pm
Thanks!
Maybe you can add it in 1.3 if there is enough space.
Title: Re: Axe Q&A
Post by: E37 on January 21, 2016, 05:26:09 pm
Is there you can call a label in another program given you know where it is?
Like:
:Goto (A)

Where A has the address of a label in another program.
I am using Runprgm so the label should still be in the same spot.
Basically I want to be able to jump to a label without having to use runprgm each time.
Can you jump to labels outside of the program you are running?
Title: Re: Axe Q&A
Post by: E37 on January 27, 2016, 04:14:08 pm
Does anyone know an good aiming routines?
The project I am working on requires that a good amount of aiming.
All attempts at creating a particle that will move at the same speed (reasonably accurately) between two points have failed.
I feel like the solution lies in the sin( cos( tan-1( command but I can't get them to work.
the world uses 256 to 1 pixel up (for good jump animation) but 1 to 1 for the side (for bigger maps)

To answer my question from earlier
:Goto (GetCalc("prgmNAME"))
Seems to work and jumps to the beginning of another program without the lag of other commands.
I know this is probably pretty dangerous and bad things will happen if the program isn't there or crashes.
It appears to be able to jump from an app to a program in ram and then return back to the app.
If it really does what I think it can that lets programs have 36000+ ram to work with (about 16000 for the app and 20000 for ram)

Any thoughts on either subject?
Title: Re: Axe Q&A
Post by: c4ooo on January 27, 2016, 04:36:33 pm
:Goto (GetCalc("prgmNAME"))
Will fail of your program contains any sort of jumps in it <_<
If you want to keep your app+program model, i would suggest copying the whole program to 0x9D93, and then doing Goto (0x9D93+3) to run the program in ram. (replace '0x' with the axe hex symbol, which looks like the lower case 'E').
Runer sould probably confirm what i am saying here as this is only theory for me <_<
Title: Re: Axe Q&A
Post by: E37 on January 27, 2016, 04:46:36 pm
Do I need to make space for it, or can I just copy a program directly to it?
Copying it directly doesn't work.

Never mind, I messed up the copy statement.

Edit: the program runs fine but crashes when exited (the program in e9D93 not the one who ran it)
Title: Re: Axe Q&A
Post by: c4ooo on January 27, 2016, 05:24:14 pm
Do I need to make space for it, or can I just copy a program directly to it?
Copying it directly doesn't work.

Never mind, I messed up the copy statement.

Edit: the program runs fine but crashes when exited (the program in e9D93 not the one who ran it)
Well, the 'program that ran it' sould be an app...
The currently running asm program is always excecuted from 9D93.
Title: Re: Axe Q&A
Post by: E37 on January 27, 2016, 05:28:22 pm
Thanks! My program wasn't an app and it over wrote its self.

Is there any way to prevent
Rect(300,,10,
from showing up on the screen? (I know the screen laps after 256)
It appears in the lower right part of the screen and I don't want it to show up a all.
I am working on a scrolling game where the world is larger than 256 pixels long and some objects lap.  :(
Title: Re: Axe Q&A
Post by: E37 on March 07, 2016, 06:00:28 pm
I have another random question to ask!  ;D
I have seen programs that can transfer the ASCII characters to tokens that can be accessed in the program manager.
How does this work? I looked through the token table for some of the characters (mainly for the cursor) and couldn't find them.
Is there an Axe way to get these characters? (I know some programs can add them for you)
Any help would be awesome!
(Do I come over as rude? I sort of feel like I am but can't find a better way to word it.)
Title: Re: Axe Q&A
Post by: Runer112 on March 07, 2016, 11:17:26 pm
I'm not quite sure I understand what you're aiming to do with these tokens. But you can definitely reference any token in Axe, as tokens are just one- or two-byte values, and you can display them with the ▶Tok variant of the text display commands.

Most characters do exist as a token, although the cursor and all of its variants are among those that do not.
Title: Re: Axe Q&A
Post by: TIfanx1999 on March 08, 2016, 04:51:07 am
@E37 I don't think you come off as rude. Perhaps you were thinking of demanding? I don't think you come off as demanding either though. You've been completely fine. :D This help topic is here for questions to be asked after all. ;)
Title: Re: Axe Q&A
Post by: E37 on March 08, 2016, 04:43:13 pm
Thanks! It feels good (in a weird way) to find out that my search was impossible and I wasn't just missing something.

Is there any useful uses of it?
I am assuming that the OS has a flag for whether the enter key is pressed on the home screen.
It there a way I can "activate the flag" and execute anything it has.
I am looking for a way to implement floating point math (It doesn't have to be fast) into my editor as a feature.
Basically I am tired of quitting my program to do a math operation on the home screen. (and I don't want to do long math in my head)
Thanks!
(the whole home screen is a program thing BLEW MY MIND)

However you'd end up doing such a thing, you'd need some things beyond the capabilities of pure Axe. My inclination would be to let the user select a line, or some more specific selection, and then press a button to request that it be replaced with its evaluation. I've never done anything like this before, but it might work something like this (DISCLAIMER: COMPLETELY UNTESTED):
  • (Optional) Save the value of Ans. This gets rather tricky for lists and matrices.
  • Create a temporary equation with the same size as the selection. The clean way to do this in assembly would be to use B_CALL(_CreateTempEqu) (http://wikiti.brandonw.net/index.php?title=83Plus:BCALLs:432D). But a pure Axe solution would be to use a fixed temporary equation name, like [03FFFF00], and create it with GetCalc(<name>,size).
  • Copy the selection into the temporary equation.
  • Install an error handler around the next step in case an error occurs while parsing the equation. DrDnar's axiom (https://www.omnimaga.org/the-axe-parser-project/(axiom)-run-(unarchived)-external-assembly-programs/) meant for running assembly programs seems to provide this functionality.
  • Execute the temporary equation by putting its name in OP1 and using B_CALL(_ParseInp) (in Axe: <name>Asm(E7EF9B4A)).
  • If an error occurred, handle it as you wish. Perhaps append "=ERROR" to the selection.
  • If no error occurred, convert the result to a string representation. Thankfully, Mateo recently demonstrated (https://www.cemetech.net/forum/viewtopic.php?p=242910#242910) how this could be done. In Axe (returns a pointer to the variable's size word): Asm(210000EF2443D5EF6949EF524BEFAB49EF6C49E1).
  • If no error occurred, delete the selection and insert the result's string representation into the program at that location.
  • (Not sure if necessary) Clean up temporary variables with B_CALL(_CleanAll) (in Axe: Asm(EF5041)).
  • (Optional) Restore the original value of Ans.
I am just looking back (after going off and working on random things) on my attempt on an small font editor.
In attempting to fix some problems (with a complete rewrite) I realized that while I was able to execute an equasion, I could only display it as an int. I tried again but after an hour of trying I am still unable to convert the number to a string. How am I able to do this?  ???
(an example would be nice)
What do you mean by "pointer to the variable's size word"?
Thanks!  ;D
Title: Re: Axe Q&A
Post by: E37 on May 10, 2016, 08:35:16 pm
Is there any way to run an app from a program?
Title: Re: Axe Q&A
Post by: Runer112 on May 10, 2016, 08:55:49 pm
B_CALL(_ExecuteApp) (http://wikiti.brandonw.net/index.php?title=83Plus:BCALLs:4C51). It won't return to your program, though; if you wanted behavior like that, you'd have to rig something up with hooks.
Title: Re: Axe Q&A
Post by: E37 on May 18, 2016, 05:47:11 pm
Are axioms compiled or uncompiled?
(does Axe compile it or do you?)
Title: Re: Axe Q&A
Post by: TheMachine02 on May 20, 2016, 02:02:20 pm
Axiom are compiled asm code. They aren't axe code compilated (altough that would be cool).
Title: Re: Axe Q&A
Post by: E37 on May 20, 2016, 03:23:27 pm
I was curious if the axiom needed to be compiled before it became usable.
I guess what I was asking was is an axiom such as memkit source code (as the 8xv) or already compiled into executable code.
Title: Re: Axe Q&A
Post by: E37 on May 21, 2016, 04:17:50 pm
Speaking of axioms, for some reason this code won't work. (I'm using mimas)
dw $C0DE
dw ax1end
db axmAll
db $BB,$1B
db axmInline
db axm0args
rorg 0
ld hl,5

dw 0
dw $03E0
db 5
db "Trial"
Title: Re: Axe Q&A
Post by: c4ooo on May 21, 2016, 04:19:16 pm
Please be more specific ;)
To quote kerm:
"What are you trying to do?
What did you expect to happen? (What errors did you get?)
What actually happened?"
Title: Re: Axe Q&A
Post by: E37 on May 21, 2016, 04:20:48 pm
Trying to make an axiom that actually compiles.
Mimas will compile it but the token won't change and Axe gives an Err:invalid axiom
Title: Re: Axe Q&A
Post by: Runer112 on May 21, 2016, 04:28:30 pm
Perhaps this just got lost in the manual copying process, but is ax1end defined properly?

If so, nothing seems obviously wrong to me. If you posted the assembeld axiom, I could probably figure out what's wrong, though.
Title: Re: Axe Q&A
Post by: E37 on May 21, 2016, 04:37:15 pm
Perhaps this just got lost in the manual copying process, but is ax1end defined properly?

If it appears so, nothing seems obviously wrong to me. If you posted the assembeld axiom, I could probably figure out what's wrong, though.
Yes I did forget to add it.
The program compiles sucessfully.
The actual function is a little different. (It displays "Magic!")
Here is the compiled code:
Title: Re: Axe Q&A
Post by: E37 on August 18, 2016, 01:24:00 pm
Just wondering if there was a way to include and run compiled assembly programs in Axe.
I've tried:([])():[prgmNAME] but, it won't work. Does it have something to do with the offset?
I am compiling the code with mimas.
Thanks!
Title: Re: Axe Q&A
Post by: Runer112 on August 18, 2016, 02:41:32 pm
For many reasons, one of the largest being code origin, you cannot simply include one assembly program into another.

Provided you have access to the source of this program (which it sounds like you do), the only way I can think to legitimately include assembly code into an Axe program is to modify the assembly program into an Axiom. Depending upon the complexity of the assembly program, you may need to utilize many of the more advanced/confusing Axiom features. I'll refrain from attempting to explain them all unless it is discovered that some of them are needed.

A much simpler way is to abandon the requirement that the assembly program be included in the Axe program and simply call the assembly program from the Axe program with the RunPrgm (https://www.omnimaga.org/the-axe-parser-project/(axiom)-run-(unarchived)-external-assembly-programs/) Axiom.
Title: Re: Axe Q&A
Post by: E37 on August 18, 2016, 03:55:16 pm
I've been using RunPrgm. A am slowly porting small parts of my projects to assembly to learn how to use it, since this gives me the benefit of not having to work out the logic of the section and knowing that the logic works.
I was hoping to avoid RunPrgm so I wouldn't have the slowdown of having to run it each time. (especially in a time sensitive loop)  :-\
I'll try "un-squishing" the code into hex (removing the C9 at the end) and pasting the hex to the desired location.
Title: Re: Axe Q&A
Post by: E37 on September 10, 2016, 06:16:03 pm
I looked in the chat and saw @neuronix was asking about renaming Axe 1.3.0 to something else to have both at once.
If @Runer112 doesn't care I'll post my renamed version of Axe 1.3.0 "Axe1.3"  ;)
Edit: I can so here it is...
Title: Re: Axe Q&A
Post by: neuronix on September 14, 2016, 12:34:55 pm
@E37 How did you make?
Title: Re: Axe Q&A
Post by: E37 on September 17, 2016, 11:16:20 am
I opened Axe with the text editor.
Then I downloaded BrandonW's FixInititalHex.
I got rabbitsign from inside the Axe download folder.
I looked on the second or third full line of hex and found Axe's name in ASCII hex. (You may need to look up a chart of the 84's version of ASCII - zStart's font editor shows the hex that corresponds with every character.)
I modified the name to what I wanted it to be. Note that space is $20 not $00 (so you can look for "2020202020" in the app's hex for the five spaces after Axe's name to help you find it).
Then I copied all but the LAST TWO HEX CHARACTERS into fixinitialhex and replaced the final two hex characters with the corrected checksum from fixinitialhex.
Save and exit.
Use rabbitsign to sign the app and you should be done!
Title: Re: Axe Q&A
Post by: neuronix on September 22, 2016, 07:19:04 am
Ok, thanks
Title: Re: Axe Q&A
Post by: ferbplatypult on July 03, 2022, 07:31:56 pm
Hello again!
I am once again having problems figuring out how to do something, this time arrays. I’ve seen people ask about them but still can’t understand how to make/ use one. I could probably copy code but I’d like to understand what it does just in case I need to do it again.
Title: Re: Axe Q&A
Post by: Xeda112358 on July 03, 2022, 07:39:06 pm
In Axe, it's really low-level-- say you want 10, 1-byte elements. What you do is find (or allocate) a 10-byte chunk of RAM that is free, and you write and read bytes from it. For convenience Axe has L1 pointing to a 768-byte chunk of free RAM, so you can "{L1+2}→A" or "A→{L1+2}" to read/write the third element.

Axe has built-in ways to access 1- and 2-byte values, but in the end, it's up to you how you want to interpret the data :)

EDIT: A word of caution: Axe has no safety nets, so it won't stop you from reading or writing to data outside of your array on accident. If you aren't comfortable with arrays like this, make sure to back up your data in case you corrupt the data you have in RAM and need to clear RAM!
Title: Re: Axe Q&A
Post by: ferbplatypult on July 03, 2022, 07:45:13 pm
So if I wanted a 5*5array I should make 25 variables? What if I wanted to dynamically access array spots
Title: Re: Axe Q&A
Post by: Xeda112358 on July 03, 2022, 07:50:45 pm
Not 25 variables per se, but 25 elements, so if you want 1-byte elements, you'd need 25 bytes :)

This is an example of where it's up to you how you want to store and retrieve the data, but commonly, people choose to store it row-by-row. The first five elements are the first row, the next five elements are the second row, and so on.

Arrays start at 0, so an easy (not necessarily best) implementation might be to refer to element (Y,X) as "{L1+(5*Y)+X}" where Y and X are between 0 and 4.
Title: Re: Axe Q&A
Post by: ferbplatypult on July 03, 2022, 07:56:24 pm
This is going to sound dumb but what are bits and how many do I need to store a 2 digit number?
Title: Re: Axe Q&A
Post by: Xeda112358 on July 03, 2022, 08:02:16 pm
Nah, that's not dumb :) A "bit" is a "binary digit" so a 0 or a 1. A 2-digit number has 102 (100) possible values, and a 7-bit number has 27 (128) possible values, so technically, you can fit a 2-digit number in 7 bits.

In reality, you'll usually be interacting with 8-bit and 16-bit  numbers (0-255 and 0-65535), so you'd just use an 8-bit value to store 2 digits.

Note: there are 8 bits per byte :)
Title: Re: Axe Q&A
Post by: ferbplatypult on July 03, 2022, 08:06:10 pm
So I’d do{L1+(8*Y)+X}?
Title: Re: Axe Q&A
Post by: Xeda112358 on July 03, 2022, 08:09:09 pm
That's assuming you have 8 bytes per row, but i think you might be mixing things up.

If you want 5 bytes per row (that's 40 bits total per row), you'd do  "{L1+(5*Y)+X}" where the 5 is how many bytes per row.

That's the code if you want a 5-by-5 array of 8-bit numbers
Title: Re: Axe Q&A
Post by: ferbplatypult on July 03, 2022, 08:16:38 pm
I think I’m starting to understand instead of having variables I have data spaces that space out and hold data in binary just hypothetical  when should sombody want to use more dangerous storage like l3
Title: Re: Axe Q&A
Post by: Xeda112358 on July 03, 2022, 08:25:57 pm
L3 is safe as long as you aren't using grayscale (Axe uses it like a second "graph screen")


L2 uses the same memory as the OS's "statistics variables" so that'll clear that data, but that's usually fine since anybody who needs it can very easily regenerate the data.


L4 gets overwritten when you archive/unarchive.


L5 is overwritten when you draw text on the homescreen


L6 is overwritten when you draw to the graph screen

Title: Re: Axe Q&A
Post by: ferbplatypult on July 03, 2022, 08:28:00 pm
Ok how many bits can I fit in l1
Title: Re: Axe Q&A
Post by: Xeda112358 on July 03, 2022, 08:30:39 pm
L1 is 768 bytes, so 768*8 = 6144 bits.

For reference, I'm using https://axe.eeems.ca/Commands.html to look things up. Eeems (an admin) hosts that Axe reference sheet and it's really handy
Title: Re: Axe Q&A
Post by: ferbplatypult on July 03, 2022, 08:32:11 pm
Than you so much I think I got it figured out (kinda) D:
Title: Re: Axe Q&A
Post by: Ki1o on July 05, 2022, 12:15:56 am
Does Axe not allow you to manipulate more than one appvar at a time? I'm getting some really strange bugs when I do. I have 2 appvars that I create in RAM. One is the appvar for the current generated floor in my game. The second appvar is supposed to be another map that I am going to use in my AI calculation that I call DistMap. I running across several strange bugs with Axe when I do this. If I create both appvars at the same time, I am no longer able to manipulate the DistMap appvar if I do anything with the Floor appvar. In this case all I am trying to do is fill it with some value for now. If I instead create the DistMap appvar whenever I press a button (down in this case), the tilemap gets corrupted somehow. Or rather, it seems as if the 2 pointers are getting mixed up somehow. Because when I try to move down a bunch of corrupted tiles are scrolled in instead. Any ideas?
Title: Re: Axe Q&A
Post by: E37 on July 05, 2022, 09:57:35 pm
Does Axe not allow you to manipulate more than one appvar at a time? I'm getting some really strange bugs when I do. I have 2 appvars that I create in RAM. One is the appvar for the current generated floor in my game. The second appvar is supposed to be another map that I am going to use in my AI calculation that I call DistMap. I running across several strange bugs with Axe when I do this. If I create both appvars at the same time, I am no longer able to manipulate the DistMap appvar if I do anything with the Floor appvar. In this case all I am trying to do is fill it with some value for now. If I instead create the DistMap appvar whenever I press a button (down in this case), the tilemap gets corrupted somehow. Or rather, it seems as if the 2 pointers are getting mixed up somehow. Because when I try to move down a bunch of corrupted tiles are scrolled in instead. Any ideas?

Some code to see exactly what is going on would be helpful. Here is a summary of what GetCalc( does which may be helpful.

Everything in ram is stored between 0x9D95 and the VAT which is at the top couple hundred bytes of memory. The VAT (Variable Allocation Table I believe) holds information about everything in RAM that isn't locked down to a fixed address. It also holds information on where archived stuff is in flash is but that doesn't matter for your problem. When you use GetCalc() to open an existing program/appvar/other that is in ram, what it is actually doing is going to the VAT to look up where in memory the file is and returning that pointer. Since the file is in memory, ti-os may move the file whenever needed. Any time you create or destroy a file, you should assume any pointers you got from GetCalc() are outdated and that you need to get them again. There are rules as to what moves when, but unless you are really, really hurting for speed, just do it anyway. I don't think that existing files move when you make a new one but it doesn't hurt to make sure. Resizing almost always moves stuff around.
Since each file is nothing but a reserved space in memory, simply reading/writing to it is no different than manipulating a normal area in memory. From your description of the problem my guess would be that you are resizing or creating and deleting appvars which causes them to move in memory and throws off your pointers. If you are, remember that creation/deletion/resizing can be slow because it likely has to copy kilobytes of memory around. That shouldn't cause slowdowns if you do it once or twice a second, but I would avoid it in a loop. I would suggest using existing memory areas before resorting to appvars. There is a lot of built in memory if you look. Take a look at this (https://www.omnimaga.org/index.php?page=ram) if you want to to beyond what Axe's L1-L6 give you. It is pretty outdated in where it says Axe's variables are located so ignore those. For example 0x8000 gives you 256 bytes of memory and as long as you don't turn your calc off, it is perfectly free to use. (although it overlaps somewhat with the 756 byte buffer L4-512)

Here are some other fun facts that probably won't help you but may be interesting:
Appvars and programs are the same thing (as far as I know) and they only differ by one byte which tells what they are.
Pretty much any name is legal for a program/appvar as long as you don't intend on interacting with it through ti-os. You can make and edit programs with lower case names. Axe will even allow you to include and compile programs with lowercase names just like normal ones. Ti-os won't let you run a program with a lowercase name but as long as you compile to an uppercase program you will be fine. When transferring these programs to and from a computer, the ti-connect will irritatingly capitalize all the names.
"prgm#" and "prgm!" are special programs that hold recently entered stuff on the home screen. I don't remember exactly what each one does, but they exist. I'm not 100% sure on their names but I'm pretty sure those are it.
When you run a program, it gets moved to 0x9D95 (0x9D93 is the 2-byte size of the program) and then executed. So if you want to run a program from within an app, you can copy it there and just :Goto E9D95. Since there could be appvars there already, you should use some calls that aren't part of standard Axe to move anything that is there out of the way.
Title: Re: Axe Q&A
Post by: Ki1o on July 06, 2022, 02:22:00 am
I'm starting to think that this is just an Axe bug. I'm never resizing or deleting or recreating, just editing them. I "fixed" the problem by calling GetCalc again before I manipulate the appvar. I have another issue. It seems that signed comparison or signed operations don't seem to work.
I have a line of code that looks like this:
Code: [Select]
~8->{°MobOX+Mob}Later on I call a function that looks like this:
Code: [Select]
Lbl AnimateMob
For(I,0,Mobs-1)
°MobArray+(I*4)->Mob
If {°MobOX+Mob}>>0
{°MobOX+Mob}--
End
If {°MobOX+Mob}<<0
{°MobOX+Mob}+1->{°MobOX+Mob}
End
If {°MobOY+Mob}>>0
{°MobOY+Mob}--
End
If {°MobOY+Mob}<<0
{°MobOY+Mob}+1->{°MobOY+Mob}
End
End
Return
However, despite being a signed comparison, it still treats {°MobOX+Mob} as some large number and decrements it instead. I've used the sign{} command but that only breaks it further. How do I do this? It's starting to feel like I really have to fight the language to do simple things. I've hand calculated the offsets so nothing is off there when I draw. It is literally not working with negative numbers. I've subtracted 8 instead, I've changed the comparison from signed to unsigned. I'm really at a loss here. Please help!
Title: Re: Axe Q&A
Post by: Xeda112358 on July 06, 2022, 07:13:13 am
This
Code: [Select]
-8→{°MobOX+Mob}Is storing -8 as an 8-bit number.

At first, -8 is a 16-bit number stored as 65536-8 = 65528. That's works when your arithmetic is 16-bit. But when you store it as an 8-bit number, you lose the top 8 bits and it is stored as 256-8 = 248 instead.

Now when you read it, Axe has no idea that it used to be a signed 16-bit number, it's reading an 8-bit value that is 248 and in 16-bit, that's a positive number.

So what you need is to sign-extend the number where you copy the sign bit [top bit] of the 8-bit number into the top 8 bits of the 16-bit number. Luckily, Axe has a command for that: signed{<ptr>}

So whenever you are reading an 8-bit number and you want to tell Axe to interpret it as a signed number, you need to explicitly tell it.
Title: Re: Axe Q&A
Post by: E37 on July 06, 2022, 08:57:31 am
Your issue with GetCalc isn't an Axe bug. I have worked with 6+ appvars at once and had no trouble. Since all Axe is doing with GetCalc is asking the os for a pointer, it would be a ti-os bug and I very much doubt that ti-os would have such a problem. If you post your code I may be able to find what the problem was.
Title: Re: Axe Q&A
Post by: ferbplatypult on July 09, 2022, 02:06:01 pm
This is probably the last question for a while. How can I make and used Latin named variables? Also why does it seem like everyone knows all about this stuff but I’m just behind?
Title: Re: Axe Q&A
Post by: Xeda112358 on July 09, 2022, 07:55:30 pm
I'm not sure what you mean, could you give an example of what you want to do?

As for Axe knowledge, I think I started using Axe around 11 years ago, so it's just experience. I've never been a heavy user of Axe since I was comfortable as an assembly programmer by the time I learned about it, but I know enough to make simple programs :) (Axe can get very convoluted in the hands of a pro.)
Title: Re: Axe Q&A
Post by: ferbplatypult on July 09, 2022, 08:13:26 pm
I didnt mean Latin but custom, like EMNX for enemy x rather than j, I see people share code with long named variables and degrees symbols and was wondering what that was.
Title: Re: Axe Q&A
Post by: Ki1o on July 09, 2022, 08:45:39 pm
Hey there! If you are talking about custom named variables, what you can do is take a memory location and give it a name using the degree symbol like so:
Code: [Select]
L1+00->->°MyVarThen you can use it as a variable in any way like so:
Code: [Select]
42->MyVarAny custom variable you create will always be 2 bytes in size.
If you use this for any other value that is not a memory location, it is basically a named constant that you can use in place of that number. It serves no purpose outside of improving readability, but it is helpful.
When using named constants you must include the degree symbol. This is not the case when using a custom variable.
There are a few additional rules for naming anything in Axe. They must begin with a capital letter and they cannot be more than 13 characters long. They must also only contain letters or numbers. Hope this helps.
Title: Re: Axe Q&A
Post by: ferbplatypult on July 09, 2022, 10:05:41 pm
So is the degree or the without degree that you can change or is it both or none? (very confusing wording I just did)
Title: Re: Axe Q&A
Post by: Ki1o on July 09, 2022, 10:11:48 pm
You use the degree when you are first naming any constant. If you are going to use it as a variable elsewhere you no longer need the degree when using it. On the other hand, if you are using the named constant for its value, then you always need the degree.
Title: Re: Axe Q&A
Post by: ferbplatypult on July 09, 2022, 10:30:35 pm
So the degree is like edit mode that unlocks the space?
Title: Re: Axe Q&A
Post by: Ki1o on July 10, 2022, 12:56:01 am
Its more like a little note to the compiler that tells it to replace that named constant with the value you assigned it.
Title: Re: Axe Q&A
Post by: ferbplatypult on July 10, 2022, 01:19:52 am
So if I’m assigning I’m using degree, thank you!
Title: Re: Axe Q&A
Post by: ferbplatypult on July 21, 2022, 03:45:04 pm
So for my game I need to invert pixels on a sprite based on a what pixels are on. I tried pointe change but It didn’t seem too work.
Title: Re: Axe Q&A
Post by: Xeda112358 on July 21, 2022, 03:47:37 pm
Could you give us some code to look at? Pt-Change( should definitely work