12/2/04
A student writes (actually several students wrote):
Ok, i have a question on the program form rules.
I guess my new name is Ok.
First, everything works great.
Even if he does say so, himself.
My program is more or less done and submited. But there was one thing that was bothering me and I am not sure if i did the right thing. In the Program 5 page, you guys hint on how one might go about using the ROW and COLUMN number to figure out which location in memory the user is going to. well... I did exactly what you guys said and put the loacation of ROW0 in R5. I am pretty sure that was the only way to do it but there wasnt any info on the registar already having that value so i knew i had to put this value in R5 my self. Second I am way to far from ROW0 in the starter code to use a LEA so i used the LC3 to get its location and .Fill it into the LC3. bad form?
Yep.
just wrong?
Nope.
I apoligize if i am being unclear and would glady clarify anything. thanks, << Not-Ok >>
Actually, it is possible to write the routines in such a way that
LEA R5, ROW0 is not too far away from the label ROW0.
However, if you are too far away, you could use the symbolic value
in the .FILL instruction. To wit (inside a subroutine), you could
put:
The Assembler, in its first pass (as you know) will pick up the
label ROW0 in creating its Symbol Table. In the second pass,
location XYZ will be filled with the address corresponding to
ROW0 (which the Assembler will get from the Symbol Table).
Yale Patt LD R5, XYZ
...
... ; other code
...
RET
XYZ .FILL ROW0
... ; other data