CS310 Resources for the LC-3 Simulator
This page consists of helpful links and information for using the LC-3 Simulator in CS 310 and is intended to provide
"one-stop shopping" for the LC-3.
Textbook resources: LC-3 Simulator,
User's Manual, Source Code
- All of the
following are found in the Patt/Patel textbook's accompanying website.
- Patt/Patel have
provided two LC-3 simulators that you can use at home or in the CS
Labs. We
encourage you to use the Windows version of the Simulator (which is
also installed in the Micro Lab) for its ease of use, which
includes a debugger and a "help menu".
- Windows
version : the .exe to download includes an editor/assembler called LC3Edit, and a
loader/simulator/debugger called LC3Simulator.
Each program has a classic GUI interface, and some built-in help
information.
- Linux
Version
- (NOTE: this version has a command line assembler, a simplified
debugger, missing features, and no built-in "help information")
- Note: UTCS
students built their own simulator that
runs on UTCS linux. (most of the team here has not used this)
- There are two LC-3
Simulator User's
Manuals and are particularly helpful to read at the first.
- All source code
provided in the book is
also on the P/P website.
UTCS MicroLab:
- The Micro Lab (in
PAI Hall) has already installed the
Windows version of the LC-3 Simulator: you will find the LC3Edit,
LC3Simulator, (and I believe that the LC-3 User's Manual for Windows is
also installed???)
Turnin Guidelines:
NOTE!!!
We will be
using the turnin program available on the
UTCS Linux systems
and NOT the turnin.exe program available in the PCs in the microlab!
The turnin guideline and standards are as
follows:
- All the
required files for the Homeworks MUST be
turned in by
the due date(s).
- Besides the
online submission, you will often be asked to turn in a stapled
hardcopy of
your source file with your name, your TA's name, discussion section time
- Your
source
files must follow the documentation guidelines.
- Sometimes you
will also be asked to include in the hardcopy a screen capture (not a
text
file) showing your outputs.
- You MUST ALWAYS Turn in electronically the
source file with your name,
your TA's name and discussion section time as part of the comments for
your
code (via the LINUX TURN IN COMMAND --- we do not accept turnin.exe
input)
- If your
program does not work, then for partial credit, it would help if you
write up a
README, describing what does work...
- The actual
Linux turnin command has been described
below:
The turnin
command is as
follows:
> /lusr/bin/turnin
--submit < ta_id > < homework_id
> < your_homework_file_name >
For example : If
you need to turn in HW#7 to Honguk,
then
type the following according to the HW FAQ:
#53845: > turnin --submit phchung
hw7 hw7.asm
LC-3 Assembler/Simulator FAQs & other questions:
- I was
trying to "read a character" but it looks like my program is in
an "infinite loop". What's happening?
First,
Probably, the simulator is waiting for you to enter a single character
into the console window. Sometimes, it is lost behind the
simulator window.
- First, debug your program, using the powerful step over button,
etc... Once it is correct, then follow these steps to create the memory
dump file.
- You will need to
re-load your
program.
- Place (“toggle”) a break point at
the specified point in the program (the turn-in
instructions will specify this point)
- Then select “run the program”.
- When the program stops at
the breakpoint, you can see the contents of memory. Examine it to
make sure that you have captured the required information.
- Select “Save Memory
Contents”
under the “File” menu in the LC3 simulator. The turn-in
instructions will specify the values that you should supply to
the Memory Address
Range.
(Choose a filename that ends with .dump)
- Some homework
questions ask me to turn in a "screen dump" (or screen capture).
How do I get a screen dump
(or screen capture) of an LC3 window?
On the MS Windows system, first make that window “active”
by mouse-clicking anywhere in the window, and then press “ALT-Print
Screen”. The dump is copied on to the clipboard. To use this in any
application, just click the “paste” item in the menu bar of the
edit menu in that application. You may use MS WORD or the PAINT program
for
this purpose.
On Unix/Linux systems, you can use the “xv”
image processing program. It has a “grab” button that will let you
grab the screen.
- How does one
access a floppy disk on a Linux machine?
In
order to use the floppy disk, you need
to mount it first. Type the following command on the prompt:
> mount /floppy
(See the man pages for more information on mount). This will mount the
file
system and your files from the floppy will be available under the
/floppy
directory.
Note: the /floppy directory is under the root directory. so
you have to change your directory first. Type:
> cd /floppy (this will take
you to the right
directory)
> ls (to view you files).
When you finish your work, you have to unmount
the
floppy drive. Just type > umount
/floppy
-
I keep getting an error message that says "A trap was executed with an illegal vector number."
First of all, make sure that you're using a Trap vector that's actually defined. (such as x20 ~ x25)
If that's not the problem, then it's very likely that you're using decimals instead of hexadecimals. (e.g. TRAP 25 is WRONG. TRAP x25 is correct)
CS310 Assembly Language Documentation Guidelines:
Source
Code for
figures & examples:
- All source code (both LC-3 and C) from figures
in the book are on the P/P website.
- Lectures: several handouts of LC-3
examples are provided in lecture, and generated during discussion
sections (see Discussion notes).
UTCS unsupported LC-3 Simulator:
This is an optional simulator for use under Linux that you may choose
to use. (Note: UTCS students
built their own simulator that runs on UTCS linux.... most of the CS310
team has not yet used this tool.)
LC3 for Linux:
1. Information on how to use this simulator (from the UTCS Linux
systems)
http://www.cs.utexas.edu/users/aliguori/lc3db/
(also designed to provide OS support for Interrupts)
2. To assemble an LC-3 program:
/p/bin/lc3asm filename.asm - assembles filename.asm and creates filename.obj,
in addition to a couple of other files.
3. To run the simulator/debugger:
/p/bin/lc3db --ddd
(with graphical interface)
/p/bin/lc3db (commandline
interface)
4. As for installing lc3db locally, I just copied the following
message
from http://www.cs.utexas.edu/users/aliguori/lc3db
"lc3db can be run locally on an Intel-based Linux machine. The only
requirement is that GNU ddd is installed
if you wish
to use a GUI interface. GNU ddd is
available from the
GNU ddd website.
There is no support provided if you run lc3db locally. It's import to
run the
static version from the directory you have it installed in."
5. The UTCS simulator buttons "step" and "next" are comparable to
the Windows simulator buttons: "Step Into" and "Step Over".
If you have encountered
a
problem with a homework, then contact the professor. Otherwise,
if you have run into a confusion with the LC-3 assembler or
simulator/debugger, and have resolved it, then please send the question
& its answer to the webmaster ( Pak Ho (Simon) Chung
) THANKS!
Last updated: 1/18/2006