1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-09-27 18:55:48 +00:00

Simplify top nibble handling.

This commit is contained in:
Thomas Harte 2023-08-30 23:07:54 -04:00
parent 67cd5dd63b
commit cdcac7c11c

View File

@ -337,11 +337,11 @@ template <Personality personality, typename T, bool uses_ready_line> void Proces
flags_.negative_result = uint8_t(result);
flags_.overflow = (( (result ^ a_) & (result ^ operand_) ) & 0x80) >> 1;
// i.e. if there was carry out of bit 7 already, or if the top nibble is too large (in which
// case there will be carry after the fix-up).
flags_.carry |= result >= 0xa0;
if(flags_.carry) {
result += 0x60;
} else if (result >= 0xa0) {
flags_.carry = 1; // There'll now definitely be carry.
result += 0x60;
}
a_ = result;