N numbers stored consecutively from 0001H. The value of N stored at 0000H. Find the sum of the numbers whose 6th bit is 1 and store the sum and carry at 0010H, 0011H respectively
LXI H,0000H
MOV B,M
XRA A
MOV D,A
MOV E,A
INX H
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,0010H
MOV M,D
INX H
MOV M,E
HLT
No comments:
Post a Comment