Lab 1
Introduction to the LC-3 Simulator
Objectives
- To download a copy of the software that will be needed for the
remaining labs
- To learn how to enter and save machine language programs and data
files using the LC3Edit program
- To learn how to run a machine language program using the LC-3 Simulator
What you should do...
Download the LC-3 editor and simulator, following these steps:
- Create a new folder on your mapped drive. Name the folder LC-3.
- Go to the authors' website.
Under "Student Resources" click on "LC-3 Simulator".
Load the Windows version of the LC-3 Simulator.
- Save the file in the LC-3 folder on your mapped drive.
- Open LC3.exe. Make sure the folder listed is the LC-3 folder on your
mapped drive. Choose "Unzip" to extract the LC-3 files. Your folder
should now contain the files LC3Edit.exe and Simulate.exe (and some others).
- Ask the TA for help if you run into any problems.
You may already have printed a copy of the "Guide to Using the Windows version
of the LC-3 Simulator and LC3Edit". If you don't have a copy with you,
you can look at the online version: go to the authors' website, and under "Student Resources" click on "LC-3
Simulator Lab Manual". This week, you will be running through the
example outlined in the manual in Chapters 1, 2, and 3, and through
Example 1 of Chapter 4.
- Chapter 1 explains how to enter a machine language program using
LC3Edit. Enter the program in binary (not hexadecimal; I want
you to begin familiarizing yourself with the different fields in each
machine code instruction, and this is best done if you represent the
instruction in binary). Also, enter the instructions as shown on the
top of page 4 in the manual, with spaces between the different fields in
each instruction, and comments after each instruction. Save your program
as instructed in the manual, and create an object file. When you get
to the part that says "Entering your program in the LC-3 assembly language",
skip ahead to Chapter 2 (page 8).
- Open the simulator (the file name is "Simulate.exe"). Read through
the explanations about the simulator in Chapter 2.
- Load your program into the simulator, as explained in Chapter 3. This
chapter explains two different ways to enter data into memory. Read
through the explanation of the first way, but enter the data the second way
(see the bottom of the page numbered 11). Continue following the instructions until you
get to the end of Chapter 3.
- Turn in your lab1 files (
addnums.bin
and data.hex
) using the turnin program.
- Go through Example 1 in Chapter 4 (this example is taken from
pages 165 and 166 in the textbook, not pages 129 and 130 as stated in the
lab manual). This chapter gives you hints on how to use the debugging
features of the simulator - these will come in handy as you work on Homework 3.
If you do not finish Example 1 during the lab period today, finish it later
at home.
You will be using this editor and simulator for the remainder of the
term, so be sure to ask the TA if you come across something you don't
understand.
See you next week!