Skip to content
Titan-06Public

About

VM and Assembler for the LC3 architecture

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

39 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

LC-3 Assembler and VM

An assembler and a virtual machine for the LC-3 (Little Computer 3), an educational 16-bit architecture. The assembler turns LC-3 assembly into machine code, and the VM runs that machine code. They do have some limitations so make sure to go over the READMEs properly before using them :)

What's inside

Assembler

  • Reads LC-3 assembly and produces an object file (.obj) that the VM can load.
  • Handles labels, directives and the standard LC-3 instruction set.

Virtual Machine

  • Emulates the LC-3: 16-bit words, 8 general-purpose registers, a program counter and condition flags.
  • Implements the full LC-3 instruction set (except RTI) and the standard trap routines (keyboard and console I/O, halt).
  • Trap routines are handled via built in C functions.

For build and usage instructions, look inside the Assembler/ and VM/ folders.

Tested on

OS Fedora Linux 44 (x86_64)
Compiler GCC 16.2.1 (GNU mode)
Language standard C23

I have only built and tested this on Linux. Other platforms or older compilers may need changes.

Tests

I've also added tests for both the assembler and the VM, in the Tests/ folder. They include some larger programs, such as 2048.

References

Credits

Tests/2048.asm is an implementation of 2048 for the LC-3 by Ryan Pendleton, taken from rpendleton/lc3-2048 and released under the MIT License. I did not write it; I use it as a large real-world test program for the assembler and VM. The original header, including the author and license notice, is kept at the top of the file. All credit for it goes to the original author.

About

VM and Assembler for the LC3 architecture

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages