Micro

 LXI H, D020H ; Step 1: HL points to starting address

        MVI C, 0AH ; Step 2: count = 10 bytes

        MVI B, 00H ; Step 3: B = even count = 0

        MVI D, 00H ; Step 4: D = odd count = 0


NEXT: MOV A, M ; Step 5: Get byte into accumulator

        ANI 01H ; Step 6: Mask LSB → check even/odd


        JNZ ODD ; If result ≠ 0 → odd number


EVEN: INR B ; Step 7: increment even counter

        JMP CONTINUE ; Step 8: skip odd part


ODD: INR D ; Step 9: increment odd counter


CONTINUE:

        INX H ; Step 10: move to next memory

        DCR C ; Step 11: decrease count

        JNZ NEXT ; Step 12: repeat until 10 bytes processed


        ; Step 13: Store results

        MVI H, D0H ; load high byte D0H

        MVI L, 70H ; store even count at D070H

        MOV M, B


        INX H ; HL = D071H

        MOV M, D ; store odd count


        HLT ; Step 14: stop program

Comments

Popular posts from this blog

Ham

Crc

Byte stuffing sending receiving