From bd69948d373eadc9575d1ae18ffe499b17327d32 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 18 Dec 2021 17:53:11 -0500 Subject: [PATCH] The Copper can now skip `Chipset::perform`. --- Machines/Amiga/Chipset.cpp | 2 +- Machines/Amiga/Chipset.hpp | 2 ++ Machines/Amiga/Copper.cpp | 9 +-------- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/Machines/Amiga/Chipset.cpp b/Machines/Amiga/Chipset.cpp index 89c8eb943..53c26dc17 100644 --- a/Machines/Amiga/Chipset.cpp +++ b/Machines/Amiga/Chipset.cpp @@ -808,7 +808,7 @@ void Chipset::update_interrupts() { void Chipset::perform(const CPU::MC68000::Microcycle &cycle) { using Microcycle = CPU::MC68000::Microcycle; - const uint32_t register_address = *cycle.address & 0x1fe; + const uint32_t register_address = *cycle.address & ChipsetAddressMask; if(cycle.operation & Microcycle::Read) { cycle.set_value16(read(register_address)); } else { diff --git a/Machines/Amiga/Chipset.hpp b/Machines/Amiga/Chipset.hpp index 104b74d53..a822624c3 100644 --- a/Machines/Amiga/Chipset.hpp +++ b/Machines/Amiga/Chipset.hpp @@ -110,6 +110,8 @@ class Chipset: private ClockingHint::Observer { // MARK: - Register read/write functions. template uint16_t read(uint32_t address); template void write(uint32_t address, uint16_t value); + static constexpr uint32_t ChipsetAddressMask = 0x1fe; + friend class Copper; // MARK: - E Clock and keyboard dividers. diff --git a/Machines/Amiga/Copper.cpp b/Machines/Amiga/Copper.cpp index a668953eb..959eb0a13 100644 --- a/Machines/Amiga/Copper.cpp +++ b/Machines/Amiga/Copper.cpp @@ -114,14 +114,7 @@ bool Copper::advance_dma(uint16_t position, uint16_t blitter_status) { break; } - // Construct a 68000-esque Microcycle in order to be able to perform the access. - CPU::MC68000::Microcycle cycle; - cycle.operation = CPU::MC68000::Microcycle::SelectWord; - uint32_t full_address = instruction_[0]; - CPU::RegisterPair16 data = instruction_[1]; - cycle.address = &full_address; - cycle.value = &data; - chipset_.perform(cycle); + chipset_.write(instruction_[0] & Chipset::ChipsetAddressMask, instruction_[1]); } // Roll onto the next command.