Axe Parser v0.3.1


Command List Index

System
Screen and Buffer
Control Blocks
Labels and Subroutines
Basic Math
Advanced Math
Drawing
Text
Data and Storage
External Variables

System
Command Description
_ Spaces are ignored in most situations. They mainly just help for code organization and readability.
: The colon and enter key end a line of code.
. The period is a single line comment. Whatever follows will be ignored until the next newline. Must be the first character on the line.
DiagnosticOn Turns on the run indicator (marching ants). Program will display "done" after finishing.
DiagnosticOff Turns off the run indicator. Program will not display "done" after finishing.
Full Full speed mode is activated if supported, making it 3 times faster on newer calculators. Returns 0 if not supported.
Normal Full speed mode is deactivated.
Pause EXP Pause for the given amount of time in milliseconds.
getKey Returns the last key pressed or zero if no keys are pressed. Its just like the BASIC getkey, but with different codes.
getKey(KEY) Returns 1 if the key is held down this instant and 0 otherwise. The key code must be a single constant.
getKey(0) Returns a non-zero number if any key is held down and 0 otherwise.
Freq(WAVE,TIME)
Key: SinReg
Sound is played out of the link port. Wave must be between 1-255 inversely proportional to frequency. Time is in the order of microseconds.
Asm(HEX) Native assembly code written in hexadecimal is inserted at the current position.
FnOn Turns on interrupts.
FnOff Turns off interrupts.
Stop Stops execution until the next interrupt occurs. Interrupts must be enabled or else the calculator will freeze.

Screen and Buffer
Command Description
ClrHome Erases the screen and text shadow and moves the cursor to the upper left corner.
ClrDraw Erases the buffer.
ClrDrawr Erases the back buffer.
DispGraph Draws the buffer on the screen.
DispGraphr Draws the 2 buffers on the screen to create 3 color grayscale. Will not work in full speed mode.
DispGraphrr Draws the 2 buffers on the screen to create 4 color grayscale. Will not work in full speed mode.
EXP→DispGraph Draws the 768 bytes of an arbitrary buffer at the pointed location onto the screen.
StoreGDB Copies the screen to the buffer.
StorePic Copies the buffer to the back-buffer.
RecallPic Copies the back-buffer to the buffer.
DrawInv The colors on the buffer are inverted.
DrawInv r The colors on the back buffer are inverted.
Horizontal +
Horizontal -
The buffer is shifted right (+) or left (-) by 1 pixel. White pixels are shifted in.
Vertical +
Vertical -
The buffer is shifted down (+) or up (-) by 1 pixel. New pixels are not shifted in, that row remains the same.
Shade(EXP) Sets the contrast. 0 is lightest, 63 is darkest.

Control Blocks
Command Description
If EXP
 code1
End
If the expression is true, code1 will be executed.
If EXP
 code1
Else
 code2
End
If the expression is true, then only code1 is executed. Otherwise, only code 2 is executed.
!If EXP
 code1
End
If the expression is false, code1 will be executed.
!If EXP
 code1
Else
 code2
End
If the expression is false, then only code1 is executed. Otherwise, only code 2 is executed.
While EXP
 code1
End
The expression is checked first. If its true, code1 will be executed over and over until its false.
Repeat EXP
 code1
End
The expression is checked first. If its false, code1 will be executed over and over until its true.
For(VAR,EXP1,EXP2)
 code1
End
The variable is initialized with expression1. Until the variable is greater than expression2, code1 is executed and the variable is incremented by 1.
DS<(VAR,MAX)
 code1
End
The variable is decreased by 1. If its 0, code1 is executed and the variable resets back to Max. If its not 0 yet, code1 is skipped.

Labels and Subroutines
Command Description
Lbl LBL Creates a label at the current position.
Goto LBL Jumps to the label.
DelVar LBL Frees the label name from memory. The name can then be reused somewhere later in the code.
Sub(LBL) Calls the subroutine. All subroutines should end with a Return.
Sub(LBL,...) Loads up to 6 arguments to the r1 through r6 variables respectively. Then the subroutine is called.
Return Returns from a subroutine. If not in a subroutine, the program will end.
ReturnIf EXP Returns only if the expression is true.
Return!If EXP Returns only if the expression is false.

Basic Math
Command Description
VAR Returns the variable. Uppercase A through Z are variables.
EXPVAR Stores the expression into the variable.
'CHAR' Converts an ASCII constant into an integer.
-EXP Returns the negative of the expression. That's a negative sign, not a minus sign!
EXP1+EXP2
EXP1-EXP2
Expression2 is added to or subtracted from expression1.
EXP1*EXP2
EXP1/EXP2
EXP1^EXP2
Expression1 is multiplied, divided, or the modulus of expression2.
EXP2 The expression is multiplied by itself.
EXP1=EXP2
EXP1EXP2
EXP1<EXP2
EXP1EXP2
EXP1>EXP2
EXP1EXP2
Returns 1 if the statement is true or 0 if its false. This is an unsigned comparison.
EXP1 or EXP2
EXP1 and EXP2
EXP1 xor EXP2
Returns the logical result of the truths. You often need parenthesis on the second argument when used.
abs(EXP) Returns the absolute value of the expression.
√(EXP) Returns the square root of the expression.
sin(EXP) Returns the sine of the expression. One Period is [0,256] and the value returned ranges from -127 to 127.
cos(EXP) Returns the cosine of the expression. One Period is [0,256] and the value returned ranges from -127 to 127.
e^(EXP1) Returns 2 to the power of the expression (modular).
ln(EXP1) Returns the log base 2 of the expression, or 255 if undefined.
min(EXP1,EXP2) Returns the minimum of the 2 expressions.
max(EXP1,EXP2) Returns the maximum of the 2 expressions.
rand Returns a random 16 bit number.

Advanced Math
Command Description
EHEX Converts a hexadecimal number into an integer. That E is the scientific notation E.
bBIN Converts a binary number into an integer.
EXP1<<EXP2
EXP1≤≤EXP2
EXP1>>EXP2
EXP1≥≥EXP2
Signed comparisons for numbers that aren't always positive. Returns 1 if the statement is true or 0 if its false.
EXP1//EXP2 Performs a division, but it works for negative numbers too.
EXP1·EXP2
EXP1+EXP2
EXP1EXP2
Returns respectively the bitwise "and", "or", and "xor" of the two expressions. These are the plot style tokens.

Drawing
Command Description
Pxl-On(X,Y) A pixel becomes black on the buffer at (X,Y).
Pxl-Off(X,Y) A pixel becomes white on the buffer at (X,Y).
Pxl-Change(X,Y) A pixel will change color on the buffer at (X,Y).
pxl-Test(X,Y) Returns 1 if pixel is black and 0 if pixel is white on the buffer at (X,Y).
Pxl-On(X,Y)r A pixel becomes black on the back buffer at (X,Y).
Pxl-Off(X,Y)r A pixel becomes white on the back buffer at (X,Y).
Pxl-Change(X,Y)r A pixel will change color on the back buffer at (X,Y).
pxl-Test(X,Y)r Returns 1 if pixel is black and 0 if pixel is white on the back buffer at (X,Y).
Pt-On(X,Y,PIC) The 8x8 sprite that is pointed to is drawn to the buffer at (X,Y). Does not clear the area behind it.
Pt-Off(X,Y,PIC) The 8x8 sprite that is pointed to is drawn to the buffer at (X,Y) but clears the area behind it first.
Pt-Change(X,Y,PIC) The 8x8 sprite that is pointed to inverts its pixels on the buffer at (X,Y).
Pt-On(X,Y,PIC)r The 8x8 sprite that is pointed to is drawn to the back buffer at (X,Y). Does not clear the area behind it.
Pt-Off(X,Y,PIC)r The 8x8 sprite that is pointed to is drawn to the back buffer at (X,Y) but clears the area behind it first.
Pt-Change(X,Y,PIC)r The 8x8 sprite that is pointed to inverts its pixels on the back buffer at (X,Y).
Bitmap(X,Y,BITMAP)
Key: Tangent()
Draws a bitmap to the screen or buffer at (X,Y). The structure pointed to should be height (1 byte), then width (1 byte), then the rows of the image padded to the nearest byte.
Line(X1,Y1,X2,Y2) Draws a black line from point (X1,Y1) to (X2,Y2) on the buffer.

Text
Command Description
Disp EXP The string that is pointed to is displayed at the cursor position. The cursor moves with the string. If it reaches the end of the screen, it will loop around to the next line.
Disp EXP▶Dec The expression is displayed as a decimal at the cursor position. The cursor is then advanced 5 spaces.
Disp EXP▶Char
Key: ▶Frac
The ASCII character of the expression is displayed at the cursor position. The cursor is advanced 1 space. A new line is added if it hits the edge.
Disp "" The string is displayed at the cursor position.
Disp i The cursor moves to the next line down. This is the imaginary, not lowercase 'i'.
Output(X) The cursor moves to the cursor position (X/256,X%256).
Output(X,Y) The cursor moves to the cursor position (X,Y).
Output(X,Y, The cursor moves to the cursor position (X,Y) and whatever follows is displayed at that position.
Text(X,Y,EXP) The text pointed to is drawn at (X,Y). See "Fix" command for drawing details.
Text(X,Y,EXP▶Dec) The expression is drawn as a decimal at (X,Y). See "Fix" command for drawing details.
Text(X,Y,EXP▶Char)
Key: ▶Frac
The ASCII character of the expression is drawn at (X,Y). See "Fix" command for drawing details.
Fix 0Small size font. Calculator should exit in this mode if changed!
Fix 1Large size font.
Fix 2Normal colored font. Calculator should exit in this mode if changed!
Fix 3Inverted font.
Fix 4Text is drawn directly to the screen. Calculator should exit in this mode if changed!
Fix 5Text is drawn to the buffer.
Fix 6Automatic scrolling on last line of display. Calculator should exit in this mode if changed!
Fix 7No scrolling on last line of display
Fix 8Bitmaps are drawn directly to the screen. Calculator should exit in this mode if changed!
Fix 9Bitmaps are drawn to the buffer.

Data and Storage
Command Description
"" Adds the string to program memory, but without the ending character.
[HEX] Adds the hex to the program memory.
[PICVAR] Absorbs the 96x63 picture from RAM into the program (756 bytes). Only the source needs the pic, not the executable.
[PICVARr] Absorbs the tile map picture from RAM into the program. 12 tiles across, 7 tiles down (672 bytes). Only the source needs the pic, not the executable.
Data(NUM,...)
Key: ΔList()
Adds the bytes to program memory. Numbers ending with r are added as 2 byte numbers.
Zeros(SIZE)
Key: det()
Adds Size bytes of zeros to program memory.
DATANAME Saves the data's pointer to a static variable. Also terminates current string if applicable.
NAME Returns a pointer to the start of the data.
L1
L2
L3
L4
L5
L6
Returns a pointer to some free memory.
L1 = 712 bytes (saveSScreen+56) Volatility: LOW
L2 = 531 bytes (statVars) Volatility: LOW (Do not use this area in Mirage OS programs)
L3 = 768 bytes (appBackUpScreen) Volatility: MED (Saving to back-buffer will corrupt)
L4 = 323 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)
{EXP}r Returns the 2 byte data the expression points to.
{EXP} Returns the single byte the expression points to. It will be in the range 0 to 255.
sign{EXP}
Key: int()
Returns the single byte the expression points to. It will be in the range -128 to 127.
EXP1→{EXP2}r The full 2 bytes of Expression1 is stored to where Expression2 points.
EXP1→{EXP2} The single byte of Expression1 is stored to where Expression2 points.
Fill(PTR1,SIZE) The byte already at Ptr1 is copied to all the bytes after it until Size bytes have been filled with that value. Zero is not a valid Size.
Copy(PTR1,PTR2,SIZE)
Key: conj()
Size bytes starting from Ptr1 are copied to Ptr2 onwards. Zero is not a valid Size.
Copy(PTR1,PTR2,SIZE)r
Key: conj()
Size bytes ending at Ptr1 are copied to Ptr2 moving backwards. Zero is not a valid Size.
Exch(PTR1,PTR2,SIZE)
Key: expr()
Size bytes starting from Ptr1 are exchanged with Size bytes starting at Ptr2. Zero is not a valid Size.
SortD(PTR,SIZE) Sorts up to 256 bytes of data from largest to smallest starting at the pointed address.

External Variables
Command Description
Ans The expression becomes the "Ans" variable as an integer. Throws an error if out of range.
EXP→Ans The expression stores into the "Ans" variable as an integer.
GetCalc(PTR) Finds the object who's name is pointed to and returns a pointer to the start of its data, or zero if it was archived or not found.
GetCalc(PTR,SIZE) Creates an application variable in RAM, with the name pointed to, and makes it Size bytes. Returns a pointer to the start of data, or zero if there was not enough RAM. Overwrites existing appvar, even if it was in archive.
UnArchive PTR Tries to unarchive the object who's name is pointed to. Returns 1 if it could unarchive and 0 otherwise. Gives a memory error if not enough RAM.
Archive PTR Tries to archive the object who's name is pointed to. Returns 1 if it could archive and 0 otherwise. Gives a memory error if not enough Flash Memory.
New In This Version
Changed From Last Version
Existing Command



Documentation for Axe Parser
Copyright (c) 2010 Kevin Horowitz