mirror of
https://github.com/TomHarte/CLK.git
synced 2025-08-15 14:27:29 +00:00
Ensure did_divu/s are performed even upon divide by zero.
This commit is contained in:
@@ -522,17 +522,18 @@ template <
|
|||||||
#define DIV(Type16, Type32, flow_function) { \
|
#define DIV(Type16, Type32, flow_function) { \
|
||||||
status.carry_flag = 0; \
|
status.carry_flag = 0; \
|
||||||
\
|
\
|
||||||
|
const auto dividend = Type32(dest.l); \
|
||||||
const auto divisor = Type32(Type16(src.w)); \
|
const auto divisor = Type32(Type16(src.w)); \
|
||||||
|
\
|
||||||
if(!divisor) { \
|
if(!divisor) { \
|
||||||
status.negative_flag = status.overflow_flag = 0; \
|
status.negative_flag = status.overflow_flag = 0; \
|
||||||
status.zero_result = 1; \
|
status.zero_result = 1; \
|
||||||
flow_controller.raise_exception(Exception::IntegerDivideByZero); \
|
flow_controller.raise_exception(Exception::IntegerDivideByZero); \
|
||||||
|
flow_controller.template flow_function<false>(dividend, divisor); \
|
||||||
return; \
|
return; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
const auto dividend = Type32(dest.l); \
|
|
||||||
const auto quotient = dividend / divisor; \
|
const auto quotient = dividend / divisor; \
|
||||||
\
|
|
||||||
if(quotient != Type32(Type16(quotient))) { \
|
if(quotient != Type32(Type16(quotient))) { \
|
||||||
status.overflow_flag = 1; \
|
status.overflow_flag = 1; \
|
||||||
flow_controller.template flow_function<true>(dividend, divisor); \
|
flow_controller.template flow_function<true>(dividend, divisor); \
|
||||||
|
Reference in New Issue
Block a user