Added 'PageType' infrastructure to PageAccess, which basically

informs the rest of the system about how a page of address
space is to be treated (READ, WRITE, READWRITE).  This makes it
much easier to track if a read from the write port has occurred.
As such, the _rwport command should now be somewhat faster.
Eventually, the debugger/disassembler will use this info to
colorize the output.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2004 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2010-04-12 19:56:14 +00:00
parent a2ca2730c1
commit af8c5a5133
34 changed files with 274 additions and 203 deletions

View File

@ -33,7 +33,6 @@ CartDebug::CartDebug(Debugger& dbg, Console& console, const RamAreaList& areas)
addRamArea(0x80, 128, 0, 0); addRamArea(0x80, 128, 0, 0);
// Add extended RAM // Add extended RAM
myRamAreas = areas;
for(RamAreaList::const_iterator i = areas.begin(); i != areas.end(); ++i) for(RamAreaList::const_iterator i = areas.begin(); i != areas.end(); ++i)
addRamArea(i->start, i->size, i->roffset, i->woffset); addRamArea(i->start, i->size, i->roffset, i->woffset);
@ -125,24 +124,17 @@ void CartDebug::triggerReadFromWritePort(uInt16 addr)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CartDebug::readFromWritePort() int CartDebug::readFromWritePort()
{ {
uInt16 peekAddress = myRWPortAddress; uInt16 addr = myRWPortAddress;
myRWPortAddress = 0; myRWPortAddress = 0;
// A read from the write port occurs when the read is actually in the write // A read from the write port occurs when the read is actually in the write
// port address space AND the last access was actually a read (the latter // port address space AND the last access was actually a read (the latter
// differentiates between reads that are normally part of a write cycle vs. // differentiates between reads that are normally part of a write cycle vs.
// ones that are illegal) // ones that are illegal)
if(mySystem.m6502().lastReadAddress() && peekAddress & 0x1000) if(mySystem.m6502().lastReadAddress() &&
{ (mySystem.getPageType(addr) & System::PAGE_WRITE) == System::PAGE_WRITE)
uInt16 addr = peekAddress & 0x0FFF; return addr;
for(RamAreaList::const_iterator i = myRamAreas.begin(); i != myRamAreas.end(); ++i) else
{
uInt16 start = (i->start + i->woffset) & 0x0FFF;
uInt16 end = (i->start + i->woffset + i->size) & 0x0FFF;
if(addr >= start && addr < end)
return peekAddress;
}
}
return 0; return 0;
} }

View File

@ -213,8 +213,6 @@ class CartDebug : public DebuggerSystem
CartState myState; CartState myState;
CartState myOldState; CartState myOldState;
RamAreaList myRamAreas;
// A pointer to an array of start addresses for each bank in a cart // A pointer to an array of start addresses for each bank in a cart
// The startup bank will normally be 0xfffc, while the others are // The startup bank will normally be 0xfffc, while the others are
// determined when the debugger is first opened // determined when the debugger is first opened

View File

@ -674,6 +674,7 @@ GUI::Rect Debugger::getTabBounds() const
bool Debugger::addFunction(const string& name, const string& definition, bool Debugger::addFunction(const string& name, const string& definition,
Expression* exp, bool builtin) Expression* exp, bool builtin)
{ {
cerr << "adding function: " << name << endl;
functions.insert(make_pair(name, exp)); functions.insert(make_pair(name, exp));
if(!builtin) if(!builtin)
functionDefs.insert(make_pair(name, definition)); functionDefs.insert(make_pair(name, definition));
@ -762,6 +763,10 @@ void Debugger::getCompletions(const char* in, StringList& list) const
if(BSPF_strncasecmp(l, in, strlen(in)) == 0) if(BSPF_strncasecmp(l, in, strlen(in)) == 0)
list.push_back(l); list.push_back(l);
} }
for(uInt32 i = 0; i < list.size(); ++i)
cerr << list[i] << endl;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -68,13 +68,13 @@ void Cartridge0840::install(System& system)
// Set the page accessing methods for the hot spots // Set the page accessing methods for the hot spots
System::PageAccess access; System::PageAccess access;
for(uInt32 i = 0x0800; i < 0x0FFF; i += (1 << shift))
{
access.directPeekBase = 0; access.directPeekBase = 0;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this; access.device = this;
access.type = System::PAGE_READ;
for(uInt32 i = 0x0800; i < 0x0FFF; i += (1 << shift))
mySystem->setPageAccess(i >> shift, access); mySystem->setPageAccess(i >> shift, access);
}
// Install pages for bank 0 // Install pages for bank 0
bank(myStartBank); bank(myStartBank);
@ -157,8 +157,9 @@ void Cartridge0840::bank(uInt16 bank)
// Setup the page access methods for the current bank // Setup the page access methods for the current bank
System::PageAccess access; System::PageAccess access;
access.device = this;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
// Map ROM image into the system // Map ROM image into the system
for(uInt32 address = 0x1000; address < 0x2000; address += (1 << shift)) for(uInt32 address = 0x1000; address < 0x2000; address += (1 << shift))

View File

@ -76,11 +76,13 @@ void Cartridge2K::install(System& system)
// Map ROM image into the system // Map ROM image into the system
System::PageAccess access; System::PageAccess access;
access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
for(uInt32 address = 0x1000; address < 0x2000; address += (1 << shift)) for(uInt32 address = 0x1000; address < 0x2000; address += (1 << shift))
{ {
access.device = this;
access.directPeekBase = &myImage[address & myMask]; access.directPeekBase = &myImage[address & myMask];
access.directPokeBase = 0;
mySystem->setPageAccess(address >> shift, access); mySystem->setPageAccess(address >> shift, access);
} }
} }

View File

@ -70,25 +70,26 @@ void Cartridge3E::install(System& system)
// Make sure the system we're being installed in has a page size that'll work // Make sure the system we're being installed in has a page size that'll work
assert((0x1800 & mask) == 0); assert((0x1800 & mask) == 0);
System::PageAccess access;
// Set the page accessing methods for the hot spots (for 100% emulation // 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 // 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 // does this via mySystem->tiaPoke(...), at least until we come up with a
// cleaner way to do it). // cleaner way to do it).
System::PageAccess access;
for(uInt32 i = 0x00; i < 0x40; i += (1 << shift))
{
access.device = this;
access.directPeekBase = 0; access.directPeekBase = 0;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READWRITE;
for(uInt32 i = 0x00; i < 0x40; i += (1 << shift))
mySystem->setPageAccess(i >> shift, access); mySystem->setPageAccess(i >> shift, access);
}
// Setup the second segment to always point to the last ROM slice // Setup the second segment to always point to the last ROM slice
access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
for(uInt32 j = 0x1800; j < 0x2000; j += (1 << shift)) for(uInt32 j = 0x1800; j < 0x2000; j += (1 << shift))
{ {
access.device = this;
access.directPeekBase = &myImage[(mySize - 2048) + (j & 0x07FF)]; access.directPeekBase = &myImage[(mySize - 2048) + (j & 0x07FF)];
access.directPokeBase = 0;
mySystem->setPageAccess(j >> shift, access); mySystem->setPageAccess(j >> shift, access);
} }
@ -180,8 +181,9 @@ void Cartridge3E::bank(uInt16 bank)
// Setup the page access methods for the current bank // Setup the page access methods for the current bank
System::PageAccess access; System::PageAccess access;
access.device = this;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
// Map ROM image into the system // Map ROM image into the system
for(uInt32 address = 0x1000; address < 0x1800; address += (1 << shift)) for(uInt32 address = 0x1000; address < 0x1800; address += (1 << shift))
@ -202,8 +204,9 @@ void Cartridge3E::bank(uInt16 bank)
// Setup the page access methods for the current bank // Setup the page access methods for the current bank
System::PageAccess access; System::PageAccess access;
access.device = this;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
// Map read-port RAM image into the system // Map read-port RAM image into the system
for(address = 0x1000; address < 0x1400; address += (1 << shift)) for(address = 0x1000; address < 0x1400; address += (1 << shift))
@ -213,6 +216,7 @@ void Cartridge3E::bank(uInt16 bank)
} }
access.directPeekBase = 0; access.directPeekBase = 0;
access.type = System::PAGE_WRITE;
// Map write-port RAM image into the system // Map write-port RAM image into the system
for(address = 0x1400; address < 0x1800; address += (1 << shift)) for(address = 0x1400; address < 0x1800; address += (1 << shift))

View File

@ -66,20 +66,20 @@ void Cartridge3F::install(System& system)
// does this via mySystem->tiaPoke(...), at least until we come up with a // does this via mySystem->tiaPoke(...), at least until we come up with a
// cleaner way to do it). // cleaner way to do it).
System::PageAccess access; System::PageAccess access;
for(uInt32 i = 0x00; i < 0x40; i += (1 << shift))
{
access.device = this;
access.directPeekBase = 0; access.directPeekBase = 0;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READWRITE;
for(uInt32 i = 0x00; i < 0x40; i += (1 << shift))
mySystem->setPageAccess(i >> shift, access); mySystem->setPageAccess(i >> shift, access);
}
// Setup the second segment to always point to the last ROM slice // Setup the second segment to always point to the last ROM slice
access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
for(uInt32 j = 0x1800; j < 0x2000; j += (1 << shift)) for(uInt32 j = 0x1800; j < 0x2000; j += (1 << shift))
{ {
access.device = this;
access.directPeekBase = &myImage[(mySize - 2048) + (j & 0x07FF)]; access.directPeekBase = &myImage[(mySize - 2048) + (j & 0x07FF)];
access.directPokeBase = 0;
mySystem->setPageAccess(j >> shift, access); mySystem->setPageAccess(j >> shift, access);
} }
@ -144,8 +144,9 @@ void Cartridge3F::bank(uInt16 bank)
// Setup the page access methods for the current bank // Setup the page access methods for the current bank
System::PageAccess access; System::PageAccess access;
access.device = this;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
// Map ROM image into the system // Map ROM image into the system
for(uInt32 address = 0x1000; address < 0x1800; address += (1 << shift)) for(uInt32 address = 0x1000; address < 0x1800; address += (1 << shift))

View File

@ -73,6 +73,8 @@ void Cartridge4A50::install(System& system)
access.directPeekBase = 0; access.directPeekBase = 0;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this; access.device = this;
access.type = System::PAGE_READ; // We don't yet indicate RAM areas
for(uInt32 i = 0x1000; i < 0x2000; i += (1 << shift)) for(uInt32 i = 0x1000; i < 0x2000; i += (1 << shift))
mySystem->setPageAccess(i >> shift, access); mySystem->setPageAccess(i >> shift, access);

View File

@ -54,6 +54,7 @@ void Cartridge4K::install(System& system)
System::PageAccess access; System::PageAccess access;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this; access.device = this;
access.type = System::PAGE_READ;
// Map ROM image into the system // Map ROM image into the system
for(uInt32 address = 0x1000; address < 0x2000; address += (1 << shift)) for(uInt32 address = 0x1000; address < 0x2000; address += (1 << shift))

View File

@ -98,6 +98,8 @@ void CartridgeAR::install(System& system)
access.directPeekBase = 0; access.directPeekBase = 0;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this; access.device = this;
access.type = System::PAGE_READ; // We don't yet indicate RAM areas
for(uInt32 i = 0x1000; i < 0x2000; i += (1 << shift)) for(uInt32 i = 0x1000; i < 0x2000; i += (1 << shift))
mySystem->setPageAccess(i >> shift, access); mySystem->setPageAccess(i >> shift, access);

View File

@ -87,29 +87,32 @@ void CartridgeCV::install(System& system)
System::PageAccess access; System::PageAccess access;
// Map ROM image into the system // Map ROM image into the system
access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
for(uInt32 address = 0x1800; address < 0x2000; address += (1 << shift)) for(uInt32 address = 0x1800; address < 0x2000; address += (1 << shift))
{ {
access.device = this;
access.directPeekBase = &myImage[address & 0x07FF]; access.directPeekBase = &myImage[address & 0x07FF];
access.directPokeBase = 0;
mySystem->setPageAccess(address >> mySystem->pageShift(), access); mySystem->setPageAccess(address >> mySystem->pageShift(), access);
} }
// Set the page accessing method for the RAM writing pages // Set the page accessing method for the RAM writing pages
access.directPeekBase = 0;
access.device = this;
access.type = System::PAGE_WRITE;
for(uInt32 j = 0x1400; j < 0x1800; j += (1 << shift)) for(uInt32 j = 0x1400; j < 0x1800; j += (1 << shift))
{ {
access.device = this;
access.directPeekBase = 0;
access.directPokeBase = &myRAM[j & 0x03FF]; access.directPokeBase = &myRAM[j & 0x03FF];
mySystem->setPageAccess(j >> shift, access); mySystem->setPageAccess(j >> shift, access);
} }
// Set the page accessing method for the RAM reading pages // Set the page accessing method for the RAM reading pages
access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
for(uInt32 k = 0x1000; k < 0x1400; k += (1 << shift)) for(uInt32 k = 0x1000; k < 0x1400; k += (1 << shift))
{ {
access.device = this;
access.directPeekBase = &myRAM[k & 0x03FF]; access.directPeekBase = &myRAM[k & 0x03FF];
access.directPokeBase = 0;
mySystem->setPageAccess(k >> shift, access); mySystem->setPageAccess(k >> shift, access);
} }
} }

View File

@ -88,24 +88,23 @@ void CartridgeDPC::install(System& system)
// Make sure the system we're being installed in has a page size that'll work // Make sure the system we're being installed in has a page size that'll work
assert(((0x1080 & mask) == 0) && ((0x1100 & mask) == 0)); assert(((0x1080 & mask) == 0) && ((0x1100 & mask) == 0));
// Set the page accessing methods for the hot spots
System::PageAccess access; System::PageAccess access;
for(uInt32 i = (0x1FF8 & ~mask); i < 0x2000; i += (1 << shift))
{ // Set the page accessing methods for the hot spots
access.directPeekBase = 0; access.directPeekBase = 0;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this; access.device = this;
access.type = System::PAGE_READ;
for(uInt32 i = (0x1FF8 & ~mask); i < 0x2000; i += (1 << shift))
mySystem->setPageAccess(i >> shift, access); mySystem->setPageAccess(i >> shift, access);
}
// Set the page accessing method for the DPC reading & writing pages // Set the page accessing method for the DPC reading & writing pages
for(uInt32 j = 0x1000; j < 0x1080; j += (1 << shift))
{
access.directPeekBase = 0; access.directPeekBase = 0;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this; access.device = this;
access.type = System::PAGE_READWRITE;
for(uInt32 j = 0x1000; j < 0x1080; j += (1 << shift))
mySystem->setPageAccess(j >> shift, access); mySystem->setPageAccess(j >> shift, access);
}
// Install pages for the startup bank // Install pages for the startup bank
bank(myStartBank); bank(myStartBank);
@ -430,8 +429,9 @@ void CartridgeDPC::bank(uInt16 bank)
// Setup the page access methods for the current bank // Setup the page access methods for the current bank
System::PageAccess access; System::PageAccess access;
access.device = this;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
// Map Program ROM image into the system // Map Program ROM image into the system
for(uInt32 address = 0x1080; address < (0x1FF8U & ~mask); for(uInt32 address = 0x1080; address < (0x1FF8U & ~mask);

View File

@ -100,6 +100,7 @@ void CartridgeDPCPlus::install(System& system)
access.directPeekBase = 0; access.directPeekBase = 0;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this; access.device = this;
access.type = System::PAGE_READ;
for(uInt32 i = 0x1000; i < 0x2000; i += (1 << shift)) for(uInt32 i = 0x1000; i < 0x2000; i += (1 << shift))
mySystem->setPageAccess(i >> shift, access); mySystem->setPageAccess(i >> shift, access);

View File

@ -57,10 +57,12 @@ void CartridgeE0::install(System& system)
assert(((0x1000 & mask) == 0) && ((0x1400 & mask) == 0) && assert(((0x1000 & mask) == 0) && ((0x1400 & mask) == 0) &&
((0x1800 & mask) == 0) && ((0x1C00 & mask) == 0)); ((0x1800 & mask) == 0) && ((0x1C00 & mask) == 0));
// Set the page acessing methods for the first part of the last segment
System::PageAccess access; System::PageAccess access;
// Set the page acessing methods for the first part of the last segment
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this; access.device = this;
access.type = System::PAGE_READ;
for(uInt32 i = 0x1C00; i < (0x1FE0U & ~mask); i += (1 << shift)) for(uInt32 i = 0x1C00; i < (0x1FE0U & ~mask); i += (1 << shift))
{ {
access.directPeekBase = &myImage[7168 + (i & 0x03FF)]; access.directPeekBase = &myImage[7168 + (i & 0x03FF)];
@ -72,10 +74,9 @@ void CartridgeE0::install(System& system)
access.directPeekBase = 0; access.directPeekBase = 0;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this; access.device = this;
access.type = System::PAGE_READ;
for(uInt32 j = (0x1FE0 & ~mask); j < 0x2000; j += (1 << shift)) for(uInt32 j = (0x1FE0 & ~mask); j < 0x2000; j += (1 << shift))
{
mySystem->setPageAccess(j >> shift, access); mySystem->setPageAccess(j >> shift, access);
}
// Install some default slices for the other segments // Install some default slices for the other segments
segmentZero(4); segmentZero(4);
@ -138,8 +139,9 @@ void CartridgeE0::segmentZero(uInt16 slice)
// Setup the page access methods for the current bank // Setup the page access methods for the current bank
System::PageAccess access; System::PageAccess access;
access.device = this;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
for(uInt32 address = 0x1000; address < 0x1400; address += (1 << shift)) for(uInt32 address = 0x1000; address < 0x1400; address += (1 << shift))
{ {
@ -161,8 +163,9 @@ void CartridgeE0::segmentOne(uInt16 slice)
// Setup the page access methods for the current bank // Setup the page access methods for the current bank
System::PageAccess access; System::PageAccess access;
access.device = this;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
for(uInt32 address = 0x1400; address < 0x1800; address += (1 << shift)) for(uInt32 address = 0x1400; address < 0x1800; address += (1 << shift))
{ {
@ -184,8 +187,9 @@ void CartridgeE0::segmentTwo(uInt16 slice)
// Setup the page access methods for the current bank // Setup the page access methods for the current bank
System::PageAccess access; System::PageAccess access;
access.device = this;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
for(uInt32 address = 0x1800; address < 0x1C00; address += (1 << shift)) for(uInt32 address = 0x1800; address < 0x1C00; address += (1 << shift))
{ {

View File

@ -70,22 +70,23 @@ void CartridgeE7::install(System& system)
assert(((0x1400 & mask) == 0) && ((0x1800 & mask) == 0) && assert(((0x1400 & mask) == 0) && ((0x1800 & mask) == 0) &&
((0x1900 & mask) == 0) && ((0x1A00 & mask) == 0)); ((0x1900 & mask) == 0) && ((0x1A00 & mask) == 0));
// Set the page accessing methods for the hot spots
System::PageAccess access; System::PageAccess access;
for(uInt32 i = (0x1FE0 & ~mask); i < 0x2000; i += (1 << shift))
{ // Set the page accessing methods for the hot spots
access.directPeekBase = 0; access.directPeekBase = 0;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this; access.device = this;
access.type = System::PAGE_READ;
for(uInt32 i = (0x1FE0 & ~mask); i < 0x2000; i += (1 << shift))
mySystem->setPageAccess(i >> shift, access); mySystem->setPageAccess(i >> shift, access);
}
// Setup the second segment to always point to the last ROM slice // Setup the second segment to always point to the last ROM slice
access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
for(uInt32 j = 0x1A00; j < (0x1FE0U & ~mask); j += (1 << shift)) for(uInt32 j = 0x1A00; j < (0x1FE0U & ~mask); j += (1 << shift))
{ {
access.device = this;
access.directPeekBase = &myImage[7 * 2048 + (j & 0x07FF)]; access.directPeekBase = &myImage[7 * 2048 + (j & 0x07FF)];
access.directPokeBase = 0;
mySystem->setPageAccess(j >> shift, access); mySystem->setPageAccess(j >> shift, access);
} }
myCurrentSlice[1] = 7; myCurrentSlice[1] = 7;
@ -176,21 +177,22 @@ void CartridgeE7::bankRAM(uInt16 bank)
System::PageAccess access; System::PageAccess access;
// Set the page accessing method for the 256 bytes of RAM writing pages // Set the page accessing method for the 256 bytes of RAM writing pages
access.directPeekBase = 0;
access.device = this;
access.type = System::PAGE_WRITE;
for(uInt32 j = 0x1800; j < 0x1900; j += (1 << shift)) for(uInt32 j = 0x1800; j < 0x1900; j += (1 << shift))
{ {
access.device = this;
access.directPeekBase = 0;
access.directPokeBase = &myRAM[1024 + offset + (j & 0x00FF)]; access.directPokeBase = &myRAM[1024 + offset + (j & 0x00FF)];
mySystem->setPageAccess(j >> shift, access); mySystem->setPageAccess(j >> shift, access);
} }
// Set the page accessing method for the 256 bytes of RAM reading pages // Set the page accessing method for the 256 bytes of RAM reading pages
access.directPeekBase = 0; access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
for(uInt32 k = 0x1900; k < 0x1A00; k += (1 << shift)) for(uInt32 k = 0x1900; k < 0x1A00; k += (1 << shift))
{ {
access.device = this;
access.directPeekBase = &myRAM[1024 + offset + (k & 0x00FF)]; access.directPeekBase = &myRAM[1024 + offset + (k & 0x00FF)];
access.directPokeBase = 0;
mySystem->setPageAccess(k >> shift, access); mySystem->setPageAccess(k >> shift, access);
} }
myBankChanged = true; myBankChanged = true;
@ -212,31 +214,34 @@ void CartridgeE7::bank(uInt16 slice)
if(slice != 7) if(slice != 7)
{ {
// Map ROM image into first segment // Map ROM image into first segment
access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
for(uInt32 address = 0x1000; address < 0x1800; address += (1 << shift)) for(uInt32 address = 0x1000; address < 0x1800; address += (1 << shift))
{ {
access.device = this;
access.directPeekBase = &myImage[offset + (address & 0x07FF)]; access.directPeekBase = &myImage[offset + (address & 0x07FF)];
access.directPokeBase = 0;
mySystem->setPageAccess(address >> shift, access); mySystem->setPageAccess(address >> shift, access);
} }
} }
else else
{ {
// Set the page accessing method for the 1K slice of RAM writing pages // Set the page accessing method for the 1K slice of RAM writing pages
access.directPeekBase = 0;
access.device = this;
access.type = System::PAGE_WRITE;
for(uInt32 j = 0x1000; j < 0x1400; j += (1 << shift)) for(uInt32 j = 0x1000; j < 0x1400; j += (1 << shift))
{ {
access.device = this;
access.directPeekBase = 0;
access.directPokeBase = &myRAM[j & 0x03FF]; access.directPokeBase = &myRAM[j & 0x03FF];
mySystem->setPageAccess(j >> shift, access); mySystem->setPageAccess(j >> shift, access);
} }
// Set the page accessing method for the 1K slice of RAM reading pages // Set the page accessing method for the 1K slice of RAM reading pages
access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
for(uInt32 k = 0x1400; k < 0x1800; k += (1 << shift)) for(uInt32 k = 0x1400; k < 0x1800; k += (1 << shift))
{ {
access.device = this;
access.directPeekBase = &myRAM[k & 0x03FF]; access.directPeekBase = &myRAM[k & 0x03FF];
access.directPokeBase = 0;
mySystem->setPageAccess(k >> shift, access); mySystem->setPageAccess(k >> shift, access);
} }
} }

View File

@ -55,15 +55,15 @@ void CartridgeEF::install(System& system)
// Make sure the system we're being installed in has a page size that'll work // Make sure the system we're being installed in has a page size that'll work
assert((0x1000 & mask) == 0); assert((0x1000 & mask) == 0);
// Set the page accessing methods for the hot spots
System::PageAccess access; System::PageAccess access;
for(uInt32 i = (0x1FE0 & ~mask); i < 0x2000; i += (1 << shift))
{ // Set the page accessing methods for the hot spots
access.directPeekBase = 0; access.directPeekBase = 0;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this; access.device = this;
access.type = System::PAGE_READ;
for(uInt32 i = (0x1FE0 & ~mask); i < 0x2000; i += (1 << shift))
mySystem->setPageAccess(i >> shift, access); mySystem->setPageAccess(i >> shift, access);
}
// Install pages for the startup bank // Install pages for the startup bank
bank(myStartBank); bank(myStartBank);
@ -104,10 +104,12 @@ void CartridgeEF::bank(uInt16 bank)
uInt16 shift = mySystem->pageShift(); uInt16 shift = mySystem->pageShift();
uInt16 mask = mySystem->pageMask(); uInt16 mask = mySystem->pageMask();
// Setup the page access methods for the current bank
System::PageAccess access; System::PageAccess access;
access.device = this;
// Setup the page access methods for the current bank
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
// Map ROM image into the system // Map ROM image into the system
for(uInt32 address = 0x1000; address < (0x1FE0U & ~mask); for(uInt32 address = 0x1000; address < (0x1FE0U & ~mask);

View File

@ -62,31 +62,33 @@ void CartridgeEFSC::install(System& system)
// Make sure the system we're being installed in has a page size that'll work // Make sure the system we're being installed in has a page size that'll work
assert((0x1000 & mask) == 0); assert((0x1000 & mask) == 0);
// Set the page accessing methods for the hot spots
System::PageAccess access; System::PageAccess access;
for(uInt32 i = (0x1FE0 & ~mask); i < 0x2000; i += (1 << shift))
{ // Set the page accessing methods for the hot spots
access.directPeekBase = 0; access.directPeekBase = 0;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this; access.device = this;
access.type = System::PAGE_READ;
for(uInt32 i = (0x1FE0 & ~mask); i < 0x2000; i += (1 << shift))
mySystem->setPageAccess(i >> shift, access); mySystem->setPageAccess(i >> shift, access);
}
// Set the page accessing method for the RAM writing pages // Set the page accessing method for the RAM writing pages
access.directPeekBase = 0;
access.device = this;
access.type = System::PAGE_WRITE;
for(uInt32 j = 0x1000; j < 0x1080; j += (1 << shift)) for(uInt32 j = 0x1000; j < 0x1080; j += (1 << shift))
{ {
access.device = this;
access.directPeekBase = 0;
access.directPokeBase = &myRAM[j & 0x007F]; access.directPokeBase = &myRAM[j & 0x007F];
mySystem->setPageAccess(j >> shift, access); mySystem->setPageAccess(j >> shift, access);
} }
// Set the page accessing method for the RAM reading pages // Set the page accessing method for the RAM reading pages
access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
for(uInt32 k = 0x1080; k < 0x1100; k += (1 << shift)) for(uInt32 k = 0x1080; k < 0x1100; k += (1 << shift))
{ {
access.device = this;
access.directPeekBase = &myRAM[k & 0x007F]; access.directPeekBase = &myRAM[k & 0x007F];
access.directPokeBase = 0;
mySystem->setPageAccess(k >> shift, access); mySystem->setPageAccess(k >> shift, access);
} }
@ -149,8 +151,9 @@ void CartridgeEFSC::bank(uInt16 bank)
// Setup the page access methods for the current bank // Setup the page access methods for the current bank
System::PageAccess access; System::PageAccess access;
access.device = this;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
// Map ROM image into the system // Map ROM image into the system
for(uInt32 address = 0x1100; address < (0x1FE0U & ~mask); for(uInt32 address = 0x1100; address < (0x1FE0U & ~mask);

View File

@ -56,15 +56,15 @@ void CartridgeF0::install(System& system)
// Make sure the system we're being installed in has a page size that'll work // Make sure the system we're being installed in has a page size that'll work
assert((0x1000 & mask) == 0); assert((0x1000 & mask) == 0);
// Set the page accessing methods for the hot spots
System::PageAccess access; System::PageAccess access;
for(uInt32 i = (0x1FF0 & ~mask); i < 0x2000; i += (1 << shift))
{ // Set the page accessing methods for the hot spots
access.directPeekBase = 0; access.directPeekBase = 0;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this; access.device = this;
access.type = System::PAGE_READ;
for(uInt32 i = (0x1FF0 & ~mask); i < 0x2000; i += (1 << shift))
mySystem->setPageAccess(i >> shift, access); mySystem->setPageAccess(i >> shift, access);
}
// Install pages for bank 1 // Install pages for bank 1
myCurrentBank = 0; myCurrentBank = 0;
@ -109,8 +109,9 @@ void CartridgeF0::incbank()
// Setup the page access methods for the current bank // Setup the page access methods for the current bank
System::PageAccess access; System::PageAccess access;
access.device = this;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
// Map ROM image into the system // Map ROM image into the system
for(uInt32 address = 0x1000; address < (0x1FF0U & ~mask); for(uInt32 address = 0x1000; address < (0x1FF0U & ~mask);

View File

@ -56,15 +56,15 @@ void CartridgeF4::install(System& system)
// Make sure the system we're being installed in has a page size that'll work // Make sure the system we're being installed in has a page size that'll work
assert((0x1000 & mask) == 0); assert((0x1000 & mask) == 0);
// Set the page accessing methods for the hot spots
System::PageAccess access; System::PageAccess access;
for(uInt32 i = (0x1FF4 & ~mask); i < 0x2000; i += (1 << shift))
{ // Set the page accessing methods for the hot spots
access.directPeekBase = 0; access.directPeekBase = 0;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this; access.device = this;
access.type = System::PAGE_READ;
for(uInt32 i = (0x1FF4 & ~mask); i < 0x2000; i += (1 << shift))
mySystem->setPageAccess(i >> shift, access); mySystem->setPageAccess(i >> shift, access);
}
// Install pages for the startup bank // Install pages for the startup bank
bank(myStartBank); bank(myStartBank);
@ -111,8 +111,9 @@ void CartridgeF4::bank(uInt16 bank)
// Setup the page access methods for the current bank // Setup the page access methods for the current bank
System::PageAccess access; System::PageAccess access;
access.device = this;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
// Map ROM image into the system // Map ROM image into the system
for(uInt32 address = 0x1000; address < (0x1FF4U & ~mask); for(uInt32 address = 0x1000; address < (0x1FF4U & ~mask);

View File

@ -62,31 +62,33 @@ void CartridgeF4SC::install(System& system)
// Make sure the system we're being installed in has a page size that'll work // Make sure the system we're being installed in has a page size that'll work
assert(((0x1080 & mask) == 0) && ((0x1100 & mask) == 0)); assert(((0x1080 & mask) == 0) && ((0x1100 & mask) == 0));
// Set the page accessing methods for the hot spots
System::PageAccess access; System::PageAccess access;
for(uInt32 i = (0x1FF4 & ~mask); i < 0x2000; i += (1 << shift))
{ // Set the page accessing methods for the hot spots
access.directPeekBase = 0; access.directPeekBase = 0;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this; access.device = this;
access.type = System::PAGE_READ;
for(uInt32 i = (0x1FF4 & ~mask); i < 0x2000; i += (1 << shift))
mySystem->setPageAccess(i >> shift, access); mySystem->setPageAccess(i >> shift, access);
}
// Set the page accessing method for the RAM writing pages // Set the page accessing method for the RAM writing pages
access.directPeekBase = 0;
access.device = this;
access.type = System::PAGE_WRITE;
for(uInt32 j = 0x1000; j < 0x1080; j += (1 << shift)) for(uInt32 j = 0x1000; j < 0x1080; j += (1 << shift))
{ {
access.device = this;
access.directPeekBase = 0;
access.directPokeBase = &myRAM[j & 0x007F]; access.directPokeBase = &myRAM[j & 0x007F];
mySystem->setPageAccess(j >> shift, access); mySystem->setPageAccess(j >> shift, access);
} }
// Set the page accessing method for the RAM reading pages // Set the page accessing method for the RAM reading pages
access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
for(uInt32 k = 0x1080; k < 0x1100; k += (1 << shift)) for(uInt32 k = 0x1080; k < 0x1100; k += (1 << shift))
{ {
access.device = this;
access.directPeekBase = &myRAM[k & 0x007F]; access.directPeekBase = &myRAM[k & 0x007F];
access.directPokeBase = 0;
mySystem->setPageAccess(k >> shift, access); mySystem->setPageAccess(k >> shift, access);
} }
@ -152,8 +154,9 @@ void CartridgeF4SC::bank(uInt16 bank)
// Setup the page access methods for the current bank // Setup the page access methods for the current bank
System::PageAccess access; System::PageAccess access;
access.device = this;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
// Map ROM image into the system // Map ROM image into the system
for(uInt32 address = 0x1100; address < (0x1FF4U & ~mask); for(uInt32 address = 0x1100; address < (0x1FF4U & ~mask);

View File

@ -55,15 +55,15 @@ void CartridgeF6::install(System& system)
// Make sure the system we're being installed in has a page size that'll work // Make sure the system we're being installed in has a page size that'll work
assert((0x1000 & mask) == 0); assert((0x1000 & mask) == 0);
// Set the page accessing methods for the hot spots
System::PageAccess access; System::PageAccess access;
for(uInt32 i = (0x1FF6 & ~mask); i < 0x2000; i += (1 << shift))
{ // Set the page accessing methods for the hot spots
access.directPeekBase = 0; access.directPeekBase = 0;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this; access.device = this;
access.type = System::PAGE_READ;
for(uInt32 i = (0x1FF6 & ~mask); i < 0x2000; i += (1 << shift))
mySystem->setPageAccess(i >> shift, access); mySystem->setPageAccess(i >> shift, access);
}
// Upon install we'll setup the startup bank // Upon install we'll setup the startup bank
bank(myStartBank); bank(myStartBank);
@ -151,8 +151,9 @@ void CartridgeF6::bank(uInt16 bank)
// Setup the page access methods for the current bank // Setup the page access methods for the current bank
System::PageAccess access; System::PageAccess access;
access.device = this;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
// Map ROM image into the system // Map ROM image into the system
for(uInt32 address = 0x1000; address < (0x1FF6U & ~mask); for(uInt32 address = 0x1000; address < (0x1FF6U & ~mask);

View File

@ -62,31 +62,33 @@ void CartridgeF6SC::install(System& system)
// Make sure the system we're being installed in has a page size that'll work // Make sure the system we're being installed in has a page size that'll work
assert(((0x1080 & mask) == 0) && ((0x1100 & mask) == 0)); assert(((0x1080 & mask) == 0) && ((0x1100 & mask) == 0));
// Set the page accessing methods for the hot spots
System::PageAccess access; System::PageAccess access;
for(uInt32 i = (0x1FF6 & ~mask); i < 0x2000; i += (1 << shift))
{ // Set the page accessing methods for the hot spots
access.directPeekBase = 0; access.directPeekBase = 0;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this; access.device = this;
access.type = System::PAGE_READ;
for(uInt32 i = (0x1FF6 & ~mask); i < 0x2000; i += (1 << shift))
mySystem->setPageAccess(i >> shift, access); mySystem->setPageAccess(i >> shift, access);
}
// Set the page accessing method for the RAM writing pages // Set the page accessing method for the RAM writing pages
access.directPeekBase = 0;
access.device = this;
access.type = System::PAGE_WRITE;
for(uInt32 j = 0x1000; j < 0x1080; j += (1 << shift)) for(uInt32 j = 0x1000; j < 0x1080; j += (1 << shift))
{ {
access.device = this;
access.directPeekBase = 0;
access.directPokeBase = &myRAM[j & 0x007F]; access.directPokeBase = &myRAM[j & 0x007F];
mySystem->setPageAccess(j >> shift, access); mySystem->setPageAccess(j >> shift, access);
} }
// Set the page accessing method for the RAM reading pages // Set the page accessing method for the RAM reading pages
access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
for(uInt32 k = 0x1080; k < 0x1100; k += (1 << shift)) for(uInt32 k = 0x1080; k < 0x1100; k += (1 << shift))
{ {
access.device = this;
access.directPeekBase = &myRAM[k & 0x007F]; access.directPeekBase = &myRAM[k & 0x007F];
access.directPokeBase = 0;
mySystem->setPageAccess(k >> shift, access); mySystem->setPageAccess(k >> shift, access);
} }
@ -195,8 +197,9 @@ void CartridgeF6SC::bank(uInt16 bank)
// Setup the page access methods for the current bank // Setup the page access methods for the current bank
System::PageAccess access; System::PageAccess access;
access.device = this;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
// Map ROM image into the system // Map ROM image into the system
for(uInt32 address = 0x1100; address < (0x1FF6U & ~mask); for(uInt32 address = 0x1100; address < (0x1FF6U & ~mask);

View File

@ -56,15 +56,15 @@ void CartridgeF8::install(System& system)
// Make sure the system we're being installed in has a page size that'll work // Make sure the system we're being installed in has a page size that'll work
assert((0x1000 & mask) == 0); assert((0x1000 & mask) == 0);
// Set the page accessing methods for the hot spots
System::PageAccess access; System::PageAccess access;
for(uInt32 i = (0x1FF8 & ~mask); i < 0x2000; i += (1 << shift))
{ // Set the page accessing methods for the hot spots
access.directPeekBase = 0; access.directPeekBase = 0;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this; access.device = this;
access.type = System::PAGE_READ;
for(uInt32 i = (0x1FF8 & ~mask); i < 0x2000; i += (1 << shift))
mySystem->setPageAccess(i >> shift, access); mySystem->setPageAccess(i >> shift, access);
}
// Install pages for the startup bank // Install pages for the startup bank
bank(myStartBank); bank(myStartBank);
@ -132,8 +132,9 @@ void CartridgeF8::bank(uInt16 bank)
// Setup the page access methods for the current bank // Setup the page access methods for the current bank
System::PageAccess access; System::PageAccess access;
access.device = this;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
// Map ROM image into the system // Map ROM image into the system
for(uInt32 address = 0x1000; address < (0x1FF8U & ~mask); for(uInt32 address = 0x1000; address < (0x1FF8U & ~mask);

View File

@ -62,31 +62,33 @@ void CartridgeF8SC::install(System& system)
// Make sure the system we're being installed in has a page size that'll work // Make sure the system we're being installed in has a page size that'll work
assert(((0x1080 & mask) == 0) && ((0x1100 & mask) == 0)); assert(((0x1080 & mask) == 0) && ((0x1100 & mask) == 0));
// Set the page accessing methods for the hot spots
System::PageAccess access; System::PageAccess access;
for(uInt32 i = (0x1FF8 & ~mask); i < 0x2000; i += (1 << shift))
{ // Set the page accessing methods for the hot spots
access.directPeekBase = 0; access.directPeekBase = 0;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this; access.device = this;
access.type = System::PAGE_READ;
for(uInt32 i = (0x1FF8 & ~mask); i < 0x2000; i += (1 << shift))
mySystem->setPageAccess(i >> shift, access); mySystem->setPageAccess(i >> shift, access);
}
// Set the page accessing method for the RAM writing pages // Set the page accessing method for the RAM writing pages
access.directPeekBase = 0;
access.device = this;
access.type = System::PAGE_WRITE;
for(uInt32 j = 0x1000; j < 0x1080; j += (1 << shift)) for(uInt32 j = 0x1000; j < 0x1080; j += (1 << shift))
{ {
access.device = this;
access.directPeekBase = 0;
access.directPokeBase = &myRAM[j & 0x007F]; access.directPokeBase = &myRAM[j & 0x007F];
mySystem->setPageAccess(j >> shift, access); mySystem->setPageAccess(j >> shift, access);
} }
// Set the page accessing method for the RAM reading pages // Set the page accessing method for the RAM reading pages
access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
for(uInt32 k = 0x1080; k < 0x1100; k += (1 << shift)) for(uInt32 k = 0x1080; k < 0x1100; k += (1 << shift))
{ {
access.device = this;
access.directPeekBase = &myRAM[k & 0x007F]; access.directPeekBase = &myRAM[k & 0x007F];
access.directPokeBase = 0;
mySystem->setPageAccess(k >> shift, access); mySystem->setPageAccess(k >> shift, access);
} }
@ -175,8 +177,9 @@ void CartridgeF8SC::bank(uInt16 bank)
// Setup the page access methods for the current bank // Setup the page access methods for the current bank
System::PageAccess access; System::PageAccess access;
access.device = this;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
// Map ROM image into the system // Map ROM image into the system
for(uInt32 address = 0x1100; address < (0x1FF8U & ~mask); for(uInt32 address = 0x1100; address < (0x1FF8U & ~mask);

View File

@ -62,31 +62,33 @@ void CartridgeFA::install(System& system)
// Make sure the system we're being installed in has a page size that'll work // Make sure the system we're being installed in has a page size that'll work
assert(((0x1100 & mask) == 0) && ((0x1200 & mask) == 0)); assert(((0x1100 & mask) == 0) && ((0x1200 & mask) == 0));
// Set the page accessing methods for the hot spots
System::PageAccess access; System::PageAccess access;
for(uInt32 i = (0x1FF8 & ~mask); i < 0x2000; i += (1 << shift))
{ // Set the page accessing methods for the hot spots
access.directPeekBase = 0; access.directPeekBase = 0;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this; access.device = this;
access.type = System::PAGE_READ;
for(uInt32 i = (0x1FF8 & ~mask); i < 0x2000; i += (1 << shift))
mySystem->setPageAccess(i >> shift, access); mySystem->setPageAccess(i >> shift, access);
}
// Set the page accessing method for the RAM writing pages // Set the page accessing method for the RAM writing pages
access.directPeekBase = 0;
access.device = this;
access.type = System::PAGE_WRITE;
for(uInt32 j = 0x1000; j < 0x1100; j += (1 << shift)) for(uInt32 j = 0x1000; j < 0x1100; j += (1 << shift))
{ {
access.device = this;
access.directPeekBase = 0;
access.directPokeBase = &myRAM[j & 0x00FF]; access.directPokeBase = &myRAM[j & 0x00FF];
mySystem->setPageAccess(j >> shift, access); mySystem->setPageAccess(j >> shift, access);
} }
// Set the page accessing method for the RAM reading pages // Set the page accessing method for the RAM reading pages
access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
for(uInt32 k = 0x1100; k < 0x1200; k += (1 << shift)) for(uInt32 k = 0x1100; k < 0x1200; k += (1 << shift))
{ {
access.device = this;
access.directPeekBase = &myRAM[k & 0x00FF]; access.directPeekBase = &myRAM[k & 0x00FF];
access.directPokeBase = 0;
mySystem->setPageAccess(k >> shift, access); mySystem->setPageAccess(k >> shift, access);
} }
@ -185,8 +187,9 @@ void CartridgeFA::bank(uInt16 bank)
// Setup the page access methods for the current bank // Setup the page access methods for the current bank
System::PageAccess access; System::PageAccess access;
access.device = this;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
// Map ROM image into the system // Map ROM image into the system
for(uInt32 address = 0x1200; address < (0x1FF8U & ~mask); for(uInt32 address = 0x1200; address < (0x1FF8U & ~mask);

View File

@ -58,6 +58,7 @@ void CartridgeFE::install(System& system)
access.directPeekBase = 0; access.directPeekBase = 0;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this; access.device = this;
access.type = System::PAGE_READ;
for(uInt32 i = 0x1000; i < 0x2000; i += (1 << shift)) for(uInt32 i = 0x1000; i < 0x2000; i += (1 << shift))
mySystem->setPageAccess(i >> shift, access); mySystem->setPageAccess(i >> shift, access);
} }

View File

@ -80,10 +80,15 @@ void CartridgeMC::install(System& system)
access.directPeekBase = 0; access.directPeekBase = 0;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this; access.device = this;
access.type = System::PAGE_READWRITE;
for(uInt32 i = 0x00; i < 0x40; i += (1 << shift)) for(uInt32 i = 0x00; i < 0x40; i += (1 << shift))
mySystem->setPageAccess(i >> shift, access); mySystem->setPageAccess(i >> shift, access);
// Map the cartridge into the system // Map the cartridge into the system
access.directPeekBase = 0;
access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ; // We don't yet indicate RAM areas
for(uInt32 j = 0x1000; j < 0x2000; j += (1 << shift)) for(uInt32 j = 0x1000; j < 0x2000; j += (1 << shift))
mySystem->setPageAccess(j >> shift, access); mySystem->setPageAccess(j >> shift, access);
} }

View File

@ -71,15 +71,15 @@ void CartridgeSB::install(System& system)
myHotSpotPageAccess[6] = mySystem->getPageAccess(0x0E00 >> shift); myHotSpotPageAccess[6] = mySystem->getPageAccess(0x0E00 >> shift);
myHotSpotPageAccess[7] = mySystem->getPageAccess(0x0F00 >> shift); myHotSpotPageAccess[7] = mySystem->getPageAccess(0x0F00 >> shift);
// Set the page accessing methods for the hot spots
System::PageAccess access; System::PageAccess access;
for(uInt32 i = 0x0800; i < 0x0FFF; i += (1 << shift))
{ // Set the page accessing methods for the hot spots
access.directPeekBase = 0; access.directPeekBase = 0;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this; access.device = this;
access.type = System::PAGE_READ;
for(uInt32 i = 0x0800; i < 0x0FFF; i += (1 << shift))
mySystem->setPageAccess(i >> shift, access); mySystem->setPageAccess(i >> shift, access);
}
// Install pages for startup bank // Install pages for startup bank
bank(myStartBank); bank(myStartBank);
@ -136,8 +136,9 @@ void CartridgeSB::bank(uInt16 bank)
// Setup the page access methods for the current bank // Setup the page access methods for the current bank
System::PageAccess access; System::PageAccess access;
access.device = this;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
// Map ROM image into the system // Map ROM image into the system
for(uInt32 address = 0x1000; address < 0x2000; address += (1 << shift)) for(uInt32 address = 0x1000; address < 0x2000; address += (1 << shift))

View File

@ -64,6 +64,7 @@ void CartridgeUA::install(System& system)
access.directPeekBase = 0; access.directPeekBase = 0;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this; access.device = this;
access.type = System::PAGE_READ;
mySystem->setPageAccess(0x0220 >> shift, access); mySystem->setPageAccess(0x0220 >> shift, access);
mySystem->setPageAccess(0x0240 >> shift, access); mySystem->setPageAccess(0x0240 >> shift, access);
@ -144,8 +145,9 @@ void CartridgeUA::bank(uInt16 bank)
// Setup the page access methods for the current bank // Setup the page access methods for the current bank
System::PageAccess access; System::PageAccess access;
access.device = this;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
// Map ROM image into the system // Map ROM image into the system
for(uInt32 address = 0x1000; address < 0x2000; address += (1 << shift)) for(uInt32 address = 0x1000; address < 0x2000; address += (1 << shift))

View File

@ -61,13 +61,12 @@ void CartridgeX07::install(System& system)
// The hotspots use almost all addresses below 0x1000, so we simply grab them // 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. // all and forward the TIA/RIOT calls from the peek and poke methods.
System::PageAccess access; System::PageAccess access;
for(uInt32 i = 0x00; i < 0x1000; i += (1 << shift))
{
access.directPeekBase = 0; access.directPeekBase = 0;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this; access.device = this;
access.type = System::PAGE_READWRITE;
for(uInt32 i = 0x00; i < 0x1000; i += (1 << shift))
mySystem->setPageAccess(i >> shift, access); mySystem->setPageAccess(i >> shift, access);
}
// Install pages for the startup bank // Install pages for the startup bank
bank(myStartBank); bank(myStartBank);
@ -130,8 +129,9 @@ void CartridgeX07::bank(uInt16 bank)
// Setup the page access methods for the current bank // Setup the page access methods for the current bank
System::PageAccess access; System::PageAccess access;
access.device = this;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = this;
access.type = System::PAGE_READ;
// Map ROM image into the system // Map ROM image into the system
for(uInt32 address = 0x1000; address < 0x2000; address += (1 << shift)) for(uInt32 address = 0x1000; address < 0x2000; address += (1 << shift))

View File

@ -91,19 +91,16 @@ void M6532::install(System& system, Device& device)
// All accesses are to the given device // All accesses are to the given device
System::PageAccess access; System::PageAccess access;
access.directPeekBase = 0;
access.directPokeBase = 0;
access.device = &device; access.device = &device;
access.type = System::PAGE_READWRITE;
// We're installing in a 2600 system // We're installing in a 2600 system
for(int address = 0; address < 8192; address += (1 << shift)) for(int address = 0; address < 8192; address += (1 << shift))
{
if((address & 0x1080) == 0x0080) if((address & 0x1080) == 0x0080)
{
access.directPeekBase = 0;
access.directPokeBase = 0;
mySystem->setPageAccess(address >> shift, access); mySystem->setPageAccess(address >> shift, access);
} }
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 M6532::peek(uInt16 addr) uInt8 M6532::peek(uInt16 addr)

View File

@ -179,6 +179,12 @@ const System::PageAccess& System::getPageAccess(uInt16 page) const
return myPageAccessTable[page]; return myPageAccessTable[page];
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
System::PageType System::getPageType(uInt16 addr) const
{
return myPageAccessTable[(addr & myAddressMask) >> myPageShift].type;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void System::setDirtyPage(uInt16 addr) void System::setDirtyPage(uInt16 addr)
{ {

View File

@ -287,6 +287,12 @@ class System : public Serializable
void unlockDataBus(); void unlockDataBus();
public: public:
enum PageType {
PAGE_READ = 1 << 0,
PAGE_WRITE = 1 << 1,
PAGE_READWRITE = PAGE_READ | PAGE_WRITE
};
/** /**
Structure used to specify access methods for a page Structure used to specify access methods for a page
*/ */
@ -310,9 +316,15 @@ class System : public Serializable
/** /**
Pointer to the device associated with this page or to the system's Pointer to the device associated with this page or to the system's
null device if the page hasn't been mapped to a device null device if the page hasn't been mapped to a device.
*/ */
Device* device; Device* device;
/**
The manner in which the pages are accessed by the system
(READ, WRITE, READ|WRITE)
*/
PageType type;
}; };
/** /**
@ -331,6 +343,14 @@ class System : public Serializable
*/ */
const PageAccess& getPageAccess(uInt16 page) const; const PageAccess& getPageAccess(uInt16 page) const;
/**
Get the page type for the given address.
@param addr The address contained in the page in questions
@return The type of page that contains the given address
*/
PageType getPageType(uInt16 addr) const;
/** /**
Mark the page containing this address as being dirty. Mark the page containing this address as being dirty.

View File

@ -295,16 +295,13 @@ void TIA::install(System& system, Device& device)
access.directPeekBase = 0; access.directPeekBase = 0;
access.directPokeBase = 0; access.directPokeBase = 0;
access.device = &device; access.device = &device;
access.type = System::PAGE_READWRITE;
// We're installing in a 2600 system // We're installing in a 2600 system
for(uInt32 i = 0; i < 8192; i += (1 << shift)) for(uInt32 i = 0; i < 8192; i += (1 << shift))
{
if((i & 0x1080) == 0x0000) if((i & 0x1080) == 0x0000)
{
mySystem->setPageAccess(i >> shift, access); mySystem->setPageAccess(i >> shift, access);
} }
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool TIA::save(Serializer& out) const bool TIA::save(Serializer& out) const