Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write the following code segment in MARIE\'s assembly language: if X > 1 do X =

ID: 3655506 • Letter: W

Question

Write the following code segment in MARIE's assembly language: if X > 1 do X = X + 1; else Y = Y + 1;

Explanation / Answer

If, Load X / Load X Subt One / Subtract 1, store result in AC Skipcond 800 / If AC>0 (X>1), skip the next instruction Jump Endif / Jump to Endif if X is not greater than 1 Then, Load X / Reload X so it can be doubled Add X / Double X Store Y / Y= X + X Load Zero / Move 0 into AC Store X / Set X to 0 Endif, Load Y / Load Y into AC Add One / Add 1 to Y Store Y / Y = Y + 1 Halt / Terminate program X, Dec ? / X has starting value, not given in problem Y, Dec ? / Y has starting value, not given in problem One, Dec 1 / Use as a constant Zero, Dec 0 / Use as a constant