-
Notifications
You must be signed in to change notification settings - Fork 0
/
mycode.asm
103 lines (72 loc) · 1.42 KB
/
mycode.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
;REMINDER! CHANGE CODE A LITTLE BIT THANKS!
;NAEEM UR RAHMAN SAJID
.model small
.data
S1 dw 0AH,0DH,"Enter the Number : $"
YES dw 0AH,0DH,"Yes, This Number is Fibacconi Series !$"
NO dw 0AH,0DH,"No, This Number is not in Fibacconi series!$"
series db 100
.code
main proc
MOV AX,@DATA
MOV DS,AX
;Generate the fibonacci series in memoey
MOV AL,0H
MOV SI,offset series
MOV [SI],AL
INC SI
ADD AL,01H
MOV [SI],AL
MOV CX,0AH
SUB CX,02H
L:
MOV AL,[SI-1]
ADD AL,[SI]
INC SI
MOV [SI],AL
LOOP L
; print series
mov cl,0Ah
MOV SI,offset series
nloop:
mov al,[si]
AAM
mov dl,ah
mov bl,al
add dl,30h
mov ah,02
int 21h
mov dl,bl
add dl,30h
mov ah,02
int 21h
inc si
loop nloop
;Check the number is in fibonacci series or not
MOV DX,OFFSET S1
MOV AH,09H
INT 21H
MOV AH,01
INT 21H
MOV BL,AL
SUB BL,30H
MOV CX,0AH
MOV SI,offset series
M:
MOV BH,[SI]
CMP BL,BH
JE N
INC SI
LOOP M
MOV DX,OFFSET NO
MOV AH,09H
INT 21H
JMP END
N:
MOV DX,OFFSET YES
MOV AH,09H
INT 21H
END:
HLT
main endp
end main