-
Notifications
You must be signed in to change notification settings - Fork 0
compiler
Ccode-lang edited this page Feb 16, 2022
·
4 revisions
The compiler is an easier way to write code for the vm. It also allows you to write hex numbers/ascii in decimal.
python3 chexcomp.py <file to compile>
This command prints one character from the given address.
Example:
; print ascii stored at address 0x00
pr 0
Jump to address given
Example:
; jump to offset 2 (program start)
jmp 2
Stores a byte at the given address
Example:
; store an ascii value of h at address 0
str 0 104
Jumps to program offset stored in memory.
Example:
; store location of program start in memory
str 0 2
; jmp to it
jmpmem 0
Compares two values stored in memory and jumps to offset given if they are equal.
Example:
; store one and two in memory
str 0 1
str 1 1
; see if they are equal and jump to program start if they are equal (so this program is basically just an over complicated forever loop)
jmpeq 0 1 2