enhanced UA bank switching to support more Brazilian carts (fixes #698)

This commit is contained in:
Thomas Jentzsch 2020-09-06 19:10:08 +02:00
parent 283d9b14e3
commit 66b3245c5a
5 changed files with 26 additions and 9 deletions

View File

@ -39,6 +39,8 @@
* Added option to select the audio device.
* Further enhanced UA bankswitching to support more Brazilian carts.
* Added option to display detected settings info when a ROM is loaded.
* Added another oddball TIA glitch option for delayed background color.

View File

@ -47,7 +47,7 @@ string CartridgeUAWidget::hotspotStr(int bank, int, bool prefix)
uInt16 hotspot = myCart.hotspot() + (bank ^ (mySwappedHotspots ? 1 : 0)) * myHotspotDelta;
info << "(" << (prefix ? "hotspot " : "");
info << "$" << Common::Base::HEX1 << hotspot << ", $" << (hotspot | 0x80);
info << "$" << Common::Base::HEX1 << hotspot << ", $" << (hotspot | 0x80) << ", $" << (hotspot | 0xf80);
info << ")";
return info.str();

View File

@ -708,15 +708,18 @@ bool CartDetector::isProbablyUA(const ByteBuffer& image, size_t size)
// using 'STA $240' or 'LDA $240'
// Similar Brazilian (Digivison) cart bankswitching switches to bank 1 by accessing address 0x2C0
// using 'BIT $2C0', 'STA $2C0' or 'LDA $2C0'
uInt8 signature[6][3] = {
// Other Brazilian (Atari Mania) ROM's bankswitching switches to bank 1 by accessing address 0xFC0
// using 'BIT $FA0', 'BIT $FC0' or 'STA $FA0'
uInt8 signature[7][3] = {
{ 0x8D, 0x40, 0x02 }, // STA $240 (Funky Fish, Pleiades)
{ 0xAD, 0x40, 0x02 }, // LDA $240 (???)
{ 0xBD, 0x1F, 0x02 }, // LDA $21F,X (Gingerbread Man)
{ 0x2C, 0xC0, 0x02 }, // BIT $2C0 (Time Pilot)
{ 0x8D, 0xC0, 0x02 }, // STA $2C0 (Fathom, Vanguard)
{ 0xAD, 0xC0, 0x02 } // LDA $2C0 (Mickey)
{ 0xAD, 0xC0, 0x02 }, // LDA $2C0 (Mickey)
{ 0x2C, 0xC0, 0x0F } // BIT $FC0 (H.E.R.O., Kung-Fu Master)
};
for(uInt32 i = 0; i < 6; ++i)
for(uInt32 i = 0; i < 7; ++i)
if(searchForBytes(image, size, signature[i], 3))
return true;

View File

@ -39,11 +39,21 @@ void CartridgeUA::install(System& system)
// Set the page accessing methods for the hot spots
System::PageAccess access(this, System::PageAccessType::READ);
mySystem->setPageAccess(0x0220, access);
mySystem->setPageAccess(0x0240, access);
mySystem->setPageAccess(0x0220 | 0x80, access);
mySystem->setPageAccess(0x0240 | 0x80, access);
// Map all potential addresses
// - A11, A10 and A8 are not connected to RIOT
// - A9 is the fixed part of the hotspot address
// - A7 is used by Brazilian carts
// - A5 and A4 determine bank
for(uInt16 a11 = 0; a11 <= 1; ++a11)
for(uInt16 a10 = 0; a10 <= 1; ++a10)
for(uInt16 a8 = 0; a8 <= 1; ++a8)
for(uInt16 a7 = 0; a7 <= 1; ++a7)
{
uInt16 addr = (a11 << 11) + (a10 << 10) + (a8 << 8) + (a7 << 7);
mySystem->setPageAccess(0x0220 | addr, access);
mySystem->setPageAccess(0x0240 | addr, access);
}
// Install pages for the startup bank
bank(startBank());
}

View File

@ -28,7 +28,9 @@
/**
Cartridge class used for UA Limited's 8K bankswitched games. There
are two 4K banks, which are switched by accessing $0220 (bank 0) and
$0240 (bank 1).
$0240 (bank 1). Similar addresses are used by Brazilian carts, e.g.
$02A0, $02C0 and $0FA0, $0FC0. The code accepts further potential
hotspot addresses.
@author Bradford W. Mott, Thomas Jentzsch
*/