This repository has been archived by the owner on Nov 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
4.3.asm
113 lines (100 loc) · 1.4 KB
/
4.3.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
data segment
str1 db "num of alphabet :$"
str2 db "num of number :$"
str3 db "num of others :$"
alph db 0
num db 0
others db 0
ends
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax
mov bx,0
mov si,offset alph
input:
mov ah,01h
int 21h
cmp al,0dh
je print
cmp al,30h
jb addothers
cmp al,3ah
jb addnum
cmp al,41h
jb addothers
cmp al,5bh
jb addalph
cmp al,61h
jb addothers
cmp al,7bh
jb addalph
jmp addothers
loop input
print:
call calf
lea dx,str1
mov ah,09h
int 21h
call print1
inc si
call calf
lea dx,str2
mov ah,09h
int 21h
call print1
inc si
call calf
lea dx,str3
mov ah,09h
int 21h
call print1
mov ax,00h
int 21h
print1:
mov cx,0
mov dx,0
mov di,0ah
mov al,[si]
mov ah,00h
ToTen:
div di
push dx
inc cx
cmp ax,0
je next1
cwd
jmp ToTen
next1:
pop dx
add dl,30h
mov ah,02h
int 21h
loop next1
ret
addalph:
mov dl,[si]
inc dl
mov [si],dl
jmp input
addnum:
mov dl,[si+1]
inc dl
mov [si+1],dl
jmp input
addothers:
mov dl,[si+2]
inc dl
mov [si+2],dl
jmp input
calf:
mov dl,0ah
mov ah,02h
int 21h
mov dl,0dh
mov ah,02h
int 21h
ret
ends
end start