Figure 9.2: The contents of example1.mac loaded into memory
Registers:
PC R R CCR
Source Code:
0000000000000000000000 0000000000000000 00000000010 0001000
0000000000001 000000000000000 00000000110 0000000000000000
Figure 9.2: The contents of example1.mac loaded into memory. Notice that the first machine language instruction in memory is shaded. Let's interpret this instruction. The opcode is 0000, which indicates a load instruction. The address is 0000000000101 which is binary for decimal 5. Thus, the instruction should load the value stored at address 5 into the register R. Memory location 5 contains a binary 2. So, an appropriate interpretation for this instruction would be: "The value 2 stored in location 5 is to be loaded into R."
Download the document lab_o9_o1.docx. Using the table within the document, complete the following. Copy down the binary form of this instruction and the interpretation of what the instruction should do when executed.
Next, click the Step button. This will execute the first instruction. Note what happens to the contents of the registers, and that the next instruction is now shaded. Now repeat the process of writing down the instruction and our interpretation of it, and stepping through it, until a message box appears that signals the halting of the program. If you need help, look in Table 9.1, or click the Opcodes button. What is the main function of the program? Is there any output in the output window?
Once you have completed the table and answered the questions, save your file with your last name in the file name (Example: lab_o9_o1_Jones.doc). To upload and submit your assignment, click the Choose File button below to find and select your saved document.
Numeric code: 0000 0001 0010 0011 0100 0101 0110 0111
Meaning:
Load x X R
Store x R
Clear x 0
Add x R+x R
Increment x x+1
Subtract x R-x R
Decrement x x-1
Compare x if x>R then 100CCR elseif x<R then 001 CCR elseif x=R then 010 CCR
1000 1001 1010
Jump x goto x Jump if greater than x goto x if CCR=100 Jump if equal x goto x if CCR=010