Sun, 20 Oct 2013, 11:46



My students,

I don't know how many of you have not mastered the notion of .FILL.
On the chance that this student is not alone, I am including my response
to you all.  If you understand how to use .FILL, please delete and move on.

A student writes:

 
> Greetings Dr. Patt,
> 
> I am in your EE306 class, and I am struggling to understand how to use
> .FILL and LD together. Similarly to the program in the book on page 184, I
> tried:
> 
> RESERVATION .FILL x3200
> 
> LD  R0, RESERVATION
> 
> hoping that the value x3200 gets put into R0, but from the simulator,
> but it does not. I can't quite seem to get the book's explanation of the
> relationship between where the LABEL is and how that address works with LD.
> Would RESEVATION be the PCOffset9? Maybe you could shed a little light on
> this situation for me.
> 
> 
> Best,
> <<name withheld to protect the student who does not get .FILL yet>>



I can not see your entire program so I do not know where the .FILL
pseudo-op is and where the LD instruction is.  The LD should be part
of the program since you want the computer to execute it.  The .FILL should 
come after the TRAP x25 since you don't want the computer to execute 

	0011 001 000000000  (x3200)

which would be treated as a ST instruction if the computer fetched it and
executed it.

It is a constant that you want the assembler to put in a location in the 
program so when the program executes, the computer will execute LD, causing 
x3200 to be loaded into R0.

To accomplish this, the placement of instructions should be something like:

		.ORIG x3000

		...

		LD R0, RESERVATION

		...

		TRAP x25

		...

RESERVATION	.FILL x3200

		...

		.END

You should first see a TA who can look at your whole program, and
more easily see where your problem is.  I am only guessing, based on
what you have told me, what your problem is.  Hopefully, what I am 
guessing and what is in your program are the same.  If a TA looks at 
your program and talks to you, there is much less guessing required.  

Good luck getting it done today.

Yale Patt