Answered step by step
Verified Expert Solution
Question
1 Approved Answer
***PLEASE FINISH THE REST OF THE CODE THAT IS HIGHLIGHTED IN ASSEMBLY CODE*** Step 2: Use the following template by copying it to your Assembly
***PLEASE FINISH THE REST OF THE CODE THAT IS HIGHLIGHTED IN ASSEMBLY CODE***
Step 2: Use the following template by copying it to your Assembly file: AREA Lab_05_YourFirstName YourLastName, CODE, READONLY EXPORT main main MOV RO,Replacewith base register MOV R1, #1 ; RI will be used to increment the loop MOV R2, #16; R2 will represent the number of iterations. MOV R3, #0 ; R3 will be used to hold the sum of the array storeValuesLoop Store the value of R1 to address of RO, then auto increment the address by 4. Hint use STR instruction. ADD R1, #1; 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 Increment the Loop by adding 1 to R1 MOV R1, #8 ; Reset R1 to start from the middle for the 2nd loop. Not from the beginning, you will need to move to the middle of the array first with the code to reset the pointer to the middle to be able to use it in the 2n loop below. You will Reset need to write two instructions to do that readValuesLoop 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; 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 Increment the Loop by adding 1 to R1 stop B stop END Step 3: We are trying to evaluate the following formula, where R1-1, and R2 16: R2 16 R3 = (R2) = ( n ) = 108 n=8 Step 4: Make sure you replace the highlighted lines in Step 2 with the correct code. Hint: You don't need more than one instruction line for each highlighted line
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