Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
This assignment is to be done using LC-3 simulator. You can download the JAVA version from Canvas. You can use the simulator to compile and test the program.
Section 1: Running the Simulator [1] (1 mark)
You can execute the simulator (‘LC3sim.jar’). We need to first load some software. The first piece of software we should load is, naturally, an operating system. The LC-3 operating system is very basic: it handles simple I/O operations and is responsible for starting other programs. Download the LC-3 OS (‘LC3os.asm’) and you can understand what the operating system does.
The LC-3 machine doesn’t understand assembly directly; we first have to ‘assemble’ the assembly code into machine language (it is an ‘.obj’ file containing binary data). The LC-3 simulator has a built-in assembler, accessible (as is the case for most of its functionality) via the Command Line text box. To assemble the operating system, type as lc3os.asm at the command line and hit enter. Make sure that the OS file is in the same directory as the ‘.jar’ file; the as command also understands relative and absolute paths if the OS is in a different directory. Output from the assembly process is displayed in the CommandLine Output Pane. After assembling the OS, you should notice that 2 new files, ‘lc3os.obj’ and ‘lc3os.sym’, have been created. The ‘.obj’ file is the machine language encoding of the assembly language file, and the ‘.sym’ file is a text file that holds symbol information so the simulator can display your symbols. Recall that symbols are really just a convenience for silly humans; the machine language encoding knows only about offsets.
Now we can load the ‘lc3os.obj’ file into the simulator, either via the command load lc3os.obj or by going to the File menu and selecting Open ‘.obj’ file. Notice that the contents of the memory change when the OS is loaded. Now assemble and load the solution file for Problem 0 (Q0.asm) into the simulator. The memory has changed again, but you may not notice since the relevant memory addresses (starting at x3000) aren’t visible unless you’ve scrolled the screen. User-level programs (i.e., non-OS code) start, by convention, at x3000. If you type the command list x3000 the memory view will jump to x3000 and you can see the 1-instruction solution to this problem.