Program to ADD the
8-bits N numbers stored sequentially from m/m location 0001H, the
value of N being stored at 0000H if D6 is 1
LXI H, 0000H
MOV B,M
XRA A
MOV D,A ; To store
the sum
MOV E,A ; To store
the carry
INX H ;
Pointing to the first 8-bit number
LOOP:
MOV A,M
ANI 40H
****
CPI 40H
JNZ SKIP
MOV A,M
ADD D
MOV D,A
JNC SKIP
INR E
SKIP:
INX H
DCR B
JNZ LOOP
LXI H, 2000H
MOV M,D ; Store the
sum at 2000H
INX H
MOV M,E ; Store the
carry at 2001H
RST5
****
D7D6D5D4D3D2D1D0
40H 0 1 0 0 0 0 0 0 AND operation
0 1 0
0 0 0 0 0 40H
No comments:
Post a Comment