subject

Modify the summation program attached as follows: select an array size using a constant: array_size = 20 array dword array_size write a new procedure that prompts the user for the number of integers to be processed. pass the same value to the promptforintegers procedure. how many integers wil be added? 19 title integer summation program (sum2.asm) ; this program inputs multiple integers from the user, ; stores them in an array, calculates the sum of the ; array, and displays the sum. include irvine32.inc integercount = 3 ; array size .data prompt1 byte "enter a signed integer: ",0 prompt2 byte "the sum of the integers is: ",0 array dword integercount .code main proc call clrscr mov esi, offset array mov ecx, integercount call promptforintegers call arraysum call displaysum exit main endp ; promptforintegers proc ; ; prompts the user for an array of integers, and fills ; the array with the user's input. ; receives: esi points to the array, ecx = array size ; returns: nothing ; pushad ; save all registers mov edx, offset prompt1 ; address of the prompt l1: call writestring ; display string call readint ; read integer into eax call crlf ; go to next output line mov [esi],eax ; store in array add esi,4 ; next integer loop l1 l2: popad ; restore all registers ret promptforintegers endp ; arraysum proc ; ; calculates the sum of an array of 32-bit integers. ; receives: esi points to the array, ecx = array size ; returns: eax = sum of the array elements ; push esi ; save esi, ecx push ecx mov eax,0 ; set the sum to zero l1: add eax,[esi] ; add each integer to sum add esi,4 ; point to next integer loop l1 ; repeat for array size l2: pop ecx ; restore ecx, esi pop esi ret ; sum is in eax arraysum endp ; displaysum proc ; ; displays the sum on the screen ; recevies: eax = the sum ; returns: nothing ; push edx mov edx, offset prompt2 ; display message call writestring call writeint ; display eax call crlf pop edx ret displaysum endp end main

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 15:10
Which activity should be part of a long-term plan to positively affect yourhealth? oa. wearing regular clothing when handling toxinsob. not worrying about secondhand smokeoc. avoiding excessive exposure to sunlightod. drinking only well water
Answers: 1
question
Computers and Technology, 22.06.2019 21:00
The average cost of one year at a private college in 2012-2013 is $43,289. the average grant aid received by a student at a private college in 2012-2013 is $15,680.   what is the average student contribution for one year at a private college in 2012-2013?
Answers: 3
question
Computers and Technology, 23.06.2019 02:30
What is the power dissipated by a resistor with a current of 0.02 a and a resistance of 1,000 ? a. 200 w b. 20 w c. 0.4 w d. 4 w
Answers: 1
question
Computers and Technology, 23.06.2019 06:40
What are the three uses of a screw?
Answers: 2
You know the right answer?
Modify the summation program attached as follows: select an array size using a constant: array_siz...
Questions
Questions on the website: 13722361