Question: ***Please only add code to the highlighted lines (2 lines total) in assembly language*** edit code AREA Lab 06_YourFirstName_YourLastName, coDE, READONLY EXPORTmain main MOV RO,

 ***Please only add code to the highlighted lines (2 lines total) ***Please only add code to the highlighted lines (2 lines total) in assembly language***

edit code

AREA Lab 06_YourFirstName_YourLastName, coDE, READONLY EXPORTmain main MOV RO, SP: Replace with base register. MOV R1, #1 ; RI 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 RI, [RO], #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 Reset R1 to start from the beginning again for the 2nd loop. MOV R1, #1 ; MOV RO, 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 AREA Lab 06_YourFirstName_YourLastName, coDE, READONLY EXPORTmain main MOV RO, SP: Replace with base register. MOV R1, #1 ; RI 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 RI, [RO], #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 Reset R1 to start from the beginning again for the 2nd loop. MOV R1, #1 ; MOV RO, 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

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!