KS57C2308/P2308/C2316/P2316 ADDRESS SPACES
2-21
++ PROGRAMMING TIP — Using the Carry Flag as a 1-Bit Accumulator
1. Set the carry flag to logic one:
SCF ; C ← 1
LD EA,#0C3H ; EA ← #0C3H
LD HL,#0AAH ; HL ← #0AAH
ADC EA,HL ; EA ← #0C3H + #0AAH + #1H, C ← 1
2. Logical-AND bit 3 of address 3FH with P3.3 and output the result to P4.0:
LD H,#3H ; Set the upper four bits of the address to the H register
value
LDB C,@H+0FH.3 ; C ← bit 3 of 3FH
BAND C,P3.3 ; C ← C AND P3.3
LDB P4.0,C ; Output result from carry flag to P4.0