fix CartFE to update access flags and counters

This commit is contained in:
thrust26 2020-04-02 11:07:04 +02:00
parent 3f7db393ba
commit a015cd9082
2 changed files with 16 additions and 7 deletions

View File

@ -180,6 +180,7 @@ uInt16 Cartridge::bankOrigin(uInt16 bank) const
{
// isolate the high 3 address bits, count them and
// select the most frequent to define the bank origin
// TODO: origin for banks smaller than 4K
const int intervals = 0x8000 / 0x100;
uInt32 offset = bank * bankSize();
//uInt16 addrMask = (4_KB - 1) & ~(bankSize(bank) - 1);
@ -211,7 +212,7 @@ uInt16 Cartridge::bankOrigin(uInt16 bank) const
maxIdx = idx;
}
}
return maxIdx << 13 | 0x1000 | (offset & 0xfff);
return maxIdx << 13 | 0x1000; //| (offset & 0xfff);
}
#endif

View File

@ -49,11 +49,6 @@ void CartridgeFE::install(System& system)
System::PageAccess access(this, System::PageAccessType::READWRITE);
for(uInt16 addr = 0x180; addr < 0x200; addr += System::PAGE_SIZE)
mySystem->setPageAccess(addr, access);
// Map all of the cart accesses to call peek and poke
access.type = System::PageAccessType::READ;
for(uInt16 addr = 0x1000; addr < 0x2000; addr += System::PAGE_SIZE)
mySystem->setPageAccess(addr, access);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -104,6 +99,19 @@ bool CartridgeFE::bank(uInt16 bank)
return false;
myBankOffset = bank << 12;
System::PageAccess access(this, System::PageAccessType::READ);
// Setup the page access methods for the current bank
// Map all of the cart accesses to call peek and poke
for(uInt16 addr = 0x1000; addr < 0x2000; addr += System::PAGE_SIZE)
{
access.romAccessBase = &myRomAccessBase[myBankOffset + (addr & 0x0FFF)];
access.romPeekCounter = &myRomAccessCounter[addr & 0x0FFF];
access.romPokeCounter = &myRomAccessCounter[addr & 0x0FFF + myImage.size()];
mySystem->setPageAccess(addr, access);
}
return myBankChanged = true;
}
@ -160,7 +168,7 @@ bool CartridgeFE::load(Serializer& in)
}
catch(...)
{
cerr << "ERROR: CartridgeF8SC::load" << endl;
cerr << "ERROR: CartridgeFE::load" << endl;
return false;
}