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 11:00
The editing of digital photos us about the same level of difficulty as editing an analog photo
Answers: 2
question
Computers and Technology, 22.06.2019 15:30
When creating a budget, log fixed expenses before income. after income. after savings. at the top.
Answers: 1
question
Computers and Technology, 23.06.2019 18:30
The computers in the sales department did not have enough data storage capacity to contain all the information the department needed to store, and it was taking a long time for team members to access the data they needed. to fix the problem, the technician installed new, larger hard drives on all the computers.
Answers: 1
question
Computers and Technology, 23.06.2019 22:30
What would be the address of the cell, which is at the intersection of the second row and the third column in a worksheet?
Answers: 1
You know the right answer?
Modify the summation program attached as follows: select an array size using a constant: array_siz...
Questions
question
Mathematics, 24.01.2020 17:31
question
Chemistry, 24.01.2020 17:31
question
Mathematics, 24.01.2020 17:31
question
Chemistry, 24.01.2020 17:31
question
Chemistry, 24.01.2020 17:31
question
Social Studies, 24.01.2020 17:31
question
Mathematics, 24.01.2020 17:31
Questions on the website: 13722360