Piston is a higher level language to be compiled into fabrication code. The language will facilitate the creation of software for the DUO Compact.
There are 3 data types in Piston.
Number and pointer variables are declared by placing a type letter (N or P) and a variable name separated by a space. Example:
A bar variable declaration must specify the size of the bar. Place a close curly brace (}) between the data type B and the variable name:
Store a value in a variable by placing the |<< operator between the variable name and the value. Example:
A bar variable will be constant if the letter C is included before the variable's declaration. Bar literals are represented by comma separated values enclosed by a forward slash and an underscore. Alternatively, write a string of ASCII characters in quotation marks. Example:
Note that bar literals can only be directly stored in constant bar variables.
To retrieve the length of any bar, place its variable name between question marks. Example:
To call a function, place the function name and a bar literal separated by a space. The bar contains the argument values to pass into the function. Example:
Function calls may not be embedded.
Code blocks are enclosed by brackets. Example:
Functions are declared with the following syntax:
The declaration outside of the bar literal defines the function return type and name. Use V for a void return value. The declarations inside of the bar literal define the argument types and names. To set the return value in the code block, use |<< with the function name. Example:
Neither overloading nor recursive calls are permitted.
Note that a bar cannot be passed from scope to scope. Use the reference function to obtain a pointer to an existing bar.
Label names are placed between asterisks. A label may be used as the argument for the jump function. Example:
Labels may also be used as an operand of |<<, but not as an argument for any other functions. This may be fixed in the future.
Use a triple at sign (@@@) to include comments in code. Example:
The wiring of your screen data bus to the I/O port may have an unusual order. To accommodate this, place screen# before any screen data bus constant. Example:
The particular connections of my own machine are shown in the diagram below:
I recommend that you also use this connection scheme. If you do not follow this convention, you will need to tweak the Piston compiler. Search for the variable named customScreenDataBitOrder in the source code.
By default, all quoted strings have the byte screen#3 appended to the end. To include this halting byte in other positions, use the tilde character (~).
There are several directives you may pass to the fabricator. These include:
To declare the start of a new program, use the METASCOPE keyword:
A metascope separates the variable names between programs and resets the relative address of labels. Note that the first metascope is visible globally so it may offer functions to all other programs.
= DEFAULT PISTON FUNCTIONS =Arithmetic operations:
Bitwise logical operations:
Flow control:
Pointer operations:
Memory operations: