Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Simple problem for you. Please view the screenshot below and corresponding copy/paste code, and rewrite only the two lines that are highlighted. please rewrite the

Simple problem for you.

Please view the screenshot below and corresponding copy/paste code, and rewrite only the two lines that are highlighted.

please rewrite the code based on the instructions in the second screenshot, labeled Step 4 and 5.

Please dont add any lines on code, should only be on the same line. thumbs up for good answer thanks. if anymore info needed please ask.

image text in transcribed

image text in transcribed

*********CODE**

AREA some_name, CODE, READONLY

EXPORT __main

__main

MOV R0, SP ; Replace ___ with base register.

MOV R1, #1 ; R1 will be used to increment the loop.

MOV R2, #20; R2 will represent the number of iterations.

MOV R3, #0 ; R3 will be used to hold the sum of the array.

storeValuesLoop

STR R1, [R0], #4;Store the value of R1 to address of R0, then auto increment the address by 4. Hint use STR instruction.

ADD R1, #1; Increment the Loop by adding 1 to R1

CMP R1, R2; Compare R1 & R2 to determine if we need to exit the loop or not

BLE storeValuesLoop; Stay in the loop if R1 is less than or equal to R2

MOV R1, #1 ; Reset R1 to start from the beginning again for the 2nd loop.

MOV R0, SP;

readValuesLoop

LDR R4, [R0], #4;Read the value of current iteration to R4. Hint use LDR instruction.

ADD R3, R4 ; Add the value your read [R4] to the sum [R3]

ADD R1, #1; Increment the Loop by adding 1 to R1

CMP R1, R2; Compare R1 & R2 to determine if we need to exit the loop or not

BLE readValuesLoop; Stay in the loop if R1 is less than or equal to R2

stop B stop

END

CODE, READONLY AREA EXPORT main main MOV RO, SP; MOV R1, #1 ; MOV R2, #20; MOV R3, #0 ; with base register. Replace Ri will be used to increment the loop R2 will represent the number of iterations. R3 will be used to hold the sum of the array storeValuesLoop STR R1, [R0], #4; Store the value of R1 to address of R0, then auto increment the address by 4. Hint use STR instruction. ADD R1, #1; CMP RI, R2; BLE storeValuesLoop: Stay in the loop if Ri is less than or equal to R2 MOV R1, #1 MOV RO, SP Increment the Loop by adding 1 to Rl Compare Rl &R2 to determine if we need to exit the loop or not Reset R1 to start from the beginning again for the 2nd loop. readValuesLoop R4, [R0], #4: Read the value of current iteration to R4. Hint use LDR instruction ADD R3, R4 ADD R1, #1; CMP Ri, R2; BLE readValuesLoop: Stay in the loop if R1 is less than or equal to R2 Add the value your read [R4] to the sum [R3] Increment the Loop by adding l to Ri Compare R1 &R2 to determine if we need to exit the loop or not stop B stop END

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 23rd European Conference Adbis 2019 Bled Slovenia September 8 11 2019 Proceedings Lncs 11695

Authors: Tatjana Welzer ,Johann Eder ,Vili Podgorelec ,Aida Kamisalic Latific

1st Edition

3030287297, 978-3030287290

More Books

Students also viewed these Databases questions

Question

1. Define the nature of interviews

Answered: 1 week ago

Question

2. Outline the different types of interviews

Answered: 1 week ago