Question: Using the code below, write a program that calculates the sum of all the values in the list and displays that value in r1 .
Using the code below, write a program that calculates the sum of all the values in the list and displays that value in r1. Assembly/ARM /* ------------------------------------------------------- listdemo.s Traverses all elements of an integer list. R0: temp storage of value in list R2: address of start of list R3: address of end of list ------------------------------------------------------- */ .org 0x1000 // Start at memory location 1000 .text // Code section .global _start _start: LDR R2, =Data // Store address of start of list LDR R3, =_Data // Store address of end of list Loop: LDR R0, [R2], #4 // Read address with post-increment (R0 = *R2, R2 += 4) CMP R3, R2 // Compare current address with end of list BNE Loop // If not at end, continue _stop: B _stop .data .align Data: .word 4,5,-9,0,3,0,8,-7,12 // The list of data _Data: // End of list address .end
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
