fixed 3E bankswitching

This commit is contained in:
thrust26 2020-05-03 08:45:15 +02:00
parent 8525c605f4
commit 9685887833
3 changed files with 25 additions and 1 deletions

View File

@ -71,3 +71,18 @@ uInt8 Cartridge3E::peek(uInt16 address)
return CartridgeEnhanced::peek(peekAddress);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge3E::poke(uInt16 address, uInt8 value)
{
uInt16 pokeAddress = address;
address &= ROM_MASK;
if(address < 0x0040) // TIA access
{
checkSwitchBank(address, value);
return mySystem->tia().poke(address, value);
}
return CartridgeEnhanced::poke(pokeAddress, value);
}

View File

@ -113,6 +113,15 @@ class Cartridge3E : public CartridgeEnhanced
*/
uInt8 peek(uInt16 address) override;
/**
Change the byte at the specified address to the given value
@param address The address where the value should be stored
@param value The value to be stored at the address
@return True if the poke changed the device address space, else false
*/
bool poke(uInt16 address, uInt8 value) override;
private:
bool checkSwitchBank(uInt16 address, uInt8 value) override;

View File

@ -232,7 +232,7 @@ bool CartridgeEnhanced::bank(uInt16 bank, uInt16 segment)
uInt32 bankOffset = uInt32(mySize) + (ramBank << (myBankShift - 1));
// Remember what bank is in this segment
myCurrentSegOffset[segment] = bank << myBankShift;
myCurrentSegOffset[segment] = uInt32(mySize) + (ramBank << myBankShift);
// Set the page accessing method for the RAM writing pages
uInt16 fromAddr = (ROM_OFFSET + segmentOffset + myWriteOffset) & ~System::PAGE_MASK;