From c834960bfbfe55f585648c99c54a9231d8759618 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 12 Dec 2021 19:18:18 -0500 Subject: [PATCH] Withdraw separate x-and-y guess, make MOVE lose a cycle if a sleep/wake occurs. --- Machines/Amiga/Copper.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Machines/Amiga/Copper.cpp b/Machines/Amiga/Copper.cpp index 1006256e0..a668953eb 100644 --- a/Machines/Amiga/Copper.cpp +++ b/Machines/Amiga/Copper.cpp @@ -23,8 +23,7 @@ namespace { bool satisfies_raster(uint16_t position, uint16_t blitter_status, uint16_t *instruction) { const uint16_t mask = 0x8000 | (instruction[1] & 0x7ffe); return - (position & mask & 0xff00) >= (instruction[0] & mask & 0xff00) && - (position & mask & 0x00ff) >= (instruction[0] & mask & 0x00ff) && + (position & mask) >= (instruction[0] & mask) && (!(blitter_status & 0x4000) || (instruction[1] & 0x8000)); } @@ -81,12 +80,11 @@ bool Copper::advance_dma(uint16_t position, uint16_t blitter_status) { default: return false; case State::Waiting: - if(!satisfies_raster(position, blitter_status, instruction_)) { - return false; + if(satisfies_raster(position, blitter_status, instruction_)) { + LOG("Unblocked waiting for " << PADHEX(4) << instruction_[0] << " at " << PADHEX(4) << position << " with mask " << PADHEX(4) << (instruction_[1] & 0x7ffe)); + state_ = State::FetchFirstWord; } - LOG("Unblocked waiting for " << PADHEX(4) << instruction_[0] << " at " << PADHEX(4) << position << " with mask " << PADHEX(4) << (instruction_[1] & 0x7ffe)); - state_ = State::FetchFirstWord; - [[fallthrough]]; + return false; case State::FetchFirstWord: instruction_[0] = ram_[address_ & ram_mask_]; @@ -133,11 +131,13 @@ bool Copper::advance_dma(uint16_t position, uint16_t blitter_status) { // Got to here => this is a WAIT or a SKIP. + const bool raster_is_satisfied = satisfies_raster(position, blitter_status, instruction_); + if(!(instruction_[1] & 1)) { // A WAIT. Empirically, I don't think this waits at all if the test is // already satisfied. - state_ = State::Waiting; - LOG("Will wait from " << PADHEX(4) << position); + state_ = raster_is_satisfied ? State::FetchFirstWord : State::Waiting; + if(raster_is_satisfied) LOG("Will wait from " << PADHEX(4) << position); break; }