-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathBaitap10.asm
115 lines (97 loc) · 1.97 KB
/
Baitap10.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
;nhap 2 so tu ban phim
; tinh a/b a*b khong su dung DIV va MUL
.model small
.stack 50
.data
so db 10,0,10 dup($)
muoi db 10
tb1 db 10,13,'A: $'
tb2 db 10,13,'B: $'
tb3 db 10,13,'A/B: $'
tb4 db 10,13,'A*B: $'
b1 dw 0
b2 dw 0
.code
main proc
mov ax,@data
mov ds,ax
mov ah,9
lea dx,tb1
int 21h
mov ah,0Ah
lea dx,so
int 21h
mov ah,9
lea dx,tb2
int 21h
call xulichuoi
mov b1,dx
mov ah,0Ah
lea dx,so
int 21h
call xulichuoi
mov b2, dx
mov ah,9
lea dx,tb3
int 21h
mov dx,b1
mov ax,b2
xor cx,cx
chia:
sub dx,ax
inc cx
cmp dx,ax
jae chia
mov ax,cx
Call Inchuoi
lea dx,tb4
mov ah,9
int 21h
xor cx,cx
xor dx,dx
mov cx,b2
Nhan:
add dx,b1
Loop Nhan
mov ax,dx
Call inchuoi
mov ah,4Ch
int 21h
main endp
inchuoi PROC
xor cx,cx
Lapchia:
xor dx,dx
div muoi
add ah,30h
mov dl,ah
push dx
inc cx
xor ah,ah
cmp ax,0
jne Lapchia
Hienthi:
pop dx
mov ah,2
int 21h
loop Hienthi
ret
inchuoi ENDP
xulichuoi PROC
xor dx,dx
xor cx,cx
lea si,so + 2
mov cl,[so+1]
Lap:
mov ax,dx
xor bx,bx
mov bl,[si]
sub bl,30h
mul muoi
add ax,bx
mov dx,ax
inc si
loop Lap
ret
xulichuoi ENDP
end main