From 522ee7f978b2936cee4b10620d16a4e21d2e9d99 Mon Sep 17 00:00:00 2001 From: thrust26 Date: Sat, 16 Jan 2021 10:23:01 +0100 Subject: [PATCH] initial commit (removed directPeek/PokeBase) --- src/emucore/CartCM.cxx | 14 +++++++------- src/emucore/CartEnhanced.cxx | 12 ++++++------ src/emucore/CartMNetwork.cxx | 8 ++++---- src/emucore/System.cxx | 24 ++++++++++++------------ src/emucore/System.hxx | 28 ++++++++++++++-------------- 5 files changed, 43 insertions(+), 43 deletions(-) diff --git a/src/emucore/CartCM.cxx b/src/emucore/CartCM.cxx index 35e2b1edc..050ae52f7 100644 --- a/src/emucore/CartCM.cxx +++ b/src/emucore/CartCM.cxx @@ -119,7 +119,7 @@ bool CartridgeCM::bank(uInt16 bank, uInt16) // Lower 2K (always ROM) for(uInt16 addr = 0x1000; addr < 0x1800; addr += System::PAGE_SIZE) { - access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; + //access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; access.romAccessBase = &myRomAccessBase[myBankOffset + (addr & 0x0FFF)]; access.romPeekCounter = &myRomAccessCounter[myBankOffset + (addr & 0x0FFF)]; access.romPokeCounter = &myRomAccessCounter[myBankOffset + (addr & 0x0FFF) + myAccessSize]; @@ -133,23 +133,23 @@ bool CartridgeCM::bank(uInt16 bank, uInt16) if(mySWCHA & 0x10) { - access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; + //access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; access.romAccessBase = &myRomAccessBase[myBankOffset + (addr & 0x0FFF)]; access.romPeekCounter = &myRomAccessCounter[myBankOffset + (addr & 0x0FFF)]; access.romPokeCounter = &myRomAccessCounter[myBankOffset + (addr & 0x0FFF) + myAccessSize]; } else { - access.directPeekBase = &myRAM[addr & 0x7FF]; + //access.directPeekBase = &myRAM[addr & 0x7FF]; access.romAccessBase = &myRomAccessBase[myBankOffset + (addr & 0x07FF)]; access.romPeekCounter = &myRomAccessCounter[myBankOffset + (addr & 0x07FF)]; access.romPokeCounter = &myRomAccessCounter[myBankOffset + (addr & 0x07FF) + myAccessSize]; } - if((mySWCHA & 0x30) == 0x20) - access.directPokeBase = &myRAM[addr & 0x7FF]; - else - access.directPokeBase = nullptr; + //if((mySWCHA & 0x30) == 0x20) + // access.directPokeBase = &myRAM[addr & 0x7FF]; + //else + // access.directPokeBase = nullptr; mySystem->setPageAccess(addr, access); } diff --git a/src/emucore/CartEnhanced.cxx b/src/emucore/CartEnhanced.cxx index 1c46e7cad..5fb7c9d54 100644 --- a/src/emucore/CartEnhanced.cxx +++ b/src/emucore/CartEnhanced.cxx @@ -118,7 +118,7 @@ void CartridgeEnhanced::install(System& system) { const uInt16 offset = addr & myRamMask; - access.directPeekBase = &myRAM[offset]; + //access.directPeekBase = &myRAM[offset]; access.romAccessBase = &myRomAccessBase[myReadOffset + offset]; access.romPeekCounter = &myRomAccessCounter[myReadOffset + offset]; access.romPokeCounter = &myRomAccessCounter[myReadOffset + offset + myAccessSize]; @@ -264,10 +264,10 @@ bool CartridgeEnhanced::bank(uInt16 bank, uInt16 segment) { const uInt32 offset = bankOffset + (addr & myBankMask); - if(myDirectPeek && addr != hotSpotAddr) - access.directPeekBase = &myImage[offset]; - else - access.directPeekBase = nullptr; + //if(myDirectPeek && addr != hotSpotAddr) + // access.directPeekBase = &myImage[offset]; + //else + // access.directPeekBase = nullptr; access.romAccessBase = &myRomAccessBase[offset]; access.romPeekCounter = &myRomAccessCounter[offset]; access.romPokeCounter = &myRomAccessCounter[offset + myAccessSize]; @@ -309,7 +309,7 @@ bool CartridgeEnhanced::bank(uInt16 bank, uInt16 segment) { const uInt32 offset = bankOffset + (addr & myRamMask); - access.directPeekBase = &myRAM[offset - mySize]; + //access.directPeekBase = &myRAM[offset - mySize]; access.romAccessBase = &myRomAccessBase[offset]; access.romPeekCounter = &myRomAccessCounter[offset]; access.romPokeCounter = &myRomAccessCounter[offset + myAccessSize]; diff --git a/src/emucore/CartMNetwork.cxx b/src/emucore/CartMNetwork.cxx index f71aff1c9..5224ab1f8 100644 --- a/src/emucore/CartMNetwork.cxx +++ b/src/emucore/CartMNetwork.cxx @@ -66,10 +66,10 @@ void CartridgeMNetwork::setAccess(uInt16 addrFrom, uInt16 size, for(uInt16 addr = addrFrom; addr < addrFrom + size; addr += System::PAGE_SIZE) { - if(type == System::PageAccessType::READ) - access.directPeekBase = &directData[directOffset + (addr & addrMask)]; - else if(type == System::PageAccessType::WRITE) // all RAM writes mapped to ::poke() - access.directPokeBase = nullptr; + //if(type == System::PageAccessType::READ) + // access.directPeekBase = &directData[directOffset + (addr & addrMask)]; + //else if(type == System::PageAccessType::WRITE) // all RAM writes mapped to ::poke() + // access.directPokeBase = nullptr; access.romAccessBase = &myRomAccessBase[codeOffset + (addr & addrMask)]; access.romPeekCounter = &myRomAccessCounter[codeOffset + (addr & addrMask)]; access.romPokeCounter = &myRomAccessCounter[codeOffset + (addr & addrMask) + myAccessSize]; diff --git a/src/emucore/System.cxx b/src/emucore/System.cxx index 7ba848bd7..6717063dc 100644 --- a/src/emucore/System.cxx +++ b/src/emucore/System.cxx @@ -121,9 +121,9 @@ uInt8 System::peek(uInt16 addr, Device::AccessFlags flags) // See if this page uses direct accessing or not uInt8 result; - if(access.directPeekBase) - result = *(access.directPeekBase + (addr & PAGE_MASK)); - else + //if(access.directPeekBase) + // result = *(access.directPeekBase + (addr & PAGE_MASK)); + //else result = access.device->peek(addr); #ifdef DEBUGGER_SUPPORT @@ -157,17 +157,17 @@ void System::poke(uInt16 addr, uInt8 value, Device::AccessFlags flags) #endif // See if this page uses direct accessing or not - if(access.directPokeBase) - { - // Since we have direct access to this poke, we can dirty its page - *(access.directPokeBase + (addr & PAGE_MASK)) = value; - myPageIsDirtyTable[page] = true; - } - else - { + //if(access.directPokeBase) + //{ + // // Since we have direct access to this poke, we can dirty its page + // *(access.directPokeBase + (addr & PAGE_MASK)) = value; + // myPageIsDirtyTable[page] = true; + //} + //else + //{ // The specific device informs us if the poke succeeded myPageIsDirtyTable[page] = access.device->poke(addr, value); - } + //} #ifdef DEBUGGER_SUPPORT if(!myDataBusLocked) diff --git a/src/emucore/System.hxx b/src/emucore/System.hxx index eabe00583..0016cd8ae 100644 --- a/src/emucore/System.hxx +++ b/src/emucore/System.hxx @@ -240,21 +240,21 @@ class System : public Serializable */ struct PageAccess { - /** - Pointer to a block of memory or the null pointer. The null pointer - indicates that the device's peek method should be invoked for reads - to this page, while other values are the base address of an array - to directly access for reads to this page. - */ - uInt8* directPeekBase{nullptr}; + ///** + // Pointer to a block of memory or the null pointer. The null pointer + // indicates that the device's peek method should be invoked for reads + // to this page, while other values are the base address of an array + // to directly access for reads to this page. + //*/ + //uInt8* directPeekBase{nullptr}; - /** - Pointer to a block of memory or the null pointer. The null pointer - indicates that the device's poke method should be invoked for writes - to this page, while other values are the base address of an array - to directly access for pokes to this page. - */ - uInt8* directPokeBase{nullptr}; + ///** + // Pointer to a block of memory or the null pointer. The null pointer + // indicates that the device's poke method should be invoked for writes + // to this page, while other values are the base address of an array + // to directly access for pokes to this page. + //*/ + //uInt8* directPokeBase{nullptr}; /** Pointer to a lookup table for marking an address as CODE, DATA, GFX,