Thursday, October 01, 2009 11:40 PM,
A student writes: I read in the problem set we are allowed to load bit masks in memory locations after the HALT instruction. So my question is can we also load other values in memory locations before our program executes? Thank You, <<name withheld to protect the student who has some other constants to load>> The short answer: Sure. By now, you understand very well the instruction cycle. So, you know that your program will get executed instruction by instruction according to the contents of the program counter until the program halts. Execution will start with the instruction whose address is initially in the PC, which you have specified in the first file you create. As long as there are no branch instructions, the instructions executed will proceed sequentially. When a branch is encountered, the PC may be changed dramatically, and execution will continue from there. Once the halt instruction is executed, that will be it. No more instructions will be executed. THEREFORE, anything in memory AFTER the halt instruction will never get fetched and never get executed. Feel free to use those locations for whatever you wish - your girlfriends phone number if you wish, provided of course she has a 16 bit binary telephone number. Good luck finishing the program. Yale Patt