Refactored various page accessing functionality:

- Removed System::PAGE_SHIFT from all classes (except where it's needed inside System); it is an implementation detail of that class that shouldn't be used outside the class, and was making the various calls to setPageAccess very messy
- Changed uInt32 to uInt16, and loop variable to 'addr' for all calls to setPageAccess; this is for consistency, and allows the reader to see how all the code is similar in different classes
- Updated comments in various places (mostly TIA and RIOT) to more clearly show how page accessing works.
This commit is contained in:
Stephen Anthony 2017-09-15 23:28:20 -02:30
parent ca69e2ed73
commit 1d99a1e5fa
45 changed files with 512 additions and 566 deletions

View File

@ -46,19 +46,19 @@ void Cartridge0840::install(System& system)
// Get the page accessing methods for the hot spots since they overlap
// areas within the TIA we'll need to forward requests to the TIA
myHotSpotPageAccess[0] = mySystem->getPageAccess(0x0800 >> System::PAGE_SHIFT);
myHotSpotPageAccess[1] = mySystem->getPageAccess(0x0900 >> System::PAGE_SHIFT);
myHotSpotPageAccess[2] = mySystem->getPageAccess(0x0A00 >> System::PAGE_SHIFT);
myHotSpotPageAccess[3] = mySystem->getPageAccess(0x0B00 >> System::PAGE_SHIFT);
myHotSpotPageAccess[4] = mySystem->getPageAccess(0x0C00 >> System::PAGE_SHIFT);
myHotSpotPageAccess[5] = mySystem->getPageAccess(0x0D00 >> System::PAGE_SHIFT);
myHotSpotPageAccess[6] = mySystem->getPageAccess(0x0E00 >> System::PAGE_SHIFT);
myHotSpotPageAccess[7] = mySystem->getPageAccess(0x0F00 >> System::PAGE_SHIFT);
myHotSpotPageAccess[0] = mySystem->getPageAccess(0x0800);
myHotSpotPageAccess[1] = mySystem->getPageAccess(0x0900);
myHotSpotPageAccess[2] = mySystem->getPageAccess(0x0A00);
myHotSpotPageAccess[3] = mySystem->getPageAccess(0x0B00);
myHotSpotPageAccess[4] = mySystem->getPageAccess(0x0C00);
myHotSpotPageAccess[5] = mySystem->getPageAccess(0x0D00);
myHotSpotPageAccess[6] = mySystem->getPageAccess(0x0E00);
myHotSpotPageAccess[7] = mySystem->getPageAccess(0x0F00);
// Set the page accessing methods for the hot spots
System::PageAccess access(this, System::PA_READ);
for(uInt32 i = 0x0800; i < 0x0FFF; i += (1 << System::PAGE_SHIFT))
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
for(uInt16 addr = 0x0800; addr < 0x0FFF; addr += System::PAGE_SIZE)
mySystem->setPageAccess(addr, access);
// Install pages for bank 0
bank(myStartBank);
@ -137,11 +137,11 @@ bool Cartridge0840::bank(uInt16 bank)
System::PageAccess access(this, System::PA_READ);
// Map ROM image into the system
for(uInt32 address = 0x1000; address < 0x2000; address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1000; addr < 0x2000; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[myBankOffset + (address & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
return myBankChanged = true;
}

View File

@ -32,7 +32,7 @@ Cartridge2K::Cartridge2K(const BytePtr& image, uInt32 size,
mySize <<= 1;
// We can't use a size smaller than the minimum page size in Stella
mySize = std::max(mySize, 1u << System::PAGE_SHIFT);
mySize = std::max<uInt32>(mySize, System::PAGE_SIZE);
// Initialize ROM with illegal 6502 opcode that causes a real 6502 to jam
myImage = make_unique<uInt8[]>(mySize);
@ -62,11 +62,11 @@ void Cartridge2K::install(System& system)
// Note that we don't need our own peek/poke methods, since the mapping
// takes care of the entire address space
System::PageAccess access(this, System::PA_READ);
for(uInt32 address = 0x1000; address < 0x2000; address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1000; addr < 0x2000; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[address & myMask];
access.codeAccessBase = &myCodeAccessBase[address & myMask];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[addr & myMask];
access.codeAccessBase = &myCodeAccessBase[addr & myMask];
mySystem->setPageAccess(addr, access);
}
}

View File

@ -53,20 +53,17 @@ void Cartridge3E::install(System& system)
System::PageAccess access(this, System::PA_READWRITE);
// Set the page accessing methods for the hot spots (for 100% emulation
// we need to chain any accesses below 0x40 to the TIA. Our poke() method
// does this via mySystem->tiaPoke(...), at least until we come up with a
// cleaner way to do it).
for(uInt32 i = 0x00; i < 0x40; i += (1 << System::PAGE_SHIFT))
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
// The hotspots ($3E and $3F) are in TIA address space, so we claim it here
for(uInt16 addr = 0x00; addr < 0x40; addr += System::PAGE_SIZE)
mySystem->setPageAccess(addr, access);
// Setup the second segment to always point to the last ROM slice
access.type = System::PA_READ;
for(uInt32 j = 0x1800; j < 0x2000; j += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1800; addr < 0x2000; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[(mySize - 2048) + (j & 0x07FF)];
access.codeAccessBase = &myCodeAccessBase[(mySize - 2048) + (j & 0x07FF)];
mySystem->setPageAccess(j >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[(mySize - 2048) + (addr & 0x07FF)];
access.codeAccessBase = &myCodeAccessBase[(mySize - 2048) + (addr & 0x07FF)];
mySystem->setPageAccess(addr, access);
}
// Install pages for the startup bank into the first segment
@ -124,10 +121,7 @@ bool Cartridge3E::poke(uInt16 address, uInt8 value)
bank(value + 256);
}
// Pass the poke through to the TIA. In a real Atari, both the cart and the
// TIA see the address lines, and both react accordingly. In Stella, each
// 64-byte chunk of address space is "owned" by only one device. If we
// don't chain the poke to the TIA, then the TIA can't see it...
// Handle TIA space that we claimed above
mySystem->tia().poke(address, value);
return false;
@ -158,12 +152,11 @@ bool Cartridge3E::bank(uInt16 bank)
System::PageAccess access(this, System::PA_READ);
// Map ROM image into the system
for(uInt32 address = 0x1000; address < 0x1800;
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1000; addr < 0x1800; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[offset + (address & 0x07FF)];
access.codeAccessBase = &myCodeAccessBase[offset + (address & 0x07FF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[offset + (addr & 0x07FF)];
access.codeAccessBase = &myCodeAccessBase[offset + (addr & 0x07FF)];
mySystem->setPageAccess(addr, access);
}
}
else
@ -173,28 +166,27 @@ bool Cartridge3E::bank(uInt16 bank)
myCurrentBank = bank + 256;
uInt32 offset = bank << 10;
uInt32 address;
// Setup the page access methods for the current bank
System::PageAccess access(this, System::PA_READ);
// Map read-port RAM image into the system
for(address = 0x1000; address < 0x1400; address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1000; addr < 0x1400; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myRAM[offset + (address & 0x03FF)];
access.codeAccessBase = &myCodeAccessBase[mySize + offset + (address & 0x03FF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myRAM[offset + (addr & 0x03FF)];
access.codeAccessBase = &myCodeAccessBase[mySize + offset + (addr & 0x03FF)];
mySystem->setPageAccess(addr, access);
}
access.directPeekBase = 0;
access.type = System::PA_WRITE;
// Map write-port RAM image into the system
for(address = 0x1400; address < 0x1800; address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1400; addr < 0x1800; addr += System::PAGE_SIZE)
{
access.directPokeBase = &myRAM[offset + (address & 0x03FF)];
access.codeAccessBase = &myCodeAccessBase[mySize + offset + (address & 0x03FF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPokeBase = &myRAM[offset + (addr & 0x03FF)];
access.codeAccessBase = &myCodeAccessBase[mySize + offset + (addr & 0x03FF)];
mySystem->setPageAccess(addr, access);
}
}
return myBankChanged = true;

View File

@ -61,12 +61,9 @@ void Cartridge3EPlus::install(System& system)
System::PageAccess access(this, System::PA_READWRITE);
// Set the page accessing methods for the hot spots (for 100% emulation
// we need to chain any accesses below 0x40 to the TIA. Our poke() method
// does this via mySystem->tiaPoke(...), at least until we come up with a
// cleaner way to do it).
for(uInt32 i = 0x00; i < 0x40; i += (1 << System::PAGE_SHIFT))
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
// The hotspots are in TIA address space, so we claim it here
for(uInt16 addr = 0x00; addr < 0x40; addr += System::PAGE_SIZE)
mySystem->setPageAccess(addr, access);
// Initialise bank values for all ROM/RAM access
// This is used to reverse-lookup from address to bank location
@ -132,10 +129,7 @@ bool Cartridge3EPlus::poke(uInt16 address, uInt8 value)
else if(address == BANK_SWITCH_HOTSPOT_ROM)
changed = bankROM(value);
// Pass the poke through to the TIA. In a real Atari, both the cart and the
// TIA see the address lines, and both react accordingly. In Stella, each
// 64-byte chunk of address space is "owned" by only one device. If we
// don't chain the poke to the TIA, then the TIA can't see it...
// Handle TIA space that we claimed above
mySystem->tia().poke(address, value);
return changed;
@ -180,20 +174,20 @@ void Cartridge3EPlus::bankRAMSlot(uInt16 bank)
access.type = System::PA_READ;
}
uInt32 start = 0x1000 + (bankNumber << (RAM_BANK_TO_POWER+1)) + (upper ? RAM_WRITE_OFFSET : 0);
uInt32 end = start + RAM_BANK_SIZE - 1;
uInt16 start = 0x1000 + (bankNumber << (RAM_BANK_TO_POWER+1)) + (upper ? RAM_WRITE_OFFSET : 0);
uInt16 end = start + RAM_BANK_SIZE - 1;
//cerr << "bank RAM: " << bankNumber << " -> " << (bankNumber * 2 + (upper ? 1 : 0)) << (upper ? " (W)" : " (R)") << endl
// << "start=" << std::hex << start << ", end=" << end << endl << endl;
for(uInt32 address = start; address <= end; address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = start; addr <= end; addr += System::PAGE_SIZE)
{
if(upper)
access.directPokeBase = &myRAM[startCurrentBank + (address & (RAM_BANK_SIZE - 1))];
access.directPokeBase = &myRAM[startCurrentBank + (addr & (RAM_BANK_SIZE - 1))];
else
access.directPeekBase = &myRAM[startCurrentBank + (address & (RAM_BANK_SIZE - 1))];
access.directPeekBase = &myRAM[startCurrentBank + (addr & (RAM_BANK_SIZE - 1))];
access.codeAccessBase = &myCodeAccessBase[mySize + startCurrentBank + (address & (RAM_BANK_SIZE - 1))];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.codeAccessBase = &myCodeAccessBase[mySize + startCurrentBank + (addr & (RAM_BANK_SIZE - 1))];
mySystem->setPageAccess(addr, access);
}
}
@ -226,14 +220,14 @@ void Cartridge3EPlus::bankROMSlot(uInt16 bank)
// Setup the page access methods for the current bank
System::PageAccess access(this, System::PA_READ);
uInt32 start = 0x1000 + (bankNumber << ROM_BANK_TO_POWER) + (upper ? ROM_BANK_SIZE / 2 : 0);
uInt32 end = start + ROM_BANK_SIZE / 2 - 1;
uInt16 start = 0x1000 + (bankNumber << ROM_BANK_TO_POWER) + (upper ? ROM_BANK_SIZE / 2 : 0);
uInt16 end = start + ROM_BANK_SIZE / 2 - 1;
for(uInt32 address = start; address <= end; address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = start; addr <= end; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[startCurrentBank + (address & (ROM_BANK_SIZE - 1))];
access.codeAccessBase = &myCodeAccessBase[startCurrentBank + (address & (ROM_BANK_SIZE - 1))];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[startCurrentBank + (addr & (ROM_BANK_SIZE - 1))];
access.codeAccessBase = &myCodeAccessBase[startCurrentBank + (addr & (ROM_BANK_SIZE - 1))];
mySystem->setPageAccess(addr, access);
}
}
@ -247,10 +241,10 @@ void Cartridge3EPlus::initializeBankState()
{
// All accesses point to peek/poke above
System::PageAccess access(this, System::PA_READ);
uInt32 start = 0x1000 + (b << RAM_BANK_TO_POWER);
uInt32 end = start + RAM_BANK_SIZE - 1;
for (uInt32 address = start; address <= end; address += (1 << System::PAGE_SHIFT))
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
uInt16 start = 0x1000 + (b << RAM_BANK_TO_POWER);
uInt16 end = start + RAM_BANK_SIZE - 1;
for(uInt16 addr = start; addr <= end; addr += System::PAGE_SIZE)
mySystem->setPageAccess(addr, access);
}
else if (bankInUse[b] & BITMASK_ROMRAM)
bankRAMSlot(bankInUse[b]);

View File

@ -51,20 +51,17 @@ void Cartridge3F::install(System& system)
System::PageAccess access(this, System::PA_READWRITE);
// Set the page accessing methods for the hot spots (for 100% emulation
// we need to chain any accesses below 0x40 to the TIA. Our poke() method
// does this via mySystem->tiaPoke(...), at least until we come up with a
// cleaner way to do it).
for(uInt32 i = 0x00; i < 0x40; i += (1 << System::PAGE_SHIFT))
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
// The hotspot ($3F) is in TIA address space, so we claim it here
for(uInt16 addr = 0x00; addr < 0x40; addr += System::PAGE_SIZE)
mySystem->setPageAccess(addr, access);
// Setup the second segment to always point to the last ROM slice
access.type = System::PA_READ;
for(uInt32 j = 0x1800; j < 0x2000; j += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1800; addr < 0x2000; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[(mySize - 2048) + (j & 0x07FF)];
access.codeAccessBase = &myCodeAccessBase[(mySize - 2048) + (j & 0x07FF)];
mySystem->setPageAccess(j >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[(mySize - 2048) + (addr & 0x07FF)];
access.codeAccessBase = &myCodeAccessBase[(mySize - 2048) + (addr & 0x07FF)];
mySystem->setPageAccess(addr, access);
}
// Install pages for startup bank into the first segment
@ -77,13 +74,9 @@ uInt8 Cartridge3F::peek(uInt16 address)
address &= 0x0FFF;
if(address < 0x0800)
{
return myImage[(address & 0x07FF) + (myCurrentBank << 11)];
}
else
{
return myImage[(address & 0x07FF) + mySize - 2048];
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -95,10 +88,7 @@ bool Cartridge3F::poke(uInt16 address, uInt8 value)
if(address <= 0x003F)
bank(value);
// Pass the poke through to the TIA. In a real Atari, both the cart and the
// TIA see the address lines, and both react accordingly. In Stella, each
// 64-byte chunk of address space is "owned" by only one device. If we
// don't chain the poke to the TIA, then the TIA can't see it...
// Handle TIA space that we claimed above
mySystem->tia().poke(address, value);
return false;
@ -128,12 +118,11 @@ bool Cartridge3F::bank(uInt16 bank)
System::PageAccess access(this, System::PA_READ);
// Map ROM image into the system
for(uInt32 address = 0x1000; address < 0x1800;
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1000; addr < 0x1800; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[offset + (address & 0x07FF)];
access.codeAccessBase = &myCodeAccessBase[offset + (address & 0x07FF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[offset + (addr & 0x07FF)];
access.codeAccessBase = &myCodeAccessBase[offset + (addr & 0x07FF)];
mySystem->setPageAccess(addr, access);
}
return myBankChanged = true;
}

View File

@ -73,8 +73,8 @@ void Cartridge4A50::install(System& system)
// Map all of the accesses to call peek and poke (We don't yet indicate RAM areas)
System::PageAccess access(this, System::PA_READ);
for(uInt32 i = 0x1000; i < 0x2000; i += (1 << System::PAGE_SHIFT))
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
for(uInt16 addr = 0x1000; addr < 0x2000; addr += System::PAGE_SIZE)
mySystem->setPageAccess(addr, access);
// Mirror all access in TIA and RIOT; by doing so we're taking responsibility
// for that address space in peek and poke below.

View File

@ -43,12 +43,11 @@ void Cartridge4K::install(System& system)
// Note that we don't need our own peek/poke methods, since the mapping
// takes care of the entire address space
System::PageAccess access(this, System::PA_READ);
for(uInt32 address = 0x1000; address < 0x2000;
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1000; addr < 0x2000; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[address & 0x0FFF];
access.codeAccessBase = &myCodeAccessBase[address & 0x0FFF];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[addr & 0x0FFF];
access.codeAccessBase = &myCodeAccessBase[addr & 0x0FFF];
mySystem->setPageAccess(addr, access);
}
}

View File

@ -45,29 +45,29 @@ void Cartridge4KSC::install(System& system)
// Set the page accessing method for the RAM writing pages
access.type = System::PA_WRITE;
for(uInt32 j = 0x1000; j < 0x1080; j += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1000; addr < 0x1080; addr += System::PAGE_SIZE)
{
access.directPokeBase = &myRAM[j & 0x007F];
access.codeAccessBase = &myCodeAccessBase[j & 0x007F];
mySystem->setPageAccess(j >> System::PAGE_SHIFT, access);
access.directPokeBase = &myRAM[addr & 0x007F];
access.codeAccessBase = &myCodeAccessBase[addr & 0x007F];
mySystem->setPageAccess(addr, access);
}
// Set the page accessing method for the RAM reading pages
access.directPokeBase = 0;
access.type = System::PA_READ;
for(uInt32 k = 0x1080; k < 0x1100; k += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myRAM[k & 0x007F];
access.codeAccessBase = &myCodeAccessBase[0x80 + (k & 0x007F)];
mySystem->setPageAccess(k >> System::PAGE_SHIFT, access);
access.directPeekBase = &myRAM[addr & 0x007F];
access.codeAccessBase = &myCodeAccessBase[0x80 + (addr & 0x007F)];
mySystem->setPageAccess(addr, access);
}
// Map ROM image into the system
for(uInt32 address = 0x1100; address < 0x2000; address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1100; addr < 0x2000; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[address & 0x0FFF];
access.codeAccessBase = &myCodeAccessBase[address & 0x0FFF];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[addr & 0x0FFF];
access.codeAccessBase = &myCodeAccessBase[addr & 0x0FFF];
mySystem->setPageAccess(addr, access);
}
}

View File

@ -79,8 +79,8 @@ void CartridgeAR::install(System& system)
// Map all of the accesses to call peek and poke (we don't yet indicate RAM areas)
System::PageAccess access(this, System::PA_READ);
for(uInt32 i = 0x1000; i < 0x2000; i += (1 << System::PAGE_SHIFT))
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
for(uInt16 addr = 0x1000; addr < 0x2000; addr += System::PAGE_SIZE)
mySystem->setPageAccess(addr, access);
bankConfiguration(0);
}

View File

@ -87,20 +87,20 @@ bool CartridgeBF::bank(uInt16 bank)
System::PageAccess access(this, System::PA_READ);
// Set the page accessing methods for the hot spots
for(uInt32 i = (0x1F80 & ~System::PAGE_MASK); i < 0x2000;
i += (1 << System::PAGE_SHIFT))
for(uInt16 addr = (0x1F80 & ~System::PAGE_MASK); addr < 0x2000;
addr += System::PAGE_SIZE)
{
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (i & 0x0FFF)];
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
// Setup the page access methods for the current bank
for(uInt32 address = 0x1000; address < (0x1F80U & ~System::PAGE_MASK);
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1000; addr < (0x1F80U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[myBankOffset + (address & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
return myBankChanged = true;
}

View File

@ -50,21 +50,21 @@ void CartridgeBFSC::install(System& system)
// Set the page accessing method for the RAM writing pages
access.type = System::PA_WRITE;
for(uInt32 j = 0x1000; j < 0x1080; j += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1000; addr < 0x1080; addr += System::PAGE_SIZE)
{
access.directPokeBase = &myRAM[j & 0x007F];
access.codeAccessBase = &myCodeAccessBase[j & 0x007F];
mySystem->setPageAccess(j >> System::PAGE_SHIFT, access);
access.directPokeBase = &myRAM[addr & 0x007F];
access.codeAccessBase = &myCodeAccessBase[addr & 0x007F];
mySystem->setPageAccess(addr, access);
}
// Set the page accessing method for the RAM reading pages
access.directPokeBase = 0;
access.type = System::PA_READ;
for(uInt32 k = 0x1080; k < 0x1100; k += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myRAM[k & 0x007F];
access.codeAccessBase = &myCodeAccessBase[0x80 + (k & 0x007F)];
mySystem->setPageAccess(k >> System::PAGE_SHIFT, access);
access.directPeekBase = &myRAM[addr & 0x007F];
access.codeAccessBase = &myCodeAccessBase[0x80 + (addr & 0x007F)];
mySystem->setPageAccess(addr, access);
}
// Install pages for the startup bank
@ -124,20 +124,20 @@ bool CartridgeBFSC::bank(uInt16 bank)
System::PageAccess access(this, System::PA_READ);
// Set the page accessing methods for the hot spots
for(uInt32 i = (0x1F80 & ~System::PAGE_MASK); i < 0x2000;
i += (1 << System::PAGE_SHIFT))
for(uInt16 addr = (0x1F80 & ~System::PAGE_MASK); addr < 0x2000;
addr += System::PAGE_SIZE)
{
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (i & 0x0FFF)];
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
// Setup the page access methods for the current bank
for(uInt32 address = 0x1100; address < (0x1F80U & ~System::PAGE_MASK);
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1100; addr < (0x1F80U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[myBankOffset + (address & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
return myBankChanged = true;
}

View File

@ -118,8 +118,8 @@ void CartridgeBUS::install(System& system)
// Map all of the accesses to call peek and poke
System::PageAccess access(this, System::PA_READ);
for(uInt32 i = 0x1000; i < 0x1040; i += (1 << System::PAGE_SHIFT))
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
for(uInt16 addr = 0x1000; addr < 0x1040; addr += System::PAGE_SIZE)
mySystem->setPageAccess(addr, access);
// Mirror all access in TIA and RIOT; by doing so we're taking responsibility
// for that address space in peek and poke below.
@ -440,11 +440,10 @@ bool CartridgeBUS::bank(uInt16 bank)
System::PageAccess access(this, System::PA_READ);
// Map Program ROM image into the system
for(uInt32 address = 0x1040; address < 0x2000;
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1040; addr < 0x2000; addr += System::PAGE_SIZE)
{
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
return myBankChanged = true;
}

View File

@ -124,8 +124,8 @@ void CartridgeCDF::install(System& system)
// Map all of the accesses to call peek and poke
System::PageAccess access(this, System::PA_READ);
for(uInt32 i = 0x1000; i < 0x1040; i += (1 << System::PAGE_SHIFT))
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
for(uInt16 addr = 0x1000; addr < 0x1040; addr += System::PAGE_SIZE)
mySystem->setPageAccess(addr, access);
// Install pages for the startup bank
bank(myStartBank);
@ -403,11 +403,10 @@ bool CartridgeCDF::bank(uInt16 bank)
System::PageAccess access(this, System::PA_READ);
// Map Program ROM image into the system
for(uInt32 address = 0x1040; address < 0x2000;
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1040; addr < 0x2000; addr += System::PAGE_SIZE)
{
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
return myBankChanged = true;
}

View File

@ -117,37 +117,35 @@ bool CartridgeCM::bank(uInt16 bank)
System::PageAccess access(this, System::PA_READ);
// Lower 2K (always ROM)
for(uInt32 address = 0x1000; address < 0x1800;
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1000; addr < 0x1800; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[myBankOffset + (address & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
// Upper 2K (RAM or ROM)
for(uInt32 address = 0x1800; address < 0x2000;
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1800; addr < 0x2000; addr += System::PAGE_SIZE)
{
access.type = System::PA_READWRITE;
if(mySWCHA & 0x10)
{
access.directPeekBase = &myImage[myBankOffset + (address & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (address & 0x0FFF)];
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
}
else
{
access.directPeekBase = &myRAM[address & 0x7FF];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (address & 0x07FF)];
access.directPeekBase = &myRAM[addr & 0x7FF];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x07FF)];
}
if((mySWCHA & 0x30) == 0x20)
access.directPokeBase = &myRAM[address & 0x7FF];
access.directPokeBase = &myRAM[addr & 0x7FF];
else
access.directPokeBase = 0;
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
mySystem->setPageAccess(addr, access);
}
return myBankChanged = true;

View File

@ -67,8 +67,8 @@ void CartridgeCTY::install(System& system)
// Map all RAM accesses to call peek and poke
System::PageAccess access(this, System::PA_READ);
for(uInt32 i = 0x1000; i < 0x1080; i += (1 << System::PAGE_SHIFT))
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
for(uInt16 addr = 0x1000; addr < 0x1080; addr += System::PAGE_SIZE)
mySystem->setPageAccess(addr, access);
// Install pages for the startup bank
bank(myStartBank);
@ -229,11 +229,10 @@ bool CartridgeCTY::bank(uInt16 bank)
// Setup the page access methods for the current bank
System::PageAccess access(this, System::PA_READ);
for(uInt32 address = 0x1080; address < 0x2000;
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1080; addr < 0x2000; addr += System::PAGE_SIZE)
{
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
return myBankChanged = true;
}

View File

@ -66,32 +66,31 @@ void CartridgeCV::install(System& system)
System::PageAccess access(this, System::PA_READ);
// Map ROM image into the system
for(uInt32 address = 0x1800; address < 0x2000;
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1800; addr < 0x2000; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[address & 0x07FF];
access.codeAccessBase = &myCodeAccessBase[address & 0x07FF];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[addr & 0x07FF];
access.codeAccessBase = &myCodeAccessBase[addr & 0x07FF];
mySystem->setPageAccess(addr, access);
}
// Set the page accessing method for the RAM writing pages
access.directPeekBase = 0;
access.codeAccessBase = 0;
access.type = System::PA_WRITE;
for(uInt32 j = 0x1400; j < 0x1800; j += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1400; addr < 0x1800; addr += System::PAGE_SIZE)
{
access.directPokeBase = &myRAM[j & 0x03FF];
mySystem->setPageAccess(j >> System::PAGE_SHIFT, access);
access.directPokeBase = &myRAM[addr & 0x03FF];
mySystem->setPageAccess(addr, access);
}
// Set the page accessing method for the RAM reading pages
access.directPokeBase = 0;
access.type = System::PA_READ;
for(uInt32 k = 0x1000; k < 0x1400; k += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1000; addr < 0x1400; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myRAM[k & 0x03FF];
access.codeAccessBase = &myCodeAccessBase[2048 + (k & 0x03FF)];
mySystem->setPageAccess(k >> System::PAGE_SHIFT, access);
access.directPeekBase = &myRAM[addr & 0x03FF];
access.codeAccessBase = &myCodeAccessBase[2048 + (addr & 0x03FF)];
mySystem->setPageAccess(addr, access);
}
}

View File

@ -53,32 +53,29 @@ void CartridgeCVPlus::install(System& system)
System::PageAccess access(this, System::PA_READWRITE);
// Set the page accessing methods for the hot spots (for 100% emulation
// we need to chain any accesses below 0x40 to the TIA. Our poke() method
// does this via mySystem->tiaPoke(...), at least until we come up with a
// cleaner way to do it).
for(uInt32 i = 0x00; i < 0x40; i += (1 << System::PAGE_SHIFT))
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
// The hotspot ($3D) is in TIA address space, so we claim it here
for(uInt16 addr = 0x00; addr < 0x40; addr += System::PAGE_SIZE)
mySystem->setPageAccess(addr, access);
// Set the page accessing method for the RAM writing pages
access.directPeekBase = 0;
access.codeAccessBase = 0;
access.type = System::PA_WRITE;
for(uInt32 j = 0x1400; j < 0x1800; j += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1400; addr < 0x1800; addr += System::PAGE_SIZE)
{
access.directPokeBase = &myRAM[j & 0x03FF];
access.codeAccessBase = &myCodeAccessBase[mySize + (j & 0x03FF)];
mySystem->setPageAccess(j >> System::PAGE_SHIFT, access);
access.directPokeBase = &myRAM[addr & 0x03FF];
access.codeAccessBase = &myCodeAccessBase[mySize + (addr & 0x03FF)];
mySystem->setPageAccess(addr, access);
}
// Set the page accessing method for the RAM reading pages
access.directPokeBase = 0;
access.type = System::PA_READ;
for(uInt32 k = 0x1000; k < 0x1400; k += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1000; addr < 0x1400; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myRAM[k & 0x03FF];
access.codeAccessBase = &myCodeAccessBase[mySize + (k & 0x03FF)];
mySystem->setPageAccess(k >> System::PAGE_SHIFT, access);
access.directPeekBase = &myRAM[addr & 0x03FF];
access.codeAccessBase = &myCodeAccessBase[mySize + (addr & 0x03FF)];
mySystem->setPageAccess(addr, access);
}
// Install pages for the startup bank into the first segment
@ -114,10 +111,7 @@ bool CartridgeCVPlus::poke(uInt16 address, uInt8 value)
if(address == 0x003D)
bank(value);
// Pass the poke through to the TIA. In a real Atari, both the cart and the
// TIA see the address lines, and both react accordingly. In Stella, each
// 64-byte chunk of address space is "owned" by only one device. If we
// don't chain the poke to the TIA, then the TIA can't see it...
// Handle TIA space that we claimed above
mySystem->tia().poke(address, value);
return false;
@ -146,12 +140,11 @@ bool CartridgeCVPlus::bank(uInt16 bank)
System::PageAccess access(this, System::PA_READ);
// Map ROM image into the system
for(uInt32 address = 0x1800; address < 0x2000;
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1800; addr < 0x2000; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[offset + (address & 0x07FF)];
access.codeAccessBase = &myCodeAccessBase[offset + (address & 0x07FF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[offset + (addr & 0x07FF)];
access.codeAccessBase = &myCodeAccessBase[offset + (addr & 0x07FF)];
mySystem->setPageAccess(addr, access);
}
return myBankChanged = true;

View File

@ -63,12 +63,9 @@ void CartridgeDASH::install(System& system)
System::PageAccess access(this, System::PA_READWRITE);
// Set the page accessing methods for the hot spots (for 100% emulation
// we need to chain any accesses below 0x40 to the TIA. Our poke() method
// does this via mySystem->tiaPoke(...), at least until we come up with a
// cleaner way to do it).
for (uInt32 i = 0x00; i < 0x40; i += (1 << System::PAGE_SHIFT))
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
// The hotspots are in TIA address space, so we claim it here
for (uInt16 addr = 0x00; addr < 0x40; addr += System::PAGE_SIZE)
mySystem->setPageAccess(addr, access);
// Initialise bank values for all ROM/RAM access
// This is used to reverse-lookup from address to bank location
@ -136,10 +133,7 @@ bool CartridgeDASH::poke(uInt16 address, uInt8 value)
else if (address == BANK_SWITCH_HOTSPOT_ROM)
changed = bankROM(value);
// Pass the poke through to the TIA. In a real Atari, both the cart and the
// TIA see the address lines, and both react accordingly. In Stella, each
// 64-byte chunk of address space is "owned" by only one device. If we
// don't chain the poke to the TIA, then the TIA can't see it...
// Handle TIA space that we claimed above
mySystem->tia().poke(address, value);
return changed;
@ -184,18 +178,18 @@ void CartridgeDASH::bankRAMSlot(uInt16 bank)
access.type = System::PA_READ;
}
uInt32 start = 0x1000 + (bankNumber << RAM_BANK_TO_POWER) + (upper ? RAM_WRITE_OFFSET : 0);
uInt32 end = start + RAM_BANK_SIZE - 1;
uInt16 start = 0x1000 + (bankNumber << RAM_BANK_TO_POWER) + (upper ? RAM_WRITE_OFFSET : 0);
uInt16 end = start + RAM_BANK_SIZE - 1;
for (uInt32 address = start; address <= end; address += (1 << System::PAGE_SHIFT))
for (uInt16 addr = start; addr <= end; addr += System::PAGE_SIZE)
{
if(upper)
access.directPokeBase = &myRAM[startCurrentBank + (address & (RAM_BANK_SIZE - 1))];
access.directPokeBase = &myRAM[startCurrentBank + (addr & (RAM_BANK_SIZE - 1))];
else
access.directPeekBase = &myRAM[startCurrentBank + (address & (RAM_BANK_SIZE - 1))];
access.directPeekBase = &myRAM[startCurrentBank + (addr & (RAM_BANK_SIZE - 1))];
access.codeAccessBase = &myCodeAccessBase[mySize + startCurrentBank + (address & (RAM_BANK_SIZE - 1))];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.codeAccessBase = &myCodeAccessBase[mySize + startCurrentBank + (addr & (RAM_BANK_SIZE - 1))];
mySystem->setPageAccess(addr, access);
}
}
@ -231,14 +225,14 @@ void CartridgeDASH::bankROMSlot(uInt16 bank)
// Setup the page access methods for the current bank
System::PageAccess access(this, System::PA_READ);
uInt32 start = 0x1000 + (bankNumber << ROM_BANK_TO_POWER) + (upper ? ROM_BANK_SIZE / 2 : 0);
uInt32 end = start + ROM_BANK_SIZE / 2 - 1;
uInt16 start = 0x1000 + (bankNumber << ROM_BANK_TO_POWER) + (upper ? ROM_BANK_SIZE / 2 : 0);
uInt16 end = start + ROM_BANK_SIZE / 2 - 1;
for (uInt32 address = start; address <= end; address += (1 << System::PAGE_SHIFT))
for (uInt16 addr = start; addr <= end; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[startCurrentBank + (address & (ROM_BANK_SIZE - 1))];
access.codeAccessBase = &myCodeAccessBase[startCurrentBank + (address & (ROM_BANK_SIZE - 1))];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[startCurrentBank + (addr & (ROM_BANK_SIZE - 1))];
access.codeAccessBase = &myCodeAccessBase[startCurrentBank + (addr & (ROM_BANK_SIZE - 1))];
mySystem->setPageAccess(addr, access);
}
}
@ -252,10 +246,10 @@ void CartridgeDASH::initializeBankState()
{
// All accesses point to peek/poke above
System::PageAccess access(this, System::PA_READ);
uInt32 start = 0x1000 + (b << RAM_BANK_TO_POWER);
uInt32 end = start + RAM_BANK_SIZE - 1;
for (uInt32 address = start; address <= end; address += (1 << System::PAGE_SHIFT))
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
uInt16 start = 0x1000 + (b << RAM_BANK_TO_POWER);
uInt16 end = start + RAM_BANK_SIZE - 1;
for (uInt16 addr = start; addr <= end; addr += System::PAGE_SIZE)
mySystem->setPageAccess(addr, access);
}
else if (bankInUse[b] & BITMASK_ROMRAM)
bankRAMSlot(bankInUse[b]);

View File

@ -83,20 +83,20 @@ bool CartridgeDF::bank(uInt16 bank)
System::PageAccess access(this, System::PA_READ);
// Set the page accessing methods for the hot spots
for(uInt32 i = (0x1FC0 & ~System::PAGE_MASK); i < 0x2000;
i += (1 << System::PAGE_SHIFT))
for(uInt16 addr = (0x1FC0 & ~System::PAGE_MASK); addr < 0x2000;
addr += System::PAGE_SIZE)
{
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (i & 0x0FFF)];
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
// Setup the page access methods for the current bank
for(uInt32 address = 0x1000; address < (0x1FC0U & ~System::PAGE_MASK);
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1000; addr < (0x1FC0U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[myBankOffset + (address & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
return myBankChanged = true;
}

View File

@ -50,21 +50,21 @@ void CartridgeDFSC::install(System& system)
// Set the page accessing method for the RAM writing pages
access.type = System::PA_WRITE;
for(uInt32 j = 0x1000; j < 0x1080; j += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1000; addr < 0x1080; addr += System::PAGE_SIZE)
{
access.directPokeBase = &myRAM[j & 0x007F];
access.codeAccessBase = &myCodeAccessBase[j & 0x007F];
mySystem->setPageAccess(j >> System::PAGE_SHIFT, access);
access.directPokeBase = &myRAM[addr & 0x007F];
access.codeAccessBase = &myCodeAccessBase[addr & 0x007F];
mySystem->setPageAccess(addr, access);
}
// Set the page accessing method for the RAM reading pages
access.directPokeBase = 0;
access.type = System::PA_READ;
for(uInt32 k = 0x1080; k < 0x1100; k += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myRAM[k & 0x007F];
access.codeAccessBase = &myCodeAccessBase[0x80 + (k & 0x007F)];
mySystem->setPageAccess(k >> System::PAGE_SHIFT, access);
access.directPeekBase = &myRAM[addr & 0x007F];
access.codeAccessBase = &myCodeAccessBase[0x80 + (addr & 0x007F)];
mySystem->setPageAccess(addr, access);
}
// Install pages for the startup bank
@ -124,20 +124,20 @@ bool CartridgeDFSC::bank(uInt16 bank)
System::PageAccess access(this, System::PA_READ);
// Set the page accessing methods for the hot spots
for(uInt32 i = (0x1FC0 & ~System::PAGE_MASK); i < 0x2000;
i += (1 << System::PAGE_SHIFT))
for(uInt16 addr = (0x1FC0 & ~System::PAGE_MASK); addr < 0x2000;
addr += System::PAGE_SIZE)
{
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (i & 0x0FFF)];
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
// Setup the page access methods for the current bank
for(uInt32 address = 0x1100; address < (0x1FC0U & ~System::PAGE_MASK);
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1100; addr < (0x1FC0U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[myBankOffset + (address & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
return myBankChanged = true;
}

View File

@ -68,8 +68,8 @@ void CartridgeDPC::install(System& system)
// Set the page accessing method for the DPC reading & writing pages
System::PageAccess access(this, System::PA_READWRITE);
for(uInt32 j = 0x1000; j < 0x1080; j += (1 << System::PAGE_SHIFT))
mySystem->setPageAccess(j >> System::PAGE_SHIFT, access);
for(uInt16 addr = 0x1000; addr < 0x1080; addr += System::PAGE_SIZE)
mySystem->setPageAccess(addr, access);
// Install pages for the startup bank
bank(myStartBank);
@ -382,20 +382,20 @@ bool CartridgeDPC::bank(uInt16 bank)
System::PageAccess access(this, System::PA_READ);
// Set the page accessing methods for the hot spots
for(uInt32 i = (0x1FF8 & ~System::PAGE_MASK); i < 0x2000;
i += (1 << System::PAGE_SHIFT))
for(uInt16 addr = (0x1FF8 & ~System::PAGE_MASK); addr < 0x2000;
addr += System::PAGE_SIZE)
{
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (i & 0x0FFF)];
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
// Setup the page access methods for the current bank
for(uInt32 address = 0x1080; address < (0x1FF8U & ~System::PAGE_MASK);
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1080; addr < (0x1FF8U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE)
{
access.directPeekBase = &myProgramImage[myBankOffset + (address & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myProgramImage[myBankOffset + (addr & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
return myBankChanged = true;
}

View File

@ -115,8 +115,8 @@ void CartridgeDPCPlus::install(System& system)
// Map all of the accesses to call peek and poke
System::PageAccess access(this, System::PA_READ);
for(uInt32 i = 0x1000; i < 0x1080; i += (1 << System::PAGE_SHIFT))
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
for(uInt16 addr = 0x1000; addr < 0x1080; addr += System::PAGE_SIZE)
mySystem->setPageAccess(addr, access);
// Install pages for the startup bank
bank(myStartBank);
@ -587,11 +587,10 @@ bool CartridgeDPCPlus::bank(uInt16 bank)
System::PageAccess access(this, System::PA_READ);
// Map Program ROM image into the system
for(uInt32 address = 0x1080; address < 0x2000;
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1080; addr < 0x2000; addr += System::PAGE_SIZE)
{
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
return myBankChanged = true;
}

View File

@ -47,12 +47,12 @@ void CartridgeE0::install(System& system)
System::PageAccess access(this, System::PA_READ);
// Set the page acessing methods for the first part of the last segment
for(uInt32 i = 0x1C00; i < (0x1FE0U & ~System::PAGE_MASK);
i += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1C00; addr < (0x1FE0U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[7168 + (i & 0x03FF)];
access.codeAccessBase = &myCodeAccessBase[7168 + (i & 0x03FF)];
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[7168 + (addr & 0x03FF)];
access.codeAccessBase = &myCodeAccessBase[7168 + (addr & 0x03FF)];
mySystem->setPageAccess(addr, access);
}
myCurrentSlice[3] = 7;
@ -60,9 +60,9 @@ void CartridgeE0::install(System& system)
access.directPeekBase = 0;
access.codeAccessBase = &myCodeAccessBase[8128];
access.type = System::PA_READ;
for(uInt32 j = (0x1FE0 & ~System::PAGE_MASK); j < 0x2000;
j += (1 << System::PAGE_SHIFT))
mySystem->setPageAccess(j >> System::PAGE_SHIFT, access);
for(uInt16 addr = (0x1FE0 & ~System::PAGE_MASK); addr < 0x2000;
addr += System::PAGE_SIZE)
mySystem->setPageAccess(addr, access);
// Install some default slices for the other segments
segmentZero(4);
@ -125,12 +125,11 @@ void CartridgeE0::segmentZero(uInt16 slice)
// Setup the page access methods for the current bank
System::PageAccess access(this, System::PA_READ);
for(uInt32 address = 0x1000; address < 0x1400;
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1000; addr < 0x1400; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[offset + (address & 0x03FF)];
access.codeAccessBase = &myCodeAccessBase[offset + (address & 0x03FF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[offset + (addr & 0x03FF)];
access.codeAccessBase = &myCodeAccessBase[offset + (addr & 0x03FF)];
mySystem->setPageAccess(addr, access);
}
myBankChanged = true;
}
@ -147,11 +146,11 @@ void CartridgeE0::segmentOne(uInt16 slice)
// Setup the page access methods for the current bank
System::PageAccess access(this, System::PA_READ);
for(uInt32 address = 0x1400; address < 0x1800; address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1400; addr < 0x1800; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[offset + (address & 0x03FF)];
access.codeAccessBase = &myCodeAccessBase[offset + (address & 0x03FF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[offset + (addr & 0x03FF)];
access.codeAccessBase = &myCodeAccessBase[offset + (addr & 0x03FF)];
mySystem->setPageAccess(addr, access);
}
myBankChanged = true;
}
@ -168,12 +167,11 @@ void CartridgeE0::segmentTwo(uInt16 slice)
// Setup the page access methods for the current bank
System::PageAccess access(this, System::PA_READ);
for(uInt32 address = 0x1800; address < 0x1C00;
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1800; addr < 0x1C00; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[offset + (address & 0x03FF)];
access.codeAccessBase = &myCodeAccessBase[offset + (address & 0x03FF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[offset + (addr & 0x03FF)];
access.codeAccessBase = &myCodeAccessBase[offset + (addr & 0x03FF)];
mySystem->setPageAccess(addr, access);
}
myBankChanged = true;
}

View File

@ -52,20 +52,20 @@ void CartridgeE7::install(System& system)
System::PageAccess access(this, System::PA_READ);
// Set the page accessing methods for the hot spots
for(uInt32 i = (0x1FE0 & ~System::PAGE_MASK); i < 0x2000;
i += (1 << System::PAGE_SHIFT))
for(uInt16 addr = (0x1FE0 & ~System::PAGE_MASK); addr < 0x2000;
addr += System::PAGE_SIZE)
{
access.codeAccessBase = &myCodeAccessBase[8128];
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
mySystem->setPageAccess(addr, access);
}
// Setup the second segment to always point to the last ROM slice
for(uInt32 j = 0x1A00; j < (0x1FE0U & ~System::PAGE_MASK);
j += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1A00; addr < (0x1FE0U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[7 * 2048 + (j & 0x07FF)];
access.codeAccessBase = &myCodeAccessBase[7 * 2048 + (j & 0x07FF)];
mySystem->setPageAccess(j >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[7 * 2048 + (addr & 0x07FF)];
access.codeAccessBase = &myCodeAccessBase[7 * 2048 + (addr & 0x07FF)];
mySystem->setPageAccess(addr, access);
}
myCurrentSlice[1] = 7;
@ -154,21 +154,21 @@ void CartridgeE7::bankRAM(uInt16 bank)
System::PageAccess access(this, System::PA_WRITE);
// Set the page accessing method for the 256 bytes of RAM writing pages
for(uInt32 j = 0x1800; j < 0x1900; j += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1800; addr < 0x1900; addr += System::PAGE_SIZE)
{
access.directPokeBase = &myRAM[1024 + offset + (j & 0x00FF)];
access.codeAccessBase = &myCodeAccessBase[8192 + 1024 + offset + (j & 0x00FF)];
mySystem->setPageAccess(j >> System::PAGE_SHIFT, access);
access.directPokeBase = &myRAM[1024 + offset + (addr & 0x00FF)];
access.codeAccessBase = &myCodeAccessBase[8192 + 1024 + offset + (addr & 0x00FF)];
mySystem->setPageAccess(addr, access);
}
// Set the page accessing method for the 256 bytes of RAM reading pages
access.directPokeBase = 0;
access.type = System::PA_READ;
for(uInt32 k = 0x1900; k < 0x1A00; k += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1900; addr < 0x1A00; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myRAM[1024 + offset + (k & 0x00FF)];
access.codeAccessBase = &myCodeAccessBase[8192 + 1024 + offset + (k & 0x00FF)];
mySystem->setPageAccess(k >> System::PAGE_SHIFT, access);
access.directPeekBase = &myRAM[1024 + offset + (addr & 0x00FF)];
access.codeAccessBase = &myCodeAccessBase[8192 + 1024 + offset + (addr & 0x00FF)];
mySystem->setPageAccess(addr, access);
}
myBankChanged = true;
}
@ -188,12 +188,11 @@ bool CartridgeE7::bank(uInt16 slice)
System::PageAccess access(this, System::PA_READ);
// Map ROM image into first segment
for(uInt32 address = 0x1000; address < 0x1800;
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1000; addr < 0x1800; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[offset + (address & 0x07FF)];
access.codeAccessBase = &myCodeAccessBase[offset + (address & 0x07FF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[offset + (addr & 0x07FF)];
access.codeAccessBase = &myCodeAccessBase[offset + (addr & 0x07FF)];
mySystem->setPageAccess(addr, access);
}
}
else
@ -201,21 +200,21 @@ bool CartridgeE7::bank(uInt16 slice)
System::PageAccess access(this, System::PA_WRITE);
// Set the page accessing method for the 1K slice of RAM writing pages
for(uInt32 j = 0x1000; j < 0x1400; j += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1000; addr < 0x1400; addr += System::PAGE_SIZE)
{
access.directPokeBase = &myRAM[j & 0x03FF];
access.codeAccessBase = &myCodeAccessBase[8192 + (j & 0x03FF)];
mySystem->setPageAccess(j >> System::PAGE_SHIFT, access);
access.directPokeBase = &myRAM[addr & 0x03FF];
access.codeAccessBase = &myCodeAccessBase[8192 + (addr & 0x03FF)];
mySystem->setPageAccess(addr, access);
}
// Set the page accessing method for the 1K slice of RAM reading pages
access.directPokeBase = 0;
access.type = System::PA_READ;
for(uInt32 k = 0x1400; k < 0x1800; k += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1400; addr < 0x1800; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myRAM[k & 0x03FF];
access.codeAccessBase = &myCodeAccessBase[8192 + (k & 0x03FF)];
mySystem->setPageAccess(k >> System::PAGE_SHIFT, access);
access.directPeekBase = &myRAM[addr & 0x03FF];
access.codeAccessBase = &myCodeAccessBase[8192 + (addr & 0x03FF)];
mySystem->setPageAccess(addr, access);
}
}
return myBankChanged = true;

View File

@ -83,20 +83,20 @@ bool CartridgeEF::bank(uInt16 bank)
System::PageAccess access(this, System::PA_READ);
// Set the page accessing methods for the hot spots
for(uInt32 i = (0x1FE0 & ~System::PAGE_MASK); i < 0x2000;
i += (1 << System::PAGE_SHIFT))
for(uInt16 addr = (0x1FE0 & ~System::PAGE_MASK); addr < 0x2000;
addr += System::PAGE_SIZE)
{
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (i & 0x0FFF)];
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
// Setup the page access methods for the current bank
for(uInt32 address = 0x1000; address < (0x1FE0U & ~System::PAGE_MASK);
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1000; addr < (0x1FE0U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[myBankOffset + (address & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
return myBankChanged = true;
}

View File

@ -50,21 +50,21 @@ void CartridgeEFSC::install(System& system)
// Set the page accessing method for the RAM writing pages
access.type = System::PA_WRITE;
for(uInt32 j = 0x1000; j < 0x1080; j += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1000; addr < 0x1080; addr += System::PAGE_SIZE)
{
access.directPokeBase = &myRAM[j & 0x007F];
access.codeAccessBase = &myCodeAccessBase[j & 0x007F];
mySystem->setPageAccess(j >> System::PAGE_SHIFT, access);
access.directPokeBase = &myRAM[addr & 0x007F];
access.codeAccessBase = &myCodeAccessBase[addr & 0x007F];
mySystem->setPageAccess(addr, access);
}
// Set the page accessing method for the RAM reading pages
access.directPokeBase = 0;
access.type = System::PA_READ;
for(uInt32 k = 0x1080; k < 0x1100; k += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myRAM[k & 0x007F];
access.codeAccessBase = &myCodeAccessBase[0x80 + (k & 0x007F)];
mySystem->setPageAccess(k >> System::PAGE_SHIFT, access);
access.directPeekBase = &myRAM[addr & 0x007F];
access.codeAccessBase = &myCodeAccessBase[0x80 + (addr & 0x007F)];
mySystem->setPageAccess(addr, access);
}
// Install pages for the startup bank
@ -124,20 +124,20 @@ bool CartridgeEFSC::bank(uInt16 bank)
System::PageAccess access(this, System::PA_READ);
// Set the page accessing methods for the hot spots
for(uInt32 i = (0x1FE0 & ~System::PAGE_MASK); i < 0x2000;
i += (1 << System::PAGE_SHIFT))
for(uInt16 addr = (0x1FE0 & ~System::PAGE_MASK); addr < 0x2000;
addr += System::PAGE_SIZE)
{
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (i & 0x0FFF)];
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
// Setup the page access methods for the current bank
for(uInt32 address = 0x1100; address < (0x1FE0U & ~System::PAGE_MASK);
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1100; addr < (0x1FE0U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[myBankOffset + (address & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
return myBankChanged = true;
}

View File

@ -91,20 +91,20 @@ bool CartridgeF0::bank(uInt16 bank)
System::PageAccess access(this, System::PA_READ);
// Set the page accessing methods for the hot spots
for(uInt32 i = (0x1FF0 & ~System::PAGE_MASK); i < 0x2000;
i += (1 << System::PAGE_SHIFT))
for(uInt16 addr = (0x1FF0 & ~System::PAGE_MASK); addr < 0x2000;
addr += System::PAGE_SIZE)
{
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (i & 0x0FFF)];
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
// Setup the page access methods for the current bank
for(uInt32 address = 0x1000; address < (0x1FF0U & ~System::PAGE_MASK);
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1000; addr < (0x1FF0U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[myBankOffset + (address & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
return myBankChanged = true;

View File

@ -88,20 +88,20 @@ bool CartridgeF4::bank(uInt16 bank)
System::PageAccess access(this, System::PA_READ);
// Set the page accessing methods for the hot spots
for(uInt32 i = (0x1FF4 & ~System::PAGE_MASK); i < 0x2000;
i += (1 << System::PAGE_SHIFT))
for(uInt16 addr = (0x1FF4 & ~System::PAGE_MASK); addr < 0x2000;
addr += System::PAGE_SIZE)
{
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (i & 0x0FFF)];
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
// Setup the page access methods for the current bank
for(uInt32 address = 0x1000; address < (0x1FF4U & ~System::PAGE_MASK);
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1000; addr < (0x1FF4U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[myBankOffset + (address & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
return myBankChanged = true;
}

View File

@ -50,21 +50,21 @@ void CartridgeF4SC::install(System& system)
// Set the page accessing method for the RAM writing pages
access.type = System::PA_WRITE;
for(uInt32 j = 0x1000; j < 0x1080; j += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1000; addr < 0x1080; addr += System::PAGE_SIZE)
{
access.directPokeBase = &myRAM[j & 0x007F];
access.codeAccessBase = &myCodeAccessBase[j & 0x007F];
mySystem->setPageAccess(j >> System::PAGE_SHIFT, access);
access.directPokeBase = &myRAM[addr & 0x007F];
access.codeAccessBase = &myCodeAccessBase[addr & 0x007F];
mySystem->setPageAccess(addr, access);
}
// Set the page accessing method for the RAM reading pages
access.directPokeBase = 0;
access.type = System::PA_READ;
for(uInt32 k = 0x1080; k < 0x1100; k += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myRAM[k & 0x007F];
access.codeAccessBase = &myCodeAccessBase[0x80 + (k & 0x007F)];
mySystem->setPageAccess(k >> System::PAGE_SHIFT, access);
access.directPeekBase = &myRAM[addr & 0x007F];
access.codeAccessBase = &myCodeAccessBase[0x80 + (addr & 0x007F)];
mySystem->setPageAccess(addr, access);
}
// Install pages for the startup bank
@ -127,20 +127,20 @@ bool CartridgeF4SC::bank(uInt16 bank)
System::PageAccess access(this, System::PA_READ);
// Set the page accessing methods for the hot spots
for(uInt32 i = (0x1FF4 & ~System::PAGE_MASK); i < 0x2000;
i += (1 << System::PAGE_SHIFT))
for(uInt16 addr = (0x1FF4 & ~System::PAGE_MASK); addr < 0x2000;
addr += System::PAGE_SIZE)
{
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (i & 0x0FFF)];
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
// Setup the page access methods for the current bank
for(uInt32 address = 0x1100; address < (0x1FF4U & ~System::PAGE_MASK);
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1100; addr < (0x1FF4U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[myBankOffset + (address & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
return myBankChanged = true;
}

View File

@ -128,20 +128,20 @@ bool CartridgeF6::bank(uInt16 bank)
System::PageAccess access(this, System::PA_READ);
// Set the page accessing methods for the hot spots
for(uInt32 i = (0x1FF6 & ~System::PAGE_MASK); i < 0x2000;
i += (1 << System::PAGE_SHIFT))
for(uInt16 addr = (0x1FF6 & ~System::PAGE_MASK); addr < 0x2000;
addr += System::PAGE_SIZE)
{
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (i & 0x0FFF)];
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
// Setup the page access methods for the current bank
for(uInt32 address = 0x1000; address < (0x1FF6U & ~System::PAGE_MASK);
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1000; addr < (0x1FF6U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[myBankOffset + (address & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
return myBankChanged = true;
}

View File

@ -50,21 +50,21 @@ void CartridgeF6SC::install(System& system)
// Set the page accessing method for the RAM writing pages
access.type = System::PA_WRITE;
for(uInt32 j = 0x1000; j < 0x1080; j += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1000; addr < 0x1080; addr += System::PAGE_SIZE)
{
access.directPokeBase = &myRAM[j & 0x007F];
access.codeAccessBase = &myCodeAccessBase[j & 0x007F];
mySystem->setPageAccess(j >> System::PAGE_SHIFT, access);
access.directPokeBase = &myRAM[addr & 0x007F];
access.codeAccessBase = &myCodeAccessBase[addr & 0x007F];
mySystem->setPageAccess(addr, access);
}
// Set the page accessing method for the RAM reading pages
access.directPokeBase = 0;
access.type = System::PA_READ;
for(uInt32 k = 0x1080; k < 0x1100; k += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myRAM[k & 0x007F];
access.codeAccessBase = &myCodeAccessBase[0x80 + (k & 0x007F)];
mySystem->setPageAccess(k >> System::PAGE_SHIFT, access);
access.directPeekBase = &myRAM[addr & 0x007F];
access.codeAccessBase = &myCodeAccessBase[0x80 + (addr & 0x007F)];
mySystem->setPageAccess(addr, access);
}
// Install pages for the startup bank
@ -170,20 +170,20 @@ bool CartridgeF6SC::bank(uInt16 bank)
System::PageAccess access(this, System::PA_READ);
// Set the page accessing methods for the hot spots
for(uInt32 i = (0x1FF6 & ~System::PAGE_MASK); i < 0x2000;
i += (1 << System::PAGE_SHIFT))
for(uInt16 addr = (0x1FF6 & ~System::PAGE_MASK); addr < 0x2000;
addr += System::PAGE_SIZE)
{
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (i & 0x0FFF)];
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
// Setup the page access methods for the current bank
for(uInt32 address = 0x1100; address < (0x1FF6U & ~System::PAGE_MASK);
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1100; addr < (0x1FF6U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[myBankOffset + (address & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
return myBankChanged = true;
}

View File

@ -116,20 +116,20 @@ bool CartridgeF8::bank(uInt16 bank)
System::PageAccess access(this, System::PA_READ);
// Set the page accessing methods for the hot spots
for(uInt32 i = (0x1FF8 & ~System::PAGE_MASK); i < 0x2000;
i += (1 << System::PAGE_SHIFT))
for(uInt16 addr = (0x1FF8 & ~System::PAGE_MASK); addr < 0x2000;
addr += System::PAGE_SIZE)
{
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (i & 0x0FFF)];
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
// Setup the page access methods for the current bank
for(uInt32 address = 0x1000; address < (0x1FF8U & ~System::PAGE_MASK);
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1000; addr < (0x1FF8U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[myBankOffset + (address & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
return myBankChanged = true;
}

View File

@ -50,21 +50,21 @@ void CartridgeF8SC::install(System& system)
// Set the page accessing method for the RAM writing pages
access.type = System::PA_WRITE;
for(uInt32 j = 0x1000; j < 0x1080; j += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1000; addr < 0x1080; addr += System::PAGE_SIZE)
{
access.directPokeBase = &myRAM[j & 0x007F];
access.codeAccessBase = &myCodeAccessBase[j & 0x007F];
mySystem->setPageAccess(j >> System::PAGE_SHIFT, access);
access.directPokeBase = &myRAM[addr & 0x007F];
access.codeAccessBase = &myCodeAccessBase[addr & 0x007F];
mySystem->setPageAccess(addr, access);
}
// Set the page accessing method for the RAM reading pages
access.directPokeBase = 0;
access.type = System::PA_READ;
for(uInt32 k = 0x1080; k < 0x1100; k += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myRAM[k & 0x007F];
access.codeAccessBase = &myCodeAccessBase[0x80 + (k & 0x007F)];
mySystem->setPageAccess(k >> System::PAGE_SHIFT, access);
access.directPeekBase = &myRAM[addr & 0x007F];
access.codeAccessBase = &myCodeAccessBase[0x80 + (addr & 0x007F)];
mySystem->setPageAccess(addr, access);
}
// Install pages for the startup bank
@ -150,20 +150,20 @@ bool CartridgeF8SC::bank(uInt16 bank)
System::PageAccess access(this, System::PA_READ);
// Set the page accessing methods for the hot spots
for(uInt32 i = (0x1FF8 & ~System::PAGE_MASK); i < 0x2000;
i += (1 << System::PAGE_SHIFT))
for(uInt16 addr = (0x1FF8 & ~System::PAGE_MASK); addr < 0x2000;
addr += System::PAGE_SIZE)
{
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (i & 0x0FFF)];
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
// Setup the page access methods for the current bank
for(uInt32 address = 0x1100; address < (0x1FF8U & ~System::PAGE_MASK);
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1100; addr < (0x1FF8U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[myBankOffset + (address & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
return myBankChanged = true;
}

View File

@ -50,21 +50,21 @@ void CartridgeFA::install(System& system)
// Set the page accessing method for the RAM writing pages
access.type = System::PA_WRITE;
for(uInt32 j = 0x1000; j < 0x1100; j += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1000; addr < 0x1100; addr += System::PAGE_SIZE)
{
access.directPokeBase = &myRAM[j & 0x00FF];
access.codeAccessBase = &myCodeAccessBase[j & 0x00FF];
mySystem->setPageAccess(j >> System::PAGE_SHIFT, access);
access.directPokeBase = &myRAM[addr & 0x00FF];
access.codeAccessBase = &myCodeAccessBase[addr & 0x00FF];
mySystem->setPageAccess(addr, access);
}
// Set the page accessing method for the RAM reading pages
access.directPokeBase = 0;
access.type = System::PA_READ;
for(uInt32 k = 0x1100; k < 0x1200; k += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1100; addr < 0x1200; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myRAM[k & 0x00FF];
access.codeAccessBase = &myCodeAccessBase[0x100 + (k & 0x00FF)];
mySystem->setPageAccess(k >> System::PAGE_SHIFT, access);
access.directPeekBase = &myRAM[addr & 0x00FF];
access.codeAccessBase = &myCodeAccessBase[0x100 + (addr & 0x00FF)];
mySystem->setPageAccess(addr, access);
}
// Install pages for the startup bank
@ -160,20 +160,20 @@ bool CartridgeFA::bank(uInt16 bank)
System::PageAccess access(this, System::PA_READ);
// Set the page accessing methods for the hot spots
for(uInt32 i = (0x1FF8 & ~System::PAGE_MASK); i < 0x2000;
i += (1 << System::PAGE_SHIFT))
for(uInt16 addr = (0x1FF8 & ~System::PAGE_MASK); addr < 0x2000;
addr += System::PAGE_SIZE)
{
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (i & 0x0FFF)];
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
// Setup the page access methods for the current bank
for(uInt32 address = 0x1200; address < (0x1FF8U & ~System::PAGE_MASK);
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1200; addr < (0x1FF8U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[myBankOffset + (address & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
return myBankChanged = true;
}

View File

@ -62,21 +62,21 @@ void CartridgeFA2::install(System& system)
// Set the page accessing method for the RAM writing pages
access.type = System::PA_WRITE;
for(uInt32 j = 0x1000; j < 0x1100; j += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1000; addr < 0x1100; addr += System::PAGE_SIZE)
{
access.directPokeBase = &myRAM[j & 0x00FF];
access.codeAccessBase = &myCodeAccessBase[j & 0x00FF];
mySystem->setPageAccess(j >> System::PAGE_SHIFT, access);
access.directPokeBase = &myRAM[addr & 0x00FF];
access.codeAccessBase = &myCodeAccessBase[addr & 0x00FF];
mySystem->setPageAccess(addr, access);
}
// Set the page accessing method for the RAM reading pages
access.directPokeBase = 0;
access.type = System::PA_READ;
for(uInt32 k = 0x1100; k < 0x1200; k += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1100; addr < 0x1200; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myRAM[k & 0x00FF];
access.codeAccessBase = &myCodeAccessBase[0x100 + (k & 0x00FF)];
mySystem->setPageAccess(k >> System::PAGE_SHIFT, access);
access.directPeekBase = &myRAM[addr & 0x00FF];
access.codeAccessBase = &myCodeAccessBase[0x100 + (addr & 0x00FF)];
mySystem->setPageAccess(addr, access);
}
// Install pages for the startup bank
@ -226,20 +226,20 @@ bool CartridgeFA2::bank(uInt16 bank)
System::PageAccess access(this, System::PA_READ);
// Set the page accessing methods for the hot spots
for(uInt32 i = (0x1FF4 & ~System::PAGE_MASK); i < 0x2000;
i += (1 << System::PAGE_SHIFT))
for(uInt16 addr = (0x1FF4 & ~System::PAGE_MASK); addr < 0x2000;
addr += System::PAGE_SIZE)
{
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (i & 0x0FFF)];
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
// Setup the page access methods for the current bank
for(uInt32 address = 0x1200; address < (0x1FF4U & ~System::PAGE_MASK);
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1200; addr < (0x1FF4U & ~System::PAGE_MASK);
addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[myBankOffset + (address & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
return myBankChanged = true;
}

View File

@ -47,13 +47,13 @@ void CartridgeFE::install(System& system)
// The hotspot $01FE is in a mirror of zero-page RAM
// We need to claim access to it here, and deal with it in peek/poke below
System::PageAccess access(this, System::PA_READWRITE);
for(uInt32 i = 0x180; i < 0x200; i += (1 << System::PAGE_SHIFT))
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
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::PA_READ;
for(uInt32 i = 0x1000; i < 0x2000; i += (1 << System::PAGE_SHIFT))
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
for(uInt16 addr = 0x1000; addr < 0x2000; addr += System::PAGE_SIZE)
mySystem->setPageAccess(addr, access);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -51,19 +51,19 @@ void CartridgeMDM::install(System& system)
// Get the page accessing methods for the hot spots since they overlap
// areas within the TIA we'll need to forward requests to the TIA
myHotSpotPageAccess[0] = mySystem->getPageAccess(0x0800 >> System::PAGE_SHIFT);
myHotSpotPageAccess[1] = mySystem->getPageAccess(0x0900 >> System::PAGE_SHIFT);
myHotSpotPageAccess[2] = mySystem->getPageAccess(0x0A00 >> System::PAGE_SHIFT);
myHotSpotPageAccess[3] = mySystem->getPageAccess(0x0B00 >> System::PAGE_SHIFT);
myHotSpotPageAccess[4] = mySystem->getPageAccess(0x0C00 >> System::PAGE_SHIFT);
myHotSpotPageAccess[5] = mySystem->getPageAccess(0x0D00 >> System::PAGE_SHIFT);
myHotSpotPageAccess[6] = mySystem->getPageAccess(0x0E00 >> System::PAGE_SHIFT);
myHotSpotPageAccess[7] = mySystem->getPageAccess(0x0F00 >> System::PAGE_SHIFT);
myHotSpotPageAccess[0] = mySystem->getPageAccess(0x0800);
myHotSpotPageAccess[1] = mySystem->getPageAccess(0x0900);
myHotSpotPageAccess[2] = mySystem->getPageAccess(0x0A00);
myHotSpotPageAccess[3] = mySystem->getPageAccess(0x0B00);
myHotSpotPageAccess[4] = mySystem->getPageAccess(0x0C00);
myHotSpotPageAccess[5] = mySystem->getPageAccess(0x0D00);
myHotSpotPageAccess[6] = mySystem->getPageAccess(0x0E00);
myHotSpotPageAccess[7] = mySystem->getPageAccess(0x0F00);
// Set the page accessing methods for the hot spots
System::PageAccess access(this, System::PA_READWRITE);
for(uInt32 i = 0x0800; i < 0x0BFF; i += (1 << System::PAGE_SHIFT))
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
for(uInt16 addr = 0x0800; addr < 0x0BFF; addr += System::PAGE_SIZE)
mySystem->setPageAccess(addr, access);
// Install pages for bank 0
bank(myStartBank);
@ -111,12 +111,11 @@ bool CartridgeMDM::bank(uInt16 bank)
System::PageAccess access(this, System::PA_READ);
// Map ROM image into the system
for(uInt32 address = 0x1000; address < 0x2000;
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1000; addr < 0x2000; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[myBankOffset + (address & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
// Accesses above bank 127 disable further bankswitching; we're only

View File

@ -50,20 +50,20 @@ void CartridgeSB::install(System& system)
// Get the page accessing methods for the hot spots since they overlap
// areas within the TIA we'll need to forward requests to the TIA
myHotSpotPageAccess[0] = mySystem->getPageAccess(0x0800 >> System::PAGE_SHIFT);
myHotSpotPageAccess[1] = mySystem->getPageAccess(0x0900 >> System::PAGE_SHIFT);
myHotSpotPageAccess[2] = mySystem->getPageAccess(0x0A00 >> System::PAGE_SHIFT);
myHotSpotPageAccess[3] = mySystem->getPageAccess(0x0B00 >> System::PAGE_SHIFT);
myHotSpotPageAccess[4] = mySystem->getPageAccess(0x0C00 >> System::PAGE_SHIFT);
myHotSpotPageAccess[5] = mySystem->getPageAccess(0x0D00 >> System::PAGE_SHIFT);
myHotSpotPageAccess[6] = mySystem->getPageAccess(0x0E00 >> System::PAGE_SHIFT);
myHotSpotPageAccess[7] = mySystem->getPageAccess(0x0F00 >> System::PAGE_SHIFT);
myHotSpotPageAccess[0] = mySystem->getPageAccess(0x0800);
myHotSpotPageAccess[1] = mySystem->getPageAccess(0x0900);
myHotSpotPageAccess[2] = mySystem->getPageAccess(0x0A00);
myHotSpotPageAccess[3] = mySystem->getPageAccess(0x0B00);
myHotSpotPageAccess[4] = mySystem->getPageAccess(0x0C00);
myHotSpotPageAccess[5] = mySystem->getPageAccess(0x0D00);
myHotSpotPageAccess[6] = mySystem->getPageAccess(0x0E00);
myHotSpotPageAccess[7] = mySystem->getPageAccess(0x0F00);
System::PageAccess access(this, System::PA_READ);
// Set the page accessing methods for the hot spots
for(uInt32 i = 0x0800; i < 0x0FFF; i += (1 << System::PAGE_SHIFT))
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
for(uInt16 addr = 0x0800; addr < 0x0FFF; addr += System::PAGE_SIZE)
mySystem->setPageAccess(addr, access);
// Install pages for startup bank
bank(myStartBank);
@ -120,12 +120,11 @@ bool CartridgeSB::bank(uInt16 bank)
System::PageAccess access(this, System::PA_READ);
// Map ROM image into the system
for(uInt32 address = 0x1000; address < 0x2000;
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1000; addr < 0x2000; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[myBankOffset + (address & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
return myBankChanged = true;
}

View File

@ -46,12 +46,12 @@ void CartridgeUA::install(System& system)
// Get the page accessing methods for the hot spots since they overlap
// areas within the TIA we'll need to forward requests to the TIA
myHotSpotPageAccess = mySystem->getPageAccess(0x0220 >> System::PAGE_SHIFT);
myHotSpotPageAccess = mySystem->getPageAccess(0x0220);
// Set the page accessing methods for the hot spots
System::PageAccess access(this, System::PA_READ);
mySystem->setPageAccess(0x0220 >> System::PAGE_SHIFT, access);
mySystem->setPageAccess(0x0240 >> System::PAGE_SHIFT, access);
mySystem->setPageAccess(0x0220, access);
mySystem->setPageAccess(0x0240, access);
// Install pages for the startup bank
bank(myStartBank);
@ -126,12 +126,11 @@ bool CartridgeUA::bank(uInt16 bank)
System::PageAccess access(this, System::PA_READ);
// Map ROM image into the system
for(uInt32 address = 0x1000; address < 0x2000;
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1000; addr < 0x2000; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[myBankOffset + (address & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[myBankOffset + (addr & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[myBankOffset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
return myBankChanged = true;
}

View File

@ -56,20 +56,20 @@ void CartridgeWD::install(System& system)
// Set the page accessing method for the RAM reading pages
System::PageAccess read(this, System::PA_READ);
for(uInt32 k = 0x1000; k < 0x1040; k += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1000; addr < 0x1040; addr += System::PAGE_SIZE)
{
read.directPeekBase = &myRAM[k & 0x003F];
read.codeAccessBase = &myCodeAccessBase[k & 0x003F];
mySystem->setPageAccess(k >> System::PAGE_SHIFT, read);
read.directPeekBase = &myRAM[addr & 0x003F];
read.codeAccessBase = &myCodeAccessBase[addr & 0x003F];
mySystem->setPageAccess(addr, read);
}
// Set the page accessing method for the RAM writing pages
System::PageAccess write(this, System::PA_WRITE);
for(uInt32 j = 0x1040; j < 0x1080; j += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1040; addr < 0x1080; addr += System::PAGE_SIZE)
{
write.directPokeBase = &myRAM[j & 0x003F];
write.codeAccessBase = &myCodeAccessBase[j & 0x003F];
mySystem->setPageAccess(j >> System::PAGE_SHIFT, write);
write.directPokeBase = &myRAM[addr & 0x003F];
write.codeAccessBase = &myCodeAccessBase[addr & 0x003F];
mySystem->setPageAccess(addr, write);
}
// Mirror all access in TIA; by doing so we're taking responsibility
@ -168,11 +168,10 @@ void CartridgeWD::segmentZero(uInt8 slice)
System::PageAccess access(this, System::PA_READ);
// Skip first 128 bytes; it is always RAM
for(uInt32 address = 0x1080; address < 0x1400;
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1080; addr < 0x1400; addr += System::PAGE_SIZE)
{
access.codeAccessBase = &myCodeAccessBase[offset + (address & 0x03FF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.codeAccessBase = &myCodeAccessBase[offset + (addr & 0x03FF)];
mySystem->setPageAccess(addr, access);
}
myOffset[0] = offset;
}
@ -183,11 +182,10 @@ void CartridgeWD::segmentOne(uInt8 slice)
uInt16 offset = slice << 10;
System::PageAccess access(this, System::PA_READ);
for(uInt32 address = 0x1400; address < 0x1800;
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1400; addr < 0x1800; addr += System::PAGE_SIZE)
{
access.codeAccessBase = &myCodeAccessBase[offset + (address & 0x03FF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.codeAccessBase = &myCodeAccessBase[offset + (addr & 0x03FF)];
mySystem->setPageAccess(addr, access);
}
myOffset[1] = offset;
}
@ -198,11 +196,10 @@ void CartridgeWD::segmentTwo(uInt8 slice)
uInt16 offset = slice << 10;
System::PageAccess access(this, System::PA_READ);
for(uInt32 address = 0x1800; address < 0x1C00;
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1800; addr < 0x1C00; addr += System::PAGE_SIZE)
{
access.codeAccessBase = &myCodeAccessBase[offset + (address & 0x03FF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.codeAccessBase = &myCodeAccessBase[offset + (addr & 0x03FF)];
mySystem->setPageAccess(addr, access);
}
myOffset[2] = offset;
}
@ -224,11 +221,10 @@ void CartridgeWD::segmentThree(uInt8 slice, bool map3bytes)
System::PageAccess access(this, System::PA_READ);
for(uInt32 address = 0x1C00; address < 0x2000;
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1C00; addr < 0x2000; addr += System::PAGE_SIZE)
{
access.codeAccessBase = &myCodeAccessBase[offset + (address & 0x03FF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.codeAccessBase = &myCodeAccessBase[offset + (addr & 0x03FF)];
mySystem->setPageAccess(addr, access);
}
myOffset[3] = offset;
}

View File

@ -50,8 +50,8 @@ void CartridgeX07::install(System& system)
// The hotspots use almost all addresses below 0x1000, so we simply grab them
// all and forward the TIA/RIOT calls from the peek and poke methods.
System::PageAccess access(this, System::PA_READWRITE);
for(uInt32 i = 0x00; i < 0x1000; i += (1 << System::PAGE_SHIFT))
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
for(uInt16 addr = 0x00; addr < 0x1000; addr += System::PAGE_SIZE)
mySystem->setPageAccess(addr, access);
// Install pages for the startup bank
bank(myStartBank);
@ -115,12 +115,11 @@ bool CartridgeX07::bank(uInt16 bank)
System::PageAccess access(this, System::PA_READ);
// Map ROM image into the system
for(uInt32 address = 0x1000; address < 0x2000;
address += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0x1000; addr < 0x2000; addr += System::PAGE_SIZE)
{
access.directPeekBase = &myImage[offset + (address & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[offset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> System::PAGE_SHIFT, access);
access.directPeekBase = &myImage[offset + (addr & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[offset + (addr & 0x0FFF)];
mySystem->setPageAccess(addr, access);
}
return myBankChanged = true;
}

View File

@ -156,9 +156,9 @@ void M6532::installDelegate(System& system, Device& device)
// The two types of addresses are differentiated in peek/poke as follows:
// (addr & 0x0200) == 0x0000 is ZP RAM (A9 is 0)
// (addr & 0x0200) != 0x0000 is IO (A9 is 1)
for(uInt16 addr = 0; addr < 0x1000; addr += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0; addr < 0x1000; addr += System::PAGE_SIZE)
if((addr & 0x0080) == 0x0080)
mySystem->setPageAccess(addr >> System::PAGE_SHIFT, access);
mySystem->setPageAccess(addr, access);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -45,7 +45,7 @@ System::System(const OSystem& osystem, M6502& m6502, M6532& m6532,
PageAccess access(&myNullDevice, System::PA_READ);
for(int page = 0; page < NUM_PAGES; ++page)
{
setPageAccess(page, access);
myPageAccessTable[page] = access;
myPageIsDirtyTable[page] = false;
}
@ -187,7 +187,7 @@ void System::setAccessFlags(uInt16 addr, uInt8 flags)
{
#ifdef DEBUGGER_SUPPORT
PageAccess& access = myPageAccessTable[(addr & ADDRESS_MASK) >> PAGE_SHIFT];
if (addr == 0xf52c /*0xf505*/)
if (addr == 0xf52c /*0xf505*/)
addr = addr;
if(access.codeAccessBase)

View File

@ -59,8 +59,11 @@ class System : public Serializable
// Amount to shift an address by to determine what page it's on
static constexpr uInt16 PAGE_SHIFT = 6;
// Size of a page
static constexpr uInt16 PAGE_SIZE = (1 << PAGE_SHIFT);
// Mask to apply to an address to obtain its page offset
static constexpr uInt16 PAGE_MASK = (1 << PAGE_SHIFT) - 1;
static constexpr uInt16 PAGE_MASK = PAGE_SIZE - 1;
// Number of pages in the system
static constexpr uInt16 NUM_PAGES = 1 << (13 - PAGE_SHIFT);
@ -298,23 +301,23 @@ class System : public Serializable
};
/**
Set the page accessing method for the specified page.
Set the page accessing method for the specified address.
@param page The page accessing methods should be set for
@param addr The address/page accessing methods should be set for
@param access The accessing methods to be used by the page
*/
void setPageAccess(uInt16 page, const PageAccess& access) {
myPageAccessTable[page] = access;
void setPageAccess(uInt16 addr, const PageAccess& access) {
myPageAccessTable[(addr & ADDRESS_MASK) >> PAGE_SHIFT] = access;
}
/**
Get the page accessing method for the specified page.
Get the page accessing method for the specified address.
@param page The page to get accessing methods for
@param addr The address/page to get accessing methods for
@return The accessing methods used by the page
*/
const PageAccess& getPageAccess(uInt16 page) const {
return myPageAccessTable[page];
const PageAccess& getPageAccess(uInt16 addr) const {
return myPageAccessTable[(addr & ADDRESS_MASK) >> PAGE_SHIFT];
}
/**

View File

@ -180,9 +180,9 @@ void TIA::installDelegate(System& system, Device& device)
// Map all peek/poke to mirrors of TIA address space to this class
// That is, all mirrors of ($00 - $3F) in the lower 4K of the 2600
// address space are mapped here
for(uInt16 addr = 0; addr < 0x1000; addr += (1 << System::PAGE_SHIFT))
for(uInt16 addr = 0; addr < 0x1000; addr += System::PAGE_SIZE)
if((addr & 0x0080) == 0x0000)
mySystem->setPageAccess(addr >> System::PAGE_SHIFT, access);
mySystem->setPageAccess(addr, access);
mySystem->m6502().setOnHaltCallback(
[this] () {