ASM Project
ASM Project
Introduction
1
CALCULATING FACTORIAL NUMBER
About
2
CALCULATING FACTORIAL NUMBER
3
CALCULATING FACTORIAL NUMBER
Advantages:
Efficient Resource Utilization: Assembly language allows
direct control over hardware, making it highly efficient in terms
of memory and processor usage. This results in faster execution
and optimized use of system resources.
4
CALCULATING FACTORIAL NUMBER
Code:
1. .MODEL SMALL
2. .STACK 100H
3. .data
4. MSG_PROMPT DB 'Enter a number (0-7): $'
5. MSG_RESULT DB 'Factorial is: $'
6. INPUT_NUM DB 0
7. FACTORIAL_RESULT DW 1
8. NEWLINE DB 0DH, 0AH, '$'
9.
10. .CODE
11. MAIN PROC
12. MOV AX, @data
13. MOV DS, AX
14. LEA DX, MSG_PROMPT
15. MOV AH, 09H
16. INT 21H
17. MOV AH, 01H
18. INT 21H
19. SUB AL, '0'
20. MOV INPUT_NUM, AL
21. MOV AL, INPUT_NUM
22. MOV AH, 0
23. MOV CX, AX
24. MOV AX, 1
25.
26. FACTORIAL_LOOP:
27. CMP CX, 1
28. JLE DISPLAY_RESULT
29. MUL CX
30. DEC CX
31. JMP FACTORIAL_LOOP
32.
33. DISPLAY_RESULT:
34. MOV FACTORIAL_RESULT, AX
35. LEA DX, MSG_RESULT
36. MOV AH, 09H
37. INT 21H
38. MOV AX, FACTORIAL_RESULT
39. CALL PRINT_NUMBER
40. LEA DX, NEWLINE
5
CALCULATING FACTORIAL NUMBER
Output:
6
CALCULATING FACTORIAL NUMBER
7
CALCULATING FACTORIAL NUMBER
Conclusion:
8
CALCULATING FACTORIAL NUMBER
Reference:
1. https://www.geeksforgeeks.org/advantages-and-disadvantages-
of-assembler/?utm_source=chatgpt.com
2. https://www.ibm.com/docs/en/z-netview/6.3.0?
topic=SSZJDU_6.3.0/com.ibm.iznetview.doc_6.3.0/
dqe_api_wwial.htm
3. https://medium.com/%40abnerrjo/factorial-function-in-
assembly-363f507773e2
4. https://www.youtube.com/watch?v=hY9P2mfNNQU
5. https://www.geeksforgeeks.org/8086-program-find-factorial-
number/?utm_source=chatgpt.com