113k views
1 vote
Consider the following MARIE Code: 100 If, Load X /Load the first value 101 Subt Y /Subtract the value of Y, store result in AC 102 Skipcond 400 /If AC=0 (X=Y), skip the next instruction 103 Jump Else /Jump to Else part if AC is not equal to 0 104 Then, Load X /Reload X so it can be doubled 105 Add X /Double X Store X /Store the new value 107 Jump Endif /Skip over the false, or else, part to the end of if 108 Else, Load Y /Start the else part by loading Y 109 Subt X /Subtract X from Y 10A Store Y /Store Y-X in Y 10B Endif, Halt /Terminate program (it doesn't do much!) 10C X, Dec 12 /Assume these values for X and Y 10D Y, Dec 20 Find the values stored in the following registers after the execution of "Skipcond 400" instruction: [5 marks] (i) PC (ii) IR (iii) MAR (iv) MBR (v) AC

User Copper
by
6.9k points

1 Answer

6 votes

The values stored in the registers is calculated by using the following codes:

Step-by-step explanation:

The program is given below,

100 If, Load / by Load the first value

101 Subt Y / Subtract the value of Y, store result in AC

102 Skipcond 400 / If AC=0 (X=Y), skip the next instruction

103 Jump Else / Jump to Else part if AC is not equal to 0

104 Then, Load X / Reload X so it can be doubled

105 Add X / Double X

106 Store X / Store the new value

107 Jump Endif / Skip over the false, or else, part to the end of if

108 Else, Load Y / Start the else part by loading Y

109 Subt X / Subtract X from Y

10A Store Y / Store Y-X in Y

10B Endif, Halt / Terminate program (it doesn't do much!)

10C X, Dec 12 / Assume these values for X and Y

10D Y, Dec 20

User Jim Ho
by
7.9k points