From 35b1a55c122e8a4dac3971ac8b0b4eee797f8986 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 4 Aug 2019 20:36:33 -0400 Subject: [PATCH] Corrects DIVS negative flag. --- Processors/68000/Implementation/68000Implementation.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Processors/68000/Implementation/68000Implementation.hpp b/Processors/68000/Implementation/68000Implementation.hpp index a25586591..dced233a9 100644 --- a/Processors/68000/Implementation/68000Implementation.hpp +++ b/Processors/68000/Implementation/68000Implementation.hpp @@ -1076,15 +1076,15 @@ template void Proces break; } - zero_result_ = decltype(zero_result_)(quotient); - negative_flag_ = zero_result_ & 0x8000; - overflow_flag_ = 0; - const uint16_t remainder = uint16_t(signed_dividend % signed_divisor); const int signed_quotient = result_sign*int(quotient); destination()->halves.high.full = remainder; destination()->halves.low.full = uint16_t(signed_quotient); + zero_result_ = decltype(zero_result_)(signed_quotient); + negative_flag_ = zero_result_ & 0x8000; + overflow_flag_ = 0; + // Algorithm here: there is a fixed cost per unset bit // in the first 15 bits of the unsigned quotient. auto positive_quotient_bits = ~quotient & 0xfffe;