An LC-3 virtual machine, implemented in Rust. Most features are implemented with a couple of exceptions, see Missing Features.
Running a program
cargo run -r --bin lc3-cli --all-features -- run examples/hello2.obj| Feature | Info |
|---|---|
| Virtual Machine | β |
| Assembler | π§ |
| Disassembler | soonβ’οΈ |
| C Compiler | soonβ’οΈ |
- Assembler is very basic at the moment, not ready yet.
-
Introduction To Computing Systems: From Bits & Gates To C/C++ & Beyond (3rd Edition)
-
https://www.jmeiners.com/lc3-vm/supplies/lc3-isa.pdf (pretty good source)
-
https://en.wikipedia.org/wiki/Little_Computer_3 (A little inaccurate, and missing key information)
| Instruction | Implemented |
|---|---|
| ADD | β |
| AND | β |
| BR | β |
| JMP | β |
| JSR | β |
| JSRR | β |
| LD | β |
| LDI | β |
| LDR | β |
| LEA | β |
| NOT | β |
| RET | β |
| RTI | β |
| ST | β |
| STI | β |
| STR | β |
| *TRAP | β |
| **reserved | β |
* not all standard TRAP vectors are implemented
** reserved causes an exception when used (which is handled by the OS, and the behavior can be changed by modifying the interrupt vector and/or its implementation)
| Feature | Status |
|---|---|
| Interrupts/Exceptions | β |
| *Memory Protection | β |
| Memory Device IO Callbacks for external bindings | β |
| Keyboard status and data register | β |
| Display status and data register | β |
- Memory protection relies on how the interrupt is handled. If the default OS is removed, strange behavior may occur if not handled correctly.
- Virtual Machine
putspTRAP vector- And maybe a few other things.
- Assembler
- Revamp error messages (completely terrible at the moment)
- Raw output format planned (currently outputs the same format as LC3Tools, without symbols or debug)
- Linking