To build:
1. Compile the vm and assembler with "make vm" and "make asm"
2. Assemble the test code with "make tests" if you wish.
To assemble:
./asm [path to asm] [path to output bin]
To disassemble:
./dis.sh [path to bin]
To run binary:
./vm [path to bin]
To add a new opcode:
1. Make a new constant in vm.h
2. Define a function for the opcode in vm.c
3. Add handling for the opcode in eval() of vm.c
4. Add handling for the opcode in mainloop of asm.c
5. Add handling for the opcode in encode() of asm.c
Some emacs notes:
For line numbering in hexadecimal starting at 0 (useful for writing assembly)
(setq linum-format '(lambda (num) (format "%2x" (- num 1))))
With color (http://www.emacswiki.org/emacs/ansi-color.el):
(require 'ansi-color)
(setq linum-format '(lambda (num) (ansi-color-apply (format "\e[1m\e[37m%2x\e[0m" (- num 1)))))