1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-19 08:31:11 +00:00

Corrects flags on CMPA.w.

This commit is contained in:
Thomas Harte 2019-12-15 14:40:55 -05:00
parent f23c5ada31
commit 4c068e9bb8

View File

@ -797,7 +797,7 @@ template <class T, bool dtack_is_implicit, bool signal_will_perform> void Proces
case Operation::CMPAw: { case Operation::CMPAw: {
const auto source = uint64_t(u_extend16(source()->halves.low.full)); const auto source = uint64_t(u_extend16(source()->halves.low.full));
const auto destination = uint64_t(u_extend16(destination()->halves.low.full)); const uint64_t destination = destination()->full;
const auto result = destination - source; const auto result = destination - source;
zero_result_ = uint32_t(result); zero_result_ = uint32_t(result);
@ -1541,7 +1541,7 @@ template <class T, bool dtack_is_implicit, bool signal_will_perform> void Proces
extend_flag_ = carry_flag_ = decltype(carry_flag_)(result & ~0xff); \ extend_flag_ = carry_flag_ = decltype(carry_flag_)(result & ~0xff); \
negative_flag_ = result & 0x80; \ negative_flag_ = result & 0x80; \
const int unadjusted_result = destination - source - (extend_flag_ ? 1 : 0); \ const int unadjusted_result = destination - source - (extend_flag_ ? 1 : 0); \
overflow_flag_ = unadjusted_result &~ result & 0x80; \ overflow_flag_ = unadjusted_result & (~result) & 0x80; \
\ \
/* Store the result. */ \ /* Store the result. */ \
destination()->halves.low.halves.low = uint8_t(result); destination()->halves.low.halves.low = uint8_t(result);