Further improvements to '3E' bankswitch autodetection. We're now down

to requiring only 4 entries out of 2722 ROMs where auto-detection fails.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1321 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2007-06-09 23:20:19 +00:00
parent 03c533e0b9
commit c4fa58b38f
3 changed files with 25 additions and 11 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: Cart.cxx,v 1.32 2007-06-08 12:36:51 stephena Exp $ // $Id: Cart.cxx,v 1.33 2007-06-09 23:20:16 stephena Exp $
//============================================================================ //============================================================================
#include <cassert> #include <cassert>
@ -203,6 +203,8 @@ string Cartridge::autodetectType(const uInt8* image, uInt32 size)
type = "E0"; type = "E0";
else if(isProbably3F(image, size)) else if(isProbably3F(image, size))
type = isProbably3E(image, size) ? "3E" : "3F"; type = isProbably3E(image, size) ? "3E" : "3F";
else if(isProbably3E(image, size))
type = "3E";
else if(isProbablyUA(image, size)) else if(isProbablyUA(image, size))
type = "UA"; type = "UA";
else if(isProbablyFE(image, size)) else if(isProbablyFE(image, size))
@ -230,6 +232,8 @@ string Cartridge::autodetectType(const uInt8* image, uInt32 size)
type = "E7"; type = "E7";
else if(isProbably3F(image, size)) else if(isProbably3F(image, size))
type = isProbably3E(image, size) ? "3E" : "3F"; type = isProbably3E(image, size) ? "3E" : "3F";
else if(isProbably3E(image, size))
type = "3E";
else else
type = "F6"; type = "F6";
} }
@ -239,6 +243,8 @@ string Cartridge::autodetectType(const uInt8* image, uInt32 size)
type = "F4SC"; type = "F4SC";
else if(isProbably3F(image, size)) else if(isProbably3F(image, size))
type = isProbably3E(image, size) ? "3E" : "3F"; type = isProbably3E(image, size) ? "3E" : "3F";
else if(isProbably3E(image, size))
type = "3E";
else else
type = "F4"; type = "F4";
} }
@ -247,6 +253,8 @@ string Cartridge::autodetectType(const uInt8* image, uInt32 size)
// TODO - autodetect 4A50 // TODO - autodetect 4A50
if(isProbably3F(image, size)) if(isProbably3F(image, size))
type = isProbably3E(image, size) ? "3E" : "3F"; type = isProbably3E(image, size) ? "3E" : "3F";
else if(isProbably3E(image, size))
type = "3E";
else else
type = "MB"; type = "MB";
} }
@ -255,6 +263,8 @@ string Cartridge::autodetectType(const uInt8* image, uInt32 size)
// TODO - autodetect 4A50 // TODO - autodetect 4A50
if(isProbably3F(image, size)) if(isProbably3F(image, size))
type = isProbably3E(image, size) ? "3E" : "3F"; type = isProbably3E(image, size) ? "3E" : "3F";
else if(isProbably3E(image, size))
type = "3E";
else else
type = "MC"; type = "MC";
} }
@ -262,6 +272,8 @@ string Cartridge::autodetectType(const uInt8* image, uInt32 size)
{ {
if(isProbably3F(image, size)) if(isProbably3F(image, size))
type = isProbably3E(image, size) ? "3E" : "3F"; type = isProbably3E(image, size) ? "3E" : "3F";
else if(isProbably3E(image, size))
type = "3E";
else else
type = "4K"; // Most common bankswitching type type = "4K"; // Most common bankswitching type
} }
@ -318,15 +330,17 @@ bool Cartridge::isProbably3F(const uInt8* image, uInt32 size)
// We expect it will be present at least 2 times, since there are // We expect it will be present at least 2 times, since there are
// at least two banks // at least two banks
uInt8 signature[] = { 0x85, 0x3F }; // STA $3F uInt8 signature[] = { 0x85, 0x3F }; // STA $3F
return searchForBytes(image, size, signature, 2) > 2; return searchForBytes(image, size, signature, 2) > 1;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge::isProbably3E(const uInt8* image, uInt32 size) bool Cartridge::isProbably3E(const uInt8* image, uInt32 size)
{ {
// TODO - fix this one, once I find a test ROM // 3E cart bankswitching is triggered by storing the bank number
uInt8 signature[] = { 0x85, 0x3E }; // in address 3E using 'STA $3E', commonly followed by an
return searchForBytes(image, size, signature, 2) > 2; // immediate mode LDA
uInt8 signature[] = { 0x85, 0x3E, 0xA9, 0x00 }; // STA $3E; LDA #$00
return searchForBytes(image, size, signature, 4) > 0;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -1302,7 +1302,7 @@ static const char* DefProps[2722][21] = {
{ "79004f84bdeee78d142e445057883169", "CCE", "", "Planet Patrol (CCE) [!]", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "79004f84bdeee78d142e445057883169", "CCE", "", "Planet Patrol (CCE) [!]", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "791bc8aceb6b0f4d9990d6062b30adfa", "Activision", "AB-035-04", "Pitfall! (1982) (Activision) (PAL) [!]", "", "Rare", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "791bc8aceb6b0f4d9990d6062b30adfa", "Activision", "AB-035-04", "Pitfall! (1982) (Activision) (PAL) [!]", "", "Rare", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "7926083ad423ed685de3b3a04a914315", "Barry Laws Jr.", "", "Face Invaders 2 by Barry Laws Jr. (Space Invaders Hack)", "Hack of Astroblast (Mattel)", "New Release (Hack)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "7926083ad423ed685de3b3a04a914315", "Barry Laws Jr.", "", "Face Invaders 2 by Barry Laws Jr. (Space Invaders Hack)", "Hack of Astroblast (Mattel)", "New Release (Hack)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "792b1d93eb1d8045260c840b0688ec8f", "Kroko", "", "3E Bankswitch Test (TIA @ $00)", "", "", "", "3E", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "792b1d93eb1d8045260c840b0688ec8f", "Kroko", "", "3E Bankswitch Test (TIA @ $00)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "7972e5101fa548b952d852db24ad6060", "Atari", "CX2627 / 6699841", "Human Cannonball (AKA Cannon Man) (1978) (Atari)", "", "Uncommon", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "7972e5101fa548b952d852db24ad6060", "Atari", "CX2627 / 6699841", "Human Cannonball (AKA Cannon Man) (1978) (Atari)", "", "Uncommon", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "798b8921276eec9e332dfcb47a2dbb17", "", "", "Cookie Monster Munch (1983) (Atari) (PAL) [a1][!]", "Uses Kids/Keypad Controllers", "", "", "", "", "", "", "", "KEYBOARD", "KEYBOARD", "", "", "", "", "", "", "" }, { "798b8921276eec9e332dfcb47a2dbb17", "", "", "Cookie Monster Munch (1983) (Atari) (PAL) [a1][!]", "Uses Kids/Keypad Controllers", "", "", "", "", "", "", "", "KEYBOARD", "KEYBOARD", "", "", "", "", "", "", "" },
{ "798cc114f1623c14085868cd3494fe8e", "", "", "Pins Revenge (Atari Freak 1)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "798cc114f1623c14085868cd3494fe8e", "", "", "Pins Revenge (Atari Freak 1)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
@ -1499,7 +1499,7 @@ static const char* DefProps[2722][21] = {
{ "8b5b1e3a434ebbdc2c2a49dc68f46360", "", "2451", "Donkey Kong (1983) (CBS Electronics) (PAL) [a1][!]", "", "Common", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "8b5b1e3a434ebbdc2c2a49dc68f46360", "", "2451", "Donkey Kong (1983) (CBS Electronics) (PAL) [a1][!]", "", "Common", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "8b7ca29a55432f886cee3d452fb00481", "Starpath", "AR-4201", "Sword of Saros (1983) (Starpath) (PAL)", "", "Extremely Rare", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "8b7ca29a55432f886cee3d452fb00481", "Starpath", "AR-4201", "Sword of Saros (1983) (Starpath) (PAL)", "", "Extremely Rare", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "8b81af55cd2ef3c7444d6aec4e3a1c09", "", "", "Dark Mage [b1]", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "", "" }, { "8b81af55cd2ef3c7444d6aec4e3a1c09", "", "", "Dark Mage [b1]", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "", "" },
{ "8bbfd951c89cc09c148bfabdefa08bec", "UA Limited", "", "Pleiades (UA Limited)", "", "Prototype", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "", "" }, { "8bbfd951c89cc09c148bfabdefa08bec", "UA Limited", "", "Pleiades (UA Limited)", "", "Prototype", "", "", "", "", "", "", "", "", "", "", "32", "", "YES", "", "" },
{ "8bc0d2052b4f259e7a50a7c771b45241", "Xonox", "", "Tomarc the Barbarian (1983) (Xonox)", "", "Rare", "", "", "", "", "", "", "", "", "", "", "24", "", "", "", "" }, { "8bc0d2052b4f259e7a50a7c771b45241", "Xonox", "", "Tomarc the Barbarian (1983) (Xonox)", "", "Rare", "", "", "", "", "", "", "", "", "", "", "24", "", "", "", "" },
{ "8bd8f65377023bdb7c5fcf46ddda5d31", "Activision", "AG-019", "Sky Jinks (1982) (Activision) [o1]", "", "Rare", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "8bd8f65377023bdb7c5fcf46ddda5d31", "Activision", "AG-019", "Sky Jinks (1982) (Activision) [o1]", "", "Rare", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "8bebac614571135933116045204f0f00", "", "", "Missile Command (CX-22 Trackball) (PAL) (2002) (TJ)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "", "" }, { "8bebac614571135933116045204f0f00", "", "", "Missile Command (CX-22 Trackball) (PAL) (2002) (TJ)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "", "" },
@ -1645,7 +1645,7 @@ static const char* DefProps[2722][21] = {
{ "9ab72d3fd2cc1a0c9adb504502579037", "Epyx", "8056100286", "California Games (1988) (Epyx) [!]", "", "Rare", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "9ab72d3fd2cc1a0c9adb504502579037", "Epyx", "8056100286", "California Games (1988) (Epyx) [!]", "", "Rare", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "9ad362179c2eea4ea115c7640b4b003e", "Activision", "AX-013", "Barnstorming (1982) (Activision) [p1][!]", "", "Uncommon", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "9ad362179c2eea4ea115c7640b4b003e", "Activision", "AX-013", "Barnstorming (1982) (Activision) [p1][!]", "", "Uncommon", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "9ad36e699ef6f45d9eb6c4cf90475c9f", "Imagic", "IA3203", "Atlantis (1982) (Imagic) [!]", "", "Uncommon", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "9ad36e699ef6f45d9eb6c4cf90475c9f", "Imagic", "IA3203", "Atlantis (1982) (Imagic) [!]", "", "Uncommon", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "9b150a42fc788960fbb4cbe250259ee2", "Kroko", "", "3E Bankswitch Test (TIA @ $40)", "", "", "", "3E", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "9b150a42fc788960fbb4cbe250259ee2", "Kroko", "", "3E Bankswitch Test (TIA @ $40)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "9b21d8fc78cc4308990d99a4d906ec52", "", "C-838", "Immies & Aggies (CCE)", "", "Extremely Rare", "", "", "", "", "", "", "", "", "", "", "18", "223", "", "", "" }, { "9b21d8fc78cc4308990d99a4d906ec52", "", "C-838", "Immies & Aggies (CCE)", "", "Extremely Rare", "", "", "", "", "", "", "", "", "", "", "18", "223", "", "", "" },
{ "9b246683f44c963a50e41d6b485bee77", "", "", "Boring (PAL) (AD)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "9b246683f44c963a50e41d6b485bee77", "", "", "Boring (PAL) (AD)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "9bb136b62521c67ac893213e01dd338f", "", "", "Spike's Peak (1983) (Xonox) (PAL) [a1][!]", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "9bb136b62521c67ac893213e01dd338f", "", "", "Spike's Peak (1983) (Xonox) (PAL) [a1][!]", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
@ -1911,7 +1911,7 @@ static const char* DefProps[2722][21] = {
{ "b5a1a189601a785bdb2f02a424080412", "Imagic", "IA3410", "Shootin' Gallery (1982) (Imagic)", "", "Extremely Rare", "", "", "", "", "", "", "", "", "", "", "29", "", "", "", "" }, { "b5a1a189601a785bdb2f02a424080412", "Imagic", "IA3410", "Shootin' Gallery (1982) (Imagic)", "", "Extremely Rare", "", "", "", "", "", "", "", "", "", "", "29", "", "", "", "" },
{ "b5cb9cf6e668ea3f4cc2be00ea70ec3c", "CommaVid", "CM-005", "Mines of Minos (1982) (CommaVid) (PAL) [!]", "", "Extremely Rare", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "", "" }, { "b5cb9cf6e668ea3f4cc2be00ea70ec3c", "CommaVid", "CM-005", "Mines of Minos (1982) (CommaVid) (PAL) [!]", "", "Extremely Rare", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "", "" },
{ "b6166f15720fdf192932f1f76df5b65d", "Amiga", "3130", "Off Your Rocker (1983) (Amiga)", "", "Extremely Rare", "", "", "", "", "", "", "", "", "", "", "27", "", "", "", "" }, { "b6166f15720fdf192932f1f76df5b65d", "Amiga", "3130", "Off Your Rocker (1983) (Amiga)", "", "Extremely Rare", "", "", "", "", "", "", "", "", "", "", "27", "", "", "", "" },
{ "b65d4a38d6047735824ee99684f3515e", "", "", "Megaboy (Brazil) (PAL) [!]", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "b65d4a38d6047735824ee99684f3515e", "", "", "Megaboy (Brazil) (PAL) [!]", "", "", "", "", "", "", "", "", "", "", "", "", "30", "", "", "", "" },
{ "b676a9b7094e0345a76ef027091d916b", "Video Gems / Thomas Jentzsch", "", "Mission Survive (1983) (NTSC by Thomas Jentzsch)", "", "New Release (Video Format Conversion)", "", "", "", "A", "", "", "", "", "", "", "", "", "YES", "", "" }, { "b676a9b7094e0345a76ef027091d916b", "Video Gems / Thomas Jentzsch", "", "Mission Survive (1983) (NTSC by Thomas Jentzsch)", "", "New Release (Video Format Conversion)", "", "", "", "A", "", "", "", "", "", "", "", "", "YES", "", "" },
{ "b6812eaf87127f043e78f91f2028f9f4", "Simage", "", "Eli's Ladder (Simage)", "", "Unbelievably Rare", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "b6812eaf87127f043e78f91f2028f9f4", "Simage", "", "Eli's Ladder (Simage)", "", "Unbelievably Rare", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "b6821ac51c4c1dcb283f01be2f047dc1", "", "", "Rubik's Cube 3D Demo (25-11-2002) (TJ)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "b6821ac51c4c1dcb283f01be2f047dc1", "", "", "Rubik's Cube 3D Demo (25-11-2002) (TJ)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },

View File

@ -68,13 +68,11 @@
"Cartridge.MD5" "9b150a42fc788960fbb4cbe250259ee2" "Cartridge.MD5" "9b150a42fc788960fbb4cbe250259ee2"
"Cartridge.Manufacturer" "Kroko" "Cartridge.Manufacturer" "Kroko"
"Cartridge.Name" "3E Bankswitch Test (TIA @ $40)" "Cartridge.Name" "3E Bankswitch Test (TIA @ $40)"
"Cartridge.Type" "3E"
"" ""
"Cartridge.MD5" "792b1d93eb1d8045260c840b0688ec8f" "Cartridge.MD5" "792b1d93eb1d8045260c840b0688ec8f"
"Cartridge.Manufacturer" "Kroko" "Cartridge.Manufacturer" "Kroko"
"Cartridge.Name" "3E Bankswitch Test (TIA @ $00)" "Cartridge.Name" "3E Bankswitch Test (TIA @ $00)"
"Cartridge.Type" "3E"
"" ""
"Cartridge.MD5" "0685bd0bcb975ceef7041749a5454a48" "Cartridge.MD5" "0685bd0bcb975ceef7041749a5454a48"
@ -8775,6 +8773,7 @@
"Cartridge.Manufacturer" "UA Limited" "Cartridge.Manufacturer" "UA Limited"
"Cartridge.Name" "Pleiades (UA Limited)" "Cartridge.Name" "Pleiades (UA Limited)"
"Cartridge.Rarity" "Prototype" "Cartridge.Rarity" "Prototype"
"Display.YStart" "32"
"Display.Phosphor" "YES" "Display.Phosphor" "YES"
"" ""
@ -11144,6 +11143,7 @@
"Cartridge.MD5" "b65d4a38d6047735824ee99684f3515e" "Cartridge.MD5" "b65d4a38d6047735824ee99684f3515e"
"Cartridge.Name" "Megaboy (Brazil) (PAL) [!]" "Cartridge.Name" "Megaboy (Brazil) (PAL) [!]"
"Display.YStart" "30"
"" ""
"Cartridge.MD5" "b5cb9cf6e668ea3f4cc2be00ea70ec3c" "Cartridge.MD5" "b5cb9cf6e668ea3f4cc2be00ea70ec3c"