First pass at adding 'hints' to each Cart class that its bank has changed.

This is very useful for conditional re-disassembly, since many bankswitch
schemes consist of ROM only, and once disassembled, cannot possibly have
a different disassembly at some later point.  This is mostly done for such
static schemes (2K, 4K, etc), but more work is required for carts with
extended RAM.  Basically, the cart knows best how its been accessed, so
it makes sense to have the hints there.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1965 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2010-03-06 18:56:36 +00:00
parent e0310e8f35
commit 2cc0d60940
32 changed files with 139 additions and 97 deletions

View File

@ -186,11 +186,9 @@ string CartDebug::toString()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDebug::disassemble(bool autocode)
{
bool changed = false;
// Test current disassembly; don't re-disassemble if it hasn't changed
// ...
changed = true; // FIXME
bool changed = myConsole.cartridge().bankChanged();
if(changed)
{
myDisassembly.clear();
@ -255,14 +253,13 @@ string CartDebug::disassemble(uInt16 start, uInt16 lines) const
// Fill the string with disassembled data
start &= 0xFFF;
ostringstream buffer;
for(uInt32 i = 0; i < list.size() && lines > 0; ++i)
for(uInt32 i = 0; i < list.size() && lines > 0; ++i, --lines)
{
const CartDebug::DisassemblyTag& tag = list[i];
if((tag.address & 0xfff) >= start)
{
buffer << uppercase << hex << setw(4) << setfill('0') << tag.address
<< ": " << tag.disasm << " " << tag.bytes << endl;
--lines;
}
}

View File

@ -208,7 +208,6 @@ void DiStella::disasm(uInt32 distart, int pass)
else if (pass == 3)
{
nextline << ourLookup[op].mnemonic;
// sprintf(linebuff,"%02X ",op);
nextlinebytes << HEX2 << (int)op << " ";
}
@ -282,10 +281,7 @@ void DiStella::disasm(uInt32 distart, int pass)
{
if (op == 0x40 || op == 0x60)
if (pass == 3)
{
sprintf(linebuff,"\n");
strcat(_nextline,linebuff);
}
nextline << "\n";
break;
}
#endif

View File

@ -187,7 +187,7 @@ void RomWidget::loadConfig()
myRomList->setList(list, state);
// Restore the old bank, in case we inadvertently switched while reading.
dbg.setBank(myCurrentBank);
// dbg.setBank(myCurrentBank); // TODO - why is this here?
myListIsDirty = false;
}

View File

@ -223,6 +223,7 @@ string Cartridge::createFromMultiCart(const uInt8*& image, uInt32& size,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge::Cartridge()
: myStartBank(0),
myBankChanged(true),
myBankLocked(false)
{
}
@ -256,6 +257,14 @@ uInt16 Cartridge::startBank()
return myStartBank;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge::bankChanged()
{
bool changed = myBankChanged;
myBankChanged = false;
return changed;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge::registerRamArea(uInt16 start, uInt16 size,
uInt16 roffset, uInt16 woffset)

View File

@ -91,8 +91,9 @@ class Cartridge : public Device
the banks before querying the cart state, otherwise reading values
could inadvertantly cause a bankswitch to occur.
*/
void lockBank() { myBankLocked = true; }
void unlockBank() { myBankLocked = false; }
inline void lockBank() { myBankLocked = true; }
inline void unlockBank() { myBankLocked = false; }
inline bool bankLocked() { return myBankLocked; }
/**
Get the default startup bank for a cart. This is the bank where
@ -103,6 +104,14 @@ class Cartridge : public Device
*/
uInt16 startBank();
/**
Answer whether the bank has changed since the last time this
method was called.
@return Whether the bank was changed
*/
bool bankChanged();
#ifdef DEBUGGER_SUPPORT
const RamAreaList& ramAreas() { return myRamAreaList; }
#endif
@ -301,15 +310,19 @@ class Cartridge : public Device
// The startup bank to use (where to look for the reset vector address)
uInt16 myStartBank;
// If myBankLocked is true, ignore attempts at bankswitching. This is used
// by the debugger, when disassembling/dumping ROM.
bool myBankLocked;
// Indicates if the bank has changed somehow (a bankswitch has occurred)
bool myBankChanged;
private:
#ifdef DEBUGGER_SUPPORT
// Contains RamArea entries for those carts with accessible RAM.
RamAreaList myRamAreaList;
#endif
// If myBankLocked is true, ignore attempts at bankswitching. This is used
// by the debugger, when disassembling/dumping ROM.
bool myBankLocked;
// Contains info about this cartridge in string format
static string myAboutString;

View File

@ -146,7 +146,7 @@ void Cartridge0840::poke(uInt16 address, uInt8 value)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge0840::bank(uInt16 bank)
{
if(myBankLocked) return;
if(bankLocked()) return;
// Remember what bank we're in
myCurrentBank = bank;
@ -164,7 +164,7 @@ void Cartridge0840::bank(uInt16 bank)
access.directPeekBase = &myImage[offset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> shift, access);
}
myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -183,14 +183,14 @@ int Cartridge0840::bankCount()
bool Cartridge0840::patch(uInt16 address, uInt8 value)
{
myImage[(myCurrentBank << 12) + (address & 0x0fff)] = value;
return true;
return myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8* Cartridge0840::getImage(int& size)
{
size = 8192;
return &myImage[0];
return myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -60,6 +60,7 @@ Cartridge2K::~Cartridge2K()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge2K::reset()
{
myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -118,14 +119,14 @@ int Cartridge2K::bankCount()
bool Cartridge2K::patch(uInt16 address, uInt8 value)
{
myImage[address & myMask] = value;
return true;
return myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8* Cartridge2K::getImage(int& size)
{
size = mySize;
return &myImage[0];
return myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -114,7 +114,7 @@ uInt8 Cartridge3E::peek(uInt16 address)
// Reading from the write port triggers an unwanted write
uInt8 value = mySystem->getDataBusState(0xFF);
if(myBankLocked)
if(bankLocked())
return value;
else
{
@ -156,7 +156,7 @@ void Cartridge3E::poke(uInt16 address, uInt8 value)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge3E::bank(uInt16 bank)
{
if(myBankLocked) return;
if(bankLocked()) return;
if(bank < 256)
{
@ -218,6 +218,7 @@ void Cartridge3E::bank(uInt16 bank)
mySystem->setPageAccess(address >> shift, access);
}
}
myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -247,14 +248,14 @@ bool Cartridge3E::patch(uInt16 address, uInt8 value)
else
myImage[(address & 0x07FF) + mySize - 2048] = value;
return true;
return myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8* Cartridge3E::getImage(int& size)
{
size = mySize;
return &myImage[0];
return myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -47,7 +47,7 @@ Cartridge3F::~Cartridge3F()
void Cartridge3F::reset()
{
// We'll map the startup bank into the first segment upon reset
bank(0);
bank(myStartBank);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -82,8 +82,8 @@ void Cartridge3F::install(System& system)
mySystem->setPageAccess(j >> shift, access);
}
// Install pages for bank 0 into the first segment
bank(0);
// Install pages for startup bank into the first segment
bank(myStartBank);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -122,7 +122,7 @@ void Cartridge3F::poke(uInt16 address, uInt8 value)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge3F::bank(uInt16 bank)
{
if(myBankLocked) return;
if(bankLocked()) return;
// Make sure the bank they're asking for is reasonable
if(((uInt32)bank << 11) < mySize)
@ -150,6 +150,7 @@ void Cartridge3F::bank(uInt16 bank)
access.directPeekBase = &myImage[offset + (address & 0x07FF)];
mySystem->setPageAccess(address >> shift, access);
}
myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -174,14 +175,14 @@ bool Cartridge3F::patch(uInt16 address, uInt8 value)
else
myImage[(address & 0x07FF) + mySize - 2048] = value;
return true;
return myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8* Cartridge3F::getImage(int& size)
{
size = mySize;
return &myImage[0];
return myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -27,6 +27,7 @@
// TODO - properly handle read from write port functionality
// Note: do r/w port restrictions even exist for this scheme??
// Port to new CartDebug/disassembler scheme
// Add bankchanged code
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge4A50::Cartridge4A50(const uInt8* image, uInt32 size)
@ -122,7 +123,7 @@ uInt8 Cartridge4A50::peek(uInt16 address)
else if((address & 0x1f00) == 0x1f00) // 256B region from 0x1f00 - 0x1fff
{
value = myImage[(address & 0xff) + 0x1ff00];
if(!myBankLocked && ((myLastData & 0xe0) == 0x60) &&
if(!bankLocked() && ((myLastData & 0xe0) == 0x60) &&
((myLastAddress >= 0x1000) || (myLastAddress < 0x200)))
mySliceHigh = (mySliceHigh & 0xf0ff) | ((address & 0x8) << 8) |
((address & 0x70) << 4);
@ -168,7 +169,7 @@ void Cartridge4A50::poke(uInt16 address, uInt8 value)
}
else if((address & 0x1f00) == 0x1f00) // 256B region at 0x1f00 - 0x1fff
{
if(!myBankLocked && ((myLastData & 0xe0) == 0x60) &&
if(!bankLocked() && ((myLastData & 0xe0) == 0x60) &&
((myLastAddress >= 0x1000) || (myLastAddress < 0x200)))
mySliceHigh = (mySliceHigh & 0xf0ff) | ((address & 0x8) << 8) |
((address & 0x70) << 4);
@ -181,7 +182,7 @@ void Cartridge4A50::poke(uInt16 address, uInt8 value)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge4A50::checkBankSwitch(uInt16 address, uInt8 value)
{
if(myBankLocked) return;
if(bankLocked()) return;
// This scheme contains so many hotspots that it's easier to just check
// all of them
@ -316,7 +317,7 @@ bool Cartridge4A50::patch(uInt16 address, uInt8 value)
uInt8* Cartridge4A50::getImage(int& size)
{
size = 131072;
return &myImage[0];
return myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -37,6 +37,7 @@ Cartridge4K::~Cartridge4K()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge4K::reset()
{
myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -96,14 +97,14 @@ int Cartridge4K::bankCount()
bool Cartridge4K::patch(uInt16 address, uInt8 value)
{
myImage[address & 0x0FFF] = value;
return true;
return myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8* Cartridge4K::getImage(int& size)
{
size = 4096;
return &myImage[0];
return myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -26,6 +26,7 @@
// TODO - properly handle read from write port functionality
// Note: do r/w port restrictions even exist for this scheme??
// Port to new CartDebug/disassembler scheme
// Add bankchanged code
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeAR::CartridgeAR(const uInt8* image, uInt32 size,
@ -392,7 +393,7 @@ void CartridgeAR::loadIntoRAM(uInt8 load)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeAR::bank(uInt16 bank)
{
if(myBankLocked) return;
if(bankLocked()) return;
bankConfiguration(bank);
}

View File

@ -22,6 +22,9 @@
#include "System.hxx"
#include "CartCV.hxx"
// TODO - Port to new CartDebug/disassembler scheme
// Add bankchanged code
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeCV::CartridgeCV(const uInt8* image, uInt32 size)
: myROM(0),
@ -113,7 +116,7 @@ uInt8 CartridgeCV::peek(uInt16 address)
// Reading from the write port triggers an unwanted write
uInt8 value = mySystem->getDataBusState(0xFF);
if(myBankLocked)
if(bankLocked())
return value;
else
{
@ -163,7 +166,7 @@ bool CartridgeCV::patch(uInt16 address, uInt8 value)
uInt8* CartridgeCV::getImage(int& size)
{
size = 2048;
return &myImage[0];
return myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -26,6 +26,7 @@
// TODO - properly handle read from write port functionality
// Note: do r/w port restrictions even exist for this scheme??
// Port to new CartDebug/disassembler scheme
// Add bankchanged code
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeDPC::CartridgeDPC(const uInt8* image, uInt32 size)
@ -420,7 +421,7 @@ void CartridgeDPC::poke(uInt16 address, uInt8 value)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeDPC::bank(uInt16 bank)
{
if(myBankLocked) return;
if(bankLocked()) return;
// Remember what bank we're in
myCurrentBank = bank;

View File

@ -23,6 +23,7 @@
#include "CartE0.hxx"
// TODO - Port to new CartDebug/disassembler scheme
// Add bankchanged code
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeE0::CartridgeE0(const uInt8* image)
@ -127,7 +128,7 @@ void CartridgeE0::poke(uInt16 address, uInt8)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeE0::segmentZero(uInt16 slice)
{
if(myBankLocked) return;
if(bankLocked()) return;
// Remember the new slice
myCurrentSlice[0] = slice;
@ -149,7 +150,7 @@ void CartridgeE0::segmentZero(uInt16 slice)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeE0::segmentOne(uInt16 slice)
{
if(myBankLocked) return;
if(bankLocked()) return;
// Remember the new slice
myCurrentSlice[1] = slice;
@ -171,7 +172,7 @@ void CartridgeE0::segmentOne(uInt16 slice)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeE0::segmentTwo(uInt16 slice)
{
if(myBankLocked) return;
if(bankLocked()) return;
// Remember the new slice
myCurrentSlice[2] = slice;

View File

@ -24,6 +24,7 @@
// TODO - Port to new CartDebug/disassembler scheme
// I'm not sure patch is working, since it doesn't consider RAM areas
// Add bankchanged code
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeE7::CartridgeE7(const uInt8* image)
@ -116,7 +117,7 @@ uInt8 CartridgeE7::peek(uInt16 address)
// Reading from the 1K write port @ $1000 triggers an unwanted write
uInt8 value = mySystem->getDataBusState(0xFF);
if(myBankLocked)
if(bankLocked())
return value;
else
{
@ -129,7 +130,7 @@ uInt8 CartridgeE7::peek(uInt16 address)
// Reading from the 256B write port @ $1800 triggers an unwanted write
uInt8 value = mySystem->getDataBusState(0xFF);
if(myBankLocked)
if(bankLocked())
return value;
else
{
@ -164,7 +165,7 @@ void CartridgeE7::poke(uInt16 address, uInt8)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeE7::bankRAM(uInt16 bank)
{
if(myBankLocked) return;
if(bankLocked()) return;
// Remember what bank we're in
myCurrentRAM = bank;
@ -197,7 +198,7 @@ void CartridgeE7::bankRAM(uInt16 bank)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeE7::bank(uInt16 slice)
{
if(myBankLocked) return;
if(bankLocked()) return;
// Remember what bank we're in
myCurrentSlice[0] = slice;

View File

@ -93,7 +93,7 @@ void CartridgeEF::poke(uInt16 address, uInt8)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeEF::bank(uInt16 bank)
{
if(myBankLocked) return;
if(bankLocked()) return;
// Remember what bank we're in
myCurrentBank = bank;
@ -113,6 +113,7 @@ void CartridgeEF::bank(uInt16 bank)
access.directPeekBase = &myImage[offset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> shift, access);
}
myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -131,14 +132,14 @@ int CartridgeEF::bankCount()
bool CartridgeEF::patch(uInt16 address, uInt8 value)
{
myImage[(myCurrentBank << 12) + (address & 0x0FFF)] = value;
return true;
return myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8* CartridgeEF::getImage(int& size)
{
size = 65536;
return &myImage[0];
return myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -108,7 +108,7 @@ uInt8 CartridgeEFSC::peek(uInt16 address)
// Reading from the write port triggers an unwanted write
uInt8 value = mySystem->getDataBusState(0xFF);
if(myBankLocked)
if(bankLocked())
return value;
else
{
@ -137,7 +137,7 @@ void CartridgeEFSC::poke(uInt16 address, uInt8)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeEFSC::bank(uInt16 bank)
{
if(myBankLocked) return;
if(bankLocked()) return;
// Remember what bank we're in
myCurrentBank = bank;
@ -157,6 +157,7 @@ void CartridgeEFSC::bank(uInt16 bank)
access.directPeekBase = &myImage[offset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> shift, access);
}
myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -175,14 +176,14 @@ int CartridgeEFSC::bankCount()
bool CartridgeEFSC::patch(uInt16 address, uInt8 value)
{
myImage[(myCurrentBank << 12) + (address & 0x0FFF)] = value;
return true;
return myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8* CartridgeEFSC::getImage(int& size)
{
size = 65536;
return &myImage[0];
return myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -95,7 +95,7 @@ void CartridgeF0::poke(uInt16 address, uInt8)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF0::incbank()
{
if(myBankLocked) return;
if(bankLocked()) return;
// Remember what bank we're in
myCurrentBank++;
@ -116,12 +116,13 @@ void CartridgeF0::incbank()
access.directPeekBase = &myImage[offset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> shift, access);
}
myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF0::bank(uInt16 bank)
{
if(myBankLocked) return;
if(bankLocked()) return;
myCurrentBank = bank - 1;
incbank();
@ -143,14 +144,14 @@ int CartridgeF0::bankCount()
bool CartridgeF0::patch(uInt16 address, uInt8 value)
{
myImage[(myCurrentBank << 12) + (address & 0x0FFF)] = value;
return true;
return myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8* CartridgeF0::getImage(int& size)
{
size = 65536;
return &myImage[0];
return myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -98,7 +98,7 @@ void CartridgeF4::poke(uInt16 address, uInt8)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF4::bank(uInt16 bank)
{
if(myBankLocked) return;
if(bankLocked()) return;
// Remember what bank we're in
myCurrentBank = bank;
@ -118,6 +118,7 @@ void CartridgeF4::bank(uInt16 bank)
access.directPeekBase = &myImage[offset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> shift, access);
}
myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -136,14 +137,14 @@ int CartridgeF4::bankCount()
bool CartridgeF4::patch(uInt16 address, uInt8 value)
{
myImage[(myCurrentBank << 12) + (address & 0x0FFF)] = value;
return true;
return myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8* CartridgeF4::getImage(int& size)
{
size = 32768;
return &myImage[0];
return myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -108,7 +108,7 @@ uInt8 CartridgeF4SC::peek(uInt16 address)
// Reading from the write port triggers an unwanted write
uInt8 value = mySystem->getDataBusState(0xFF);
if(myBankLocked)
if(bankLocked())
return value;
else
{
@ -140,7 +140,7 @@ void CartridgeF4SC::poke(uInt16 address, uInt8)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF4SC::bank(uInt16 bank)
{
if(myBankLocked) return;
if(bankLocked()) return;
// Remember what bank we're in
myCurrentBank = bank;
@ -160,6 +160,7 @@ void CartridgeF4SC::bank(uInt16 bank)
access.directPeekBase = &myImage[offset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> shift, access);
}
myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -178,14 +179,14 @@ int CartridgeF4SC::bankCount()
bool CartridgeF4SC::patch(uInt16 address, uInt8 value)
{
myImage[(myCurrentBank << 12) + (address & 0x0FFF)] = value;
return true;
return myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8* CartridgeF4SC::getImage(int& size)
{
size = 32768;
return &myImage[0];
return myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -139,7 +139,7 @@ void CartridgeF6::poke(uInt16 address, uInt8)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF6::bank(uInt16 bank)
{
if(myBankLocked) return;
if(bankLocked()) return;
// Remember what bank we're in
myCurrentBank = bank;
@ -159,6 +159,7 @@ void CartridgeF6::bank(uInt16 bank)
access.directPeekBase = &myImage[offset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> shift, access);
}
myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -177,14 +178,14 @@ int CartridgeF6::bankCount()
bool CartridgeF6::patch(uInt16 address, uInt8 value)
{
myImage[(myCurrentBank << 12) + (address & 0x0FFF)] = value;
return true;
return myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8* CartridgeF6::getImage(int& size)
{
size = 16384;
return &myImage[0];
return myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -131,7 +131,7 @@ uInt8 CartridgeF6SC::peek(uInt16 address)
// Reading from the write port triggers an unwanted write
uInt8 value = mySystem->getDataBusState(0xFF);
if(myBankLocked)
if(bankLocked())
return value;
else
{
@ -183,7 +183,7 @@ void CartridgeF6SC::poke(uInt16 address, uInt8)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF6SC::bank(uInt16 bank)
{
if(myBankLocked) return;
if(bankLocked()) return;
// Remember what bank we're in
myCurrentBank = bank;
@ -203,6 +203,7 @@ void CartridgeF6SC::bank(uInt16 bank)
access.directPeekBase = &myImage[offset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> shift, access);
}
myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -221,14 +222,14 @@ int CartridgeF6SC::bankCount()
bool CartridgeF6SC::patch(uInt16 address, uInt8 value)
{
myImage[(myCurrentBank << 12) + (address & 0x0FFF)] = value;
return true;
return myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8* CartridgeF6SC::getImage(int& size)
{
size = 16384;
return &myImage[0];
return myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -120,7 +120,7 @@ void CartridgeF8::poke(uInt16 address, uInt8)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF8::bank(uInt16 bank)
{
if(myBankLocked) return;
if(bankLocked()) return;
// Remember what bank we're in
myCurrentBank = bank;
@ -140,6 +140,7 @@ void CartridgeF8::bank(uInt16 bank)
access.directPeekBase = &myImage[offset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> shift, access);
}
myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -158,14 +159,14 @@ int CartridgeF8::bankCount()
bool CartridgeF8::patch(uInt16 address, uInt8 value)
{
myImage[(myCurrentBank << 12) + (address & 0x0FFF)] = value;
return true;
return myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8* CartridgeF8::getImage(int& size)
{
size = 8192;
return &myImage[0];
return myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -121,7 +121,7 @@ uInt8 CartridgeF8SC::peek(uInt16 address)
// Reading from the write port triggers an unwanted write
uInt8 value = mySystem->getDataBusState(0xFF);
if(myBankLocked)
if(bankLocked())
return value;
else
{
@ -163,7 +163,7 @@ void CartridgeF8SC::poke(uInt16 address, uInt8)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF8SC::bank(uInt16 bank)
{
if(myBankLocked) return;
if(bankLocked()) return;
// Remember what bank we're in
myCurrentBank = bank;
@ -183,6 +183,7 @@ void CartridgeF8SC::bank(uInt16 bank)
access.directPeekBase = &myImage[offset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> shift, access);
}
myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -201,14 +202,14 @@ int CartridgeF8SC::bankCount()
bool CartridgeF8SC::patch(uInt16 address, uInt8 value)
{
myImage[(myCurrentBank << 12) + (address & 0x0FFF)] = value;
return true;
return myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8* CartridgeF8SC::getImage(int& size)
{
size = 8192;
return &myImage[0];
return myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -126,7 +126,7 @@ uInt8 CartridgeFA::peek(uInt16 address)
// Reading from the write port triggers an unwanted write
uInt8 value = mySystem->getDataBusState(0xFF);
if(myBankLocked)
if(bankLocked())
return value;
else
{
@ -173,7 +173,7 @@ void CartridgeFA::poke(uInt16 address, uInt8)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeFA::bank(uInt16 bank)
{
if(myBankLocked) return;
if(bankLocked()) return;
// Remember what bank we're in
myCurrentBank = bank;
@ -193,6 +193,7 @@ void CartridgeFA::bank(uInt16 bank)
access.directPeekBase = &myImage[offset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> shift, access);
}
myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -211,14 +212,14 @@ int CartridgeFA::bankCount()
bool CartridgeFA::patch(uInt16 address, uInt8 value)
{
myImage[(myCurrentBank << 12) + (address & 0x0FFF)] = value;
return true;
return myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8* CartridgeFA::getImage(int& size)
{
size = 12288;
return &myImage[0];
return myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -23,6 +23,7 @@
#include "CartFE.hxx"
// TODO - Port to new CartDebug/disassembler scheme
// Add bankchanged code
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeFE::CartridgeFE(const uInt8* image)

View File

@ -26,6 +26,7 @@
// No test ROMs exist as of 2009-11-08, so we can't be sure how
// accurate the emulation is
// Port to new CartDebug/disassembler scheme
// Add bankchanged code
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeMC::CartridgeMC(const uInt8* image, uInt32 size)
@ -147,7 +148,7 @@ uInt8 CartridgeMC::peek(uInt16 address)
// Reading from the write port triggers an unwanted write
uInt8 value = mySystem->getDataBusState(0xFF);
if(myBankLocked) return value;
if(bankLocked()) return value;
else return myRAM[(uInt32)((block & 0x3F) << 9) + (address & 0x01FF)] = value;
}
}

View File

@ -125,7 +125,7 @@ void CartridgeSB::poke(uInt16 address, uInt8 value)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeSB::bank(uInt16 bank)
{
if(myBankLocked) return;
if(bankLocked()) return;
// Remember what bank we're in
myCurrentBank = bank;
@ -143,6 +143,7 @@ void CartridgeSB::bank(uInt16 bank)
access.directPeekBase = &myImage[offset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> shift, access);
}
myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -161,14 +162,14 @@ int CartridgeSB::bankCount()
bool CartridgeSB::patch(uInt16 address, uInt8 value)
{
myImage[(myCurrentBank << 12) + (address & 0x0FFF)] = value;
return true;
return myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8* CartridgeSB::getImage(int& size)
{
size = mySize;
return &myImage[0];
return myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -133,7 +133,7 @@ void CartridgeUA::poke(uInt16 address, uInt8 value)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeUA::bank(uInt16 bank)
{
if(myBankLocked) return;
if(bankLocked()) return;
// Remember what bank we're in
myCurrentBank = bank;
@ -151,6 +151,7 @@ void CartridgeUA::bank(uInt16 bank)
access.directPeekBase = &myImage[offset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> shift, access);
}
myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -169,14 +170,14 @@ int CartridgeUA::bankCount()
bool CartridgeUA::patch(uInt16 address, uInt8 value)
{
myImage[(myCurrentBank << 12) + (address & 0x0FFF)] = value;
return true;
return myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8* CartridgeUA::getImage(int& size)
{
size = 8192;
return &myImage[0];
return myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -119,7 +119,7 @@ void CartridgeX07::poke(uInt16 address, uInt8 value)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeX07::bank(uInt16 bank)
{
if(myBankLocked) return;
if(bankLocked()) return;
// Remember what bank we're in
myCurrentBank = (bank & 0x0f);
@ -137,6 +137,7 @@ void CartridgeX07::bank(uInt16 bank)
access.directPeekBase = &myImage[offset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> shift, access);
}
myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -155,14 +156,14 @@ int CartridgeX07::bankCount()
bool CartridgeX07::patch(uInt16 address, uInt8 value)
{
myImage[(myCurrentBank << 12) + (address & 0x0FFF)] = value;
return true;
return myBankChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8* CartridgeX07::getImage(int& size)
{
size = 65536;
return &myImage[0];
return myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -229,9 +229,9 @@ void Properties::copy(const Properties& properties)
void Properties::print() const
{
cout << get(Cartridge_MD5) << "|"
<< get(Cartridge_Name) << "|"
<< get(Cartridge_Manufacturer) << "|"
<< get(Cartridge_ModelNo) << "|"
<< get(Cartridge_Name) << "|"
<< get(Cartridge_Note) << "|"
<< get(Cartridge_Rarity) << "|"
<< get(Cartridge_Sound) << "|"
@ -273,9 +273,9 @@ PropertyType Properties::getPropertyType(const string& name)
void Properties::printHeader()
{
cout << "Cartridge_MD5|"
<< "Cartridge_Name|"
<< "Cartridge_Manufacturer|"
<< "Cartridge_ModelNo|"
<< "Cartridge_Name|"
<< "Cartridge_Note|"
<< "Cartridge_Rarity|"
<< "Cartridge_Sound|"