Sunday, October 25, 2009 10:49 PM,



Although this is a little late for tonight's deadline, it could be helpful to 
those targeting Tuesday, and certainly to all of you wrt the remaining 
programs.

A student writes:


	 Dr. Patt,
	 
	 Can you have multiple ".ORIG" and multiple ".END"? In one of your 
	 emails you included a .END but wouldn't the assembler just stop once 
	 it sees that? If so, how can there be more than one .ORIG?
	 I'm still a little confused about that.
	 
	 -
	 <<name withheld to protect the student wanting more than one .ORIG>>



First, you are absolutely right.  As soon as the assembler sees a .END, that 
is the message the assembler needs to know it has the entire .asm file, and so 
does not consider anything beyond the .END pseudo-op.

I am not sure where the confusion comes from.  If it is due to my response to 
a student with respect to loading a file of grades, then we miscommunicated.
In that case there is only one .ORIG and one .END in EACH of the two files - 
the program and the grades data.  By the time the assembler has converted 
these two files to object files (0s and 1s), there are NO .orig or .end 
remaining.  That is, the assembler uses the .orig and .end to help it create 
the object file.  What I suggested to the student was that after separately 
assembling his program and the grade file, he load the grade file into memory, 
and then he load his program into memory.  Assuming there is no overlap in the 
addresses, both loads will be successful and he will have his program and the 
test data in memory starting at their correct addresses.

Finally, if he loads the program last, the PC will be pointing to the first 
instruction to be executed.

Got it?
  
By the way, my co-author and I have thought about allowing multiple .ORIG 
together with a single .END in order to handle this case, but so far we have 
decided not to add it.

Hope this helps.

Yale Patt