0% found this document useful (0 votes)
28 views3 pages

Recursive Factorial in 8086 Assembly

Uploaded by

malikuzair1242
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views3 pages

Recursive Factorial in 8086 Assembly

Uploaded by

malikuzair1242
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Name Muhammad Osama

[Link] Sp23-Bcs-072
Tutor [Link]

Lab Report: Recursive Factorial Calculation in Assembly


Language (8086)
Objective
The objective of this lab task is to implement recursion in assembly language on the 8086
microprocessor to calculate the factorial of a given number and store the result in RAM.
This task demonstrates the use of stack operations, recursive calls, and proper memory
management.

Code

mov ax, 0200h


mov sp, 0400h
mov ax, 0300h
mov ds, ax

mov ax, 4

call recursion
mov [0100h], ax
hlt

recursion proc
cmp ax, 1
jz end_rec
push ax
dec ax
call recursion
pop bx
mul bx
end_rec:
ret
recursion endp

mov ax, 0200h


mov ss, ax
mov sp, 0400h
mov ax, 0300h
mov ds, ax

mov ax, 4

call recursion
mov [0100h], ax
hlt

recursion proc
cmp ax,1
jz end_rec
push ax
dec ax
call recursion
pop bx
mul bx
end_rec:
ret
recursion endp

You might also like