Systems Programming • 2025

Diagram of Tiny Accumulator Machine: PC, ACC, RAM, and instruction format
Two-word instruction virtual machine: opcode + operand, with PC, ACC, RAM, and basic control flow.

Description

A minimal virtual machine written in C that executes a Tiny Accumulator Machine (TAM) instruction set. Each instruction is two words—an opcode and an operand. The VM maintains a program counter (PC), accumulator (ACC), and memory. It supports arithmetic and control-flow (e.g., LOAD, STORE, ADD, SUB, JMP, JZ) and halts on HALT. Programs are loaded from a simple text/binary format and executed step-by-step with clear state updates.

Demo

This demo shows the elf.txt input program and a captured run of the VM in console (with user inputs).

Example Input (elf.txt)

Loading elf.txt…

Open tinyvm.c on GitHub

Example Output

Loading run log…

View full run log

How to Run (Repo)

  1. Clone the repo and follow the README instructions.
  2. Build the VM with gcc and run a sample program.

View source & README on GitHub

Skills Used & Learned

  • C programming (pointers, structs, file I/O)
  • Virtual machine & ISA design (two-word instructions)
  • Execution state: PC, ACC, memory, halt conditions
  • Control flow & branching (JMP/JZ), arithmetic ops
  • Input parsing (program loader) and error handling
  • CLI UX & documentation (README, examples)
  • Version control & hosting (Git, GitHub Pages iframe demo)