WRITE THIS IN THE WRITING SIDE OF THE JOURNAL
ADDRESS | OPCODE | LABEL | MNEMONICS | COMMENT |
---|---|---|---|---|
4000 | 21 50 40 | LXI H,4050H | ;set memory pointer in HL | |
4003 | AF | XRA A | ;reset carry flag | |
4004 | 06 05 | MVI B,05H | ;move 05H to B | |
4006 | 0E 00 | MVI C,00H | ;set odd counter to 00H | |
4008 | 16 00 | MVI D,00H | ;set even counter to 00H | |
400A | 7E | AGAIN: | MOV A,M | ;move mem. to Acc. |
400B | 1F | RAR | ;rotate right through carry | |
400C | D2 13 40 | JNC DOWN | ;jump if no carry to down | |
400F | 0C | INR C | ;increment odd counter | |
4010 | C3 14 40 | JMP EVEN | ;jump to even | |
4013 | 14 | DOWN: | INR D | ;increment even counter |
4014 | 23 | EVEN: | INX H | ;increment HL address |
4015 | 05 | DCR B | ;decrement counter B | |
4016 | C2 0A 40 | JNZ AGAIN | ;jump if not zero to again | |
4019 | 21 60 40 | LXI H,4060H | ;set Hl for result | |
401C | 71 | MOV M,C | ;store odd counter no. | |
401D | 23 | INX H | ;increment HL address | |
401E | 72 | MOV M,D | ;store even counter no. | |
401F | 76 | hlt | ;8085 in halt state |
Result: Draw it on the writing side



) Sign Flag is reset: Result is positive
) Zero flag is set: result is set to zero after the execution of arithmetic or logical operation
) auxiliary carry flag is set: there is a carry from bit D3 to D4
) parity flag is set: result stored in accumulator contain even number of 1’s
) carry flag is result: no carry or borrow bit during the execution of arithmetic operation