TinyVM is a simple register based virtual machine implemented in C (tinyvm.c
). The bytecode assembler is written in Python (tas.py
). TinyVM has 4 registers ($0
- $3
) and 64k of memory in a 32-bit address space (0x00000000
- 0x0000FFFF
).
Each instruction is encoded in a single 64-bit word. Register count and memory are defined at compile time, but due to only having 32 bits available for addressing and 8 bits for registers, allocating more than 4GB of memory or 256 registers is pointless.
The following instructions (loosely based on MIPS) have been implemented:
No. | Keyword | Instruction | Example | Description
-------|---------|-------------------------------|--------------------|------------