Question
The following MARIE assembly program first creates an array of 5 numbers. The array starts at memory word #30 and ends at memory word #34.
The following MARIE assembly program first creates an array of 5 numbers. The array starts at memory word #30 and ends at memory word #34. It contains integers 3, 10, 17, 24, 31.
After creating the list in the memory, the program asks for an address (suppose we will enter 0x33, that is HEX 33). The program is supposed to swap the contents of this memory address with the contents of the next memory address (HEX 34).
The beginning part of a working program is given below and you will complete the rest. Submit your code and sample run screenshots, include comments in your program.
NOTE/HINT: If we had an instruction for register indirect load instruction (something like LOAD_RI) that would have solved the problem: The ID of the AC register is 4. Therefore LOAD_RI 4 would have used the contents of register-4 (AC) as the memory address of the data. But we do not have an instruction like LOAD_RI, therefore we will make use of memory-indirect addressing for this problem.
LOAD addr
STORE next
loop, LOAD start
STOREI next
ADD step
STORE start
LOAD next
ADD one
STORE next
LOAD cnt
SUBT one
STORE cnt
SKIPCOND 400
JUMP loop
INPUT
STORE X
LOADI X
OUTPUT
STORE TEMP
LOAD X
ADD one
STORE X
LOADI X
STORE TEMP2
Step 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