This repository contains an implementation of the LC-3 (Little Computer 3) Virtual Machine, a 16-bit educational computer architecture. This project is inspired by this blog post and structured with guidance from this repository.
- Implements the LC-3 instruction set, including arithmetic, memory operations, and control flow.
- Supports TRAP routines for input and output operations.
- Uses a fetch-execute cycle to process LC-3 machine code.
- Implements computed GOTO for faster instruction dispatch.
- Supports loading and executing LC-3 object files.
Ensure you have a C compiler and CMake installed. If not, install them:
sudo apt update && sudo apt install build-essential cmakeClone the repository and build the project using CMake:
git clone git@github.com:usyntest/lc3-vm.git
cd lc3-vm
mkdir build && cd build
cmake ..
makeOnce built, you can run an LC-3 object file:
./lc3 ../images/2048.lc3lc3.c– Main entry point; implements the fetch-execute cycle.instruction-set.c– Implements the LC-3 instruction set.instruction-set.h– Header file for LC-3 instructions.core/– Contains utility functions for bit manipulation, input buffering, and reading object files.