mirror of https://github.com/stella-emu/stella.git
added 03E0 bankswitching for Brazilian Parker Bros ROMs (resolves #887)
This commit is contained in:
parent
8d6862062b
commit
cbe0ba8eee
|
@ -38,6 +38,8 @@
|
||||||
|
|
||||||
* Added limited GameLine Master Module bankswitching support.
|
* Added limited GameLine Master Module bankswitching support.
|
||||||
|
|
||||||
|
* Added 03E0 bankswitching for Brazilian Parker Bros ROMs.
|
||||||
|
|
||||||
* Added BUS bankswitching support for some older demos.
|
* Added BUS bankswitching support for some older demos.
|
||||||
|
|
||||||
* Fixed broken 7800 pause key support.
|
* Fixed broken 7800 pause key support.
|
||||||
|
|
|
@ -4888,6 +4888,7 @@ Ms Pac-Man (Stella extended codes):
|
||||||
Note: If 'Filter' is checked, only the bankswitching types matching the ROM size are listed.
|
Note: If 'Filter' is checked, only the bankswitching types matching the ROM size are listed.
|
||||||
<table cellpadding="2" border="1">
|
<table cellpadding="2" border="1">
|
||||||
<tr><th> Type </th><th>Description</th><th>File Extension<br>(to force type)</th></tr>
|
<tr><th> Type </th><th>Description</th><th>File Extension<br>(to force type)</th></tr>
|
||||||
|
<tr><td>03e0 </td><td>8K Brazilian Parker Bros</td><td>.03e, .03e0</td></tr>
|
||||||
<tr><td>0840 </td><td>8K EconoBanking</td><td>.084, .0840</td></tr>
|
<tr><td>0840 </td><td>8K EconoBanking</td><td>.084, .0840</td></tr>
|
||||||
<tr><td>0FA0 </td><td>8K Fotomania</td><td>.0FA, .0FA0</td></tr>
|
<tr><td>0FA0 </td><td>8K Fotomania</td><td>.0FA, .0FA0</td></tr>
|
||||||
<tr><td>2IN1 ¹</td><td>4-64K Multicart (2 games)</td><td>.2N1 </td></tr>
|
<tr><td>2IN1 ¹</td><td>4-64K Multicart (2 games)</td><td>.2N1 </td></tr>
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
//============================================================================
|
||||||
|
//
|
||||||
|
// SSSS tt lll lll
|
||||||
|
// SS SS tt ll ll
|
||||||
|
// SS tttttt eeee ll ll aaaa
|
||||||
|
// SSSS tt ee ee ll ll aa
|
||||||
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||||
|
// SS SS tt ee ll ll aa aa
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa
|
||||||
|
//
|
||||||
|
// Copyright (c) 1995-2023 by Bradford W. Mott, Stephen Anthony
|
||||||
|
// and the Stella Team
|
||||||
|
//
|
||||||
|
// See the file "License.txt" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
|
#include "Cart03E0.hxx"
|
||||||
|
#include "Cart03E0Widget.hxx"
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
Cartridge03E0Widget::Cartridge03E0Widget(
|
||||||
|
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
|
||||||
|
int x, int y, int w, int h, Cartridge03E0& cart)
|
||||||
|
: CartridgeEnhancedWidget(boss, lfont, nfont, x, y, w, h, cart)
|
||||||
|
{
|
||||||
|
initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
string Cartridge03E0Widget::description()
|
||||||
|
{
|
||||||
|
ostringstream info;
|
||||||
|
|
||||||
|
info << "03E0 cartridge,\n eight 1K banks mapped into four segments\n"
|
||||||
|
<< CartridgeEnhancedWidget::description();
|
||||||
|
|
||||||
|
return info.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
string Cartridge03E0Widget::romDescription()
|
||||||
|
{
|
||||||
|
ostringstream info;
|
||||||
|
|
||||||
|
for(int seg = 0; seg < 4; ++seg)
|
||||||
|
{
|
||||||
|
const uInt16 segmentOffset = seg << 10; // myCart.myBankShift;
|
||||||
|
|
||||||
|
info << "Segment #" << seg << " accessible @ $"
|
||||||
|
<< Common::Base::HEX4 << (ADDR_BASE | segmentOffset)
|
||||||
|
<< " - $" << (ADDR_BASE | (segmentOffset + /*myCart.myBankSize - 1*/ 0x3FF)) << ",\n";
|
||||||
|
if (seg < 3)
|
||||||
|
info << " Hotspots " << hotspotStr(0, seg, true) << " - " << hotspotStr(7, seg, true) << "\n";
|
||||||
|
else
|
||||||
|
info << " Always points to last 1K bank of ROM\n";
|
||||||
|
}
|
||||||
|
info << "Startup banks = 4 / 5 / 6 or undetermined";
|
||||||
|
|
||||||
|
return info.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
string Cartridge03E0Widget::hotspotStr(int bank, int segment, bool noBrackets)
|
||||||
|
{
|
||||||
|
static constexpr uInt16 hotspots[3] = {0x03E0, 0x03D0, 0x03B0};
|
||||||
|
ostringstream info;
|
||||||
|
|
||||||
|
info << (noBrackets ? "" : "(")
|
||||||
|
<< "$" << Common::Base::HEX1 << ( hotspots[segment] + bank)
|
||||||
|
<< (noBrackets ? "" : ")");
|
||||||
|
|
||||||
|
return info.str();
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
//============================================================================
|
||||||
|
//
|
||||||
|
// SSSS tt lll lll
|
||||||
|
// SS SS tt ll ll
|
||||||
|
// SS tttttt eeee ll ll aaaa
|
||||||
|
// SSSS tt ee ee ll ll aa
|
||||||
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||||
|
// SS SS tt ee ll ll aa aa
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa
|
||||||
|
//
|
||||||
|
// Copyright (c) 1995-2023 by Bradford W. Mott, Stephen Anthony
|
||||||
|
// and the Stella Team
|
||||||
|
//
|
||||||
|
// See the file "License.txt" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
|
#ifndef CARTRIDGE03E0_WIDGET_HXX
|
||||||
|
#define CARTRIDGE03E0_WIDGET_HXX
|
||||||
|
|
||||||
|
class Cartridge03E0;
|
||||||
|
|
||||||
|
#include "CartEnhancedWidget.hxx"
|
||||||
|
|
||||||
|
class Cartridge03E0Widget : public CartridgeEnhancedWidget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Cartridge03E0Widget(GuiObject* boss, const GUI::Font& lfont,
|
||||||
|
const GUI::Font& nfont,
|
||||||
|
int x, int y, int w, int h,
|
||||||
|
Cartridge03E0& cart);
|
||||||
|
~Cartridge03E0Widget() override = default;
|
||||||
|
|
||||||
|
private:
|
||||||
|
string manufacturer() override { return "Parker Brothers (Brazil Pirate)"; }
|
||||||
|
|
||||||
|
string description() override;
|
||||||
|
|
||||||
|
string romDescription() override;
|
||||||
|
|
||||||
|
string hotspotStr(int bank, int segment, bool noBrackets = false) override;
|
||||||
|
|
||||||
|
uInt16 bankSegs() override { return 3; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Following constructors and assignment operators not supported
|
||||||
|
Cartridge03E0Widget() = delete;
|
||||||
|
Cartridge03E0Widget(const Cartridge03E0Widget&) = delete;
|
||||||
|
Cartridge03E0Widget(Cartridge03E0Widget&&) = delete;
|
||||||
|
Cartridge03E0Widget& operator=(const Cartridge03E0Widget&) = delete;
|
||||||
|
Cartridge03E0Widget& operator=(Cartridge03E0Widget&&) = delete;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -270,7 +270,7 @@ string CartridgeEnhancedWidget::bankState()
|
||||||
|
|
||||||
//if(hotspot >= 0x100)
|
//if(hotspot >= 0x100)
|
||||||
if(hotspot != 0 && myHotspotDelta > 0)
|
if(hotspot != 0 && myHotspotDelta > 0)
|
||||||
buf << " " << hotspotStr(bank, 0, bankSegs() < 3);
|
buf << " " << hotspotStr(bank, seg, bankSegs() < 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -6,6 +6,7 @@ MODULE_OBJS := \
|
||||||
src/debugger/gui/AtariVoxWidget.o \
|
src/debugger/gui/AtariVoxWidget.o \
|
||||||
src/debugger/gui/AudioWidget.o \
|
src/debugger/gui/AudioWidget.o \
|
||||||
src/debugger/gui/BoosterWidget.o \
|
src/debugger/gui/BoosterWidget.o \
|
||||||
|
src/debugger/gui/Cart03E0Widget.o \
|
||||||
src/debugger/gui/Cart0840Widget.o \
|
src/debugger/gui/Cart0840Widget.o \
|
||||||
src/debugger/gui/Cart0FA0Widget.o \
|
src/debugger/gui/Cart0FA0Widget.o \
|
||||||
src/debugger/gui/Cart2KWidget.o \
|
src/debugger/gui/Cart2KWidget.o \
|
||||||
|
|
|
@ -75,6 +75,7 @@ bool Bankswitch::isValidRomName(string_view name, string& ext)
|
||||||
constexpr std::array<Bankswitch::Description, static_cast<uInt32>(Bankswitch::Type::NumSchemes)>
|
constexpr std::array<Bankswitch::Description, static_cast<uInt32>(Bankswitch::Type::NumSchemes)>
|
||||||
Bankswitch::BSList = {{
|
Bankswitch::BSList = {{
|
||||||
{ "AUTO" , "Auto-detect" },
|
{ "AUTO" , "Auto-detect" },
|
||||||
|
{ "03E0" , "03E0 (8K Braz. Parker Bros)" },
|
||||||
{ "0840" , "0840 (8K EconoBanking)" },
|
{ "0840" , "0840 (8K EconoBanking)" },
|
||||||
{ "0FA0" , "0FA0 (8K Fotomania)" },
|
{ "0FA0" , "0FA0 (8K Fotomania)" },
|
||||||
{ "2IN1" , "2in1 Multicart (4-64K)" },
|
{ "2IN1" , "2in1 Multicart (4-64K)" },
|
||||||
|
@ -138,6 +139,7 @@ Bankswitch::BSList = {{
|
||||||
const std::array<Bankswitch::SizesType, static_cast<uInt32>(Bankswitch::Type::NumSchemes)>
|
const std::array<Bankswitch::SizesType, static_cast<uInt32>(Bankswitch::Type::NumSchemes)>
|
||||||
Bankswitch::Sizes = {{
|
Bankswitch::Sizes = {{
|
||||||
{ Bankswitch::any_KB, Bankswitch::any_KB }, // _AUTO
|
{ Bankswitch::any_KB, Bankswitch::any_KB }, // _AUTO
|
||||||
|
{ 8_KB, 8_KB }, // _03E0
|
||||||
{ 8_KB, 8_KB }, // _0840
|
{ 8_KB, 8_KB }, // _0840
|
||||||
{ 8_KB, 8_KB }, // _0FA0
|
{ 8_KB, 8_KB }, // _0FA0
|
||||||
{ 4_KB, 64_KB }, // _2IN1
|
{ 4_KB, 64_KB }, // _2IN1
|
||||||
|
@ -210,6 +212,8 @@ Bankswitch::ExtensionMap Bankswitch::ourExtensions = {
|
||||||
{ "cu" , Bankswitch::Type::_AUTO },
|
{ "cu" , Bankswitch::Type::_AUTO },
|
||||||
|
|
||||||
// All bankswitch types (those that UnoCart and HarmonyCart support have the same name)
|
// All bankswitch types (those that UnoCart and HarmonyCart support have the same name)
|
||||||
|
{ "03E" , Bankswitch::Type::_03E0 },
|
||||||
|
{ "03E0" , Bankswitch::Type::_03E0 },
|
||||||
{ "084" , Bankswitch::Type::_0840 },
|
{ "084" , Bankswitch::Type::_0840 },
|
||||||
{ "0840" , Bankswitch::Type::_0840 },
|
{ "0840" , Bankswitch::Type::_0840 },
|
||||||
{ "0FA" , Bankswitch::Type::_0FA0 },
|
{ "0FA" , Bankswitch::Type::_0FA0 },
|
||||||
|
@ -288,6 +292,7 @@ Bankswitch::ExtensionMap Bankswitch::ourExtensions = {
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
Bankswitch::NameToTypeMap Bankswitch::ourNameToTypes = {
|
Bankswitch::NameToTypeMap Bankswitch::ourNameToTypes = {
|
||||||
{ "AUTO" , Bankswitch::Type::_AUTO },
|
{ "AUTO" , Bankswitch::Type::_AUTO },
|
||||||
|
{ "03E0" , Bankswitch::Type::_03E0 },
|
||||||
{ "0840" , Bankswitch::Type::_0840 },
|
{ "0840" , Bankswitch::Type::_0840 },
|
||||||
{ "0FA0" , Bankswitch::Type::_0FA0 },
|
{ "0FA0" , Bankswitch::Type::_0FA0 },
|
||||||
{ "2IN1" , Bankswitch::Type::_2IN1 },
|
{ "2IN1" , Bankswitch::Type::_2IN1 },
|
||||||
|
|
|
@ -38,13 +38,13 @@ class Bankswitch
|
||||||
public:
|
public:
|
||||||
// Currently supported bankswitch schemes
|
// Currently supported bankswitch schemes
|
||||||
enum class Type {
|
enum class Type {
|
||||||
_AUTO, _0840, _0FA0, _2IN1, _4IN1, _8IN1, _16IN1, _32IN1,
|
_AUTO, _03E0, _0840, _0FA0, _2IN1, _4IN1, _8IN1, _16IN1,
|
||||||
_64IN1, _128IN1, _2K, _3E, _3EX, _3EP, _3F, _4A50,
|
_32IN1, _64IN1, _128IN1, _2K, _3E, _3EX, _3EP, _3F,
|
||||||
_4K, _4KSC, _AR, _BF, _BFSC, _BUS, _CDF, _CM,
|
_4A50, _4K, _4KSC, _AR, _BF, _BFSC, _BUS, _CDF,
|
||||||
_CTY, _CV, _DF, _DFSC, _DPC, _DPCP, _E0, _E7,
|
_CM, _CTY, _CV, _DF, _DFSC, _DPC, _DPCP, _E0,
|
||||||
_EF, _EFSC, _F0, _F4, _F4SC, _F6, _F6SC, _F8,
|
_E7, _EF, _EFSC, _F0, _F4, _F4SC, _F6, _F6SC,
|
||||||
_F8SC, _FA, _FA2, _FC, _FE, _GL, _MDM, _MVC,
|
_F8, _F8SC, _FA, _FA2, _FC, _FE, _GL, _MDM,
|
||||||
_SB, _TVBOY, _UA, _UASW, _WD, _WDSW, _X07,
|
_MVC, _SB, _TVBOY, _UA, _UASW, _WD, _WDSW, _X07,
|
||||||
#ifdef CUSTOM_ARM
|
#ifdef CUSTOM_ARM
|
||||||
_CUSTOM,
|
_CUSTOM,
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -0,0 +1,113 @@
|
||||||
|
//============================================================================
|
||||||
|
//
|
||||||
|
// SSSS tt lll lll
|
||||||
|
// SS SS tt ll ll
|
||||||
|
// SS tttttt eeee ll ll aaaa
|
||||||
|
// SSSS tt ee ee ll ll aa
|
||||||
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||||
|
// SS SS tt ee ll ll aa aa
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa
|
||||||
|
//
|
||||||
|
// Copyright (c) 1995-2023 by Bradford W. Mott, Stephen Anthony
|
||||||
|
// and the Stella Team
|
||||||
|
//
|
||||||
|
// See the file "License.txt" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
|
#include "System.hxx"
|
||||||
|
#include "Cart03E0.hxx"
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
Cartridge03E0::Cartridge03E0(const ByteBuffer& image, size_t size,
|
||||||
|
string_view md5, const Settings& settings,
|
||||||
|
size_t bsSize)
|
||||||
|
: CartridgeEnhanced(image, size, md5, settings, bsSize)
|
||||||
|
{
|
||||||
|
myBankShift = BANK_SHIFT;
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Cartridge03E0::install(System& system)
|
||||||
|
{
|
||||||
|
CartridgeEnhanced::install(system);
|
||||||
|
|
||||||
|
// Get the page accessing methods for the hot spots since they overlap
|
||||||
|
// areas within the TIA we'll need to forward requests to the TIA
|
||||||
|
myHotSpotPageAccess[0] = mySystem->getPageAccess(0x0380);
|
||||||
|
myHotSpotPageAccess[1] = mySystem->getPageAccess(0x03c0);
|
||||||
|
|
||||||
|
// Set the page accessing methods for the hot spots
|
||||||
|
const System::PageAccess access(this, System::PageAccessType::READ);
|
||||||
|
for(uInt16 addr = 0x0380; addr < 0x03FF; addr += System::PAGE_SIZE)
|
||||||
|
mySystem->setPageAccess(addr, access);
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Cartridge03E0::reset()
|
||||||
|
{
|
||||||
|
// Setup segments to some default banks
|
||||||
|
if(randomStartBank())
|
||||||
|
{
|
||||||
|
bank(mySystem->randGenerator().next() % 8, 0);
|
||||||
|
bank(mySystem->randGenerator().next() % 8, 1);
|
||||||
|
bank(mySystem->randGenerator().next() % 8, 2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bank(4, 0);
|
||||||
|
bank(5, 1);
|
||||||
|
bank(6, 2);
|
||||||
|
}
|
||||||
|
myBankChanged = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
bool Cartridge03E0::checkSwitchBank(uInt16 address, uInt8)
|
||||||
|
{
|
||||||
|
bool switched = false;
|
||||||
|
|
||||||
|
if((address & 0x10) == 0)
|
||||||
|
{
|
||||||
|
bank(address & 0x0007, 0);
|
||||||
|
switched = true;
|
||||||
|
}
|
||||||
|
if((address & 0x20) == 0)
|
||||||
|
{
|
||||||
|
bank(address & 0x0007, 1);
|
||||||
|
switched = true;
|
||||||
|
}
|
||||||
|
if((address & 0x40) == 0)
|
||||||
|
{
|
||||||
|
bank(address & 0x0007, 2);
|
||||||
|
switched = true;
|
||||||
|
}
|
||||||
|
return switched;
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
uInt8 Cartridge03E0::peek(uInt16 address)
|
||||||
|
{
|
||||||
|
checkSwitchBank(address, 0);
|
||||||
|
|
||||||
|
// Because of the way we've set up accessing above, we can only
|
||||||
|
// get here when the addresses are from 0x380 - 0x3FF
|
||||||
|
const int hotspot = ((address & 0x40) >> 6);
|
||||||
|
return myHotSpotPageAccess[hotspot].device->peek(address);
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
bool Cartridge03E0::poke(uInt16 address, uInt8 value)
|
||||||
|
{
|
||||||
|
// Because of the way accessing is set up, we will may get here by
|
||||||
|
// doing a write to 0x380 - 0x3FF or cart; we ignore the cart write
|
||||||
|
if(!(address & 0x1000))
|
||||||
|
{
|
||||||
|
checkSwitchBank(address, 0);
|
||||||
|
|
||||||
|
const int hotspot = ((address & 0x40) >> 6);
|
||||||
|
myHotSpotPageAccess[hotspot].device->poke(address, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
|
@ -0,0 +1,137 @@
|
||||||
|
//============================================================================
|
||||||
|
//
|
||||||
|
// SSSS tt lll lll
|
||||||
|
// SS SS tt ll ll
|
||||||
|
// SS tttttt eeee ll ll aaaa
|
||||||
|
// SSSS tt ee ee ll ll aa
|
||||||
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||||
|
// SS SS tt ee ll ll aa aa
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa
|
||||||
|
//
|
||||||
|
// Copyright (c) 1995-2023 by Bradford W. Mott, Stephen Anthony
|
||||||
|
// and the Stella Team
|
||||||
|
//
|
||||||
|
// See the file "License.txt" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
|
#ifndef Cartridge03E0_HXX
|
||||||
|
#define Cartridge03E0_HXX
|
||||||
|
|
||||||
|
#include "bspf.hxx"
|
||||||
|
#include "CartEnhanced.hxx"
|
||||||
|
#include "System.hxx"
|
||||||
|
#ifdef DEBUGGER_SUPPORT
|
||||||
|
#include "Cart03e0Widget.hxx"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
This is the cartridge class for Parker Brothers' 8K games with special
|
||||||
|
Brazilian bankswitching. In this bankswitching scheme the 2600's 4K
|
||||||
|
cartridge address space is broken into four 1K segments.
|
||||||
|
|
||||||
|
The desired 1K bank of the ROM is selected as follows:
|
||||||
|
If A12 == 0, A9 == 1, A8 == 1, A7 == 1 ($0380..$03ff):
|
||||||
|
A4 == 0 ($03e0) loads the bank number for segment #0
|
||||||
|
A5 == 0 ($03d0) loads the bank number for segment #1
|
||||||
|
A6 == 0 ($03b0) loads the bank number for segment #2
|
||||||
|
Bits A0, A1, A2 determine the bank number (0..7)
|
||||||
|
|
||||||
|
The last 1K segment always points to the last 1K of the ROM image.
|
||||||
|
|
||||||
|
Because of the complexity of this scheme, the cart reports having
|
||||||
|
only one actual bank, in which pieces of it can be swapped out in
|
||||||
|
many different ways.
|
||||||
|
|
||||||
|
@author Thomas Jentzsch
|
||||||
|
*/
|
||||||
|
class Cartridge03E0 : public CartridgeEnhanced
|
||||||
|
{
|
||||||
|
friend class Cartridge03E0Widget;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Create a new cartridge using the specified image
|
||||||
|
|
||||||
|
@param image Pointer to the ROM image
|
||||||
|
@param size The size of the ROM image
|
||||||
|
@param md5 The md5sum of the ROM image
|
||||||
|
@param settings A reference to the various settings (read-only)
|
||||||
|
@param bsSize The size specified by the bankswitching scheme
|
||||||
|
*/
|
||||||
|
Cartridge03E0(const ByteBuffer& image, size_t size, string_view md5,
|
||||||
|
const Settings& settings, size_t bsSize = 8_KB);
|
||||||
|
~Cartridge03E0() override = default;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Install cartridge in the specified system. Invoked by the system
|
||||||
|
when the cartridge is attached to it.
|
||||||
|
|
||||||
|
@param system The system the device should install itself in
|
||||||
|
*/
|
||||||
|
void install(System& system) override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reset device to its power-on state
|
||||||
|
*/
|
||||||
|
void reset() override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get a descriptor for the device name (used in error checking).
|
||||||
|
|
||||||
|
@return The name of the object
|
||||||
|
*/
|
||||||
|
string name() const override { return "Cartridge03E0"; }
|
||||||
|
|
||||||
|
#ifdef DEBUGGER_SUPPORT
|
||||||
|
/**
|
||||||
|
Get debugger widget responsible for accessing the inner workings
|
||||||
|
of the cart.
|
||||||
|
*/
|
||||||
|
CartDebugWidget* debugWidget(GuiObject* boss, const GUI::Font& lfont,
|
||||||
|
const GUI::Font& nfont, int x, int y, int w, int h) override
|
||||||
|
{
|
||||||
|
return new Cartridge03E0Widget(boss, lfont, nfont, x, y, w, h, *this);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
Get the byte at the specified address.
|
||||||
|
|
||||||
|
@return The byte at the specified address
|
||||||
|
*/
|
||||||
|
uInt8 peek(uInt16 address) override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Change the byte at the specified address to the given value
|
||||||
|
|
||||||
|
@param address The address where the value should be stored
|
||||||
|
@param value The value to be stored at the address
|
||||||
|
@return True if the poke changed the device address space, else false
|
||||||
|
*/
|
||||||
|
bool poke(uInt16 address, uInt8 value) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool checkSwitchBank(uInt16 address, uInt8) override;
|
||||||
|
|
||||||
|
uInt16 hotspot() const override { return 0x0380; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
// log(ROM bank segment size) / log(2)
|
||||||
|
static constexpr uInt16 BANK_SHIFT = 10; // = 1K = 0x0400
|
||||||
|
|
||||||
|
// Previous Device's page access
|
||||||
|
std::array<System::PageAccess, 2> myHotSpotPageAccess;
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Following constructors and assignment operators not supported
|
||||||
|
Cartridge03E0() = delete;
|
||||||
|
Cartridge03E0(const Cartridge03E0&) = delete;
|
||||||
|
Cartridge03E0(Cartridge03E0&&) = delete;
|
||||||
|
Cartridge03E0& operator=(const Cartridge03E0&) = delete;
|
||||||
|
Cartridge03E0& operator=(Cartridge03E0&&) = delete;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
#include "Cart.hxx"
|
#include "Cart.hxx"
|
||||||
|
#include "Cart03E0.hxx"
|
||||||
#include "Cart0840.hxx"
|
#include "Cart0840.hxx"
|
||||||
#include "Cart0FA0.hxx"
|
#include "Cart0FA0.hxx"
|
||||||
#include "Cart2K.hxx"
|
#include "Cart2K.hxx"
|
||||||
|
@ -232,6 +233,8 @@ CartCreator::createFromImage(const ByteBuffer& image, size_t size,
|
||||||
// We should know the cart's type by now so let's create it
|
// We should know the cart's type by now so let's create it
|
||||||
switch(type)
|
switch(type)
|
||||||
{
|
{
|
||||||
|
case Bankswitch::Type::_03E0:
|
||||||
|
return make_unique<Cartridge03E0>(image, size, md5, settings);
|
||||||
case Bankswitch::Type::_0840:
|
case Bankswitch::Type::_0840:
|
||||||
return make_unique<Cartridge0840>(image, size, md5, settings);
|
return make_unique<Cartridge0840>(image, size, md5, settings);
|
||||||
case Bankswitch::Type::_0FA0:
|
case Bankswitch::Type::_0FA0:
|
||||||
|
|
|
@ -92,6 +92,8 @@ Bankswitch::Type CartDetector::autodetectType(const ByteBuffer& image, size_t si
|
||||||
type = Bankswitch::Type::_WD;
|
type = Bankswitch::Type::_WD;
|
||||||
else if (isProbablyFC(image, size))
|
else if (isProbablyFC(image, size))
|
||||||
type = Bankswitch::Type::_FC;
|
type = Bankswitch::Type::_FC;
|
||||||
|
else if(isProbably03E0(image, size))
|
||||||
|
type = Bankswitch::Type::_03E0;
|
||||||
else
|
else
|
||||||
type = Bankswitch::Type::_F8;
|
type = Bankswitch::Type::_F8;
|
||||||
}
|
}
|
||||||
|
@ -324,6 +326,22 @@ bool CartDetector::isProbablyARM(const ByteBuffer& image, size_t size)
|
||||||
return searchForBytes(image, std::min<size_t>(size, 1_KB), signature[1], 4);
|
return searchForBytes(image, std::min<size_t>(size, 1_KB), signature[1], 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
bool CartDetector::isProbably03E0(const ByteBuffer& image, size_t size)
|
||||||
|
{
|
||||||
|
// 03E0 cart bankswitching for Brazilian Parker Bros ROMs, switches segment
|
||||||
|
// 0 into bank 0 by accessing address 0x3E0 using 'LDA $3E0' or 'ORA $3E0'.
|
||||||
|
static constexpr uInt8 signature[2][4] = {
|
||||||
|
{ 0x0D, 0xE0, 0x03, 0x0D }, // ORA $3E0, ORA (Popeye)
|
||||||
|
{ 0xAD, 0xE0, 0x03, 0xAD } // LDA $3E0, ORA (Montezuma's Revenge)
|
||||||
|
};
|
||||||
|
for(const auto* const sig: signature)
|
||||||
|
if(searchForBytes(image, size, sig, 4))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool CartDetector::isProbably0840(const ByteBuffer& image, size_t size)
|
bool CartDetector::isProbably0840(const ByteBuffer& image, size_t size)
|
||||||
{
|
{
|
||||||
|
|
|
@ -86,13 +86,18 @@ class CartDetector
|
||||||
*/
|
*/
|
||||||
static bool isProbablyARM(const ByteBuffer& image, size_t size);
|
static bool isProbablyARM(const ByteBuffer& image, size_t size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns true if the image is probably a 03E0 bankswitching cartridge
|
||||||
|
*/
|
||||||
|
static bool isProbably03E0(const ByteBuffer& image, size_t size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns true if the image is probably a 0840 bankswitching cartridge
|
Returns true if the image is probably a 0840 bankswitching cartridge
|
||||||
*/
|
*/
|
||||||
static bool isProbably0840(const ByteBuffer& image, size_t size);
|
static bool isProbably0840(const ByteBuffer& image, size_t size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns true if the image is probably a BRazilian bankswitching cartridge
|
Returns true if the image is probably a Brazilian 0FA0 bankswitching cartridge
|
||||||
*/
|
*/
|
||||||
static bool isProbably0FA0(const ByteBuffer& image, size_t size);
|
static bool isProbably0FA0(const ByteBuffer& image, size_t size);
|
||||||
|
|
||||||
|
|
|
@ -67,5 +67,6 @@ bool CartridgeE0::checkSwitchBank(uInt16 address, uInt8)
|
||||||
bank(address & 0x0007, 2);
|
bank(address & 0x0007, 2);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ MODULE_OBJS := \
|
||||||
src/emucore/CartCreator.o \
|
src/emucore/CartCreator.o \
|
||||||
src/emucore/CartDetector.o \
|
src/emucore/CartDetector.o \
|
||||||
src/emucore/CartEnhanced.o \
|
src/emucore/CartEnhanced.o \
|
||||||
|
src/emucore/Cart03E0.o \
|
||||||
src/emucore/Cart0840.o \
|
src/emucore/Cart0840.o \
|
||||||
src/emucore/Cart0FA0.o \
|
src/emucore/Cart0FA0.o \
|
||||||
src/emucore/Cart2K.o \
|
src/emucore/Cart2K.o \
|
||||||
|
|
|
@ -353,7 +353,7 @@ bool FileListWidget::handleKeyDown(StellaKey key, StellaMod mod)
|
||||||
_lastKey = key; _lastMod = mod;
|
_lastKey = key; _lastMod = mod;
|
||||||
if(_quickSelectTime < TimerManager::getTicks() / 1000)
|
if(_quickSelectTime < TimerManager::getTicks() / 1000)
|
||||||
_firstMod = mod;
|
_firstMod = mod;
|
||||||
else if(key == KBDK_SPACE) // allow seaching strings with a space without selecting/starting
|
else if(key == KBDK_SPACE) // allow searching ROMs with a space without selecting/starting
|
||||||
handled = true;
|
handled = true;
|
||||||
|
|
||||||
return handled;
|
return handled;
|
||||||
|
|
|
@ -43,6 +43,7 @@ SOURCES_CXX := \
|
||||||
$(CORE_DIR)/emucore/CartCreator.cxx \
|
$(CORE_DIR)/emucore/CartCreator.cxx \
|
||||||
$(CORE_DIR)/emucore/CartDetector.cxx \
|
$(CORE_DIR)/emucore/CartDetector.cxx \
|
||||||
$(CORE_DIR)/emucore/CartEnhanced.cxx \
|
$(CORE_DIR)/emucore/CartEnhanced.cxx \
|
||||||
|
$(CORE_DIR)/emucore/Cart03E0.cxx \
|
||||||
$(CORE_DIR)/emucore/Cart0840.cxx \
|
$(CORE_DIR)/emucore/Cart0840.cxx \
|
||||||
$(CORE_DIR)/emucore/Cart0FA0.cxx \
|
$(CORE_DIR)/emucore/Cart0FA0.cxx \
|
||||||
$(CORE_DIR)/emucore/Cart2K.cxx \
|
$(CORE_DIR)/emucore/Cart2K.cxx \
|
||||||
|
|
|
@ -219,6 +219,7 @@
|
||||||
<ClCompile Include="..\..\emucore\AtariVox.cxx" />
|
<ClCompile Include="..\..\emucore\AtariVox.cxx" />
|
||||||
<ClCompile Include="..\..\emucore\Booster.cxx" />
|
<ClCompile Include="..\..\emucore\Booster.cxx" />
|
||||||
<ClCompile Include="..\..\emucore\Cart.cxx" />
|
<ClCompile Include="..\..\emucore\Cart.cxx" />
|
||||||
|
<ClCompile Include="..\..\emucore\Cart03E0.cxx" />
|
||||||
<ClCompile Include="..\..\emucore\Cart0840.cxx" />
|
<ClCompile Include="..\..\emucore\Cart0840.cxx" />
|
||||||
<ClCompile Include="..\..\emucore\Cart0FA0.cxx" />
|
<ClCompile Include="..\..\emucore\Cart0FA0.cxx" />
|
||||||
<ClCompile Include="..\..\emucore\Cart2K.cxx" />
|
<ClCompile Include="..\..\emucore\Cart2K.cxx" />
|
||||||
|
@ -382,6 +383,7 @@
|
||||||
<ClInclude Include="..\..\emucore\AtariVox.hxx" />
|
<ClInclude Include="..\..\emucore\AtariVox.hxx" />
|
||||||
<ClInclude Include="..\..\emucore\Booster.hxx" />
|
<ClInclude Include="..\..\emucore\Booster.hxx" />
|
||||||
<ClInclude Include="..\..\emucore\Cart.hxx" />
|
<ClInclude Include="..\..\emucore\Cart.hxx" />
|
||||||
|
<ClInclude Include="..\..\emucore\Cart03E0.hxx" />
|
||||||
<ClInclude Include="..\..\emucore\Cart0840.hxx" />
|
<ClInclude Include="..\..\emucore\Cart0840.hxx" />
|
||||||
<ClInclude Include="..\..\emucore\Cart0FA0.hxx" />
|
<ClInclude Include="..\..\emucore\Cart0FA0.hxx" />
|
||||||
<ClInclude Include="..\..\emucore\Cart2K.hxx" />
|
<ClInclude Include="..\..\emucore\Cart2K.hxx" />
|
||||||
|
|
|
@ -918,6 +918,7 @@
|
||||||
<ClCompile Include="..\..\debugger\gui\CartRamWidget.cxx">
|
<ClCompile Include="..\..\debugger\gui\CartRamWidget.cxx">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-NoDebugger|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-NoDebugger|x64'">true</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\debugger\gui\Cart03E0Widget.cxx" />
|
||||||
<ClCompile Include="..\..\debugger\gui\CartTVBoyWidget.cxx">
|
<ClCompile Include="..\..\debugger\gui\CartTVBoyWidget.cxx">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-NoDebugger|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-NoDebugger|x64'">true</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -978,6 +979,7 @@
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\debugger\TimerMap.cxx" />
|
<ClCompile Include="..\..\debugger\TimerMap.cxx" />
|
||||||
<ClCompile Include="..\..\emucore\Bankswitch.cxx" />
|
<ClCompile Include="..\..\emucore\Bankswitch.cxx" />
|
||||||
|
<ClCompile Include="..\..\emucore\Cart03E0.cxx" />
|
||||||
<ClCompile Include="..\..\emucore\Cart3EPlus.cxx" />
|
<ClCompile Include="..\..\emucore\Cart3EPlus.cxx" />
|
||||||
<ClCompile Include="..\..\emucore\Cart3EX.cxx" />
|
<ClCompile Include="..\..\emucore\Cart3EX.cxx" />
|
||||||
<ClCompile Include="..\..\emucore\Cart4KSC.cxx" />
|
<ClCompile Include="..\..\emucore\Cart4KSC.cxx" />
|
||||||
|
@ -2108,6 +2110,7 @@
|
||||||
<ClInclude Include="..\..\debugger\gui\BoosterWidget.hxx">
|
<ClInclude Include="..\..\debugger\gui\BoosterWidget.hxx">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-NoDebugger|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-NoDebugger|x64'">true</ExcludedFromBuild>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\debugger\gui\Cart03E0Widget.hxx" />
|
||||||
<ClInclude Include="..\..\debugger\gui\Cart0840Widget.hxx">
|
<ClInclude Include="..\..\debugger\gui\Cart0840Widget.hxx">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-NoDebugger|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-NoDebugger|x64'">true</ExcludedFromBuild>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -2303,6 +2306,7 @@
|
||||||
<ClInclude Include="..\..\emucore\AmigaMouse.hxx" />
|
<ClInclude Include="..\..\emucore\AmigaMouse.hxx" />
|
||||||
<ClInclude Include="..\..\emucore\AtariMouse.hxx" />
|
<ClInclude Include="..\..\emucore\AtariMouse.hxx" />
|
||||||
<ClInclude Include="..\..\emucore\Bankswitch.hxx" />
|
<ClInclude Include="..\..\emucore\Bankswitch.hxx" />
|
||||||
|
<ClInclude Include="..\..\emucore\Cart03E0.hxx" />
|
||||||
<ClInclude Include="..\..\emucore\Cart3EPlus.hxx" />
|
<ClInclude Include="..\..\emucore\Cart3EPlus.hxx" />
|
||||||
<ClInclude Include="..\..\emucore\Cart3EX.hxx" />
|
<ClInclude Include="..\..\emucore\Cart3EX.hxx" />
|
||||||
<ClInclude Include="..\..\emucore\Cart4KSC.hxx" />
|
<ClInclude Include="..\..\emucore\Cart4KSC.hxx" />
|
||||||
|
|
|
@ -1203,6 +1203,12 @@
|
||||||
<ClCompile Include="..\..\debugger\gui\CartGLWidget.cxx">
|
<ClCompile Include="..\..\debugger\gui\CartGLWidget.cxx">
|
||||||
<Filter>Source Files\debugger\gui</Filter>
|
<Filter>Source Files\debugger\gui</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\emucore\Cart03E0.cxx">
|
||||||
|
<Filter>Source Files\emucore</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\debugger\gui\Cart03E0Widget.cxx">
|
||||||
|
<Filter>Source Files\debugger\gui</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\common\bspf.hxx">
|
<ClInclude Include="..\..\common\bspf.hxx">
|
||||||
|
@ -2453,6 +2459,12 @@
|
||||||
<ClInclude Include="..\..\debugger\gui\CartGLWidget.hxx">
|
<ClInclude Include="..\..\debugger\gui\CartGLWidget.hxx">
|
||||||
<Filter>Header Files\debugger\gui</Filter>
|
<Filter>Header Files\debugger\gui</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\emucore\Cart03E0.hxx">
|
||||||
|
<Filter>Header Files\emucore</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\debugger\gui\Cart03E0Widget.hxx">
|
||||||
|
<Filter>Header Files\debugger\gui</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="stella.ico">
|
<None Include="stella.ico">
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue