1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-01-23 01:16:10 +00:00

Allow is-1mhz decision to observe shortened addresses.

This commit is contained in:
Thomas Harte
2025-10-28 21:32:09 -04:00
parent fc02a3d34b
commit 9ff09a45be
2 changed files with 4 additions and 3 deletions

View File

@@ -769,7 +769,7 @@ public:
template <CPU::MOS6502Mk2::BusOperation operation, typename AddressT>
Cycles perform(const AddressT address, CPU::MOS6502Mk2::data_t<operation> value) {
// Returns @c true if @c address is a device on the 1Mhz bus; @c false otherwise.
static constexpr auto is_1mhz = [](const uint16_t address) {
const auto is_1mhz = [&] {
// Fast exit if outside the IO space.
if(address < 0xfc00) return false;
if(address >= 0xff00) return false;
@@ -788,10 +788,10 @@ public:
// Otherwise: in IO space, but not a 1Mhz device.
return false;
};
}();
// Determine whether this access hits the 1Mhz bus; if so then apply appropriate penalty, and update phase.
const auto duration = Cycles(is_1mhz(address) ? 2 + (phase_&1) : 1);
const auto duration = Cycles(is_1mhz ? 2 + (phase_&1) : 1);
if(typer_) typer_->run_for(duration);
phase_ += duration.as<int>();

View File

@@ -126,6 +126,7 @@ public:
private:
uint8_t result_;
#ifndef NDEBUG
bool did_write_ = false;
#endif