PROGRAM
.model small
.stack
print macro p
lea dx,p
mov ah,09h
int 21h
endm
.data
m1 db 10,13,"Enter the binary
Number:$"
m2 db 10,13,"The Decimal Number:$"
res dw ?
.code
mov
ax,@data
mov
ds,ax
print
m1
mov
cx,08
mov
bl,128
l3: mov
ah,01h
int
21h
mov
ah,00h
sub
al,30h
mul
bl
push
ax
mov
bh,00
mov
ax,bx
mov
bl,02
div
bl
mov
bx,ax
mov
bh,00
loop
l3
mov
cx,07
pop
ax
l4: pop
bx
add
ax,bx
loop
l4
mov
res,ax
print
m2
mov
cx,00
mov
ax,res
mov
bx,0ah
l1: mov
dx,00
div
bx
push
dx
inc
cx
cmp
ax,00
jnz
l1
l2: pop
dx
add
dx,30h
mov
ah,02h
int
21h
loop
l2
mov
ah,4ch
int
21h
end
mov
ah,4ch
int
21h
end
OUTPUT
Enter the binary Number: 10110100
The Decimal Number: 180
No comments:
Post a Comment