1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-09-29 00:56:21 +00:00

Goes nuclear on ROXL and ROXR.

This commit is contained in:
Thomas Harte 2019-07-01 23:05:48 -04:00
parent 726e07ed5b
commit 0a67cc3dab
2 changed files with 16 additions and 26 deletions

View File

@ -69,7 +69,7 @@
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
enableASanStackUseAfterReturn = "YES"

View File

@ -1769,26 +1769,21 @@ template <class T, bool dtack_is_implicit, bool signal_will_perform> void Proces
case Operation::RORw: ror(active_program_->destination->halves.low.full, 16); break;
case Operation::RORl: ror(active_program_->destination->full, 32); break;
#define roxl(destination, size) { \
decode_shift_count(); \
const auto value = destination; \
\
if(!shift_count) { \
carry_flag_ = extend_flag_; \
} else { \
shift_count %= (size + 1); \
destination = decltype(destination)(\
(value << shift_count) | \
(value >> (size + 1 - shift_count)) | \
((extend_flag_ ? decltype(destination)(1 << (size - 1)) : 0) >> (size - shift_count))\
); \
carry_flag_ = extend_flag_ = (value >> (size - shift_count))&1; \
} \
shift_count %= (size + 1); \
uint64_t compound = uint64_t(destination) | (extend_flag_ ? (1ull << size) : 0); \
compound = \
(compound << shift_count) | \
(compound >> (size + 1 - shift_count)); \
carry_flag_ = extend_flag_ = decltype(carry_flag_)((compound >> size) & 1); \
destination = decltype(destination)(compound); \
\
set_neg_zero_overflow(destination, 1 << (size - 1)); \
}
case Operation::ROXLm: {
const auto value = active_program_->destination->halves.low.full;
active_program_->destination->halves.low.full = uint16_t((value << 1) | (extend_flag_ ? 0x0001 : 0x0000));
@ -1799,21 +1794,16 @@ template <class T, bool dtack_is_implicit, bool signal_will_perform> void Proces
case Operation::ROXLw: roxl(active_program_->destination->halves.low.full, 16); break;
case Operation::ROXLl: roxl(active_program_->destination->full, 32); break;
#define roxr(destination, size) { \
decode_shift_count(); \
const auto value = destination; \
\
if(!shift_count) { \
carry_flag_ = extend_flag_; \
} else { \
shift_count %= (size + 1); \
destination = \
decltype(destination)(value >> shift_count) | \
decltype(destination)(value << (size + 1 - shift_count)) | \
decltype(destination)((extend_flag_ ? 1 : 0) << (size - shift_count)); \
carry_flag_ = extend_flag_ = value & (1 << shift_count); \
} \
shift_count %= (size + 1); \
uint64_t compound = uint64_t(destination) | (extend_flag_ ? (1ull << size) : 0); \
compound = \
(compound >> shift_count) | \
(compound << (size + 1 - shift_count)); \
carry_flag_ = extend_flag_ = decltype(carry_flag_)((compound >> size) & 1); \
destination = decltype(destination)(compound); \
\
set_neg_zero_overflow(destination, 1 << (size - 1)); \
}