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 02:20
The reset circuit used on the four 3-bit counters analyzed in this activity reset the counts to zero (000). it makes sense for the up-counters to start at zero (000), but the down-counters should start at seven (111). what would you need to change so that the 3-bit binary down counter with j/k flip-flops you just created would reset to seven (111)?
Answers: 1
question
Computers and Technology, 23.06.2019 19:00
This question involves a class named textfile that represents a text file. public class textfile { private string filename; private string filename; private arraylist words; // constructors not shown // postcondition: returns the number of bytes in this file public int filesize() { } // precondition: 0 < = index < words.size() // postcondition: removes numwords words from the words arraylist beginning at // index. public void deletewords(int index, int numwords) { } // precondition: 0 < = index < = words.size() // postcondition: adds elements from newwords array to words arraylist beginning // at index. pub lic voidaddwords(int index, string[] newwords) { } // other methods not shown } complete the filesize() method. the filesize() is computed in bytes. in a text file, each character in each word counts as one byte. in addition, there is a space in between each word in the words arraylist, and each of those spaces also counts as one byte. for example, suppose the words arraylist stores the following words: { mary had a little lamb; its fleece was white as snow. } the filesize() method would compute 4 + 3 + 1 + 6 + 5 + 4 + 6 + 3 + 5 + 2 + 5 as the sum of the lengths of each string in the arraylist. the value returned would be this sum plus 10, because there would also be 10 spaces in between the 11 words. complete the filesize() method below: // postcondition: returns the number of bytes in this file public int filesize() { }
Answers: 1
question
Computers and Technology, 23.06.2019 19:30
2. fluorine and chlorine molecules are blamed fora trapping the sun's energyob forming acid rainoc producing smogod destroying ozone molecules
Answers: 2
question
Computers and Technology, 23.06.2019 22:20
Read “suburban homes construction project” at the end of chapters 8 and 9 (in the textbook) and then develop a wbs (work breakdown structure) in microsoft excel or in microsoft word (using tables)
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, 17.01.2020 19:31
question
Mathematics, 17.01.2020 19:31
question
English, 17.01.2020 19:31
question
Social Studies, 17.01.2020 19:31
Questions on the website: 13722361