Question: 5. TASK-4 : Simple Program with Loops Branching instructions can be used to implement loops in assembly language. For example if we want to find

 5. TASK-4 : Simple Program with Loops Branching instructions can be
used to implement loops in assembly language. For example if we want

5. TASK-4 : Simple Program with Loops Branching instructions can be used to implement loops in assembly language. For example if we want to find the sum of five numbers which are stored in the memory, then the first step is to initialize a counter to indicate how many numbers there are This counter can be implemented using a data meister. The second step would be to initialize the sum toer so that we can add the numbers accumulatively to this sum Again, the sum can be implemented using a second datang . At that we start adding data from memory to the sum while des ting the counter by each time When the counter reaches , this means that all the numbers have been used and the program can finish. At this point we can move them from the data wer to memory for storage. The flow chart below describes the loop used to add a list of five mus Write an embly program to demonstrate the loop shown in the flow chart below The numbers can be stored using the DCD directive.Forcample in the section where constants are defined, write: const_values DCD 561.23 LOCEM 0 2 Page of 10 The pointer to data can be implemented using a general register that stores the address of the first number. For example: LDR R2-const_values; load starting memory address of the array in R2 Then, to advance the pointer to the location of the next number. An offset of 4 bytes must be added ADDS R2, R2,0 ; update to the next address, after 4 bytes COUNTERS COUNTER Task 4: Code with comments Screenshots of the final SUM

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!