From 67a039b1114a1487de7b11e51b4d1d07ef88c603 Mon Sep 17 00:00:00 2001 From: thrust26 Date: Tue, 9 May 2023 12:26:12 +0200 Subject: [PATCH] changed CommaVid ROMs to 4K size (fixes #969) --- src/emucore/CartCV.cxx | 9 +++++++-- src/emucore/CartCV.hxx | 5 +---- src/emucore/CartEnhanced.cxx | 2 +- src/emucore/CartF4SC.hxx | 3 --- src/emucore/CartF6SC.hxx | 3 --- 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/emucore/CartCV.cxx b/src/emucore/CartCV.cxx index 0a0121d5c..bed4b10a9 100644 --- a/src/emucore/CartCV.cxx +++ b/src/emucore/CartCV.cxx @@ -24,11 +24,16 @@ CartridgeCV::CartridgeCV(const ByteBuffer& image, size_t size, size_t bsSize) : CartridgeEnhanced(image, size, md5, settings, bsSize) { - myBankShift = BANK_SHIFT; myRamSize = RAM_SIZE; myRamWpHigh = RAM_HIGH_WP; - if(size == 4_KB) + if (size == 2_KB) + { + // Move the ROM of 2K files to the 2nd half of the 4K ROM + // The 1st half is used for RAM + std::copy_n(image.get(), 2_KB, myImage.get() + 2_KB); + } + else if(size == 4_KB) { // The game has something saved in the RAM // Useful for MagiCard program listings diff --git a/src/emucore/CartCV.hxx b/src/emucore/CartCV.hxx index 75f4548ac..27e1e69ac 100644 --- a/src/emucore/CartCV.hxx +++ b/src/emucore/CartCV.hxx @@ -50,7 +50,7 @@ class CartridgeCV : public CartridgeEnhanced @param bsSize The size specified by the bankswitching scheme */ CartridgeCV(const ByteBuffer& image, size_t size, string_view md5, - const Settings& settings, size_t bsSize = 2_KB); + const Settings& settings, size_t bsSize = 4_KB); ~CartridgeCV() override = default; public: @@ -86,9 +86,6 @@ class CartridgeCV : public CartridgeEnhanced ByteBuffer myInitialRAM{nullptr}; private: - // Calculated as: log(ROM bank segment size) / log(2) - static constexpr uInt16 BANK_SHIFT = 11; // 2K - // RAM size static constexpr uInt32 RAM_SIZE = 0x400; // 1K diff --git a/src/emucore/CartEnhanced.cxx b/src/emucore/CartEnhanced.cxx index bcd78f5f4..c15727f6c 100644 --- a/src/emucore/CartEnhanced.cxx +++ b/src/emucore/CartEnhanced.cxx @@ -40,7 +40,7 @@ CartridgeEnhanced::CartridgeEnhanced(const ByteBuffer& image, size_t size, else if(size < bsSize) { ostringstream buf; - buf << "ROM smaller than expected (" << bsSize << " > " << size + buf << "ROM smaller than expected (" << size << " < " << bsSize << "), appending " << (bsSize - size) << " bytes\n"; Logger::info(buf.str()); } diff --git a/src/emucore/CartF4SC.hxx b/src/emucore/CartF4SC.hxx index 130278a5f..0bc95af2d 100644 --- a/src/emucore/CartF4SC.hxx +++ b/src/emucore/CartF4SC.hxx @@ -79,9 +79,6 @@ class CartridgeF4SC : public CartridgeF4 // RAM size static constexpr size_t RAM_SIZE = 0x80; - // RAM mask - static constexpr uInt16 RAM_MASK = RAM_SIZE - 1; - private: // Following constructors and assignment operators not supported CartridgeF4SC() = delete; diff --git a/src/emucore/CartF6SC.hxx b/src/emucore/CartF6SC.hxx index 0caa83bd0..61fcf1fed 100644 --- a/src/emucore/CartF6SC.hxx +++ b/src/emucore/CartF6SC.hxx @@ -79,9 +79,6 @@ class CartridgeF6SC : public CartridgeF6 // RAM size static constexpr size_t RAM_SIZE = 0x80; - // RAM mask - static constexpr uInt16 RAM_MASK = RAM_SIZE - 1; - private: // Following constructors and assignment operators not supported CartridgeF6SC() = delete;