A virtual machine in C utilizing 48-bit machine words.

Joshua Drake f3f745ef91 Moved state into core struct 9 years ago
src f3f745ef91 Moved state into core struct 9 years ago
tests 2f6b4359a5 update to newest rev 9 years ago
LICENSE 9789d76e4c Initial commit 9 years ago
Makefile 2e9089537b Atomize memory operations 9 years ago
README fa14ca55f0 Added bitshifting instructions 9 years ago
TODO 0207ff1106 Thoughts on interupts 9 years ago
dis.sh 5ec8fc7b85 dis.sh use new src dir 9 years ago

README

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)))))