Neo is a stack-based virtual machine; it has two stacks, the working stack, and the return stack, each 512 bytes in length.
Neo's comment syntax is ()
(this is a comment)
Integers are values placed directly into the resulting ROM.
Integers are specified with hexadecimal numbers, which must be 2, 4, 6, or 8 digits in length.
ff aa 0a
Strings are pieces of text started with ' and delimited by whitespace.
'catdog
'Hello 20 'there 0a
Labels are non-digit, non-opcode, and non-runic symbols used to mark parts.
The address of a label may be accessed with ;.
This becomes a LIT4 followed by the label's address.
@cat
;cat
The structuce of instructions in ROM are as follows:
0 00 00000
| | |
| | +------ opcode
| +--------- operand size
+----------- return mode
Most instructions are able to modified with r, 4, 3, and 2.
r causes instructions to read and write from and to the return stack instead of the data stack.
4, 3, 2 changes the amount of bytes read from certain operands; without one of these modeifers, a single byte is read.
( - N)
Pushes the bytes following it onto the stack.
LIT 30
A shortcut for non-r LIT is #.
#10 #20
#4030
(device8 port8 - N)
(N device8 port8 - )
(N - )
( - )
(N - N N)
(N N' - N' N)
(N N' N" - N' N" N)
(N - )
(N - |N)
( - addr4)
(addr4 - N)
(N addr4 - )
(N src4 dst4 - )
(addr4 - )
(N addr4 - )
(N addr4 - )
(N N' - byte)
(N N' - byte)
(N 'N - byte)
(N 'N - byte)
(N 'N - N + 'N)
(N 'N - N - 'N)
(N 'N - N * 'N)
(N 'N - N / 'N)
(N 'N - N & 'N)
(N 'N - N | 'N)
(N 'N - N ^ 'N)
(N - ~N)
Devices are how Neo interfaces with the enviroment; each device has ports,
which each act as functions for interfacing with the part of the enviroment that device manages.
There are 256 available device slots, each with 256 available ports.
The DEI and DEO instructions are used to read and write from and to device ports.
If a port that is only meant for writing is read from, it will return 0;
likewise, if a port that is only meant for reading is written to, this does nothing.
Accepts: reading
This port acts as stdin.
Only one byte is ever read;
any extras will be consumed, but otherwise ignored.
Accepts: writing
This port acts as stdout.
Accepts: writing
This port acts as stderr.