Look at the program stored in RAM addresses 0-6 (lines 7 and 8 are data) and then complete the gaps below.

Gap-fill exercise

Fill in all the gaps, then press "Check" to check your answers. Use the "Hint" button to get a free letter if an answer is giving you trouble. Note that you will lose points if you ask for hints clues!
capture.JPG
----------------------------------------------
Fetching instruction...
Set MAR to address held by Counter: 0
Program Counter by 1 so it stores address 1
Fetch instruction from address stored in the MAR
Fetched instruction: LDA 8 stored in the MDR
Copy instruction from the MDR to the CIR
instruction stored in CIR...
LDA
Executing Instruction...
Set MAR to the operand of the current instruction: 8
Fetch data at the location held by the MAR (8) and store it in the : 2
Store the MDR value in the Accumulator: 2
----------------------------------------------
Fetching instruction...
Set MAR to address held by Program : 1
Increment Program Counter by 1 so it stores address 2
Fetch instruction from stored in the
Fetched instruction: INP stored in the MDR
Copy instruction from the MDR to the CIR
Decoding instruction stored in CIR...
OUT
Executing Instruction...
value held in the :
----------------------------------------------
Fetching instruction...
Set to address held by Program Counter: 2
Increment Program Counter by so it stores address
Fetch instruction from address stored in the MAR
Fetched instruction: SUB 7 stored in the MDR
Copy instruction from the to the CIR
Decoding instruction stored in CIR...

Executing Instruction...
Set MAR to the operand of the current instruction:
Fetch data at the location held by the MAR and store it in the MDR: 1
Subtratct MDR value from the Accumulator and store the result in the Accumulator: 2-1=1
----------------------------------------------
Fetching instruction...
Set to address held by Program Counter: 3
Increment Program Counter by 1 so it stores address 4
Fetch instruction from address stored in the MAR
Fetched instruction: 8 stored in the MDR
Copy instruction from the MDR to the CIR
Decoding instruction stored in CIR...
STA
Executing Instruction...
Set MAR to the operand of the current instruction: 8
Set MDR to the value held in the Accumulator: 1
Store MDR value 1 at the memory location held in the MAR: 8
----------------------------------------------
instruction...
Set MAR to address held by : 4
Increment Program Counter by 1 so it stores address 5
Fetch instruction from stored in the
Fetched instruction: BRZ 6 stored in the MDR
Copy instruction from the to the
Decoding instruction stored in CIR...
BRZ
Executing Instruction...
Check if the value held in the accumulator is 0
1==0 - false
----------------------------------------------
Fetching instruction...
Set MAR to address held by Program Counter:
Increment Program Counter by so it stores address
Fetch instruction from address stored in the MAR
Fetched instruction: BRA 0 stored in the MDR
Copy instruction from the MDR to the CIR
Decoding instruction stored in CIR...

Executing Instruction...
Set the PC to the operand of the instruction: 0
----------------------------------------------
Fetching instruction...
Set MAR to address held by Program Counter: 0
Increment Counter by 1 so it stores address 1
Fetch instruction from address stored in the MAR
Fetched : LDA stored in the
Copy instruction from the MDR to the CIR
Decoding instruction stored in CIR...
LDA
Executing Instruction...
Set MAR to the operand of the current instruction: 8
Fetch data at the location held by the MAR (8) and store it in the MDR: 1
Store the value in the : 1
----------------------------------------------
Fetching instruction...
Set MAR to held by Program Counter: 1
Increment Program Counter by 1 so it stores address 2
Fetch instruction from address stored in the MAR
Fetched instruction: OUT stored in the MDR
Copy instruction from the MDR to the CIR
Decoding instruction stored in CIR...
OUT
Executing Instruction...
value held in the : 1
----------------------------------------------
instruction...
Set MAR to address held by Program Counter: 2
Increment Program Counter by 1 so it stores address 3
Fetch instruction from address stored in the MAR
Fetched instruction: SUB 7 stored in the MDR
Copy instruction from the MDR to the CIR
instruction stored in CIR...
SUB
Instruction...
Set MAR to the operand of the current instruction:
Fetch data at the location held by the and store it in the : 1
Subtratct MDR value from the and store the result in the : 1-1=
----------------------------------------------
Fetching instruction...
Set MAR to address held by Program Counter: 3
Increment Program Counter by 1 so it stores address 4
Fetch instruction from address stored in the MAR
Fetched instruction: 8 stored in the MDR
Copy instruction from the MDR to the CIR
Decoding instruction stored in CIR...
STA
Executing Instruction...
Set to the operand of the current instruction: 8
Set to the value held in the Accumulator: 0
Store value 0 at the memory location held in the MAR: 8
----------------------------------------------
Fetching instruction...
Set MAR to address held by Program Counter:
Increment Program Counter by 1 so it stores address
instruction from address stored in the
Fetched instruction: 6 stored in the MDR
Copy instruction from the MDR to the CIR
Decoding instruction stored in CIR...
BRZ
Instruction...
Check if the value held in the accumulator is 0
0==0 -
Set to the operand of the instruction:
----------------------------------------------
Fetching instruction...
Set MAR to address held by Program Counter: 6
Increment Program Counter by 1 so it stores address
Fetch instruction from address stored in the MAR
Fetched instruction: HLT stored in the MDR
instruction from the MDR to the CIR
Decoding instruction stored in CIR...
HLT
Executing Instruction...
Program stopped
----------------------------------------------
Program Executed in FDE Cycles.