ORG 000h
MOV DPTR,#0Ah ; an external address
MOV RO,#0Ah ;array counter
MOV R1,#0h ;to count number odd numbers
loop:
MOV A,@DPTR
RRC A
JNC even
INC R1
DJNZ R0,loop
SJMP end
even: DJNZ R0,loop
MOV DPTR,#0Ah ; an external address
MOV RO,#0Ah ;array counter
MOV R1,#0h ;to count number odd numbers
loop:
MOV A,@DPTR
RRC A
JNC even
INC R1
DJNZ R0,loop
SJMP end
even: DJNZ R0,loop
end: NOP
END
In alp programming its important to look that loops are executed only when we need ,coz as i said,compiler executes sequentially.If u don’t branch them correctly ,the program may go wrong.