diff --git a/Changes.txt b/Changes.txt index 31e2254ef..b3929fb3c 100644 --- a/Changes.txt +++ b/Changes.txt @@ -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. diff --git a/src/debugger/gui/CartUAWidget.cxx b/src/debugger/gui/CartUAWidget.cxx index f6ae16bc7..02728b52d 100644 --- a/src/debugger/gui/CartUAWidget.cxx +++ b/src/debugger/gui/CartUAWidget.cxx @@ -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(); diff --git a/src/emucore/CartDetector.cxx b/src/emucore/CartDetector.cxx index 0ecc6e82e..dba8bb3e4 100644 --- a/src/emucore/CartDetector.cxx +++ b/src/emucore/CartDetector.cxx @@ -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; diff --git a/src/emucore/CartUA.cxx b/src/emucore/CartUA.cxx index e73f166db..83afca20e 100644 --- a/src/emucore/CartUA.cxx +++ b/src/emucore/CartUA.cxx @@ -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()); } diff --git a/src/emucore/CartUA.hxx b/src/emucore/CartUA.hxx index 95d4d022d..f5b25803f 100644 --- a/src/emucore/CartUA.hxx +++ b/src/emucore/CartUA.hxx @@ -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 */