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

John Dulaney 0deea75e87 Minor code cleanup 9 роки тому
src 0deea75e87 Minor code cleanup 9 роки тому
tests 2f6b4359a5 update to newest rev 9 роки тому
LICENSE 9789d76e4c Initial commit 9 роки тому
Makefile 2e9089537b Atomize memory operations 9 роки тому
README fa14ca55f0 Added bitshifting instructions 9 роки тому
dis.sh 4a4fae7110 dis.sh support some more opcodes 9 роки тому

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