Question: Exercise 4.5. Modify the program given in Example 41 so that we can find the sum of the first 10 odd numbers. Example 4.1 (The

 Exercise 4.5. Modify the program given in Example 41 so that
we can find the sum of the first 10 odd numbers. Example

Exercise 4.5. Modify the program given in Example 41 so that we can find the sum of the first 10 odd numbers. Example 4.1 (The first assembly program.). The complete assembly program for summing first five even integers is given below, which can be compiled and executed. This assembly program does not require startup.s' file. THUMB ; Marks the THUMB mode of operation StackSize EQU 0x00000100 ; Define stack size of 256 byes AREA STACK, NOINIT, READWRITE, ALIGN-3 MyStackMem SPACE StackSize AREA RESET, READONLY EXPORT _Vectors Vectors DCD MyStackMem + StackSize ; stack pointer for empty stack DCD Reset_Handler reset vector AREA MYCODE, CODE, READONLY ENTRY EXPORT Reset_Handler Reset Handler MOV Re, #8 Initial value of sum MOV R1, #2 First even numben MOV R2, #5 ; Counter for the loop iterations I begin CBZ R2, lend ADD Re, R1 ADD R1, #2 SUB R2, #1 Blbegin lend END Terminate loop if counter is zero Build the sun Generate next even number : Decrement the counter

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!