Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
image text in transcribed
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

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

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

Students also viewed these Databases questions