Little Computer

An implementation of the LC-3 VM, a 16-bit educational computer architecture from scratch in C.

Overview

The LC3 VM is a fully functional virtual machine implementing the LC-3 (Little Computer 3) architecture, a 16-bit educational computer. Written from scratch in C, this project simulates the LC-3 instruction set, allowing it to execute compiled LC-3 assembly programs.

This implementation follows the fetch-decode-execute cycle and includes:

  • Memory management to store instructions and data.
  • Instruction decoding & execution for all LC-3 opcodes.
  • Trap routines for basic I/O operations (e.g., reading/writing characters).

The project was built for low-level programming enthusiasts and provides a great opportunity to understand how virtual machines and CPU instruction sets work at the hardware level.

On the left is the server listening on port 8000, and on the right is the client connected to port 8000

Technologies Used

  • C
  • Socket Programming

How to Use

Installation

git clone git@github.com:usyntest/lc3-vm.git
cd lc3-vm
mkdir build && cd build
cmake ..
make

Running images on the VM, you can download any LC3 image and run it:

./lc3 ../images/2048.lc3