; ; ADD: A = A + B ; LD A, 00010111B ; 17D (packed BCD) LD B, 01010100B ; 54D (packed BCD) OUT (00H), A ; Set LEDs in 00H with 1st operand LD C, 01H OUT (C), B ; Set LEDs in 01H with 2nd operand ADD A, B ; A and B are added together, and the result is written back to A OUT (02H), A ; Send result (expect 0110 1011 = 6BH) of A + B to 02H ; ; The A register is BCD corrected using the contents of the flags. ; See: http://z80-heaven.wikidot.com/instructions-set:daa ; DAA ; A register is BCD corrected using the contents of the Flags OUT (03H), A ; Set LEDs in 03H ch. B with content DAA result, expect 0111 0001 = 71D