Computers and Technology

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

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 21:30, kikilax
What is linux? an open source operating system a version of ms dos the first version of unix the newest technology available
Answers: 1
image
Computers and Technology, 23.06.2019 15:00, abelxoconda
1. which of the following statements are true about routers and routing on the internet. choose two answers. a. protocols ensure that a single path between two computers is established before sending packets over it. b. routers are hierarchical and the "root" router is responsible for communicating to sub-routers the best paths for them to route internet traffic. c. a packet traveling between two computers on the internet may be rerouted many times along the way or even lost or "dropped". d. routers act independently and route packets as they see fit.
Answers: 2
image
Computers and Technology, 25.06.2019 11:30, robertabenavidesq
Janet has created an original musical composition, recorded it on a cd and registered her work online. which law will protect her work from any kind of infringement? a. copyright b. trademark c. patent d. trade secret
Answers: 2
image
Computers and Technology, 25.06.2019 17:30, chavez0
Is the number of sentinels that need to agree the fact that the master is not reachable and make a failover procedure promoting slave to master.
Answers: 1
Do you know the correct answer?
Modify the summation program attached as follows: select an array size using a constant: array_siz...

Questions in other subjects:

Konu
English, 15.01.2021 01:30
Konu
Mathematics, 15.01.2021 01:30