Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

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

Semantics Of A Networked World Semantics For Grid Databases First International Ifip Conference Icsnw 2004 Paris France June 2004 Revised Selected Papers Lncs 3226

Authors: Mokrane Bouzeghoub ,Carole Goble ,Vipul Kashyap ,Stefano Spaccapietra

2004 Edition

3540236090, 978-3540236092

More Books

Students also viewed these Databases questions