Saturday, November 28, 2009 9:14 PM,



A student sent me email asking how many files he should submit for Program 4:



	 Hello Dr. Patt,
	 
	 Just to check, I am only supposed to submit one file for Program 4, right? 
	so I have to have all my subroutines in one program file to be submitted?
	 
	 Thanks,
	 <<name withheld to protect the student who does not understand JSR 
	 (maybe)>>



My first reaction was to wonder what is not clear in the statement of the 
programming assignment.  The Connect-4 instructions state:  "The file that you 
submit for this assignment must be named connect4.asm."  Similarly, for
Nim:  "The file that you submit for this assignment must be named nim.asm."

Then one of my TAs helped me, saying that maybe the student does not realize 
that JSR allows an 11-bit offset, and therefore he does not have a single 
assembly language program nim.asm, for example, but is kludging up something.

If that is the problem, yes, you are to write the game playing program as a 
single assembly language program, and you should call it nim.asm or 
connect4.asm, according to which game program you are writing.

And, yes, subroutines help keep the size of the program smaller than would be 
the case if you included the code SEPARATELY for each execution of the 
subroutine.  For example, if you execute a 30 instruction subroutine 10 times, 
this should not result in 300 instructions in your program.  It should result 
in 31 (the code plus the RET at the end) + 10 (the 10 JSR instructions).  
That is, 41 instructions is a lot fewer than 300 instructions.

Hope this helps.

Yale Patt