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

Corrects CHK N flag.

This commit is contained in:
Thomas Harte 2019-12-16 20:01:33 -05:00
parent 8be26502c4
commit 84167af54f

View File

@ -1326,7 +1326,8 @@ template <class T, bool dtack_is_implicit, bool signal_will_perform> void Proces
overflow_flag_ = carry_flag_ = 0;
zero_result_ = destination()->halves.low.full;
negative_flag_ = (is_under && !is_over) ? 1 : 0;
if(is_under) negative_flag_ = 1;
if(is_over) negative_flag_ = 0;
// No exception is the default course of action; deviate only if an
// exception is necessary.
@ -1541,7 +1542,7 @@ template <class T, bool dtack_is_implicit, bool signal_will_perform> void Proces
extend_flag_ = carry_flag_ = decltype(carry_flag_)(result & ~0xff); \
negative_flag_ = result & 0x80; \
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. */ \
destination()->halves.low.halves.low = uint8_t(result);