Consider the following MARIE Code: 100 If, Load X /Load the first value 101 Subt Y /Subtract…

Our academic writers are ready and waiting to assist with any assignment you may have. From simple essays to full dissertations, you're guaranteed we've got a writing expert to perfectly match your needs.

Order a Similar Paper Order a Different Paper

Question 3 – MARIE Assembly [20 marks]

(a) 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

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

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

(b) Suppose we add the following instruction to MARIE’s ISA:

JumpIOffset X

This instruction will jump to the address calculated by going to address X, then adding the value found there to the value in the AC. Show how this instruction would be executed using RTN. [5 marks]

(c) Write a MARIE program to allow the user to input 8 integers (positive, negative, or zero) and then find the smallest and the largest and print each of these out.

As an example, if the user enters the following decimal numbers as input (one after the other)

23, -6, 78, 0, 36, 3, -250, –5

the program would output the following values as the maximum and minimum, respectively:


Assume that the user will always provide valid numbers as input; that is, do not worry about dealing with invalid input data.

Write comments within your program so that a reader can understand it easily. [10 marks]

Do you need help with this or a different assignment? In a world where academic success does not come without efforts, we do our best to provide the most proficient and capable essay writing service. After all, impressing professors shouldn’t be hard, we make that possible. If you decide to make your order on our website, you will get 15 % off your first order. You only need to indicate the discount code GET15.

Order a Similar Paper Order a Different Paper