Q> With the assumption that there are 100 eight bit data in a table starting form A000H, Write an 8085 program to find the sums of even and odd numbers of the table and store the 16-bit sums at the end of the table.
Solution:
LXI B,A000H
LXI D,0000H
LXI H,0000H
START: LDAX B
RRC
JC ODD
RLC
ADD E
JNZC P1
INR D
P1: MOV E,A
JMP INCR
ODD: RLC
ADD L
JNC P2
INR H
P2: MOV L,A
INCR: INX B
MOV A,C
CPI 64H
JNZ START
SHLD A064H
XCHG
SHLD A066H
HLT
Solution:
LXI B,A000H
LXI D,0000H
LXI H,0000H
START: LDAX B
RRC
JC ODD
RLC
ADD E
JNZC P1
INR D
P1: MOV E,A
JMP INCR
ODD: RLC
ADD L
JNC P2
INR H
P2: MOV L,A
INCR: INX B
MOV A,C
CPI 64H
JNZ START
SHLD A064H
XCHG
SHLD A066H
HLT