Question: Given a JAVA pseudo code in the following, Write its equivalent code segment in MARIE assembly language first and then assemble it using MARIE simulator

Given a JAVA pseudo code in the following, Write its equivalent code segment in MARIE assembly language first and then assemble it using MARIE simulator and finally execute it by loading it into MARIE simulator. make sure you comment each line of your codes, and the screenshot of the MARIE simulator after executing the assembly program. (Also show the machine code that you wrote).

int sum = 0;

for (int i = 0; i < 10; i++) { sum = sum + i;

}

Hint: the following code can be used to initialize the variables sum, i, one, and ten, in which sum is initialized to 0, i is 0, one is 1 and ten is initialized to 10.

sum, DEC 0 / initial value of sum, i.e. 0, used to save result i, DEC 0 /used for loop counter

one, DEC 1 /used for counter, subtract one after each loop

ten, DEC 10 / because we will repeatedly add 10 times

Comment each instruction in your program to explain its contents and functionality.

Use correctly ORG to start your program and halt to terminate your program.

Use ADD correctly to add the numbers.

Use STORE correctly to store the result back to sum.

Use SKIPCOND and JUMP correctly to implement a loop.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!