From af976b8b3da299a5220497b0b505d1def0e6e08a Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 30 Jan 2020 23:09:24 -0500 Subject: [PATCH] Eliminates modulus operation per ROM access. --- Machines/Atari/ST/AtariST.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Machines/Atari/ST/AtariST.cpp b/Machines/Atari/ST/AtariST.cpp index 16583a7f5..f1ed580bc 100644 --- a/Machines/Atari/ST/AtariST.cpp +++ b/Machines/Atari/ST/AtariST.cpp @@ -101,8 +101,10 @@ class ConcreteMachine: const bool is_early_tos = true; if(is_early_tos) { + rom_start_ = 0xfc0000; for(c = 0xfc; c < 0xff; ++c) memory_map_[c] = BusDevice::ROM; } else { + rom_start_ = 0xe00000; for(c = 0xe0; c < 0xe4; ++c) memory_map_[c] = BusDevice::ROM; } @@ -245,7 +247,7 @@ class ConcreteMachine: case BusDevice::ROM: memory = rom_.data(); - address %= rom_.size(); + address -= rom_start_; break; case BusDevice::Floating: @@ -505,6 +507,7 @@ class ConcreteMachine: std::vector ram_; std::vector rom_; + uint32_t rom_start_ = 0; enum class BusDevice { /// A mostly RAM page is one that returns ROM for the first 8 bytes, RAM elsewhere.