This is my implementation of a VM for the LC3. The VM will only run on Unix-like machines but the assembler should run on either. LC3 Virtual Machine and Assembler
To build, run
make
in the base directory.
To run the VM, run
./lc3.pls [path] [swap_endianness]
path
: relative or abolute path to input binary code using forward slashes.swap_endianness
: whether to swap byte order during loading of binary image. Acceptable values are TRUE or FALSE. Should typically be TRUE.
To run the Assembler, run
./assembler.pls [path] [swap_endianness]
path
: relative or abolute path to input LC3 assembly code file using forward slashes.swap_endianness
: whether to swap byte order during writing of binary image. Acceptable values are TRUE or FALSE. Should typically be TRUE.
The VM portion of the project could not have been made without the help of LC3 VMthis excellent site.
I made the assembler portion of this project by reading the project docs and reverse engineering pre-assembled binaries and comparing them to their assembly code. For the two projects I tested against, it produces byte identical binary. LC3 Assembler
As per the LC3 standard, SEMICOLON marks a comment. Comments can be on a line by themselves or after an instruction.
Tokens can be seperated by any combination of TAB, SPACE or COMMA.