Saturday, 6 October 2012

FACTORIAL OF NO 8086 PROGRAME

FACTORIAL OF NO 8086 PROGRAME:

.model small
.stack 100h
.data
m0 db 0dh,0ah,"enter the number:$"
m1 db 0dh,0ah,"factorial is: 1 $"
m3 db 0dh,0ah,"factorial is : $"
.code
.startup
lea dx,m0
mov ah,09h
int 21h
mov ah,01h
int 21h
sub al,30h
cmp al,00h
je l1
mov bl,al
lea dx,m3
mov ah,09h
int 21h
mov al,bl
l2:
sub bl,01h
cmp bl,00h
je l3
mov ah,00h
mul bl
jmp l2
l3:
mov cl,0ah
div cl
mov bl,ah
mov ah,00h
div cl
mov bh,ah
mov ah,00h
mov dl,al
add dl,30h
mov ah,02h
int 21h
mov dl,bh
add dl,30h
mov ah,02h
int 21h
mov dl,bl
add dl,30h
mov ah,02h
int 21h
jmp exit

l1:
lea dx,m1
mov ah,09h
int 21h
jmp exit
exit:

.exit
end

0 comments:

Post a Comment