-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproc.asm
65 lines (48 loc) · 1.02 KB
/
proc.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
; This program prompts the user for three integers,
; stores them in an array, calculates the sum of the
; array, and displays the sum.
INCLUDE Irvine32.inc
Couter = 3
.data
msg1 byte "Enter a Signed integer : ",0
array dword 3 dup(?)
msg2 byte "The sum of array is : ",0
.code
main PROC
call Clrscr
mov ecx,Couter
mov esi,offset array
call PromptForIntegers
call ArraySum
call DisplaySum
exit
main ENDP
;-----------------------------------------------------
PromptForIntegers PROC uses ecx edx esi
mov edx,offset msg1
l1:
call writestring
call readint
call crlf
mov [esi],eax
add esi,Type dword
loop l1
ret
PromptForIntegers ENDP
;-----------------------------------------------------
ArraySum PROC uses ecx esi
mov eax,0
l1:
add eax,[esi]
add esi,type array
loop l1
ret
ArraySum ENDP
;-----------------------------------------------------
DisplaySum PROC uses edx
mov edx, offset msg2
call writestring
call writeint
ret
DisplaySum ENDP
END main