Aim
Write a program to perform division of 8 bit numbers
Program
Write a program to perform division of 8 bit numbers
Program
assume cs:code,ds:data
data segment
m1 db 0ah,0dh,"enter no 1: $"
m2 db 0ah,0dh,"enter no 2: $"
m3 db 0ah,0dh,"result:$"
r1 db 0ah,0dh,"Quotient:$"
r2 db 0ah,0dh,"Reminder:$"
data ends
code segment
start:mov ax,data
mov ds,ax
lea dx,m1
mov ah,09h
int 21h
mov ah,01h
int 21h
mov bh,al
mov ah,01h
int 21h
mov bl,al
lea dx,m2
mov ah,09h
int 21h
mov ah,01h
int 21h
mov ch,al
mov ah,01h
int 21h
mov ah,ch
sub bx,3030h
sub ax,3030h
aad
mov cl,al
mov ax,bx
aad
mov ah,00h
div cl
add ax,3030h
mov bx,ax
lea dx,m3
mov ah,09h
int 21h
lea dx,r1
mov ah,09h
int 21h
mov dl,bl
mov ah,02h
int 21h
lea dx,r2
mov ah,09h
int 21h
mov dl,bh
mov ah,02h
int 21h
mov ah,4ch
int 21h
code ends
end start
data segment
m1 db 0ah,0dh,"enter no 1: $"
m2 db 0ah,0dh,"enter no 2: $"
m3 db 0ah,0dh,"result:$"
r1 db 0ah,0dh,"Quotient:$"
r2 db 0ah,0dh,"Reminder:$"
data ends
code segment
start:mov ax,data
mov ds,ax
lea dx,m1
mov ah,09h
int 21h
mov ah,01h
int 21h
mov bh,al
mov ah,01h
int 21h
mov bl,al
lea dx,m2
mov ah,09h
int 21h
mov ah,01h
int 21h
mov ch,al
mov ah,01h
int 21h
mov ah,ch
sub bx,3030h
sub ax,3030h
aad
mov cl,al
mov ax,bx
aad
mov ah,00h
div cl
add ax,3030h
mov bx,ax
lea dx,m3
mov ah,09h
int 21h
lea dx,r1
mov ah,09h
int 21h
mov dl,bl
mov ah,02h
int 21h
lea dx,r2
mov ah,09h
int 21h
mov dl,bh
mov ah,02h
int 21h
mov ah,4ch
int 21h
code ends
end start
No comments:
Post a Comment
Post Your valuable comments here ..........