.model small
.code
org 100h
tdata : jmp proses
uji0 db 'Hasil jumlah : B + D = $'
uji1 db 13,10,'Hasil kurang : D - F = $'
uji2 db 13,10,'Hasil kali : A * E = $'
uji3 db 13,10, 'Hasil bagi : D / E = $'
uji4 db 13,10, 'Hasil (A + B) / C = $'
uji5 db 13,10, 'Hasil (C * D) + E = $'
uji6 db 13,10, 'Hasil (B - A) / C = $'
A dw 12
B dw 28
C dw 6
D dw 20
E dw 8
CetKal proc near
mov ah,09h
int 21h
ret
CetKal endp
CetAng proc near
mov bx,10
xor cx,cx
ulang:
xor dx,dx
div bx
push dx
inc cx
cmp ax,0
jne ulang
cetak :
pop dx
add dl,'0'
mov ah,02h
int 21h
loop cetak
ret
CetAng endp
proses :
mov dx, offset uji0
call CetKal
mov ax,D
mov bx,C
add ax,bx
call CetAng
mov dx, offset uji1
call CetKal
mov ax,B
mov bx,C
sub ax,bx
call CetAng
mov dx, offset uji2
call CetKal
mov ax,A
mov bx,E
mul bx
call CetAng
mov dx, offset uji3
call CetKal
mov ax,D
mov bx,E
xor dx,dx
div bx
call CetAng
mov dx, offset uji4
call CetKal
mov ax,A
mov bx,B
add ax,bx
mov bx,C
xor dx,dx
div bx
call CetAng
mov dx, offset uji5
call CetKal
mov ax,C
mov bx,D
mul bx
mov bx,E
add ax,bx
call CetAng
mov dx, offset uji6
call CetKal
mov ax,B
mov bx,A
sub ax,bx
mov bx,C
xor dx,dx
div bx
call CetAng
int 20h
end tdata