Axe Parser v0.4.3


Index des Listes de Commandes

Système
Ecran et Tampon
Blocs de contrôle
Labels et Fonctions
Maths Basiques
Maths Avancées
Dessin
Sprites
Texte
Données et Stockage
Variables Externes
Interrupteurs
Port I/O


Système

Commande

Description

_

Les espaces sont ignorés dans la plupart des situations. Ils sont là en général pour aider à l'organisation du code et à faciliter sa lecture.

:

Les deux points et la touche enter terminent une ligne de code.

.

Le point est un commentaire d'une ligne. Tout ce qui suit est ignoré jusqu'au prochain saut de ligne. Ce doit être le premier caractère sur la ligne.

DiagnosticOn

Active l'indicateur d'exécution (les pixels défilants en haut à droite). Le programme affichera « done » après s'être terminé.

DiagnosticOff

Désactive l'indicateur d'exécution. Le programme n'affichera pas « done » après s'être terminé.

Full

Le mode vitesse maximale est activé, le rendant 3 fois plus rapide sur les nouvelles calculatrices. Renvoi 0 si non supporté.

Normal

Le mode vitesse maximale est désactivé.

Pause EXP

Pause pour un temps donné. Une pause d'une seconde a une valeur d'environ 1900 à vitesse normal ou 4700 en mode vitesse maximale.

getKey

Renvoi la dernière touche appuyée ou zéro si aucune touche n'est appuyée. C'est comme les getkey en BASIC, mais avec des codes de touches différents.

getKey(KEY)

Renvoi 1 si la touche est appuyée en cet instant et 0 dans le cas contraire. Le code de touche doit être une seule constante. Ne fonctionnera pas aussi bien en mode Vitesse Maximale.

getKey(0)

Renvoi un nombre non nul si une touche quelconque est appuyée et 0 dans le cas contraire.

Asm(HEX)

Du code natif assembleur écrit en hexadécimal est inséré à la position actuelle.

Axiom(NAME)

Key: AsmComp()

La bibliothèque assembleur Axiom devient utilisable dans le programme. Les guillemets ne sont pas nécessaire, tapez juste le nom de l'appvar sensible à la casse.

prgmNAME

Le code provenant du programme externe est parsé comme s'il remplaçait cette commande dans le programme prinicpal. (Similaire à l'« include » du C++)


Ecran et Tampon

Commande

Description

ClrHome

Efface l'écran et l'ombre de texte et bouge le curseur dans le coin supérieur gauche.

ClrDraw

Efface le tampon.

ClrDrawr

Efface le tampon secondaire.

DispGraph

Dessine le tampon sur l'écran.

DispGraphr

Dessine les 2 tampons sur l'écran pour créer du 3 niveaux de gris. Ne fonctionnera pas en mode vitesse maximale.

DispGraphrr

Dessine les 2 tampons sur l'écran pour créer du 4 niveaux de gris. Ne fonctionnera pas en mode vitesse maximale. Ne peut pas être utilisé avec une fonction d'interrupteur personnalisé.

EXP→DispGraph

Dessine les 768 octets d'un tampon arbitraire à la position indiquée sur l'écran.

StoreGDB

Copie l'écran sur le tampon.

StorePic

Copie le tampon sur le tampon secondaire.

RecallPic

Copie le tampon secondaire sur le tampon.

DrawInv

Les couleurs sur le tampon sont inversées.

DrawInv r

Les couleurs sur le tampon secondaire sont inversées.

Horizontal +
Horizontal -

Le tampon est décalé à droite (+) ou à gauche (-) d'un pixel. Des pixels blancs sont insérés.

Vertical +
Vertical -

Le tampon est décalé en bas (+) ou en haut (-) d'un pixel. Aucun nouveau pixel n'est inséré, cette ligne reste la même.

Horizontal +r
Horizontal -r

Le tampon secondaire est décalé à droite (+) ou à gauche (-) d'un pixel. Des pixels blancs sont insérés.

Vertical +r
Vertical -r

Le tampon secondaire est décalé en bas (+) ou en haut (-) d'un pixel. Aucun nouveau pixel n'est inséré, cette ligne reste la même.

Shade(EXP)

Ajuste le contraste. 0 est le plus clair, 63 est le plus sombre.


Blocs de Contrôle

Commande

Description

If EXP
 code1
End

Si l'expression est vraie, code1 sera exécuté.

If EXP
 code1
Else
 code2
End

Si l'expression est vraie, seul code1 est exécuté. Sinon, seul code2 est exécuté.

!If EXP
 code1
End

Si l'expression est fausse, code1 sera exécuté.

!If EXP
 code1
Else
 code2
End

Si l'expression est fausse, alors seul code1 est exécuté. Sinon, seul code2 est exécuté.

While EXP
 code1
End

L'expression est d'abord évaluée. Si elle est vraie, code1 sera exécuté en boucle jusqu'à ce qu'elle soit fausse.

Repeat EXP
 code1
End

L'expression est d'abord évaluée. Si elle est fausse, code1 sera exécuté en boucle jusqu'à ce qu'elle soit vraie.

For(VAR,EXP1,EXP2)
 code1
End

La variable est initialisée avec expression1. Jusqu'à ce que cette variable soit supérieure à expression2, code1 est exécuté et la variable est incrémentée de 1.

DS<(VAR,MAX)
 code1
End

La variable est décrémentée de 1. Si c'est 0, code1 sera exécuté et la variable est réinitialisée à Max. Si ce n'est pas encore 0, code1 est sauté.


Labels et Fonctions

Commande

Description

Lbl LBL

Crées un label à la position actuelle.

Goto LBL

Saute jusqu'au label.

Sub(LBL)

Appelle la fonction. Toutes les fonctions doivent finir par un Return.

Sub(LBL,...)

Charge jusqu'à 6 arguments des variables r1 à r6 respectivement. La fonction est appelée après.

Return

Revient d'un fonction. Si ce n'est pas dans une fonction, le programme s'arrêtera.

ReturnIf EXP

Revient uniquement si l'expression est vraie.

Return!If EXP

Revient uniquement si l'expression est fausse.


Maths Basiques

Commande

Description

VAR

Renvoi la variable. Les majuscules de A à Z sont des variables.

EXPVAR

Stocke l'expression dans la variable.

'CHAR'

Convertit une constante ASCII en un entier.

-EXP

Renvoi l'opposé de l'expression. C'est le signe négatif, pas le signe moins!

EXP1+EXP2
EXP1-EXP2

Expression2 est additionnée ou soustraite de expression1.

EXP1*EXP2
EXP1/EXP2
EXP1^EXP2

Expression1 est multipliée, divisée, ou le modulo de expression2.

EXP2

L'expression est multipliée par elle-même.

EXP1=EXP2
EXP1EXP2
EXP1<EXP2
EXP1EXP2
EXP1>EXP2
EXP1EXP2

Renvoi 1 si l'(in)égalité est vraie ou 0 si elle est fausse. C'est une comparaison non signée.

EXP1 or EXP2
EXP1 and EXP2
EXP1 xor EXP2

Renvoi l'opération logique sur les 8 bits inférieurs des expressions. Une parenthèse doit parfois être utilisée sur le second argument lorsqu'il est utilisé.

abs(EXP)

Renvoi la valeur absolue de l'expression.

(EXP)

Renvoi la racine carrée de l'expression.

sin(EXP)

Renvoi le sinus de l'expression. Une Période est de [0,256] et la valeur renvoyée varie de -127 à 127.

cos(EXP)

Renvoi le cosinus de l'expression. Une Période est de [0,256] et la valeur renvoyée varie de -127 à 127.

e^(EXP1)

Renvoi 2 à la puissance de l'expression (modulaire).

ln(EXP1)

Renvoi le log base 2 de l'expression, ou 255 si non défini.

min(EXP1,EXP2)

Renvoi le minimum de 2 expressions.

max(EXP1,EXP2)

Renvoi le maximum de 2 expressions.

rand

Renvoi un nombre à 16 bits aléatoire.


Advanced Math

Command

Description

EHEX

Converts a hexadecimal number into an integer. That prefix is the scientific notation "E".

bBIN

Converts a binary number into an integer. That prefix is the lowercase "b".

TTOKEN

Converts the 1 or 2 byte token into an integer. That prefix is the transpose symbol "T".

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

The signed multiplication is performed using the high byte as the integer part and the low byte as the decimal part returning a number in the same format.

EXP1*^EXP2

Computes the high order 16 bits of an unsigned multiplication.

EXP1//EXP2

Performs a division, but it works for negative numbers too.

EXP1·EXP2
EXP1+EXP2
EXP1EXP2

Returns respectively the full 16 bit "and", "or", and "xor" of the two expressions. These are the plot style tokens.

EXP1eEXP2

Gets the expression2-th bit of the 8-bit number in expression1. Unlike assembly, the leftmost bit (high order) is bit 0 and the rightmost bit (low order) is bit 7. The bit checking is modular. That's the Euler's constant "e".

EXP1eeEXP2

Gets the expression2-th bit of the 16-bit number in expression1. Unlike assembly, the leftmost bit (high order) is bit 0 and the rightmost bit (low order) is bit 15. The bit checking is modular. That's the Euler's constant "e".


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).

Line(X1,Y1,X2,Y2)

Draws a black line from point (X1,Y1) to (X2,Y2) on the buffer.

Rect(X,Y,W,H)

Key: ref()

Draws a filled rectangle with its upper left corner at (X,Y), a width of W, and a height H on the buffer.

RectI(X,Y,W,H)

Key: rref()

Inverts a filled rectangle with its upper left corner at (X,Y), a width of W, and a height H on the buffer.

Rect(X,Y,W,H)r

Key: ref()

Draws a filled rectangle with its upper left corner at (X,Y), a width of W, and a height H on the back buffer.

RectI(X,Y,W,H)r

Key: rref()

Inverts a filled rectangle with its upper left corner at (X,Y), a width of W, and a height H on the back buffer.

Circle(X,Y,R)

Draws a circle with center (X,Y) and radius R on the buffer.


Drawing

Command

Description

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).

Pt-Mask(X,Y,PIC)

Key: Plot1()

The 8x8 grayscale sprite (2 layers) that is pointed to is drawn to both buffers at (X,Y). Areas clear on both layers are transparent and the other combinations are 3-level grayscale. Can also be used for monochrome masking, but the back buffer still gets written to.

Pt-Command()BUFF

Performs any of the Pt-On(), Pt-Off(), or Pt-change() routines to an arbitrary buffer of your choice.

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.

rotC(PIC)

Key: ShadeNorm()

A copy of the 8x8 sprite pointed to is rotated clockwise 90 degrees. Returns a pointer to that new rotated sprite. Cannot be used recursively.

rotCC(PIC)

Key: Shade_t()

A copy of the 8x8 sprite pointed to is rotated counter-clockwise 90 degrees. Returns a pointer to that new rotated sprite. Cannot be used recursively.

flipV(PIC)

Key: ShadeX2()

A copy of the 8x8 sprite pointed to is flipped vertically. Returns a pointer to that new flipped sprite. Cannot be used recursively.

flipH(PIC)

Key: ShadeF()

A copy of the 8x8 sprite pointed to is flipped horizontally. Returns a pointer to that new flipped sprite.


Text

Command

Description

Disp PTR

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 number is displayed as a decimal at the cursor position. The cursor is then advanced 5 spaces.

Disp EXP▶Char

Key: ▶Frac

The ASCII character is displayed at the cursor position. The cursor is advanced 1 space. A new line is added if it hits the edge.

Disp EXP▶Tok

Key: ▶DMS

The 1 or 2 byte token is displayed at the cursor position. The cursor is advanced. A new line is added if it hits the edge.

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 EXP

The text pointed to is drawn at the current pen location. See "Fix" command for drawing details.

Text EXP▶Dec

The number is drawn as a decimal at the current pen location. See "Fix" command for drawing details.

Text EXP▶Char

Key: ▶Frac

The ASCII character is drawn at the current pen location. See "Fix" command for drawing details.

Text PTR▶Tok

Key: ▶DMS

The 1 or 2 byte token POINTED TO is drawn at the current pen location. Notice how this is different than Disp. See "Fix" command for drawing details.

Text(X)

The text pen moves to the position (X%256,X/256).

Text(X,Y)

The text pen moves to the position (X,Y).

Text(X,Y,...)

The text pen moves to the position (X,Y). Whatever comes next becomes the "Text" command.

Fix 0

Small size font. Calculator should exit in this mode if changed!

Fix 1

Large size font.

Fix 2

Normal colored font. Calculator should exit in this mode if changed!

Fix 3

Inverted font.

Fix 4

Text is drawn directly to the screen. Calculator should exit in this mode if changed!

Fix 5

Text is drawn to the buffer.

Fix 6

Automatic scrolling on last line of display. Calculator should exit in this mode if changed!

Fix 7

No scrolling on last line of display

Fix 8

Bitmaps are drawn directly to the screen. Calculator should exit in this mode if changed!

Fix 9

Bitmaps 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 picture from RAM into the program (usually 96x63 and 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 when custom interrupts are enabled, including Mirage OS)
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}

Returns the single byte the expression points to. It will be in the range 0 to 255.

{EXP}r

Returns the 2 byte data the expression points to.

{EXP}rr

Returns the 2 byte data the expression points to but in reverse order.

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.

length(PTR)

Returns the number of bytes from the pointer to the next zero data element.

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,FILE)

Attempts to create a file of the OS variable who's name is pointed to so it can be read from archive. Returns 0 if the variable was not found or unarchived, and non-zero otherwise.

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.

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.

DelVar PTR

Deletes the OS variable who's name is pointed to even if in archive. Nothing happens if the variable does not exist.


Interrupts

Command

Description

FnInt(LBL,FREQ)

Turns the subroutine into an interrupt and then turns interrupts on. The frequency can be (fastest) 0, 2, 4, or 6 (slowest). L2 is used for interrupt data so do not use L2 for storage when using interrupts.

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.

LnReg

Returns the calculator to regular interrupt mode. MUST be called before exiting the program if using interrupts.


Link Port

Command

Description

Port

Key: ClrTable

Returns the status of the link port as a number 0-3.

EXP→Port

Key: ClrTable

Sets the link port to a given status with a number 0-3. Must exit program with status 0 if changed!

Freq(WAVE,TIME)

Key: SinReg

Sound is played out of the link port. Wave is inversely proportional to frequency and Time must be greater than Wave to hear anything.

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 sucessfully or 0 if it timed-out. Time is in the order of microseconds.

Get

Checks 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.

New In This Version

Changed From Last Version

Existing Command




Documentation for Axe Parser
Copyright (c) 2010 Kevin Horowitz