Author Topic: Axe Tutorial  (Read 5117 times)

0 Members and 1 Guest are viewing this topic.

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Axe Tutorial
« on: March 17, 2011, 06:37:42 pm »
I am working on a tutorial for Axe, with focus on game design, just like my TI-Basic one, which is now up on my website. Please read the sections of the tutorial as I post them below. Correct any technical mistakes, factual inaccuracies, and propose any add-ins. Thanks to the community.



Table of Contents


Chapter 1: Introduction to Axe Parser

   1.1: Using Axe
   1.2: Setup of an Axe program
   1.3: Memory Structure, with Respect to Axe

Chapter 2: Using Memory in Axe

   1.1: Variables
   1.2: Name Strings
   1.3: SafeRam areas
   1.4: Pointers
   1.5: Data Storage and Manipulation
   1.6: Archive memory and files
   1.7: Commands that deal with memory

Chapter 2: Axe, the Basics

   2.1: Text Display
   2.2: Drawing
   2.3: Using Jumps and Subroutines
   2.4: Control Blocks
   2.5: Mathematical Operations
   2.6: Commands for Basic Axe

Chapter 3: Constructing an Interface

   3.1: Saving Data
   3.2: Sprites
   3.3: Tiles and Tilemaps
   3.4: Collision Detect
   3.5: Key press/Input Detection
   3.6: Screen v. Buffer v. Back buffer
   3.7: Commands for Interface design

Chapter 4: Advanced Game Mechanics

   3.1: Real-time programming
   3.2: Artificial Intelligence
   3.3: Interrupts
   3.4: I/O linking in Axe
   3.5: CALCnet2.2 as a linking protocol



1.1:  Using Axe


Axe is a programming platform designed by Quigibo . It is currently in late beta stages. It is a Flash Application, compatible with the z80 line of calculators (TI-83+/84+). It allows you to compile your programs into z80 executables, much like true assembly is. Axe has a command syntax similar to TI-Basic, but it is much more powerful. Have a look at the Commands list, provided on the tutorials page, to see specific instructions that Axe currently supports.

What sets Axe aside from its programming counterparts? It’s ease of use, and its power, for a language so easy to use. This tutorial will delve into using Axe to design games. Then, it will explore using CALCnet2.2, the robust calculator network designed by Kerm Martian, to achieve multiplayer linking.




1.2: Setup of an Axe Program


Every Axe program must have a name, at it is written using the program editor provided by the TI-OS. It is important to give this program, called your “source program”, a name that is different than the name you want your executable to have. Let us first deal with the setup of an Axe program.

Every Axe source program needs a header that tells the Parser what to name the output file. This is done using the comment denoting character, “.”.

PROGRAM:AXSRC
.SOURCE

This causes the Parser to output the executable to a program named SOURCE. If you wish, you can include a description after the name. For example:

PROGRAM:AXSRC
.SOURCE an example program

This has the same result as the program above, but the second one has a small description. Henceforth, the Parser will completely ignore lines of code preceded by a period (.).

Axe Parser also has the capacity to compile programs for certain shells by including a specific header: DoorsCS, MirageOS, and ION. This may be set in the Options menu. If you choose not to compile for a shell, you may simply set the Parser to the “No Shell” option. Finally, the Parser gives one more option. For those who wish to be daring, the Parser can compile your code into an application. This code is very hackish, and is therefore inefficient. However, Quigibo has assured me that this compiling mechanism is stable, meaning it does not endanger sensitive parts of your calculator. However, this option should be avoided if it can be.

Programming in Axe has elements of both TI-Basic programming and assembly programming. Axe provides the ease of use of TI-Basic-like commands, making the language easy to learn and easier to code in. However, data in Axe functions like data in assembly. This means you must be familiar with the usage of pointers, referencing memory by bytes, and sometimes by bits. It means that you can do math with variables, because they are, in fact, simply numbers. All of this will be discussed later.



1.3: Memory Structure, with Respect to Axe


In Axe, none of the variables you regularly program with exist. All that exists is your code. You use the variables as pointers to data in your code, and thenceforth use those variables to reference the data. You have several variable sets available to you in Axe. These are listed below, by how they are named on calculator.

GDB0-9
Pic0-9
Str0-9

Furthermore, Axe supports longer names for these variables. You may annex up to two letters (A-Z) to the end of any one of the above to form a variable name. So, this means that all of the following are examples of valid names:

GDB0
GDB1A
GDB3CA
Pic4
Pic6N
Pic9AZ
Str6
Str9A
Str2VA

While these names look a lot like TI-Basic variables, they are not. They are simply pointers, used by the programmer to reference large segments of data. We will discuss the importance and usage of them later.

The memory of your calculator consists of a series of bits, utilizing binary numerals. There are eight (8) bits in one (1) byte of memory. Similarly, there are two (2) hexadecimal numerals in one (1) byte of memory. Using Axe, you will need to know how to use and manipulate data in hexadecimal, especially if you are making tile-maps for an RPG. However, most of Axe’s commands accept input in standard decimal and Axe does provide conversionary tokens for input in hex and binary.

There are a few key things you need to know, going forward. You must read and write data directly to bytes either one byte at a time or two bytes at a time. This is because, in assembly, there are two types of numbers. There are one-byte numbers (0-255) and there are two-byte numbers (0-65536). These are positive numbers. If you underflow the stack of numbers, you move to the top and if you overflow it, you move to the bottom. There are ways to use negative numbers, and Axe makes it fairly trivial to do so. This will be discussed later.

Now, remember, as it is with assembly, there is a non-trivial difference between addresses and data. Each byte in memory has an address, starting at zero and continuing until the device runs out of memory. The offset from zero of a byte is its address. Thus, a byte at offset 200 would have an address of 200. This is not the same as the value of byte 200. Axe makes the difference easy to see. Let us assume that you have already stored the number 7 to the byte at 200. Well, you must store the value to a pointer.

200→C
C            ;   returns the address of the byte, 200.
{C}        ;   returns the value of the byte, 7.

In Axe, the curly brackets indicate that we are reading or writing data, not getting an address. They are very important.



Current Footnotes:

1  Kevin Horowitz, aka Quigibo is the designer of Axe Parser, and its programming platform. This tutorial borrows some material from the Official Documentation.
« Last Edit: March 17, 2011, 07:04:24 pm by ACagliano »

Offline yunhua98

  • You won't this read sentence right.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2718
  • Rating: +214/-12
  • Go take a dive in the River Lethe.
    • View Profile
Re: Axe Tutorial
« Reply #1 on: March 17, 2011, 06:38:57 pm »
I reading this right now, but shouldn't this be in Axe Language subforum?

EDIT:  looks good, but you can add 2 A-Z, theta, and 0-9 to the end of a pointer name.  ;)
« Last Edit: March 17, 2011, 06:42:11 pm by yunhua98 »

Spoiler For =====My Projects=====:
Minor setback due to code messing up.  On hold for Contest.
<hr>
On hold for Contest.


Spoiler For ===Staff Memberships===:






Have you seen any good news-worthy programs/events?  If so, PM me with an article to be included in the next issue of CGPN!
The Game is only a demo, the code that allows one to win hasn't been done.
To paraphrase Oedipus, Hamlet, Lear, and all those guys, "I wish I had known this some time ago."
Signature Last Updated: 12/26/11
<hr>

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: Axe Tutorial
« Reply #2 on: March 17, 2011, 06:41:48 pm »
I reading this right now, but shouldn't this be in Axe Language subforum?

Possibly. I put it here, as it is not a complete tutorial yet, and is technically a project of mine. I also felt it would get noticed more here.

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: Axe Tutorial
« Reply #3 on: March 17, 2011, 06:47:06 pm »
I'm really looking foward to it.
*Yeong can't figure it out why Axe generate random stuff in memory that causes reset if attempt to delete it.
Sig wipe!

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: Axe Tutorial
« Reply #4 on: March 17, 2011, 06:50:10 pm »
Also, if anyone would like to assist in writing sections in their area of specialty, like AI or collision detect, or interrupts, I welcome it and you will be cited as the author of the section.

Offline yunhua98

  • You won't this read sentence right.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2718
  • Rating: +214/-12
  • Go take a dive in the River Lethe.
    • View Profile
Re: Axe Tutorial
« Reply #5 on: March 17, 2011, 06:54:18 pm »
I could write up a version of my tilemapper tutorial with out the example.  ;)

Spoiler For =====My Projects=====:
Minor setback due to code messing up.  On hold for Contest.
<hr>
On hold for Contest.


Spoiler For ===Staff Memberships===:






Have you seen any good news-worthy programs/events?  If so, PM me with an article to be included in the next issue of CGPN!
The Game is only a demo, the code that allows one to win hasn't been done.
To paraphrase Oedipus, Hamlet, Lear, and all those guys, "I wish I had known this some time ago."
Signature Last Updated: 12/26/11
<hr>

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: Axe Tutorial
« Reply #6 on: March 17, 2011, 06:55:56 pm »
I could write up a version of my tilemapper tutorial with out the example.  ;)

Excellent. Great. I can see that the sprites section will be large. I may even splinter it into Sprites and Tilemaps.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Axe Tutorial
« Reply #7 on: March 23, 2011, 03:14:15 pm »
Nice! Also I like how you have a CALCnet section. This will definitively be a must later, considering gCn now has USB and due to DCS and Axe popularity.

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Axe Tutorial
« Reply #8 on: March 23, 2011, 03:41:46 pm »
Wow this is much better than my one!
I'm not a nerd but I pretend:

Offline Binder News

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 785
  • Rating: +46/-3
  • Zombie of Tomorrow
    • View Profile
Re: Axe Tutorial
« Reply #9 on: March 23, 2011, 03:49:00 pm »
I would love to do a physics section.
* Binder News brings out his old physics engine and starts making it into a game
Spoiler For userbars:







Hacker-in-training!   Z80 Assembly Programmer     Axe Programmer
C++ H4X0R             Java Coder                           I <3 Python!

Perdidisti ludum     Cerebrum non habes

"We are humans first, no matter what."
"Fame is a vapor, popularity an accident, and riches take wings. Only one thing endures, and that is character."
Spoiler For Test Results: