From a0eb20ff1f27d62e02d27876f25f8f5fbf5690c5 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 3 May 2019 14:29:36 -0400 Subject: [PATCH] Tweaks divide-by-zero timing. --- .../Implementation/68000Implementation.hpp | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/Processors/68000/Implementation/68000Implementation.hpp b/Processors/68000/Implementation/68000Implementation.hpp index 678302fe9..2244a524d 100644 --- a/Processors/68000/Implementation/68000Implementation.hpp +++ b/Processors/68000/Implementation/68000Implementation.hpp @@ -884,15 +884,21 @@ template void Proces Divisions. */ +#define announce_divide_by_zero() \ + active_program_ = nullptr; \ + active_micro_op_ = short_exception_micro_ops_; \ + bus_program = active_micro_op_->bus_program; \ + \ + populate_trap_steps(5, get_status()); \ + bus_program->microcycle.length = HalfCycles(8); \ + \ + program_counter_.full -= 2; + case Operation::DIVU: { // An attempt to divide by zero schedules an exception. if(!active_program_->source->halves.low.full) { // Schedule a divide-by-zero exception. - active_program_ = nullptr; - active_micro_op_ = short_exception_micro_ops_; - bus_program = active_micro_op_->bus_program; - populate_trap_steps(5, get_status()); - program_counter_.full -= 2; + announce_divide_by_zero(); break; } @@ -951,11 +957,7 @@ template void Proces // An attempt to divide by zero schedules an exception. if(!active_program_->source->halves.low.full) { // Schedule a divide-by-zero exception. - active_program_ = nullptr; - active_micro_op_ = short_exception_micro_ops_; - bus_program = active_micro_op_->bus_program; - populate_trap_steps(5, get_status()); - program_counter_.full -= 2; + announce_divide_by_zero() break; } @@ -1005,6 +1007,8 @@ template void Proces active_step_->microcycle.length = HalfCycles(cycles_expended * 2); } break; +#undef announce_divide_by_zero + /* MOVEP: move words and long-words a byte at a time. */