mirror of https://github.com/stella-emu/stella.git
Updated RWP stuff for DASH scheme.
Again, this is a relatively untested BS scheme, with only one test ROM available.
This commit is contained in:
parent
70fcd0f3b5
commit
a26288c788
|
@ -116,7 +116,6 @@ bool Cartridge3EPlus::poke(uInt16 address, uInt8 value)
|
|||
|
||||
if(address == BANK_SWITCH_HOTSPOT_RAM)
|
||||
changed = bankRAM(value);
|
||||
|
||||
else if(address == BANK_SWITCH_HOTSPOT_ROM)
|
||||
changed = bankROM(value);
|
||||
|
||||
|
|
|
@ -92,28 +92,19 @@ uInt8 CartridgeDASH::peek(uInt16 address)
|
|||
uInt32 bank = (address >> (ROM_BANK_TO_POWER - 1)) & 7; // convert to 512 byte bank index (0-7)
|
||||
uInt16 imageBank = bankInUse[bank]; // the ROM/RAM bank that's here
|
||||
|
||||
if (imageBank == BANK_UNDEFINED) // an uninitialised bank?
|
||||
if(imageBank == BANK_UNDEFINED) // an uninitialised bank?
|
||||
{
|
||||
// accessing invalid bank, so return should be... random?
|
||||
value = mySystem->randGenerator().next();
|
||||
|
||||
}
|
||||
else if (imageBank & BITMASK_ROMRAM) // a RAM bank
|
||||
{
|
||||
// Reading from the write port triggers an unwanted write
|
||||
value = mySystem->getDataBusState(0xFF);
|
||||
|
||||
if(bankLocked())
|
||||
return value;
|
||||
else
|
||||
else if(imageBank & BITMASK_ROMRAM) // a RAM bank
|
||||
{
|
||||
Int32 ramBank = imageBank & BIT_BANK_MASK; // discard irrelevant bits
|
||||
Int32 offset = ramBank << RAM_BANK_TO_POWER; // base bank address in RAM
|
||||
offset += (address & BITMASK_RAM_BANK); // + byte offset in RAM bank
|
||||
myRAM[offset] = value;
|
||||
triggerReadFromWritePort(peekAddress);
|
||||
return value;
|
||||
}
|
||||
|
||||
return peekRAM(myRAM[offset], peekAddress);
|
||||
}
|
||||
|
||||
return value;
|
||||
|
@ -129,12 +120,27 @@ bool CartridgeDASH::poke(uInt16 address, uInt8 value)
|
|||
|
||||
if (address == BANK_SWITCH_HOTSPOT_RAM)
|
||||
changed = bankRAM(value);
|
||||
|
||||
else if (address == BANK_SWITCH_HOTSPOT_ROM)
|
||||
changed = bankROM(value);
|
||||
|
||||
if(!(address & 0x1000))
|
||||
{
|
||||
// Handle TIA space that we claimed above
|
||||
mySystem->tia().poke(address, value);
|
||||
changed = changed || mySystem->tia().poke(address, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
uInt32 bankNumber = (address >> RAM_BANK_TO_POWER) & 7; // now 512 byte bank # (ie: 0-7)
|
||||
Int16 whichBankIsThere = bankInUse[bankNumber]; // ROM or RAM bank reference
|
||||
|
||||
if(whichBankIsThere & BITMASK_ROMRAM)
|
||||
{
|
||||
uInt32 byteOffset = address & BITMASK_RAM_BANK;
|
||||
uInt32 baseAddress = ((whichBankIsThere & BIT_BANK_MASK) << RAM_BANK_TO_POWER) + byteOffset;
|
||||
pokeRAM(myRAM[baseAddress], address, value);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
@ -183,9 +189,7 @@ void CartridgeDASH::bankRAMSlot(uInt16 bank)
|
|||
|
||||
for (uInt16 addr = start; addr <= end; addr += System::PAGE_SIZE)
|
||||
{
|
||||
if(upper)
|
||||
access.directPokeBase = &myRAM[startCurrentBank + (addr & (RAM_BANK_SIZE - 1))];
|
||||
else
|
||||
if(!upper)
|
||||
access.directPeekBase = &myRAM[startCurrentBank + (addr & (RAM_BANK_SIZE - 1))];
|
||||
|
||||
access.codeAccessBase = &myCodeAccessBase[mySize + startCurrentBank + (addr & (RAM_BANK_SIZE - 1))];
|
||||
|
|
Loading…
Reference in New Issue