Added JANE bankswitching (for Tarzan prototype)

This commit is contained in:
thrust26 2024-06-05 15:27:41 +02:00
parent 2d0de2b415
commit bd757e7d2f
15 changed files with 308 additions and 20 deletions

View File

@ -50,6 +50,10 @@
* Added 03E0 bankswitching for Brazilian Parker Bros ROMs.
* Added WF8 bankswitching used by some certain Coleco white carts
* Added JANE bankswitching used by Coleco's Tarzan prototype
* Added BUS bankswitching support for some older demos.
* Fixed broken 7800 pause key support.

View File

@ -5071,6 +5071,7 @@ Ms Pac-Man (Stella extended codes):
<tr><td>FC </td><td>Amiga Power Play Aracde 16/32K </td><td>.FC </td></tr>
<tr><td>FE </td><td>8K Activision (aka SCABS)</td><td>.FE </td></tr>
<tr><td>GL &#178;</td><td>4 or 6K GameLine Master Module</td><td>.GL </td></tr>
<tr><td>JANE </td><td>16K Coleco (Tarzan) </td><td>.JAN, .JANE </td></tr>
<tr><td>MDM </td><td>Menu Driven Megacart </td><td>.MDM </td></tr>
<tr><td>MVC </td><td>Movie Cart</td><td>.MVC </td></tr>
<tr><td>SB </td><td>128-256K SUPERbanking </td><td>.SB </td></tr>

View File

@ -0,0 +1,52 @@
//============================================================================
//
// 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-2024 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 "CartJANE.hxx"
#include "CartJANEWidget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeJANEWidget::CartridgeJANEWidget(
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
int x, int y, int w, int h, CartridgeJANE& cart)
: CartridgeEnhancedWidget(boss, lfont, nfont, x, y, w, h, cart)
{
initialize();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartridgeJANEWidget::description()
{
ostringstream info;
info << "Tarzan cartridge, four 4K banks\n"
<< CartridgeEnhancedWidget::description();
return info.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartridgeJANEWidget::hotspotStr(int bank, int, bool prefix)
{
ostringstream info;
const uInt16 hotspot = myCart.hotspot() | ADDR_BASE;
info << (prefix ? "(hotspot " : "(")
<< "$" << Common::Base::HEX1 << (hotspot + (bank < 2 ? bank : bank + 6))
<< (prefix ? ")" : ")");
return info.str();
}

View File

@ -0,0 +1,50 @@
//============================================================================
//
// 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-2024 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 CARTRIDGEJANE_WIDGET_HXX
#define CARTRIDGEJANE_WIDGET_HXX
class CartridgeJANE;
#include "CartEnhancedWidget.hxx"
class CartridgeJANEWidget : public CartridgeEnhancedWidget
{
public:
CartridgeJANEWidget(GuiObject* boss, const GUI::Font& lfont,
const GUI::Font& nfont,
int x, int y, int w, int h,
CartridgeJANE& cart);
~CartridgeJANEWidget() override = default;
private:
string manufacturer() override { return "Coleco"; }
string description() override;
string hotspotStr(int bank, int seg = 0, bool prefix = false) override;
private:
// Following constructors and assignment operators not supported
CartridgeJANEWidget() = delete;
CartridgeJANEWidget(const CartridgeJANEWidget&) = delete;
CartridgeJANEWidget(CartridgeJANEWidget&&) = delete;
CartridgeJANEWidget& operator=(const CartridgeJANEWidget&) = delete;
CartridgeJANEWidget& operator=(CartridgeJANEWidget&&) = delete;
};
#endif

View File

@ -48,6 +48,7 @@ MODULE_OBJS := \
src/debugger/gui/CartFCWidget.o \
src/debugger/gui/CartFEWidget.o \
src/debugger/gui/CartGLWidget.o \
src/debugger/gui/CartJANEWidget.o \
src/debugger/gui/CartMDMWidget.o \
src/debugger/gui/CartRamWidget.o \
src/debugger/gui/CartSBWidget.o \

View File

@ -121,6 +121,7 @@ Bankswitch::BSList = {{
{ "FC" , "FC (32K Amiga)" },
{ "FE" , "FE (8K Activision)" },
{ "GL" , "GL (GameLine Master Module)" },
{ "JANE" , "JANE (16K Tarzan prototype)" },
{ "MDM" , "MDM (Menu Driven Megacart)" },
{ "MVC" , "MVC (Movie Cart)" },
{ "SB" , "SB (128-256K SUPERbank)" },
@ -186,6 +187,7 @@ Bankswitch::Sizes = {{
{ 32_KB, 32_KB }, // _FC
{ 8_KB, 8_KB }, // _FE
{ 4_KB, 6_KB }, // _GL
{ 16_KB, 16_KB }, // _JANE
{ 8_KB, Bankswitch::any_KB }, // _MDM
{ 1024_KB, Bankswitch::any_KB }, // _MVC
{ 128_KB, 256_KB }, // _SB
@ -279,6 +281,8 @@ Bankswitch::ExtensionMap Bankswitch::ourExtensions = {
{ "FC" , Bankswitch::Type::_FC },
{ "FE" , Bankswitch::Type::_FE },
{ "GL" , Bankswitch::Type::_GL },
{ "JAN" , Bankswitch::Type::_JANE },
{ "JANE" , Bankswitch::Type::_JANE },
{ "MDM" , Bankswitch::Type::_MDM },
{ "MVC" , Bankswitch::Type::_MVC },
{ "SB" , Bankswitch::Type::_SB },
@ -341,6 +345,7 @@ Bankswitch::NameToTypeMap Bankswitch::ourNameToTypes = {
{ "FC" , Bankswitch::Type::_FC },
{ "FE" , Bankswitch::Type::_FE },
{ "GL" , Bankswitch::Type::_GL },
{ "JANE" , Bankswitch::Type::_JANE },
{ "MDM" , Bankswitch::Type::_MDM },
{ "MVC" , Bankswitch::Type::_MVC },
{ "SB" , Bankswitch::Type::_SB },

View File

@ -43,9 +43,9 @@ class Bankswitch
_4A50, _4K, _4KSC, _AR, _BF, _BFSC, _BUS, _CDF,
_CM, _CTY, _CV, _DF, _DFSC, _DPC, _DPCP, _E0,
_E7, _EF, _EFSC, _F0, _F4, _F4SC, _F6, _F6SC,
_F8, _F8SC, _FA, _FA2, _FC, _FE, _GL, _MDM,
_MVC, _SB, _TVBOY, _UA, _UASW, _WD, _WDSW, _WF8,
_X07,
_F8, _F8SC, _FA, _FA2, _FC, _FE, _GL, _JANE,
_MDM, _MVC, _SB, _TVBOY, _UA, _UASW, _WD, _WDSW,
_WF8, _X07,
#ifdef CUSTOM_ARM
_CUSTOM,
#endif

View File

@ -56,6 +56,7 @@
#include "CartFC.hxx"
#include "CartFE.hxx"
#include "CartGL.hxx"
#include "CartJANE.hxx"
#include "CartMDM.hxx"
#include "CartMVC.hxx"
#include "CartSB.hxx"
@ -273,6 +274,7 @@ CartCreator::createFromImage(const ByteBuffer& image, size_t size,
case _FC: return make_unique<CartridgeFC>(image, size, md5, settings);
case _FE: return make_unique<CartridgeFE>(image, size, md5, settings, size);
case _GL: return make_unique<CartridgeGL>(image, size, md5, settings);
case _JANE: return make_unique<CartridgeJANE>(image, size, md5, settings);
case _MDM: return make_unique<CartridgeMDM>(image, size, md5, settings);
case _UA: return make_unique<CartridgeUA>(image, size, md5, settings);
case _UASW: return make_unique<CartridgeUA>(image, size, md5, settings, true);

View File

@ -124,6 +124,8 @@ Bankswitch::Type CartDetector::autodetectType(const ByteBuffer& image, size_t si
else if(isProbably3F(image, size))
type = Bankswitch::Type::_3F;
*/
else if (isProbablyJANE(image, size))
type = Bankswitch::Type::_JANE;
else
type = Bankswitch::Type::_F6;
}
@ -724,6 +726,14 @@ bool CartDetector::isProbablyFE(const ByteBuffer& image, size_t size)
return false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDetector::isProbablyJANE(const ByteBuffer& image, size_t size)
{
static constexpr uInt8 signature[] = { 0xad, 0xf1, 0xff, 0x60 }; // LDA $0CB8
return searchForBytes(image, size, signature, sizeof(signature));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDetector::isProbablyGL(const ByteBuffer& image, size_t size)
{

View File

@ -206,6 +206,11 @@ class CartDetector
*/
static bool isProbablyFE(const ByteBuffer& image, size_t size);
/**
Returns true if the image is probably a JANE cartridge (Tarzan)
*/
static bool isProbablyJANE(const ByteBuffer& image, size_t size);
/**
Returns true if the image is probably a GameLine cartridge
*/

58
src/emucore/CartJANE.cxx Normal file
View File

@ -0,0 +1,58 @@
//============================================================================
//
// 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-2024 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 "CartJANE.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeJANE::CartridgeJANE(const ByteBuffer& image, size_t size,
string_view md5, const Settings& settings,
size_t bsSize)
: CartridgeEnhanced(image, size, md5, settings, bsSize)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeJANE::checkSwitchBank(uInt16 address, uInt8)
{
// Switch banks if necessary
switch (address)
{
case 0x1FF0:
// Set the current bank to the 1st 4k bank
bank(0);
return true;
case 0x1FF1:
// Set the current bank to the 2nd 4k bank
bank(1);
return true;
case 0x1FF8:
// Set the current bank to the 3rd 4k bank
bank(2);
return true;
case 0x1FF9:
// Set the current bank to the 4th 4k bank
bank(3);
return true;
default:
break;
}
return false;
}

86
src/emucore/CartJANE.hxx Normal file
View File

@ -0,0 +1,86 @@
//============================================================================
//
// 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-2024 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 CARTRIDGEJANE_HXX
#define CARTRIDGEJANE_HXX
#include "CartEnhanced.hxx"
#ifdef DEBUGGER_SUPPORT
#include "CartJANEWidget.hxx"
#endif
/**
Cartridge class used for the Tarzan prototype. There are four 4K banks,
accessible by read at $1FF0/1/8/9.
@author Thomas Jentzsch
*/
class CartridgeJANE : public CartridgeEnhanced
{
friend class CartridgeJANEWidget;
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
*/
CartridgeJANE(const ByteBuffer& image, size_t size, string_view md5,
const Settings& settings, size_t bsSize = 16_KB);
~CartridgeJANE() override = default;
public:
/**
Get a descriptor for the device name (used in error checking).
@return The name of the object
*/
string name() const override { return "CartridgeJANE"; }
#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 CartridgeJANEWidget(boss, lfont, nfont, x, y, w, h, *this);
}
#endif
private:
bool checkSwitchBank(uInt16 address, uInt8 value) override;
uInt16 hotspot() const override { return 0x1FF0; }
uInt16 getStartBank() const override { return 1; }
private:
// Following constructors and assignment operators not supported
CartridgeJANE() = delete;
CartridgeJANE(const CartridgeJANE&) = delete;
CartridgeJANE(CartridgeJANE&&) = delete;
CartridgeJANE& operator=(const CartridgeJANE&) = delete;
CartridgeJANE& operator=(CartridgeJANE&&) = delete;
};
#endif

View File

@ -48,6 +48,7 @@ MODULE_OBJS := \
src/emucore/CartFC.o \
src/emucore/CartFE.o \
src/emucore/CartGL.o \
src/emucore/CartJANE.o \
src/emucore/CartMDM.o \
src/emucore/CartMVC.o \
src/emucore/CartSB.o \

View File

@ -586,6 +586,7 @@
<ClCompile Include="..\..\debugger\gui\CartGLWidget.cxx">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-NoDebugger|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\debugger\gui\CartJANEWidget.cxx" />
<ClCompile Include="..\..\debugger\gui\CartMDMWidget.cxx">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-NoDebugger|x64'">true</ExcludedFromBuild>
</ClCompile>
@ -681,6 +682,7 @@
<ClCompile Include="..\..\emucore\CartFA2.cxx" />
<ClCompile Include="..\..\emucore\CartFC.cxx" />
<ClCompile Include="..\..\emucore\CartGL.cxx" />
<ClCompile Include="..\..\emucore\CartJANE.cxx" />
<ClCompile Include="..\..\emucore\CartMDM.cxx" />
<ClCompile Include="..\..\emucore\CartMVC.cxx" />
<ClCompile Include="..\..\emucore\CartTVBoy.cxx" />
@ -1546,6 +1548,7 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-NoDebugger|x64'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="..\..\debugger\gui\CartGLWidget.hxx" />
<ClInclude Include="..\..\debugger\gui\CartJANEWidget.hxx" />
<ClInclude Include="..\..\debugger\gui\CartMDMWidget.hxx">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-NoDebugger|x64'">true</ExcludedFromBuild>
</ClInclude>
@ -1645,6 +1648,7 @@
<ClInclude Include="..\..\emucore\CartFA2.hxx" />
<ClInclude Include="..\..\emucore\CartFC.hxx" />
<ClInclude Include="..\..\emucore\CartGL.hxx" />
<ClInclude Include="..\..\emucore\CartJANE.hxx" />
<ClInclude Include="..\..\emucore\CartMDM.hxx" />
<ClInclude Include="..\..\emucore\CartMVC.hxx" />
<ClInclude Include="..\..\emucore\CartTVBoy.hxx" />

View File

@ -1230,6 +1230,12 @@
<ClCompile Include="..\..\debugger\gui\CartWF8Widget.cxx">
<Filter>Source Files\debugger\gui</Filter>
</ClCompile>
<ClCompile Include="..\..\emucore\CartJANE.cxx">
<Filter>Source Files\emucore</Filter>
</ClCompile>
<ClCompile Include="..\..\debugger\gui\CartJANEWidget.cxx">
<Filter>Source Files\debugger\gui</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\emucore\AtariVox.hxx">
@ -2489,15 +2495,18 @@
<ClInclude Include="Windows.hxx">
<Filter>Header Files\os</Filter>
</ClInclude>
<ClInclude Include="..\..\common\md5type.hxx">
<Filter>Header Files\common</Filter>
</ClInclude>
<ClInclude Include="..\..\emucore\CartWF8.hxx">
<Filter>Header Files\emucore</Filter>
</ClInclude>
<ClInclude Include="..\..\debugger\gui\CartWF8Widget.hxx">
<Filter>Header Files\debugger\gui</Filter>
</ClInclude>
<ClInclude Include="..\..\emucore\CartJANE.hxx">
<Filter>Header Files\emucore</Filter>
</ClInclude>
<ClInclude Include="..\..\debugger\gui\CartJANEWidget.hxx">
<Filter>Header Files\debugger\gui</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="stella.ico">