PROGRAM: Generation of Fibonacci Series
PROGRAM: Generation of Fibonacci Series
Address
2000
Mnemonics
MVI
Operand
D, 08H
2001
Opcode
16
Remarks
Initialize counter to display numbers in series.
08
06
00
0E
01
21
2007
00
Lower-order of 3000H.
2008
30
Higher-order of 3000H.
2002
MVI
B, 00H
2003
2004
MVI
C, 01H
2005
2006
LXI
H, 3000H
2009
MOV
M, B
70
200A
INX
23
200B
MOV
M, C
71
200C
MOV
A, B
78
200D
ADD
81
200E
MOV
B, C
41
200F
MOV
C, A
4F
2010
INX
23
2011
MOV
M, A
77
2012
DCR
15
Decrement counter.
2013
JNZ
200DH
C2
2014
0D
Lower-order of 200DH.
2015
20
Higher-order of 200DH.
76
Halt.
2016
HLT
Mnemonics
MVI
Operand
B, 05H
MVI
C, 05H
LXI
H, 3000H
MOV
INX
CMP
JC
A, M
H
M
2015H
JZ
2015H
2010
MOV
D, M
56
2011
2012
2013
2014
2015
2016
2017
2018
2019
201A
201B
201C
201D
MOV
DCX
MOV
INX
DCR
JNZ
M, A
H
M, D
H
C
2007H
DCR
JNZ
B
2002
77
2B
72
23
0D
C2
07
20
05
C2
02
20
76
HLT
Opcode
06
05
0E
05
21
00
30
7E
23
BD
DA
15
20
CA
15
20
Remarks
Initialize counter-1.
Immediate value 05H.
Initialize counter-2.
Immediate value 05H.
Load H-L pair with address 3000H.
Lower-order of 3000H.
Higher-order of 3000H.
Move the number from memory to reg. A.
Increment H-L pair.
Compare the number with next number.
Dont interchange if number < next number.
Lower-order of 2015H.
Higher-order of 2015H.
Dont interchange if number = next number.
Lower-order of 2015H.
Higher-order of 2015H.
Otherwise, swap the numbers. Move next
number from memory to D.
Move first number from A to memory.
Decrement H-L pair.
Move next number from D to memory.
Increment H-L pair.
Decrement counter 2.
If counter-2 0, repeat.
Lower-order of 2007H.
Higher-order of 2007H.
Decrement counter-1.
If counter-1 0, repeat.
Lower-order of 2002H.
Higher-order of 2002H.
Halt.