Close

3.2) A2Z_Basic Language

A project log for A2Z Computer

A computer invented, designed and built from scratch. Custom CPU on FPGA.

f4hdkf4hdk 11/13/2016 at 18:150 Comments

A2Z Basic is a language invented by myself. I wanted something slightly different from existing languages, primarily for fun, but also to help the compiler. The syntax is closed to C, but much less rich.

Be careful : if you code in A2Z Basic, there are lots of constraints that exist just to make the job easier for the compiler. For example, each instruction must be in a new line, including closing accolades.

If you want to copy the result of a computation in a variable, you must use the instruction “assign” before the formula.

Finally, the compiler is not smart, and it is not able to prioritize math or logic operations inside a complex expression. You must put parenthesis everywhere, in order to split each elementary computation.

if ( ((Xm_pos//4) >= 128 ) & ((Ym_pos//4) >= 32 ) ) {

If you don’t respect these rules, there will probably be no error message from the compiler, but the executable code generated will not work.

You can integrate assembly code directly in the middle of A2Z Basic code. This is used to code low level functions, to access hardware directly (drivers).

The directive #appli_config sets the maximum allowed size for code and variables, and the position of the generated file inside RAM. The RAM portion dedicated to variables can be common (separation = 1) or separated (separation = 2) from the executable code. With option 2, you can use the full range 64kB for variables.

Functions:

There are 3 types of “functions”:

Limitations of the language and the compiler

Discussions