-
Notifications
You must be signed in to change notification settings - Fork 15
/
fibonacci.asm
84 lines (63 loc) · 1.18 KB
/
fibonacci.asm
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
;Code for Program to Print the Fibonacci series in Assembly Language
.MODEL SMALL
.STACK 64
.DATA
VAL1 DB 01H
VAL2 DB 01H
LP DB 00H
V1 DB 00H
V2 DB 00H
NL DB 0DH,0AH,'$'
.CODE
MAIN PROC
MOV AX,@DATA
MOV DS,AX
MOV AH,01H
INT 21H
MOV CL,AL
SUB CL,30H
SUB CL,2
MOV AH,02H
MOV DL,VAL1
ADD DL,30H
INT 21H
MOV AH,09H
LEA DX,NL
INT 21H
MOV AH,02H
MOV DL,VAL2
ADD DL,30H
INT 21H
MOV AH,09H
LEA DX,NL
INT 21H
DISP:
MOV BL,VAL1
ADD BL,VAL2
MOV AH,00H
MOV AL,BL
MOV LP,CL
MOV CL,10
DIV CL
MOV CL,LP
MOV V1,AL
MOV V2,AH
MOV DL,V1
ADD DL,30H
MOV AH,02H
INT 21H
MOV DL,V2
ADD DL,30H
MOV AH,02H
INT 21H
MOV DL,VAL2
MOV VAL1,DL
MOV VAL2,BL
MOV AH,09H
LEA DX,NL
INT 21H
LOOP DISP
MOV AH,4CH
INT 21H
MAIN ENDP
END MAIN