initial commit (removed directPeek/PokeBase)

This commit is contained in:
thrust26 2021-01-16 10:23:01 +01:00
parent d9c8750d01
commit 6b900f2ba0
5 changed files with 43 additions and 43 deletions

View File

@ -119,7 +119,7 @@ bool CartridgeCM::bank(uInt16 bank, uInt16)
// Lower 2K (always ROM) // Lower 2K (always ROM)
for(uInt16 addr = 0x1000; addr < 0x1800; addr += System::PAGE_SIZE) 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.romAccessBase = &myRomAccessBase[myBankOffset + (addr & 0x0FFF)];
access.romPeekCounter = &myRomAccessCounter[myBankOffset + (addr & 0x0FFF)]; access.romPeekCounter = &myRomAccessCounter[myBankOffset + (addr & 0x0FFF)];
access.romPokeCounter = &myRomAccessCounter[myBankOffset + (addr & 0x0FFF) + myAccessSize]; access.romPokeCounter = &myRomAccessCounter[myBankOffset + (addr & 0x0FFF) + myAccessSize];
@ -133,23 +133,23 @@ bool CartridgeCM::bank(uInt16 bank, uInt16)
if(mySWCHA & 0x10) if(mySWCHA & 0x10)
{ {
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)]; //access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];
access.romAccessBase = &myRomAccessBase[myBankOffset + (addr & 0x0FFF)]; access.romAccessBase = &myRomAccessBase[myBankOffset + (addr & 0x0FFF)];
access.romPeekCounter = &myRomAccessCounter[myBankOffset + (addr & 0x0FFF)]; access.romPeekCounter = &myRomAccessCounter[myBankOffset + (addr & 0x0FFF)];
access.romPokeCounter = &myRomAccessCounter[myBankOffset + (addr & 0x0FFF) + myAccessSize]; access.romPokeCounter = &myRomAccessCounter[myBankOffset + (addr & 0x0FFF) + myAccessSize];
} }
else else
{ {
access.directPeekBase = &myRAM[addr & 0x7FF]; //access.directPeekBase = &myRAM[addr & 0x7FF];
access.romAccessBase = &myRomAccessBase[myBankOffset + (addr & 0x07FF)]; access.romAccessBase = &myRomAccessBase[myBankOffset + (addr & 0x07FF)];
access.romPeekCounter = &myRomAccessCounter[myBankOffset + (addr & 0x07FF)]; access.romPeekCounter = &myRomAccessCounter[myBankOffset + (addr & 0x07FF)];
access.romPokeCounter = &myRomAccessCounter[myBankOffset + (addr & 0x07FF) + myAccessSize]; access.romPokeCounter = &myRomAccessCounter[myBankOffset + (addr & 0x07FF) + myAccessSize];
} }
if((mySWCHA & 0x30) == 0x20) //if((mySWCHA & 0x30) == 0x20)
access.directPokeBase = &myRAM[addr & 0x7FF]; // access.directPokeBase = &myRAM[addr & 0x7FF];
else //else
access.directPokeBase = nullptr; // access.directPokeBase = nullptr;
mySystem->setPageAccess(addr, access); mySystem->setPageAccess(addr, access);
} }

View File

@ -118,7 +118,7 @@ void CartridgeEnhanced::install(System& system)
{ {
const uInt16 offset = addr & myRamMask; const uInt16 offset = addr & myRamMask;
access.directPeekBase = &myRAM[offset]; //access.directPeekBase = &myRAM[offset];
access.romAccessBase = &myRomAccessBase[myReadOffset + offset]; access.romAccessBase = &myRomAccessBase[myReadOffset + offset];
access.romPeekCounter = &myRomAccessCounter[myReadOffset + offset]; access.romPeekCounter = &myRomAccessCounter[myReadOffset + offset];
access.romPokeCounter = &myRomAccessCounter[myReadOffset + offset + myAccessSize]; access.romPokeCounter = &myRomAccessCounter[myReadOffset + offset + myAccessSize];
@ -264,10 +264,10 @@ bool CartridgeEnhanced::bank(uInt16 bank, uInt16 segment)
{ {
const uInt32 offset = bankOffset + (addr & myBankMask); const uInt32 offset = bankOffset + (addr & myBankMask);
if(myDirectPeek && addr != hotSpotAddr) //if(myDirectPeek && addr != hotSpotAddr)
access.directPeekBase = &myImage[offset]; // access.directPeekBase = &myImage[offset];
else //else
access.directPeekBase = nullptr; // access.directPeekBase = nullptr;
access.romAccessBase = &myRomAccessBase[offset]; access.romAccessBase = &myRomAccessBase[offset];
access.romPeekCounter = &myRomAccessCounter[offset]; access.romPeekCounter = &myRomAccessCounter[offset];
access.romPokeCounter = &myRomAccessCounter[offset + myAccessSize]; access.romPokeCounter = &myRomAccessCounter[offset + myAccessSize];
@ -309,7 +309,7 @@ bool CartridgeEnhanced::bank(uInt16 bank, uInt16 segment)
{ {
const uInt32 offset = bankOffset + (addr & myRamMask); const uInt32 offset = bankOffset + (addr & myRamMask);
access.directPeekBase = &myRAM[offset - mySize]; //access.directPeekBase = &myRAM[offset - mySize];
access.romAccessBase = &myRomAccessBase[offset]; access.romAccessBase = &myRomAccessBase[offset];
access.romPeekCounter = &myRomAccessCounter[offset]; access.romPeekCounter = &myRomAccessCounter[offset];
access.romPokeCounter = &myRomAccessCounter[offset + myAccessSize]; access.romPokeCounter = &myRomAccessCounter[offset + myAccessSize];

View File

@ -66,10 +66,10 @@ void CartridgeMNetwork::setAccess(uInt16 addrFrom, uInt16 size,
for(uInt16 addr = addrFrom; addr < addrFrom + size; addr += System::PAGE_SIZE) for(uInt16 addr = addrFrom; addr < addrFrom + size; addr += System::PAGE_SIZE)
{ {
if(type == System::PageAccessType::READ) //if(type == System::PageAccessType::READ)
access.directPeekBase = &directData[directOffset + (addr & addrMask)]; // access.directPeekBase = &directData[directOffset + (addr & addrMask)];
else if(type == System::PageAccessType::WRITE) // all RAM writes mapped to ::poke() //else if(type == System::PageAccessType::WRITE) // all RAM writes mapped to ::poke()
access.directPokeBase = nullptr; // access.directPokeBase = nullptr;
access.romAccessBase = &myRomAccessBase[codeOffset + (addr & addrMask)]; access.romAccessBase = &myRomAccessBase[codeOffset + (addr & addrMask)];
access.romPeekCounter = &myRomAccessCounter[codeOffset + (addr & addrMask)]; access.romPeekCounter = &myRomAccessCounter[codeOffset + (addr & addrMask)];
access.romPokeCounter = &myRomAccessCounter[codeOffset + (addr & addrMask) + myAccessSize]; access.romPokeCounter = &myRomAccessCounter[codeOffset + (addr & addrMask) + myAccessSize];

View File

@ -121,9 +121,9 @@ uInt8 System::peek(uInt16 addr, Device::AccessFlags flags)
// See if this page uses direct accessing or not // See if this page uses direct accessing or not
uInt8 result; uInt8 result;
if(access.directPeekBase) //if(access.directPeekBase)
result = *(access.directPeekBase + (addr & PAGE_MASK)); // result = *(access.directPeekBase + (addr & PAGE_MASK));
else //else
result = access.device->peek(addr); result = access.device->peek(addr);
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
@ -157,17 +157,17 @@ void System::poke(uInt16 addr, uInt8 value, Device::AccessFlags flags)
#endif #endif
// See if this page uses direct accessing or not // See if this page uses direct accessing or not
if(access.directPokeBase) //if(access.directPokeBase)
{ //{
// Since we have direct access to this poke, we can dirty its page // // Since we have direct access to this poke, we can dirty its page
*(access.directPokeBase + (addr & PAGE_MASK)) = value; // *(access.directPokeBase + (addr & PAGE_MASK)) = value;
myPageIsDirtyTable[page] = true; // myPageIsDirtyTable[page] = true;
} //}
else //else
{ //{
// The specific device informs us if the poke succeeded // The specific device informs us if the poke succeeded
myPageIsDirtyTable[page] = access.device->poke(addr, value); myPageIsDirtyTable[page] = access.device->poke(addr, value);
} //}
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
if(!myDataBusLocked) if(!myDataBusLocked)

View File

@ -240,21 +240,21 @@ class System : public Serializable
*/ */
struct PageAccess struct PageAccess
{ {
/** ///**
Pointer to a block of memory or the null pointer. The null pointer // 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 // 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 this page, while other values are the base address of an array
to directly access for reads to this page. // to directly access for reads to this page.
*/ //*/
uInt8* directPeekBase{nullptr}; //uInt8* directPeekBase{nullptr};
/** ///**
Pointer to a block of memory or the null pointer. The null pointer // 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 // 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 this page, while other values are the base address of an array
to directly access for pokes to this page. // to directly access for pokes to this page.
*/ //*/
uInt8* directPokeBase{nullptr}; //uInt8* directPokeBase{nullptr};
/** /**
Pointer to a lookup table for marking an address as CODE, DATA, GFX, Pointer to a lookup table for marking an address as CODE, DATA, GFX,