Sun, 6 Oct 2013, 16:13

My students,

This is the second student that has expressed confusion over something
that I would not have guessed was confusing so I am responding to all 
of you just in case there are others.

A student writes:

> Dear Dr. Patt
> I haven't emailed you yet and I guessed the test was as good of a time as
> any to start asking you questions. I discovered after trying to make my
> program work last week that I had to first write a line of code to store
> the program at memory location x3000 to make anything work. I have two
> questions associated with this discovery.  Does this apply for all programs
> in lc3 including those compiled from assembly and, when you were writing
> your code on Wednesday was their a reason you didn't include a starting
> store program here line. If you did put a str line on the program on
> Wednesday and I didnt write it down please disregard the last question and
> note that I was out a little to late Tuesday night.
> Best regards,
> << name withheld to protect the student who was out a little too late >>

1. In class my objective was to create a program to solve a problem and I wanted
to show you where in memory each instruction would be located.  Therefore:

x3000: first instruction
x3001: second instruction

2. For the LC-3 Simulator to accept a machine language program and store it 
in memory, the file  has to be in exactly the following form:

first instruction
second instruction

That is, for the LC-3 Simulator to load a program into memory and set the PC,
the program must be in the form: (a) first line, the address to load into the
PC: (b) second 16 bit line, the first instruction which will be stored in the
location specified by the first line; (c) third 16 bit line, second instruction
to be stored in the next sequential memory location, (d) etc.

Therefore two different reasons imply two different representations.  I could
have written the code in the .bin form, but it would have been less clear to
you in class.  I could have sent the form I used in class to the LC-3 
Simulator, but the Simulator would not have known what to do with it.

By the way, the first line 00110000000000000000 is not a line of code, it is
an address and is used to specify where in memory the program will be put.

Finally, you asked whether we are going to do this all semester.  Answer: No.
In the second programming assignment, we will start using LC-3 assembly 
language, and the issue of where to actually place the program will be handled


Yale Patt


Your other