1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-19 23:32:28 +00:00

Withdraw separate x-and-y guess, make MOVE lose a cycle if a sleep/wake occurs.

This commit is contained in:
Thomas Harte 2021-12-12 19:18:18 -05:00
parent 600abc55b5
commit c834960bfb

View File

@ -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;
[[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;
}