Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You have to create a MARIE Computer Simulator. So basically, you have to write a program that takes the assembly code as input and write
You have to create a MARIE Computer Simulator.
So basically, you have to write a program that takes the assembly code as input and write the output of accumulator when it sees HALT instruction.
You can use JAVA to the write the program.
Sample input file contents:
100 Load 104
101 Add 105
102 Store 106
103 HALT
104 0023
105 FFE9
106 0000
The output should be for example, like the image below.
ORG 100 Example 4.1 Load Addr /Load address of first number to be added Store Next /Store this address is our Next pointer Load Num /Load the number of items to be added Subt One /Decrement to control looping Store Ctr /Store this value in Ctr oop, Load Sum /Load the Sum into AC Next /Add the value pointed to by location Next AddI Store Sum /Store this sum Load Next /Load Next Add One /Increment by one to point to next address Store Next /Store in our pointer Next Load Ctr /Load the loop control variable Subt One /Subtract one from the loop control variable Store Ctr /Store this new value in loop control variable Skip Cond 000 /If control variable 0, skip next instruction Loop /Otherwise, go to Loop Jump Halt /Terminate program Addr Hex 117 /Numbers to be summed start at location 118 /A pointer to the next number to add Next Hex /The number of values to add Num Dec Sum Dec The sum Ctr Hex /The loop control variable One /Used to increment and decrement by 1 DeC 10 /The values to be added together Dec Dec 15 Dec 20 25 Dec Dec 30Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started