A simple RISC-based virtual machine written in Rust.
Any line can be prefixed with an identifier and used as a reference point in other instructions.
.byte
: Store an ASCII value as a byte of data
.byte 'A'
.word
: Store a signed integer as a word of data
.word 10
JMP
: Jump to a label
JMP label
JMR
: Jump to an address stored in a register
JMR reg_1
!0
: Jump to a label if the value stored in a register is not 0
!0 reg_1 label
>0
: Jump to a label if the value stored in a register is greater than 0
>0 reg_1 label
<0
: Jump to a label if the value stored in a register is greater than 0
<0 reg_1 label
=0
: Jump to a label if the value stored in a register is equal to 0
=0 reg_1 label
MOV
: Copy data from the second register into the first register
MOV reg_1 reg_2
LDA
: Load the address of a label into a register
LDA reg_1 label
STW
: Store a word of data at a label
STW reg_1 label
LDW
: Loads a word of data from a label into a register
LDW reg_1 label
STB
: Store a byte of data at a label
STB reg_1 label
LDB
: Load a byte of data from a label
LDB reg_1 label