-
Notifications
You must be signed in to change notification settings - Fork 0
/
10_4.ASM
81 lines (72 loc) · 1.13 KB
/
10_4.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
TITLE TAKE INPUT n AND DISPLAY SUM OF MULTIPLICATION UPTO n
.MODEL SMALL
.STACK 64
.DATA
MAXLEN DB 100
ACTLEN DB ?
SENTENCE DB 100 DUP('$')
COUNT DW ?
RESCOUNT DB 8 DUP('$')
VOWEL DB "AEIOU", "$"
.CODE
MAIN PROC FAR
MOV AX, @DATA
MOV DS, AX
MOV DX, OFFSET MAXLEN
MOV AH, 0AH
INT 21H
MOV SI, OFFSET SENTENCE
MOV BX, 0
CHECK: MOV DL, [SI]
CMP DL, '$'
JE EXIT
CMP DL, 60H
JL OK
SUB DL, 20H
OK : MOV CX, 05
MOV DI, OFFSET VOWEL
CTD: CMP DL, [DI]
JNE ANOTHER
INC BX
JMP CONTINUE
ANOTHER:INC DI
LOOP CTD
CONTINUE:INC SI
JMP CHECK
EXIT: MOV COUNT, BX
CALL NUM2STR
MOV AX, 0200H
MOV DX, 0DH
INT 21H
MOV DX, 0AH
INT 21H
MOV DX, OFFSET RESCOUNT
MOV AH, 09H
INT 21H
MOV AH, 4CH
INT 21H
MAIN ENDP
NUM2STR PROC NEAR
MOV BX, 10
MOV AX, COUNT
MOV DI, 0080H
NEXT: XOR DX, DX
DIV BX
ADD DX, 30H
MOV [DI], DX
INC DI
CMP AX, 00
JNE NEXT
;REVERSE THE STRING
MOV CX, DI
MOV SI, DI
SUB CX, 80H
MOV DI, OFFSET RESCOUNT
ASCII: DEC SI
MOV AL, [SI]
MOV [DI], AL
INC DI
LOOP ASCII
RET
NUM2STR ENDP
END