Improved 'E7' autodetection; several ROMs that were detected as F6 are

now properly detected as E7.

Some minor cleanups to the Cart classes.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2036 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2010-05-10 00:50:26 +00:00
parent 2468585c3e
commit 03c6e2c4f0
29 changed files with 159 additions and 273 deletions

View File

@ -496,6 +496,40 @@ bool Cartridge::isProbablySC(const uInt8* image, uInt32 size)
return true; return true;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge::isProbably0840(const uInt8* image, uInt32 size)
{
// 0840 cart bankswitching is triggered by accessing addresses 0x0800
// or 0x0840
uInt8 signature1[2][3] = {
{ 0xAD, 0x00, 0x08 }, // LDA $0800
{ 0xAD, 0x40, 0x08 } // LDA $0840
};
for(uInt32 i = 0; i < 2; ++i)
if(searchForBytes(image, size, signature1[i], 3, 1))
return true;
uInt8 signature2[2][4] = {
{ 0x0C, 0x00, 0x08, 0x4C }, // NOP $0800; JMP ...
{ 0x0C, 0xFF, 0x0F, 0x4C } // NOP $0FFF; JMP ...
};
for(uInt32 i = 0; i < 2; ++i)
if(searchForBytes(image, size, signature2[i], 4, 1))
return true;
return false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge::isProbably3E(const uInt8* image, uInt32 size)
{
// 3E cart bankswitching is triggered by storing the bank number
// in address 3E using 'STA $3E', commonly followed by an
// immediate mode LDA
uInt8 signature[] = { 0x85, 0x3E, 0xA9, 0x00 }; // STA $3E; LDA #$00
return searchForBytes(image, size, signature, 4, 1);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge::isProbably3F(const uInt8* image, uInt32 size) bool Cartridge::isProbably3F(const uInt8* image, uInt32 size)
{ {
@ -508,13 +542,28 @@ bool Cartridge::isProbably3F(const uInt8* image, uInt32 size)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge::isProbably3E(const uInt8* image, uInt32 size) bool Cartridge::isProbably4A50(const uInt8* image, uInt32 size)
{ {
// 3E cart bankswitching is triggered by storing the bank number // 4A50 carts store address $4A50 at the NMI vector, which
// in address 3E using 'STA $3E', commonly followed by an // in this scheme is always in the last page of ROM at
// immediate mode LDA // $1FFA - $1FFB (at least this is true in rev 1 of the format)
uInt8 signature[] = { 0x85, 0x3E, 0xA9, 0x00 }; // STA $3E; LDA #$00 int idx = size - 6; // $1FFA
return searchForBytes(image, size, signature, 4, 1); return (image[idx] == 0x50 && image[idx+1] == 0x4A);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge::isProbablyCV(const uInt8* image, uInt32 size)
{
// CV RAM access occurs at addresses $f3ff and $f400
// These signatures are attributed to the MESS project
uInt8 signature[2][3] = {
{ 0x9D, 0xFF, 0xF3 }, // STA $F3FF
{ 0x99, 0x00, 0xF4 } // STA $F400
};
if(searchForBytes(image, size, signature[0], 3, 1))
return true;
else
return searchForBytes(image, size, signature[1], 3, 1);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -560,14 +609,16 @@ bool Cartridge::isProbablyE7(const uInt8* image, uInt32 size)
// search for only certain known signatures // search for only certain known signatures
// Thanks to "stella@casperkitty.com" for this advice // Thanks to "stella@casperkitty.com" for this advice
// These signatures are attributed to the MESS project // These signatures are attributed to the MESS project
uInt8 signature[5][3] = { uInt8 signature[7][3] = {
{ 0xAD, 0xE2, 0xFF }, // LDA $FFE2
{ 0xAD, 0xE5, 0xFF }, // LDA $FFE5 { 0xAD, 0xE5, 0xFF }, // LDA $FFE5
{ 0xAD, 0xE5, 0x1F }, // LDA $1FE5 { 0xAD, 0xE5, 0x1F }, // LDA $1FE5
{ 0xAD, 0xE7, 0x1F }, // LDA $1FE7
{ 0x0C, 0xE7, 0x1F }, // NOP $1FE7 { 0x0C, 0xE7, 0x1F }, // NOP $1FE7
{ 0x8D, 0xE7, 0xFF }, // STA $FFE7 { 0x8D, 0xE7, 0xFF }, // STA $FFE7
{ 0x8D, 0xE7, 0x1F } // STA $1FE7 { 0x8D, 0xE7, 0x1F } // STA $1FE7
}; };
for(uInt32 i = 0; i < 5; ++i) for(uInt32 i = 0; i < 7; ++i)
if(searchForBytes(image, size, signature[i], 3, 1)) if(searchForBytes(image, size, signature[i], 3, 1))
return true; return true;
@ -591,32 +642,24 @@ bool Cartridge::isProbablyEF(const uInt8* image, uInt32 size)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge::isProbablyUA(const uInt8* image, uInt32 size) bool Cartridge::isProbablyFE(const uInt8* image, uInt32 size)
{ {
// UA cart bankswitching switches to bank 1 by accessing address 0x240 // FE bankswitching is very weird, but always seems to include a
// using 'STA $240' or 'LDA $240' // 'JSR $xxxx'
uInt8 signature[3][3] = { // These signatures are attributed to the MESS project
{ 0x8D, 0x40, 0x02 }, // STA $240 uInt8 signature[4][5] = {
{ 0xAD, 0x40, 0x02 }, // LDA $240 { 0x20, 0x00, 0xD0, 0xC6, 0xC5 }, // JSR $D000; DEC $C5
{ 0xBD, 0x1F, 0x02 } // LDA $21F,X { 0x20, 0xC3, 0xF8, 0xA5, 0x82 }, // JSR $F8C3; LDA $82
{ 0xD0, 0xFB, 0x20, 0x73, 0xFE }, // BNE $FB; JSR $FE73
{ 0x20, 0x00, 0xF0, 0x84, 0xD6 } // JSR $F000; STY $D6
}; };
for(uInt32 i = 0; i < 3; ++i) for(uInt32 i = 0; i < 4; ++i)
if(searchForBytes(image, size, signature[i], 3, 1)) if(searchForBytes(image, size, signature[i], 5, 1))
return true; return true;
return false; return false;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge::isProbably4A50(const uInt8* image, uInt32 size)
{
// 4A50 carts store address $4A50 at the NMI vector, which
// in this scheme is always in the last page of ROM at
// $1FFA - $1FFB (at least this is true in rev 1 of the format)
int idx = size - 6; // $1FFA
return (image[idx] == 0x50 && image[idx+1] == 0x4A);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge::isProbablySB(const uInt8* image, uInt32 size) bool Cartridge::isProbablySB(const uInt8* image, uInt32 size)
{ {
@ -632,58 +675,17 @@ bool Cartridge::isProbablySB(const uInt8* image, uInt32 size)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge::isProbably0840(const uInt8* image, uInt32 size) bool Cartridge::isProbablyUA(const uInt8* image, uInt32 size)
{ {
// 0840 cart bankswitching is triggered by accessing addresses 0x0800 // UA cart bankswitching switches to bank 1 by accessing address 0x240
// or 0x0840 // using 'STA $240' or 'LDA $240'
uInt8 signature1[2][3] = { uInt8 signature[3][3] = {
{ 0xAD, 0x00, 0x08 }, // LDA $0800 { 0x8D, 0x40, 0x02 }, // STA $240
{ 0xAD, 0x40, 0x08 } // LDA $0840 { 0xAD, 0x40, 0x02 }, // LDA $240
{ 0xBD, 0x1F, 0x02 } // LDA $21F,X
}; };
for(uInt32 i = 0; i < 2; ++i) for(uInt32 i = 0; i < 3; ++i)
if(searchForBytes(image, size, signature1[i], 3, 1)) if(searchForBytes(image, size, signature[i], 3, 1))
return true;
uInt8 signature2[2][4] = {
{ 0x0C, 0x00, 0x08, 0x4C }, // NOP $0800; JMP ...
{ 0x0C, 0xFF, 0x0F, 0x4C } // NOP $0FFF; JMP ...
};
for(uInt32 i = 0; i < 2; ++i)
if(searchForBytes(image, size, signature2[i], 4, 1))
return true;
return false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge::isProbablyCV(const uInt8* image, uInt32 size)
{
// CV RAM access occurs at addresses $f3ff and $f400
// These signatures are attributed to the MESS project
uInt8 signature[2][3] = {
{ 0x9D, 0xFF, 0xF3 }, // STA $F3FF
{ 0x99, 0x00, 0xF4 } // STA $F400
};
if(searchForBytes(image, size, signature[0], 3, 1))
return true;
else
return searchForBytes(image, size, signature[1], 3, 1);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge::isProbablyFE(const uInt8* image, uInt32 size)
{
// FE bankswitching is very weird, but always seems to include a
// 'JSR $xxxx'
// These signatures are attributed to the MESS project
uInt8 signature[4][5] = {
{ 0x20, 0x00, 0xD0, 0xC6, 0xC5 }, // JSR $D000; DEC $C5
{ 0x20, 0xC3, 0xF8, 0xA5, 0x82 }, // JSR $F8C3; LDA $82
{ 0xD0, 0xFB, 0x20, 0x73, 0xFE }, // BNE $FB; JSR $FE73
{ 0x20, 0x00, 0xF0, 0x84, 0xD6 } // JSR $F000; STY $D6
};
for(uInt32 i = 0; i < 4; ++i)
if(searchForBytes(image, size, signature[i], 5, 1))
return true; return true;
return false; return false;

View File

@ -251,15 +251,30 @@ class Cartridge : public Device
static bool isProbablySC(const uInt8* image, uInt32 size); static bool isProbablySC(const uInt8* image, uInt32 size);
/** /**
Returns true if the image is probably a 3F bankswitching cartridge Returns true if the image is probably a 0840 bankswitching cartridge
*/ */
static bool isProbably3F(const uInt8* image, uInt32 size); static bool isProbably0840(const uInt8* image, uInt32 size);
/** /**
Returns true if the image is probably a 3E bankswitching cartridge Returns true if the image is probably a 3E bankswitching cartridge
*/ */
static bool isProbably3E(const uInt8* image, uInt32 size); static bool isProbably3E(const uInt8* image, uInt32 size);
/**
Returns true if the image is probably a 3F bankswitching cartridge
*/
static bool isProbably3F(const uInt8* image, uInt32 size);
/**
Returns true if the image is probably a 4A50 bankswitching cartridge
*/
static bool isProbably4A50(const uInt8* image, uInt32 size);
/**
Returns true if the image is probably a CV bankswitching cartridge
*/
static bool isProbablyCV(const uInt8* image, uInt32 size);
/** /**
Returns true if the image is probably a DPC+ bankswitching cartridge Returns true if the image is probably a DPC+ bankswitching cartridge
*/ */
@ -281,14 +296,14 @@ class Cartridge : public Device
static bool isProbablyEF(const uInt8* image, uInt32 size); static bool isProbablyEF(const uInt8* image, uInt32 size);
/** /**
Returns true if the image is probably a UA bankswitching cartridge Returns true if the image is probably an F6 bankswitching cartridge
*/ */
static bool isProbablyUA(const uInt8* image, uInt32 size); static bool isProbablyF6(const uInt8* image, uInt32 size);
/** /**
Returns true if the image is probably a 4A50 bankswitching cartridge Returns true if the image is probably an FE bankswitching cartridge
*/ */
static bool isProbably4A50(const uInt8* image, uInt32 size); static bool isProbablyFE(const uInt8* image, uInt32 size);
/** /**
Returns true if the image is probably a SB bankswitching cartridge Returns true if the image is probably a SB bankswitching cartridge
@ -296,19 +311,9 @@ class Cartridge : public Device
static bool isProbablySB(const uInt8* image, uInt32 size); static bool isProbablySB(const uInt8* image, uInt32 size);
/** /**
Returns true if the image is probably a 0840 bankswitching cartridge Returns true if the image is probably a UA bankswitching cartridge
*/ */
static bool isProbably0840(const uInt8* image, uInt32 size); static bool isProbablyUA(const uInt8* image, uInt32 size);
/**
Returns true if the image is probably a CV bankswitching cartridge
*/
static bool isProbablyCV(const uInt8* image, uInt32 size);
/**
Returns true if the image is probably an FE bankswitching cartridge
*/
static bool isProbablyFE(const uInt8* image, uInt32 size);
/** /**
Returns true if the image is probably an X07 bankswitching cartridge Returns true if the image is probably an X07 bankswitching cartridge

View File

@ -199,11 +199,9 @@ const uInt8* Cartridge0840::getImage(int& size) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge0840::save(Serializer& out) const bool Cartridge0840::save(Serializer& out) const
{ {
const string& cart = name();
try try
{ {
out.putString(cart); out.putString(name());
out.putInt(myCurrentBank); out.putInt(myCurrentBank);
} }
catch(const char* msg) catch(const char* msg)
@ -218,11 +216,9 @@ bool Cartridge0840::save(Serializer& out) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge0840::load(Serializer& in) bool Cartridge0840::load(Serializer& in)
{ {
const string& cart = name();
try try
{ {
if(in.getString() != cart) if(in.getString() != name())
return false; return false;
myCurrentBank = (uInt16)in.getInt(); myCurrentBank = (uInt16)in.getInt();

View File

@ -136,11 +136,9 @@ const uInt8* Cartridge2K::getImage(int& size) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge2K::save(Serializer& out) const bool Cartridge2K::save(Serializer& out) const
{ {
const string& cart = name();
try try
{ {
out.putString(cart); out.putString(name());
} }
catch(const char* msg) catch(const char* msg)
{ {
@ -154,11 +152,9 @@ bool Cartridge2K::save(Serializer& out) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge2K::load(Serializer& in) bool Cartridge2K::load(Serializer& in)
{ {
const string& cart = name();
try try
{ {
if(in.getString() != cart) if(in.getString() != name())
return false; return false;
} }
catch(const char* msg) catch(const char* msg)

View File

@ -273,11 +273,9 @@ const uInt8* Cartridge3E::getImage(int& size) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge3E::save(Serializer& out) const bool Cartridge3E::save(Serializer& out) const
{ {
const string& cart = name();
try try
{ {
out.putString(cart); out.putString(name());
out.putInt(myCurrentBank); out.putInt(myCurrentBank);
// Output RAM // Output RAM
@ -297,11 +295,9 @@ bool Cartridge3E::save(Serializer& out) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge3E::load(Serializer& in) bool Cartridge3E::load(Serializer& in)
{ {
const string& cart = name();
try try
{ {
if(in.getString() != cart) if(in.getString() != name())
return false; return false;
myCurrentBank = (uInt16) in.getInt(); myCurrentBank = (uInt16) in.getInt();

View File

@ -192,11 +192,9 @@ const uInt8* Cartridge3F::getImage(int& size) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge3F::save(Serializer& out) const bool Cartridge3F::save(Serializer& out) const
{ {
const string& cart = name();
try try
{ {
out.putString(cart); out.putString(name());
out.putInt(myCurrentBank); out.putInt(myCurrentBank);
} }
catch(const char* msg) catch(const char* msg)
@ -211,11 +209,9 @@ bool Cartridge3F::save(Serializer& out) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge3F::load(Serializer& in) bool Cartridge3F::load(Serializer& in)
{ {
const string& cart = name();
try try
{ {
if(in.getString() != cart) if(in.getString() != name())
return false; return false;
myCurrentBank = (uInt16) in.getInt(); myCurrentBank = (uInt16) in.getInt();

View File

@ -373,11 +373,9 @@ const uInt8* Cartridge4A50::getImage(int& size) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge4A50::save(Serializer& out) const bool Cartridge4A50::save(Serializer& out) const
{ {
const string& cart = name();
try try
{ {
out.putString(cart); out.putString(name());
// The 32K bytes of RAM // The 32K bytes of RAM
out.putInt(32768); out.putInt(32768);
@ -410,11 +408,9 @@ bool Cartridge4A50::save(Serializer& out) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge4A50::load(Serializer& in) bool Cartridge4A50::load(Serializer& in)
{ {
const string& cart = name();
try try
{ {
if(in.getString() != cart) if(in.getString() != name())
return false; return false;
uInt32 limit = (uInt32) in.getInt(); uInt32 limit = (uInt32) in.getInt();

View File

@ -113,11 +113,9 @@ const uInt8* Cartridge4K::getImage(int& size) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge4K::save(Serializer& out) const bool Cartridge4K::save(Serializer& out) const
{ {
const string& cart = name();
try try
{ {
out.putString(cart); out.putString(name());
} }
catch(const char* msg) catch(const char* msg)
{ {
@ -131,11 +129,9 @@ bool Cartridge4K::save(Serializer& out) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge4K::load(Serializer& in) bool Cartridge4K::load(Serializer& in)
{ {
const string& cart = name();
try try
{ {
if(in.getString() != cart) if(in.getString() != name())
return false; return false;
} }
catch(const char* msg) catch(const char* msg)

View File

@ -444,13 +444,11 @@ const uInt8* CartridgeAR::getImage(int& size) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeAR::save(Serializer& out) const bool CartridgeAR::save(Serializer& out) const
{ {
const string& cart = name();
try try
{ {
uInt32 i; uInt32 i;
out.putString(cart); out.putString(name());
// Indicates the offest within the image for the corresponding bank // Indicates the offest within the image for the corresponding bank
out.putInt(2); out.putInt(2);
@ -506,11 +504,9 @@ bool CartridgeAR::save(Serializer& out) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeAR::load(Serializer& in) bool CartridgeAR::load(Serializer& in)
{ {
const string& cart = name();
try try
{ {
if(in.getString() != cart) if(in.getString() != name())
return false; return false;
uInt32 i, limit; uInt32 i, limit;

View File

@ -196,11 +196,9 @@ const uInt8* CartridgeCV::getImage(int& size) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeCV::save(Serializer& out) const bool CartridgeCV::save(Serializer& out) const
{ {
const string& cart = name();
try try
{ {
out.putString(cart); out.putString(name());
// Output RAM // Output RAM
out.putInt(1024); out.putInt(1024);
@ -219,11 +217,9 @@ bool CartridgeCV::save(Serializer& out) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeCV::load(Serializer& in) bool CartridgeCV::load(Serializer& in)
{ {
const string& cart = name();
try try
{ {
if(in.getString() != cart) if(in.getString() != name())
return false; return false;
// Input RAM // Input RAM

View File

@ -479,13 +479,11 @@ const uInt8* CartridgeDPC::getImage(int& size) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeDPC::save(Serializer& out) const bool CartridgeDPC::save(Serializer& out) const
{ {
const string& cart = name();
try try
{ {
uInt32 i; uInt32 i;
out.putString(cart); out.putString(name());
// Indicates which bank is currently active // Indicates which bank is currently active
out.putInt(myCurrentBank); out.putInt(myCurrentBank);
@ -533,11 +531,9 @@ bool CartridgeDPC::save(Serializer& out) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeDPC::load(Serializer& in) bool CartridgeDPC::load(Serializer& in)
{ {
const string& cart = name();
try try
{ {
if(in.getString() != cart) if(in.getString() != name())
return false; return false;
uInt32 i, limit; uInt32 i, limit;

View File

@ -599,13 +599,11 @@ const uInt8* CartridgeDPCPlus::getImage(int& size) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeDPCPlus::save(Serializer& out) const bool CartridgeDPCPlus::save(Serializer& out) const
{ {
const string& cart = name();
try try
{ {
uInt32 i; uInt32 i;
out.putString(cart); out.putString(name());
// Indicates which bank is currently active // Indicates which bank is currently active
out.putInt(myCurrentBank); out.putInt(myCurrentBank);
@ -680,11 +678,9 @@ bool CartridgeDPCPlus::save(Serializer& out) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeDPCPlus::load(Serializer& in) bool CartridgeDPCPlus::load(Serializer& in)
{ {
const string& cart = name();
try try
{ {
if(in.getString() != cart) if(in.getString() != name())
return false; return false;
uInt32 i, limit; uInt32 i, limit;

View File

@ -238,11 +238,9 @@ const uInt8* CartridgeE0::getImage(int& size) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeE0::save(Serializer& out) const bool CartridgeE0::save(Serializer& out) const
{ {
const string& cart = name();
try try
{ {
out.putString(cart); out.putString(name());
out.putInt(4); out.putInt(4);
for(uInt32 i = 0; i < 4; ++i) for(uInt32 i = 0; i < 4; ++i)
@ -260,11 +258,9 @@ bool CartridgeE0::save(Serializer& out) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeE0::load(Serializer& in) bool CartridgeE0::load(Serializer& in)
{ {
const string& cart = name();
try try
{ {
if(in.getString() != cart) if(in.getString() != name())
return false; return false;
uInt32 limit = (uInt32) in.getInt(); uInt32 limit = (uInt32) in.getInt();

View File

@ -300,13 +300,11 @@ const uInt8* CartridgeE7::getImage(int& size) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeE7::save(Serializer& out) const bool CartridgeE7::save(Serializer& out) const
{ {
const string& cart = name();
try try
{ {
uInt32 i; uInt32 i;
out.putString(cart); out.putString(name());
out.putInt(2); out.putInt(2);
for(i = 0; i < 2; ++i) for(i = 0; i < 2; ++i)
@ -331,11 +329,9 @@ bool CartridgeE7::save(Serializer& out) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeE7::load(Serializer& in) bool CartridgeE7::load(Serializer& in)
{ {
const string& cart = name();
try try
{ {
if(in.getString() != cart) if(in.getString() != name())
return false; return false;
uInt32 i, limit; uInt32 i, limit;

View File

@ -150,12 +150,9 @@ const uInt8* CartridgeEF::getImage(int& size) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeEF::save(Serializer& out) const bool CartridgeEF::save(Serializer& out) const
{ {
const string& cart = name();
try try
{ {
out.putString(cart); out.putString(name());
out.putInt(myCurrentBank); out.putInt(myCurrentBank);
} }
catch(const char* msg) catch(const char* msg)
@ -170,11 +167,9 @@ bool CartridgeEF::save(Serializer& out) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeEF::load(Serializer& in) bool CartridgeEF::load(Serializer& in)
{ {
const string& cart = name();
try try
{ {
if(in.getString() != cart) if(in.getString() != name())
return false; return false;
myCurrentBank = (uInt16) in.getInt(); myCurrentBank = (uInt16) in.getInt();

View File

@ -205,12 +205,9 @@ const uInt8* CartridgeEFSC::getImage(int& size) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeEFSC::save(Serializer& out) const bool CartridgeEFSC::save(Serializer& out) const
{ {
const string& cart = name();
try try
{ {
out.putString(cart); out.putString(name());
out.putInt(myCurrentBank); out.putInt(myCurrentBank);
} }
catch(const char* msg) catch(const char* msg)
@ -225,11 +222,9 @@ bool CartridgeEFSC::save(Serializer& out) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeEFSC::load(Serializer& in) bool CartridgeEFSC::load(Serializer& in)
{ {
const string& cart = name();
try try
{ {
if(in.getString() != cart) if(in.getString() != name())
return false; return false;
myCurrentBank = (uInt16) in.getInt(); myCurrentBank = (uInt16) in.getInt();

View File

@ -161,12 +161,9 @@ const uInt8* CartridgeF0::getImage(int& size) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF0::save(Serializer& out) const bool CartridgeF0::save(Serializer& out) const
{ {
const string& cart = name();
try try
{ {
out.putString(cart); out.putString(name());
out.putInt(myCurrentBank); out.putInt(myCurrentBank);
} }
catch(const char* msg) catch(const char* msg)
@ -181,11 +178,9 @@ bool CartridgeF0::save(Serializer& out) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF0::load(Serializer& in) bool CartridgeF0::load(Serializer& in)
{ {
const string& cart = name();
try try
{ {
if(in.getString() != cart) if(in.getString() != name())
return false; return false;
myCurrentBank = (uInt16) in.getInt(); myCurrentBank = (uInt16) in.getInt();

View File

@ -154,11 +154,9 @@ const uInt8* CartridgeF4::getImage(int& size) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF4::save(Serializer& out) const bool CartridgeF4::save(Serializer& out) const
{ {
const string& cart = name();
try try
{ {
out.putString(cart); out.putString(name());
out.putInt(myCurrentBank); out.putInt(myCurrentBank);
} }
catch(const char* msg) catch(const char* msg)
@ -173,14 +171,10 @@ bool CartridgeF4::save(Serializer& out) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF4::load(Serializer& in) bool CartridgeF4::load(Serializer& in)
{ {
const string& cart = name();
try try
{ {
if(in.getString() != cart) if(in.getString() != name())
{
return false; return false;
}
myCurrentBank = (uInt16)in.getInt(); myCurrentBank = (uInt16)in.getInt();
} }

View File

@ -208,12 +208,9 @@ const uInt8* CartridgeF4SC::getImage(int& size) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF4SC::save(Serializer& out) const bool CartridgeF4SC::save(Serializer& out) const
{ {
const string& cart = name();
try try
{ {
out.putString(cart); out.putString(name());
out.putInt(myCurrentBank); out.putInt(myCurrentBank);
// The 128 bytes of RAM // The 128 bytes of RAM
@ -233,11 +230,9 @@ bool CartridgeF4SC::save(Serializer& out) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF4SC::load(Serializer& in) bool CartridgeF4SC::load(Serializer& in)
{ {
const string& cart = name();
try try
{ {
if(in.getString() != cart) if(in.getString() != name())
return false; return false;
myCurrentBank = (uInt16) in.getInt(); myCurrentBank = (uInt16) in.getInt();

View File

@ -194,12 +194,9 @@ const uInt8* CartridgeF6::getImage(int& size) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF6::save(Serializer& out) const bool CartridgeF6::save(Serializer& out) const
{ {
const string& cart = name();
try try
{ {
out.putString(cart); out.putString(name());
out.putInt(myCurrentBank); out.putInt(myCurrentBank);
} }
catch(const char* msg) catch(const char* msg)
@ -214,11 +211,9 @@ bool CartridgeF6::save(Serializer& out) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF6::load(Serializer& in) bool CartridgeF6::load(Serializer& in)
{ {
const string& cart = name();
try try
{ {
if(in.getString() != cart) if(in.getString() != name())
return false; return false;
myCurrentBank = (uInt16) in.getInt(); myCurrentBank = (uInt16) in.getInt();

View File

@ -251,12 +251,9 @@ const uInt8* CartridgeF6SC::getImage(int& size) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF6SC::save(Serializer& out) const bool CartridgeF6SC::save(Serializer& out) const
{ {
const string& cart = name();
try try
{ {
out.putString(cart); out.putString(name());
out.putInt(myCurrentBank); out.putInt(myCurrentBank);
// The 128 bytes of RAM // The 128 bytes of RAM
@ -277,11 +274,9 @@ bool CartridgeF6SC::save(Serializer& out) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF6SC::load(Serializer& in) bool CartridgeF6SC::load(Serializer& in)
{ {
const string& cart = name();
try try
{ {
if(in.getString() != cart) if(in.getString() != name())
return false; return false;
myCurrentBank = (uInt16) in.getInt(); myCurrentBank = (uInt16) in.getInt();

View File

@ -175,12 +175,9 @@ const uInt8* CartridgeF8::getImage(int& size) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF8::save(Serializer& out) const bool CartridgeF8::save(Serializer& out) const
{ {
const string& cart = name();
try try
{ {
out.putString(cart); out.putString(name());
out.putInt(myCurrentBank); out.putInt(myCurrentBank);
} }
catch(const char* msg) catch(const char* msg)
@ -195,11 +192,9 @@ bool CartridgeF8::save(Serializer& out) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF8::load(Serializer& in) bool CartridgeF8::load(Serializer& in)
{ {
const string& cart = name();
try try
{ {
if(in.getString() != cart) if(in.getString() != name())
return false; return false;
myCurrentBank = (uInt16) in.getInt(); myCurrentBank = (uInt16) in.getInt();

View File

@ -231,12 +231,9 @@ const uInt8* CartridgeF8SC::getImage(int& size) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF8SC::save(Serializer& out) const bool CartridgeF8SC::save(Serializer& out) const
{ {
const string& cart = name();
try try
{ {
out.putString(cart); out.putString(name());
out.putInt(myCurrentBank); out.putInt(myCurrentBank);
// The 128 bytes of RAM // The 128 bytes of RAM
@ -256,11 +253,9 @@ bool CartridgeF8SC::save(Serializer& out) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF8SC::load(Serializer& in) bool CartridgeF8SC::load(Serializer& in)
{ {
const string& cart = name();
try try
{ {
if(in.getString() != cart) if(in.getString() != name())
return false; return false;
myCurrentBank = (uInt16) in.getInt(); myCurrentBank = (uInt16) in.getInt();

View File

@ -241,12 +241,9 @@ const uInt8* CartridgeFA::getImage(int& size) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeFA::save(Serializer& out) const bool CartridgeFA::save(Serializer& out) const
{ {
const string& cart = name();
try try
{ {
out.putString(cart); out.putString(name());
out.putInt(myCurrentBank); out.putInt(myCurrentBank);
// The 256 bytes of RAM // The 256 bytes of RAM
@ -266,11 +263,9 @@ bool CartridgeFA::save(Serializer& out) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeFA::load(Serializer& in) bool CartridgeFA::load(Serializer& in)
{ {
const string& cart = name();
try try
{ {
if(in.getString() != cart) if(in.getString() != name())
return false; return false;
myCurrentBank = (uInt16) in.getInt(); myCurrentBank = (uInt16) in.getInt();

View File

@ -139,11 +139,9 @@ const uInt8* CartridgeFE::getImage(int& size) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeFE::save(Serializer& out) const bool CartridgeFE::save(Serializer& out) const
{ {
const string& cart = name();
try try
{ {
out.putString(cart); out.putString(name());
out.putInt(myLastAddress1); out.putInt(myLastAddress1);
out.putInt(myLastAddress2); out.putInt(myLastAddress2);
} }
@ -159,11 +157,9 @@ bool CartridgeFE::save(Serializer& out) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeFE::load(Serializer& in) bool CartridgeFE::load(Serializer& in)
{ {
const string& cart = name();
try try
{ {
if(in.getString() != cart) if(in.getString() != name())
return false; return false;
myLastAddress1 = (uInt16)in.getInt(); myLastAddress1 = (uInt16)in.getInt();

View File

@ -246,12 +246,10 @@ const uInt8* CartridgeMC::getImage(int& size) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeMC::save(Serializer& out) const bool CartridgeMC::save(Serializer& out) const
{ {
uInt32 i;
const string& cart = name();
try try
{ {
out.putString(cart); uInt32 i;
out.putString(name());
// The currentBlock array // The currentBlock array
out.putInt(4); out.putInt(4);
@ -275,14 +273,11 @@ bool CartridgeMC::save(Serializer& out) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeMC::load(Serializer& in) bool CartridgeMC::load(Serializer& in)
{ {
uInt32 i;
const string& cart = name();
try try
{ {
uInt32 limit; uInt32 i, limit;
if(in.getString() != cart) if(in.getString() != name())
return false; return false;
// The currentBlock array // The currentBlock array

View File

@ -178,11 +178,9 @@ const uInt8* CartridgeSB::getImage(int& size) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeSB::save(Serializer& out) const bool CartridgeSB::save(Serializer& out) const
{ {
const string& cart = name();
try try
{ {
out.putString(cart); out.putString(name());
out.putInt(myCurrentBank); out.putInt(myCurrentBank);
} }
catch(const char* msg) catch(const char* msg)
@ -197,11 +195,9 @@ bool CartridgeSB::save(Serializer& out) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeSB::load(Serializer& in) bool CartridgeSB::load(Serializer& in)
{ {
const string& cart = name();
try try
{ {
if(in.getString() != cart) if(in.getString() != name())
return false; return false;
myCurrentBank = (uInt16)in.getInt(); myCurrentBank = (uInt16)in.getInt();

View File

@ -187,12 +187,9 @@ const uInt8* CartridgeUA::getImage(int& size) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeUA::save(Serializer& out) const bool CartridgeUA::save(Serializer& out) const
{ {
const string& cart = name();
try try
{ {
out.putString(cart); out.putString(name());
out.putInt(myCurrentBank); out.putInt(myCurrentBank);
} }
catch(const char* msg) catch(const char* msg)
@ -207,11 +204,9 @@ bool CartridgeUA::save(Serializer& out) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeUA::load(Serializer& in) bool CartridgeUA::load(Serializer& in)
{ {
const string& cart = name();
try try
{ {
if(in.getString() != cart) if(in.getString() != name())
return false; return false;
myCurrentBank = (uInt16)in.getInt(); myCurrentBank = (uInt16)in.getInt();

View File

@ -171,11 +171,9 @@ const uInt8* CartridgeX07::getImage(int& size) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeX07::save(Serializer& out) const bool CartridgeX07::save(Serializer& out) const
{ {
const string& cart = name();
try try
{ {
out.putString(cart); out.putString(name());
out.putInt(myCurrentBank); out.putInt(myCurrentBank);
} }
catch(const char* msg) catch(const char* msg)
@ -190,11 +188,9 @@ bool CartridgeX07::save(Serializer& out) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeX07::load(Serializer& in) bool CartridgeX07::load(Serializer& in)
{ {
const string& cart = name();
try try
{ {
if(in.getString() != cart) if(in.getString() != name())
return false; return false;
myCurrentBank = (uInt16)in.getInt(); myCurrentBank = (uInt16)in.getInt();