Saturday, October 03, 2009 2:42 PM,





A student writes:

	 I have been working on the program for a while now. I'm still having 
	 some difficulties making things work out right. To be more specific, I 
	 understand how to enter the codes, the instruction process, and the 
	 majority of chapters 4 and 5. That part is fine I think. The thing 
	 that has got me really stumped right now is the value of bit 15 and 
	 the value of bit 7 of the data that is entered in x3100 in memory. I 
	 originally had my program so that the bits [15:8] would be cleared or 
	 all changed to 0 by a bit mask that I ANDED with the value in x3100. 
	 Then the a branch would be taken based on whether the value of [7:0] 
	 was negative, postitive, or 0. To be more specific the branch would be 
	 taken if the value was 0 or positive, and the branch would not be 
	 taken if the value was negative. The problem that I can't seem to fix 
	 is that when i AND whatever value thats in x3100 with the bit mask 
	 that  saves bits [7;0] (bit mask 0000000011111111), the value that 
	 gets read by the conditional branch instruction will always be 
	 positive, because bits [1:5:8] of the value will be changed to 0, thus 
	 making my branch useless if it will never be negative.
	
	 I was just wondering if you could give me anymore hints or words of 
	 wisdom that could help me out. If you can't then I understand. I have 
	 gone to some office hours already and they have helped, but this is a 
	 problem that I just came across recently. I'm guessing that I may be 
	 overthinking things but Im not really sure. I plan to go to more 
	 office hours on saturday to figure things out but any help now would be 
	greatly appreciated.
	
	 Thanks!
	 <<name withheld to protect a student needing to read my email more 
	 carefully>>


Have you been reading my email to the class?  I sent an email that dealt 
exactly with your question.  Yes, if you make [15:8] all 0s, you will always 
have a zero or positive value.

The question is what bit determines whether the value in [7:0] is negative or 
positive.

The second question is what instruction with two operands will provide one 
answer in N,Z,P if that bit is a 1 and a different answer in N,Z,P if that bit 
is 0.

Good luck finishing by midnight tomorrow night.

Yale Patt=20