This is a specification of a very limited assembly language (almost machine code) for the first level of abstraction from brainfuck.
It does not provide several common operations (such as multiplier), and also lacks labels and macros.
Hence, every instruction should be written in the form:
<I> <A><N>
Where <I>
is the instruction letter, <A>
is the optional addressing mode symbol
and <N>
is a non-negative integer.
The addressing mode symbol can be:
<N>
@
-> Indicates that value is at<N>
memory address*
-> Indicates a pointer. It will fetch operand value from the address stored at<N>
Some instructions only accepts literal values, while others can work with values stored on memory and pointers. Here are the instructions in all available forms:
L <N>
-> Loads the value<N>
into registerL @<N>
-> Loads to register the value at<N>
memory addressL *<N>
-> Loads to register the value value pointed by<N>
S @<N>
-> Saves register value into<N>
memory addressS *<N>
-> Saves register value into memory address pointed by<N>
+ <N>
-> Adds<N>
to register+ @<N>
-> Adds value at<N>
memory address to register+ *<N>
-> Adds value pointed by<N>
to register- <N>
-> Subtracts<N>
from register (storing result in register)- @<N>
-> Subtracts value at<N>
memory address from register- *<N>
-> Subtracts value pointed by<N>
from registerJ <N>
-> Jumps to line number<N>
J @<N>
-> Jumps to line number in<N>
memory addressJ *<N>
-> Jumps to line number pointed by<N>
= <N>
-> Skips next line if register is equals to<N>
= @<N>
-> Skips next line if register is equals to value at<N>
memory address= *<N>
-> Skips next line if register is equals to value pointed by<N>
< <N>
-> Skips next line if register is less than<N>
< @<N>
-> Skips next line if register is less than value at<N>
memory address< *<N>
-> Skips next line if register is less than value pointed by<N>
> <N>
-> Skips next line if register is greater than<N>
> @<N>
-> Skips next line if register is greater than value at<N>
memory address> *<N>
-> Skips next line if register is greater than value pointed by<N>
R
-> Reads a char from stdin to registerW
-> Writes a char from register to stdout
Comments starts on the ;
character and ends at end of line. White spaces are free