SPP7 - call WriteString call WriteInt call Crlf pop edx ret...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
TITLE SPP7 INCLUDE Irvine32.inc IntegerCount = 20 .data promptl BYTE "Enter a signed integer: ",0 prompt2 BYTE "The sum of the integers is: ",0 prompt3 BYTE "How many integers will be added? ",0 prompt4 BYTE "The array cannot be larger than ",0 array DWORD IntegerCount DUP(?) a .code main PROC call Clrscr mov esi,OFFSET array ; mov ecx, IntegerCount call NumberOfIntegers call PromptForIntegers call ArraySum call DisplaySum exit main ENDP m PromptForIntegers PROC pushad mov edx,OFFSET promptl Ll: call WriteString call ReadInt call Crlf mov [esi],eax add esi,4 loop Ll popad ret PromptForIntegers ENDP P ArraySum PROC push esi push ecx mov eax,0 L1: add eax,[esi] add esi,4 loop L1 pop ecx pop esi ret ArraySum ENDP A DisplaySum PROC push edx mov edx,OFFSET prompt2
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: call WriteString call WriteInt call Crlf pop edx ret DisplaySum ENDP D NumberOfIntegers PROC push edx push eax mov edx,OFFSET prompt3 call WriteString ;prompt for the number of integers call ReadInt ;get the number of integers entered by the user cmp eax,IntegerCount ;compare it to the number of integers allowed jna L2 ;if not above get the numbers and process the array mov edx,OFFSET prompt4 ;if above display message and terminate the program call WriteString mov eax,IntegerCount call WriteDec call CrLf pop eax pop edx exit ret L2: mov ecx,eax ;the number of integers is stored in ecx pop eax pop edx ret NumberOfIntegers ENDP END main...
View Full Document

Page1 / 2

SPP7 - call WriteString call WriteInt call Crlf pop edx ret...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online