Blogger

Delete comment from: Ken Shirriff's blog

Zuoliu Ding said...

@Hugo: theoretically this should be not considered as Overflow if c6 xor c7. Let's simply take it in BYTE
7F + 80 = FF
that is not overflow because for signed 7F is a positive 127 in byte and 80 a negative -128, the result FF is just -1 based on the signed point of view as you think of Overflow flag.

For any Non-Zero operands:
 Logic viewpoint: OF = 1, Overflow flag is only set when
• Two positive operands are added and their sum is negative
• Two negative operands are added and their sum is positive

 Hardware implementation: For Non-Zero operands
• OF = (carry out of the MSB) XOR (carry into the MSB)

Feb 5, 2023, 6:08:31 PM


Posted to The 6502 overflow flag explained mathematically

Google apps
Main menu