-
Notifications
You must be signed in to change notification settings - Fork 0
/
Task 32.asm
118 lines (97 loc) · 1.56 KB
/
Task 32.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
.model small
.stack 100h
.data
msg1 db 'Enter a statement: $'
msg2 db 'Total Vowels: $'
msg3 db 'Total Consonants: $'
msg4 db 'Press Y to run again or ESC key to terminate: $'
vowels db '0'
consonants db '0'
.code
main proc
mov ax,@data
mov ds,ax
input:
lea dx,msg1
call display
characterCheck:
mov ah,1
int 21h
cmp al,13
je displayCount
cmp al,32
je characterCheck
cmp al,'A'
je vowel
cmp al,'a'
je vowel
cmp al,'E'
je vowel
cmp al,'e'
je vowel
cmp al,'I'
je vowel
cmp al,'i'
je vowel
cmp al,'O'
je vowel
cmp al,'o'
je vowel
cmp al,'U'
je vowel
cmp al,'u'
je vowel
jmp consonant
vowel:
inc vowels
jmp characterCheck
consonant:
inc consonants
jmp characterCheck
displayCount:
call newline
lea dx,msg2
call display
mov dl,vowels
mov ah,2
int 21h
call newline
lea dx,msg3
call display
mov dl,consonants
mov ah,2
int 21h
mov vowels,'0'
mov consonants,'0'
runAgain:
call newline
lea dx,msg4
call display
mov ah,1
int 21h
mov bl,al
call newline
cmp bl,'Y'
je input
cmp bl,27
je exit
jmp runAgain
exit:
mov ah,4ch
int 21h
main endp
display proc
mov ah,9
int 21h
ret
display endp
newline proc
mov dl,10
mov ah,2
int 21h
mov dl,13
mov ah,2
int 21h
ret
newline endp
end main