WRITE THIS IN THE WRITING SIDE OF THE JOURNAL
ADDRESS | OPCODE | LABEL | MNEMONICS | COMMENT |
---|---|---|---|---|
4000 | 31 FF 80 | LXI SP,4010H | ;Initialize stack pointer | |
4003 | 21 2B 80 | LXI H,4000H | ;Pointer to the HL | |
4006 | 01 2C 80 | LXI B,4001H | ;set memory pointer in BC | |
4009 | 7E | MOV A,M | ;move content of mem. to Acc. | |
400A | CD 0F 80 | CALL BCDBIN | ;Subroutine to convert a BCD number to HEX | |
400D | 02 | STAX B | ;Store Acc to memory location pointed by BC | |
400E | 76 | HLT | ;8085 in Halt state | |
400F | C5 | BCDBIN: | PUSH B | ;saving B |
4010 | 47 | MOV B,A | ;move content of Acc to B | |
4011 | E6 0F | ANI 0FH | ;Mask of the most significant four bits | |
4013 | 4F | MOV C,A | ;move content of Acc. to C | |
4014 | 78 | MOV A,B | ;move content of B to Acc | |
4015 | E6 F0 | ANI 0F0H | ;Mask of the least significant four bits | |
4017 | 0F | RRC | ;Rotate accumulator right 4 times | |
4018 | 0F | RRC | ||
4019 | RRC | |||
401A | RRC | |||
401B | 57 | MOV D,A | ;move content of Acc. to D | |
401C | AF | XRA A | ;clear content of Acc. | |
401D | 1E 0A | MVI E,0AH | ;Initialize Reg. E with 0AH | |
401F | 83 | SUM: | ADD E | ;Add the contents of Reg. E to A |
4020 | 15 | DCR D | ;decrement D | |
4021 | C2 1F 80 | JNZ SUM | ;jump if not zero to sum | |
4024 | 81 | ADD C | ;Add the contents of Reg. C to A | |
4025 | C1 | POP B | ;Restoring B | |
4026 | C9 | RET | ;Returning control to the calling program | |
4027 | 72 | HLT | ;8085 in halt state |
) 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