11/14/04

A student asks a few non-critical questions. But, in the interest of keeping everyone happy, I am responding. If you are swamped, feel free to delete and move on.

     Hello Professor,

Hello, Student.

     I was just curious about the output on the fourth programming assigment.
     When it says a player wins, how many lines are to be skipped before the
     halt message is displayed? I cannot tell if it is 2 or 3 lines.

Actually, we don't care. One line is sufficient. In fact, I would not be surprised if some hotshot decides to embellish his program by adding (after "Player x wins" the line "Would you like to play again? (Type Y or N):" and THEN either executes the halt or initates a new game. That way, he can take it home for Thanksgiving and keep his younger brother and sister amused all weekend so they leave him alone so he can study 306 after dinner on Thursday, and watch the A&M game on Friday.

     Also, I don't think I fully understand the point of the JSRR
     instruction. Is this not the same as a jump instruction? If so,
     couldn't we combine JSR/JMP into the same, with the following format.
     [15:12] for = the opcode, [11] to specify JSR/JMP, then the rest the
     same as it is now.

Indeed we could. In fact, we did exactly that with the LC-2. But that used different opcodes for different addressing modes -- one opcode for JSR and another opcode for JSRR. I decided it was better to to use one opcode for JSR/JSRR and a different opcode for JMP, since JSR/JSRR does something different (i.e., saves the return linkage in R7) from what JMP does. AND, use bit[11] to specify the addressing mode used by JSR/JSRR. This is more in keeping with how ISAs that you will use after you graduate specify their instructions.

OK?

     Thanks in advance,
     << name withheld to protect the new ISA designer >>

     P.S. why is BRZN not acceptable, when BRNZ is? BRZN causes compile 
     errors. Thanks again!

Ooops! I almost missed this one. A third question!

Answer: Because it isn't. Seriously, it could have been. The former student of mine (now a senior developer at Microsoft) who wrote the Simulator for the LC-2 and LC-3 decided (I guess) that he did not want to bother checking all variations of n, z, and p, and decided it was easy enough for a programmer to write them in one standard order.

Actually, I did not realize he allowed BRNZ to be recognized. I guess now that he is a senior developer, he does not listen to me anymore. I wanted the assembly language opcode to be BRnz, and to have the Assembler reject BRNZ. My reason is strictly pedagogical. I wanted to be sure every student understood the difference between z (for example), which is the bit in the branch instruction telling the computer which condition code to check and Z which is the actual condition code that the computer checks.

Good luck with the rest of the course.

Yale Patt