Exam-style question
Try this first
Assume an accumulator and memory location 50 initially contain 0. Trace the following mnemonic instructions and state the final contents of the accumulator and memory location 50. Explain where immediate and direct addressing are used. LOAD #6 ADD #4 STORE 50 LOAD 50 SUBTRACT #3 HALT.
Model answer
What a good answer should say
- After LOAD #6, the accumulator contains 6.
- ADD #4 changes it to 10.
- STORE 50 copies 10 into memory location 50, so memory location 50 contains 10 and the accumulator remains 10.
- LOAD 50 loads the value stored at memory location 50, so the accumulator is still 10.
Explanation
Why this works
The trace must distinguish an operand that is a value from an operand that identifies a memory address. STORE changes memory as well as leaving the accumulator unchanged; LOAD 50 then retrieves the stored value.
HALT ends the sequence and does not alter the values.
Common mistake
No common mistake is linked to this question yet.
