forked from shoaib30/Microprocessor-Lab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFACTORIAL.asm
More file actions
49 lines (42 loc) · 778 Bytes
/
FACTORIAL.asm
File metadata and controls
49 lines (42 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
;shoaib ahmed
;30.9.15
;factorial
;FACT.asm
assume cs:code,ds:data
data segment
x db 4
fact db ?
data ends
code segment
START: MOV ax,data
MOV ds,ax
MOV al,x
CALL FACTO
MOV al,fact
AAM
ADD ax,3030h
PUSH ax
MOV dl,ah
MOV ah,2h
INT 21h
POP ax
MOV dl,al
MOV ah,2h
INT 21h
MOV ah,4ch
INT 21h
FACTO PROC
CMP al,1
JBE FIN
PUSH ax
DEC al
CALL FACTO
POP ax
MUL fact
MOV fact,al
RET
FIN: MOV fact,1
RET
FACTO ENDP
code ends
end start