The ADI (Add Immediate) instruction adds an immediate 8-bit value to the contents of the accumulator.
1. Performing the Addition:
Initial Accumulator (A) = $FFH = 1111 \ 1111_2$
Immediate value = $01H = 0000 \ 0001_2$
$1111 \ 1111$ (FFH)
$+ 0000 \ 0001$ (01H)
$(1) \ 0000 \ 0000$ (00H)
2. Result in Accumulator:
The 8-bit result is 00H. The bits that exceed the 8-bit capacity of the register are captured by the carry flag.
3. Setting the Carry Flag (CY):
Since the addition of $FFH + 01H$ results in $100H$ (256 in decimal), an overflow from the 7th bit (the MSB) into the carry position occurs. Therefore, the Carry Flag (CY) = 1.
The final status is: Accumulator = 00H, Carry = 1.