11/9/04
Recall the dialogue tonight about Problem 9.5 in the book. A student writes:
Hi Dr. Patt, I did what you suggested for the issue we discussed in the review session- in reference to problem 9.5 in the book which is also problem 3 on the review (word for word)- which was to look on the errata sheet online to see if it had been considered as an error and I found that it is not on the errata sheet as far as I could tell. The problem was you have an instruction ST R0, x3007 and you cannot write x3007 and there WILL be an assemble time error and the question tells you that there are no errors. Maybe you will have to speak to one of your old TA's after all. << name withheld to protect the helpful student >>
Clearly, so I did! It turns out what happened was, as
I said in class, that we lifted the exam question from two years ago when
we were using the LC-2 and put it at the end of Chapter 9. The
LC-2 Assembler was a little more forgiving and allowed ST R0, x3007
to be assembled, recognizing that the programmer meant address
x3007, rather than offset x3007.
What we did not realize at the time, however, was that the guy who
actually wrote the Assembler for the LC-3 (THREE, not TWO) decided
that ST R0, x3007 was just too ugly to let the Assembler let it go.
Ergo, the assemble time error on your LC-3 Simulator.
So, in the interest of having an LC-3 assembly language program that
does the thing we wanted to illustrate, let me offer:
...and this will show up on the errata sheet as soon as Santhosh
can get to it.
Thanks for the help.
Yale Patt .ORIG x3000
LEA R0, LABEL
STR R1, R0, #3
TRAP x22
TRAP x25
LABEL .STRINGZ "FUNKY"
LABEL2 .STRINGZ "HELLO WORLD"
.END