From d4b7d73fc4cfdd3ba4eced007b875a67940bf3fe Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 7 Aug 2022 19:19:00 -0400 Subject: [PATCH] Further reduces lines to one access per slot, max. --- Machines/Amiga/Blitter.cpp | 22 +++++++++++++++++++--- Machines/Amiga/Blitter.hpp | 1 + 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Machines/Amiga/Blitter.cpp b/Machines/Amiga/Blitter.cpp index dd55f01dd..e15cc4289 100644 --- a/Machines/Amiga/Blitter.cpp +++ b/Machines/Amiga/Blitter.cpp @@ -292,18 +292,30 @@ bool Blitter::advance_dma() { // at https://github.com/niklasekstrom/blitter-subpixel-line/blob/master/Drawing%20lines%20using%20the%20Amiga%20blitter.pdf // + // + // Caveat: I've no idea how the DMA access slots should be laid out for + // line drawing. + // + if(!busy_) { error_ = int16_t(pointer_[0] << 1) >> 1; // TODO: what happens if line_sign_ doesn't agree with this? draw_ = true; busy_ = true; + has_c_data_ = false; } + bool did_output = false; if(draw_) { // TODO: patterned lines. Unclear what to do with the bit that comes out of b. // Probably extend it to a full word? - c_data_ = ram_[pointer_[3] & ram_mask_]; - if constexpr (record_bus) { - transactions_.emplace_back(Transaction::Type::ReadC, pointer_[3], c_data_); + + if(!has_c_data_) { + has_c_data_ = true; + c_data_ = ram_[pointer_[3] & ram_mask_]; + if constexpr (record_bus) { + transactions_.emplace_back(Transaction::Type::ReadC, pointer_[3], c_data_); + } + return true; } const uint16_t output = @@ -311,6 +323,8 @@ bool Blitter::advance_dma() { ram_[pointer_[3] & ram_mask_] = output; not_zero_flag_ |= output; draw_ &= !one_dot_; + has_c_data_ = false; + did_output = true; if constexpr (record_bus) { transactions_.emplace_back(Transaction::Type::WriteFromPipeline, pointer_[3], output); } @@ -361,6 +375,8 @@ bool Blitter::advance_dma() { busy_ = false; posit_interrupt(InterruptFlag::Blitter); } + + return did_output; } else { // Copy mode. if(!busy_) { diff --git a/Machines/Amiga/Blitter.hpp b/Machines/Amiga/Blitter.hpp index 34ad82c89..720202004 100644 --- a/Machines/Amiga/Blitter.hpp +++ b/Machines/Amiga/Blitter.hpp @@ -263,6 +263,7 @@ template class Blitter: public DMADevice<4, 4> { int error_ = 0; bool draw_ = false; + bool has_c_data_ = false; void add_modulos(); std::vector transactions_;