Skip to content
Arno van der Vegt edited this page Oct 5, 2020 · 30 revisions

Commands

The virtual machine has 16 commands. Each command can have up to two parameters.

# Command Description
0 call Call a procedure
1 ret Return from a procedure
2 copy Copy from the source register to the destination register.
3 jmpc Jump conditional, based on the given flag value.
4 mod Call a module.
5 set Set a value.
6 add Add a value.
7 sub Subtract a value.
8 mul Multiply a value.
9 div Divide a value.
10 and Logic and a value.
11 or Logic or a value.
12 cmp Compare two values.
13 setf Set a flag.
14 sets Set a string.
15 adds Add a string.

Registers

Register Offset
stack 0
src 1
dest 2
ptr 3
code 4
return 5
flags 6
range1 7
range2 8

Flags

Flag Value
eq 1
neq 2
l 4
le 8
g 16
ge 32