Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
A small program is stored at addresses 10 to 14. Address 20 holds 14 and address 21 holds 9.
Find the value in the ACC after each of the first three instructions, and the value at address 22 when the program stops.
The CPU has two units. The ALU does calculations and logic, and the CU decodes instructions and sends control signals. There are five registers. The PC holds the address of the next instruction and the MAR holds the address being used. The MDR holds the data or instruction read or to be written. The CIR holds the instruction being decoded and executed, and the ACC holds the result from the ALU. The address bus goes one way, from the CPU to memory. The data bus and the control bus go both ways.
Have you tried it?
Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.
Step 1. LOAD 20. The ACC gets the value at address 20, so it holds .
Step 2. The first ADD 21. The ALU adds : .
Step 3. The second ADD 21. It adds again: .
Step 4. STORE 22. The ACC is copied to address 22, which now holds . The ACC still holds too.
Check. The program works out . Yes.
Answer: 14, 23 and 32, and address 22 holds 32.
Log in to join the discussion.
Loading…