forked from shoaib30/Microprocessor-Lab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFIB.asm
More file actions
56 lines (51 loc) · 1015 Bytes
/
FIB.asm
File metadata and controls
56 lines (51 loc) · 1015 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
50
51
52
53
54
55
56
;FIB.asm
;Shoaib Ahmed
;06.09.2015
;Fibbonacci
assume cs:code,ds:data
data segment
fib db 10 dup(?)
data ends
code segment
START: MOV ax,data
MOV ds,ax
MOV al,0; (n-2)
LEA si,fib
MOV [si],al
MOV bl,1; (n-1)
INC si
MOV [si],bl
INC si
XOR ch,ch
MOV cl,8
RPT: ADD al,bl
MOV [si],al
INC si
XCHG al,bl
LOOP RPT
LEA si,fib
MOV cx,10
PRINT: MOV al,[si]
CALL DISP
MOV dx,' '
MOV ah,2h
INT 21h
INC si
LOOP PRINT
MOV ah,4ch
INT 21h
DISP PROC
AAM
ADD ax,3030h
MOV dl,ah
PUSH ax
MOV ah,2
INT 21h
POP ax
MOV dl,al
MOV ah,2
INT 21h
RET
DISP ENDP
code ends
END START