Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: E37 on January 13, 2016, 04:56:27 pm

Title: Axe tutorial
Post by: E37 on January 13, 2016, 04:56:27 pm
When I was learning Axe I couldn't find a good tutorial. All I had to go off of was the included documentation and the command list.
Honestly both were confusing and I had a hard time getting started.
I think if we could put together a good tutorial or at least a little article on each command and how to use it.
There aren't any good tutorials probably because it is too large for anyone, if members could post the articles individually it will be much easier.
Hopefully a good how-to will attract more programmers!

I was thinking an article would look a lot like:

Command: Disp (string),(string)...
Example:
:.EXAMPLE
:Disp "HI!"
 When this is compiled and run it shows:
HI!

... Or something like that...
Is this a good idea or won't it come to anything?

Title: Re: Axe tutorial
Post by: Sorunome on January 13, 2016, 04:59:48 pm
Well, an Axe tutorial would be nice indeed, but what you just said is IMO more like a description of every command, rather than a tutorial, which explains how to use the language and some programming aspects and stuff.
Title: Re: Axe tutorial
Post by: E37 on January 13, 2016, 05:01:58 pm
I was thinking to have an intro article explaining pointers and various other things, since once you can grasp the basics all you need is a good explanation of the commands and experience to make cool games and other programs!
Title: Re: Axe tutorial
Post by: Dudeman313 on January 13, 2016, 05:18:59 pm
This sounds like a good idea! I am hoping to learn Axe and could really use some help! :)
Title: Re: Axe tutorial
Post by: TIfanx1999 on January 13, 2016, 05:28:51 pm
@E37 I think a lot of people would get good use out of something like this.
Title: Re: Axe tutorial
Post by: E37 on January 13, 2016, 06:02:38 pm
Hopefully this is a group effort and not just me.
I will try to add one each day, is anyone willing to do the basics?
Title: Re: Axe tutorial
Post by: Dudeman313 on January 16, 2016, 07:08:10 pm
Seems like no one is willing to do the basics. I would, but I'm the student, not the teacher, sensei, or guru.
Title: Re: Axe tutorial
Post by: E37 on January 16, 2016, 08:25:33 pm
Here are the basics:
Numbers in Axe aren’t the nice as-big-as-you-want-with-decimals, rather they are an integer with a range of 0-255 for an 8 bit number or 0-35565 for a 16 bit.
If a number is greater than its max it will loop back to 0.
You can simulate negative numbers though. 255 can act as -1. For example if you add 1 and 255 it will loop back to 0 just like 1 + -1 = 0. This trick works for all numbers, -2 = 254…
In Axe (and a lot of other languages) variables don’t hold numbers, rather they hold a pointer.
A pointer is like a direction to a location. The variable bossHp would contain some number (you don’t need to know what it is) that points the place where the computer stores the number for the boss’s health.
However rather than think about what they are the letter variables (and a few others) act just the way you think they should. If you ask it to display the value of A it will tell you it’s value NOT its pointer.
The most important thing in Axe is lists or as I will call them, arrays. Arrays are just lists of 8 bit numbers (range 0-255). L1 is a pointer to an area of FREE RAM. Free ram is basically areas of memory that the calc uses for various reasons that the ordinary user can’t use. However in programs you can use them. Some areas contain information and using them could produce weird results, I will be using L1 which is actually named saveSScreen which contains no important information.
The first line of code is ALWAYS a period then the name of the program once it is compiled.
Here is how you use them (example code):
:.EXAMPLE
:5->{L1}
:Disp {L1} >Dec
:2 -> {L1+1}
:Disp {L1] >Dec
Once this is compiled and run it will display:
5
2
Okay… so what did I just do? You probably got the 5 and the 2 are the same ones displayed, but what are the {} and the +1 and L1?
L1 is the pointer to the area of memory I want to use, it tells the program where to store the data.
The {} tell the program that I want the value stored there, NOT the pointer.
Finally, the +1 means I want the 2nd item on the list, that way I am not overwriting the first value.
Now, if you didn’t get the correct result here are some reasons what could be wrong…
>Dec is one token it is found under the math menu.
Did you compile the program?
Did you run prgmEXAMPLE ?
Is there a period in front of EXAMPLE (in the program)?
You need to use the Asm( prgmCompliedProgramName) to run the compiled program.

Some things to remember…
The source code (the part you edit) and the executable (the part you run) are separate.
There is a limit on the size of all areas of free ram (nothing has unlimited memory) for L1 / saveSScreen is 712. If you try to modify {L1 + 1000} bad things will happen.
What are those bad things? Well, it will probably corrupt you RAM. What is that? You can tell if your RAM is corrupted if you go to the memory menu (I won’t spell out how to get there) and go to the 2nd option: “Mem Mgmt/Del” and scroll down. There will be a nice list of all your programs apps and appvars but if something is wrong you will notice some impossibly large entries. For example it might say that Y1 is 61592 bytes large (the total amount of ram is only about 24000) so, it can’t logically exist. The only way to fix it is, well… a RAM wipe. You need to archive everything important and reset you RAM. If you look back the weird files should be gone.
What to do if your calculator freezes: There isn’t really much you can do, your only option is to open the battery case and remove one of the batteries and put it back in. This will cause the calc to reset RAM. Note: you don’t get to archive your files so if they are in RAM they will be lost!
I recommend some kind of shell like Doors CS 7 as it lets you edit a program in archive and run programs without using the Asm( command as well as a LOT of other functions.
If your program doesn’t work as expected it probably isn’t Axe’s fault. I know I sometimes blame Axe in frustration. Look closer. I have never found a problem that was Axe’s fault. (Thanks Runner!)
Remember, all it takes is a bit of practice.
Check back later for some instructions on how to use some of the other commands.
Please post if you have any questions (or comments).
Don’t let the whole list of things that could go wrong discourage you, those are all of the major problems, and I haven’t really covered the basics yet of what Axe can do!
Title: Re: Axe tutorial
Post by: c4ooo on January 16, 2016, 08:28:30 pm
Well there is already an axe wiki, but no one really rushed to help out >.<
https://www.omnimaga.org/news/axe-wiki-opens!/

"I have never found a problem that was Axe's fault". I have :P
Albeit the problem is in a beta version of axe.
Title: Re: Axe tutorial
Post by: E37 on January 16, 2016, 08:31:47 pm
Really? I have never heard of it or come across it in all my searches for help.
I guess it is easier to start a new thread than try to revive an old one.
(just how old is it?)
My ultimate goal is to "compile" all of the tutorial and the command overviews into one document.
Title: Re: Axe tutorial
Post by: c4ooo on January 16, 2016, 08:34:06 pm
Well its from May 18th 2015.
I myself have thought of doing a tutorial, but i dont think the payoff is worth the time expended :/
Title: Re: Axe tutorial
Post by: E37 on January 16, 2016, 08:38:03 pm
True, but dudeman313 asked me to teach him Axe and I might as well see how far I can get.
We am also working on a side-scrolling-no-story line-combat game and I could use some help.
(That is what Bog Sluzi is for)

Maybe I thought that if I asked for people to just write a short overview on a command that I would get some help  :-\
Title: Re: Axe tutorial
Post by: Runer112 on January 16, 2016, 09:31:24 pm
There's a fantastic Axe tutorial, written by @kindermoumoute,@Matrefeytontias, and @nikitouzz, that's really detailed and pretty up-to-date. There's just one slight hitch: it's written in French (https://openclassrooms.com/courses/l-axe-parser). But I've always thought that, if someone were to translate it to English, it could easily serve as the definitive general Axe tutorial.
Title: Re: Axe tutorial
Post by: Dudeman313 on January 17, 2016, 08:51:40 am
If I view it w/ Google Chrome, I might get a mangled but somewhat understandable meaning...

EDIT:
Here's where I point out how clueless I am when it comes to code:
Where would I enter the code in that tutorial above? All Axe Parser does is compile
& stuff.
Title: Re: Axe tutorial
Post by: E37 on January 17, 2016, 11:28:22 am
You create a new program.
go to PRGM - NEW -Create New - Then you enter the name of the new program and it creates a new program.
Title: Re: Axe tutorial
Post by: E37 on January 17, 2016, 11:30:04 am
Hey Runner can I modify the Axe command list to make it a little clearer (like changing corrupts to modify in the free RAM section)
Title: Re: Axe tutorial
Post by: Runer112 on January 17, 2016, 11:39:14 am
Hey Runner can I modify the Axe command list to make it a little clearer (like changing corrupts to modify in the free RAM section)

If you have suggestions to make the command list better, I can simply include them in the official version for whenever 1.3.0 is really released. But yes, I agree that the "corrupt" wording is weird, and I'll fix it for 1.3.0.


EDIT: As a side note, if you have other suggestions like this, perhaps the general Axe Parser thread (https://www.omnimaga.org/the-axe-parser-project/axe-parser/) would be the place to make them.
Title: Re: Axe tutorial
Post by: E37 on January 17, 2016, 11:57:49 am
I think that on the Getcalc( command it should specify what files are. (instead of saying file it should say file Y0 -Y9)
That is if you are still keeping them. I think I heard that they were giving you problems.
I think that {ptr -2}r should also be included in some way.
Possibly you could say that Buff(5) is the same as Data(0,0,0,0,0). I thought that Buff( could only be used for screen buffers and if you needed to add 500 bytes of program memory you had to do Data(0,0,0,0,0,0,0,...
Title: Re: Axe tutorial
Post by: Runer112 on January 17, 2016, 12:17:53 pm
I think that on the Getcalc( command it should specify what files are. (instead of saying file it should say file Y0 -Y9)

You're right, information about files is lacking from the command list. I've made a note to add such information.

I think that {ptr -2}r should also be included in some way.

Yes, this should probably be mentioned in the GetCalc() documentation. Noted.

Possibly you could say that Buff(5) is the same as Data(0,0,0,0,0). I thought that Buff( could only be used for screen buffers and if you needed to add 500 bytes of program memory you had to do Data(0,0,0,0,0,0,0,...

Considering that Buff() is in the Data and Storage section rather than the Screen and Buffer section and that it doesn't suggest that it can only be used for screen buffers, I think it should be clear enough as-is. A buffer is simply a data storage area. Note that, throughout the command list, all references to a "buffer" that imply a screen buffer include some kind of qualifier, such as "main," "back," or "768 byte."

I might reword it slightly, but I don't want to be verbose in what should be a succinct command list.
Title: Re: Axe tutorial
Post by: Dudeman313 on January 17, 2016, 02:02:11 pm
When I'm done entering stuff under New Program, what do I do?
Title: Re: Axe tutorial
Post by: E37 on January 17, 2016, 02:29:17 pm
If you mean the name, hit enter.
If you mean editing the program hit 2nd mode for quit.
Title: Re: Axe tutorial
Post by: Dudeman313 on January 17, 2016, 05:04:13 pm
Thanks! Also, in the example, the program displays 5 and 2 and quits automatically within a second. What's up with that?
Title: Re: Axe tutorial
Post by: E37 on January 18, 2016, 10:44:07 am
I have no idea why it clears the screen after it is finished, however it does.
I you want it to stay longer add:
:Pause SomeNumber
I recommend 1500 for the number, it is about a second. It needs to be after the display command or it will pause then display then quit.



For your next step, the most important thing in games is the graph screen. Most games use the graph screen not the home screen.
I am no longer going to give you numbers instead give you a spot to add your own such as SomeX which would stand for some number, whatever you want it to be.
Here is an example program:

:.SomeName
:ClearDraw
:Pt-on(SomeX,SomeY,[FFFFFFFFFFFFFFFF] (There are 16 F's)
:DispGraph
:Pause 5000

The program should draw an 8 by 8 square whose upper right corner is at SomeX, SomeY, Pause for a couple seconds and quit.
Ok... so what did I just do?
ClearDraw clears the screen so it is blank.
Pt-on( draws the sprite at SomeX,SomeY.
DispGraph displays the image. Without DispGraph nothing would be shown!
The pause command pauses the image so you can see it.

Now... for all those F's...
The sprite is always 16 letters and numbers long.
Each character is actually a number in Hex. What is hex? Ask Google.
Hex counts 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,10,11,12,13,14,15,16,17,18,19,1A,1B...
How do you make hex sprites... I really don't want to cover it right now. If you bug me enough I will go over how to do it.
Some things that could go wrong...
Axe said the sprite was invalid: Then it isn't 16 characters long.
invalid constant: SomeX represents a number, don't just type it in!
Remember the comment in the parenthesis shouldn't be added in the program!
Ask if you have any questions!

Edit (Eeems): Merged double post
Title: Re: Axe tutorial
Post by: Eeems on January 18, 2016, 12:00:19 pm
Hey @E37 could you please use the modify button instead of double posting?
Title: Re: Axe tutorial
Post by: E37 on January 18, 2016, 12:31:57 pm
Sorry, I am pretty scatterbrained today.  :-\
Title: Re: Axe tutorial
Post by: c4ooo on January 18, 2016, 12:45:53 pm
Thanks! Also, in the example, the program displays 5 and 2 and quits automatically within a second. What's up with that?
getKeyr will pause the program until the user presses any key.

@E37 it is recommended that sprites are not stored inline, so it would be better to do something like:
Code: [Select]
Pt-on(fooX,fooY,PicFOO)
[1038387c7c7cfefe]->PicFOO
;)
Title: Re: Axe tutorial
Post by: E37 on January 18, 2016, 01:11:40 pm
I know, but I don't think the tutorial is ready for program memory yet.

Can I get anyone to help write the tutorial???
If not, then this project is as good as dead.
Title: Re: Axe tutorial
Post by: Dudeman313 on January 20, 2016, 03:01:00 pm
It was a great idea... Oh well. :( :-\ :(