A student is studying for the test and writes:

     Dear Dr. Patt,

     I was reviewing for the test and had two questions. 
     I was hoping you could answer them for me.
     1. I know that .BLKW is used to set a side 
     a certain number of contiguous 
     memory locations. How do you know what the starting location is of that 
     allocated block of memory? or do you not 
     need to know that information since there is a label in front of it?

You are setting aside the block of memory locations, presumably in order to later store values into them.

For example,

                SPACE   .BLKW    #10

If you label that pseudo-op (SPACE, in this case), you have identified the starting address of that sequential set of locations. You can refer to the first location by the label. You can refer to the others with LDR and STR, as follows:

                        LEA   Ri, SPACE
                        LDR   Rj, Ri, #k

where k allows you to specify which of the ten locations you wish to load from. (...or store to, if you replace LDR with STR.)

     2. On pg 203 of the text book, there is a program that 
     shows the basic 
     input routine. I dont understand why the 
     condtion codes on line 02 are BRzp and 
     not BRz. Because according to what I understand, 
     it should loop back to line 01 
     if the KBSR is 0 (polling until user inputs 
     a character), and should continue 
     on w/ the program if the KBSR is set to 1 (meaning a character has been 

Actually, you mean KBSR[15], rather than KBSR.

     But if KBSR is one, then R1 
     is loaded w/ 1 and 1 is a positive 
     number. So wouldn't that make it loop back to 
     the beginning when it should 
     continue on w/ the rest of the program?

Assuming all the other bits in KBSR were 0, then indeed we could use BRz, rather than BRzp. I decided to use BRzp to slip in a little robust code on you. That is, my program fragment is only concerned about KBSR[15], the ready bit of the KBSR. If I use BRz, then I need to be sure there is nothing else going on with this status register that I don't know about and need to worry about. Since I REALLY ONLY CARE about bit 15, I use BRzp because that is the branch that checks bit 15 and only bit 15. ...and I don't have to worry about any use of the other 15 bits of the status register. OK?

Good luck with the exam.

Yale Patt

     Thank you for your help.

     << name withheld... >>
     EE 306 student