[][src]Crate lc3_vm

A VM is a program that acts like a computer. It simulates a CPU along with a few other hardware components, allowing it to perform arithmetic, read and write to memory, and interact with I/O devices, just like a physical computer. Most importantly, it can understand a machine language which you can you can use to program it. LC-3 (Little Computer - 3) VM simulates a fictional computer called the LC-3. It has a simplified instruction set compared to x86, but contains all the main ideas used in modern CPUs.

  • Run lc3_vm using cargo : cargo run resources/2048.obj

Modules

file

file reading : The first 16 bits of the program file specify the address in memory where the program should start. This address is called the origin. It must be read first, after which the rest of the data can be read from the file into memory starting at the origin address.

hardware

Hardware - A module to simulate hardware of LC-3 (Little Computer - 3).

sys

sys module is designed to handle low level interaction with the system. Most of the times, such interactions require use of unsafe code via libc and other crates.

Functions

handle_args

handle_args fn processes commandline arguments. If appropriate file path is found in the args, it reads the file into the memory.