A collection of stupid little virtual machines.
C Python Assembly
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Greg's Virtual Machine Collection

A collection of stupid little virtual machines for the purpose of learning how to do interpretation and optimiztion.

Lab 1 VM - Virtual Machine Example for 0618.303

This is an example virtual machine for Lab 1 of 0618.303 (Microcomputers).

It is a very basic introduction to processing opcodes and simple optimization using GCC.


  • Four 4-bit registers
  • 4 operations, no Program Counter
  • Pretty useless


  • MOV Rsrc, Rdest - Copy value from src register to dest register
    • MOV R1, R3 - Copy value from R1 to R3
  • ST Rsrc - 'Store to memory' (in this case print to stdio)
    • ST R3 - Print R3 to stdio
  • LI #val, Rdest - Load the immediate value into dest register
    • LI #3, R1 - Load the number 3 into R1
  • DIS #val - Print the immediate value
    • DIS #5 - Print the number 5 to stdio

MU0 VM - Virtual Machine for MU0

MU0 is a simple academic microcomputer that is sometimes used to present the basics of a microcomputer to students. This is a little VM for it.

Link to lecture notes


  • Von Numan based architecture
  • no general purpose registers
  • accumulator based
  • load/store based

Assembling the example

xxd -r examples/first.hex > examples/first.bit
xxd -r examples/first-heap.hex > examples/first-heap.bit

Running the example

./mu0 examples/first.bit examples/first-heap.bit

Cool resources

Labels as values