pub enum Opcode {
Show 15 variants
HALT,
LOAD,
MOVE,
COPY,
CALCULATE,
COMPARE,
BITWISE,
JUMP,
JUMPC,
INTERRUPT,
CALL,
RETURN,
PUSH,
APPEND,
ILLEGAL,
}
Variants§
HALT
Stop all execution instantly.
LOAD
MOVE
Move a value from a register to a memory location or vice versa. The first argument is the source, the second is the destination. Swap the arguments to change the direction. The source will be cleared after the operation.
This opcode is followed by two 64-bit unsigned integers.
COPY
Copy a value from a register to a memory location or vice versa. The source will be left untouched.
This opcode is followed by two 64-bit unsigned integers.
CALCULATE
Perform a calculation (ADD
, SUBTRACT
, MULTIPLY
, DIVIDE
) on two registers
and write the result to a third.
This opcode is followed by three 16-bit unsigned integers.
COMPARE
Perform a comparison (EQ
, NEQ
, LT
, LTE
, GT
, GTE
) on two registers
and write the result to a third.
This opcode is followed by three 16-bit unsigned integers.
BITWISE
Perform a bitwise operation (AND
, OR
, XOR
, NOT
, LSH
, RSH
) on two or
three addresses.
JUMP
Set the program counter to a value from a location, using one of the
methods (absolute
, forward
, backward
)
JUMPC
Set the program counter to a value from a location if the byte at a given address in memory has the value of 1
INTERRUPT
Emit an event that needs immediate attention (READ
, PRINT
)
CALL
RETURN
PUSH
APPEND
ILLEGAL
An invalid opcode.