merged E7 bankswitching classes

This commit is contained in:
Thomas Jentzsch 2021-09-24 22:22:48 +02:00
parent 0b468c1b0f
commit 71dbf0baa3
21 changed files with 117 additions and 551 deletions

View File

@ -4856,8 +4856,7 @@ Ms Pac-Man (Stella extended codes):
<tr><td>DPC </td><td>Pitfall II </td><td>.DPC </td></tr>
<tr><td>DPC+</td><td>Enhanced DPC </td><td>.DPP, .DPC+ </td></tr>
<tr><td>E0 </td><td>8K Parker Bros </td><td>.E0 </td></tr>
<tr><td>E7 </td><td>16K M Network </td><td>.E7 </td></tr>
<tr><td>E78K </td><td>8K M Network </td><td>.E78, .E78K </td></tr>
<tr><td>E7 </td><td>8-16K M Network </td><td>.E7 .E78, .E78K</td></tr>
<tr><td>EF </td><td>64K Homestar Runner </td><td>.EF </td></tr>
<tr><td>EFSC </td><td>64K Homestar Runner + RAM</td><td>.EFS, .EFSC </td></tr>
<tr><td>F0 </td><td>Dynacom Megaboy </td><td>.F0 </td></tr>

View File

@ -1,71 +0,0 @@
//============================================================================
//
// 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-2021 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 "CartMNetwork.hxx"
#include "PopUpWidget.hxx"
#include "CartE78KWidget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeE78KWidget::CartridgeE78KWidget(
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
int x, int y, int w, int h,
CartridgeMNetwork& cart)
: CartridgeMNetworkWidget(boss, lfont, nfont, x, y, w, h, cart)
{
ostringstream info;
info << "E78K cartridge, four 2K banks ROM + 2K RAM,\n"
<< " mapped into three segments\n"
<< "Lower 2K accessible @ $F000 - $F7FF\n"
<< " ROM banks 0 - 2 (hotspots $FFE4 to $FFE6)\n"
<< " 1K RAM bank 3 (hotspot $FFE7)\n"
<< " $F400 - $F7FF (R), $F000 - $F3FF (W)\n"
<< "256B RAM accessible @ $F800 - $F9FF\n"
<< " RAM banks 0 - 3 (hotspots $FFE8 - $FFEB)\n"
<< " $F900 - $F9FF (R), $F800 - $F8FF (W)\n"
<< "Upper 1.5K ROM accessible @ $FA00 - $FFFF\n"
<< " Always points to last 1.5K of ROM\n"
<< "Startup segments = 0 / 0 or undetermined\n";
#if 0
// Eventually, we should query this from the debugger/disassembler
uInt16 start = (cart.myImage[size - 3] << 8) | cart.myImage[size - 4];
start -= start % 0x1000;
info << "Bank RORG" << " = $" << HEX4 << start << "\n";
#endif
initialize(boss, cart, info);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const char* CartridgeE78KWidget::getSpotLower(int idx)
{
static constexpr std::array<const char*, 4> spot_lower = {
"#0 - ROM ($FFE4)", "#1 - ROM ($FFE5)", "#2 - ROM ($FFE6)", "#3 - RAM ($FFE7)"
};
return spot_lower[idx];
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const char* CartridgeE78KWidget::getSpotUpper(int idx)
{
static constexpr std::array<const char*, 4> spot_upper = {
"#0 - RAM ($FFE8)", "#1 - RAM ($FFE9)", "#2 - RAM ($FFEA)", "#3 - RAM ($FFEB)"
};
return spot_upper[idx];
}

View File

@ -1,45 +0,0 @@
//============================================================================
//
// 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-2021 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 CARTRIDGEE78K_WIDGET_HXX
#define CARTRIDGEE78K_WIDGET_HXX
#include "CartMNetworkWidget.hxx"
class CartridgeE78KWidget : public CartridgeMNetworkWidget
{
public:
CartridgeE78KWidget(GuiObject* boss, const GUI::Font& lfont,
const GUI::Font& nfont,
int x, int y, int w, int h,
CartridgeMNetwork& cart);
~CartridgeE78KWidget() override = default;
protected:
const char* getSpotLower(int idx) override;
const char* getSpotUpper(int idx) override;
private:
// Following constructors and assignment operators not supported
CartridgeE78KWidget() = delete;
CartridgeE78KWidget(const CartridgeE78KWidget&) = delete;
CartridgeE78KWidget(CartridgeE78KWidget&&) = delete;
CartridgeE78KWidget& operator=(const CartridgeE78KWidget&) = delete;
CartridgeE78KWidget& operator=(CartridgeE78KWidget&&) = delete;
};
#endif

View File

@ -1,71 +0,0 @@
//============================================================================
//
// 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-2021 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 "CartMNetwork.hxx"
#include "CartE7Widget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeE7Widget::CartridgeE7Widget(
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
int x, int y, int w, int h,
CartridgeMNetwork& cart)
: CartridgeMNetworkWidget(boss, lfont, nfont, x, y, w, h, cart)
{
ostringstream info;
info << "E7 cartridge, eight 2K banks ROM + 2K RAM,\n"
<< " mapped into three segments\n"
<< "Lower 2K accessible @ $F000 - $F7FF\n"
<< " ROM Banks 0 - 6 (hotspots $FFE0 to $FFE6)\n"
<< " 1K RAM Bank 7 (hotspot $FFE7)\n"
<< " $F400 - $F7FF (R), $F000 - $F3FF (W)\n"
<< "256B RAM accessible @ $F800 - $F9FF\n"
<< " RAM banks 0 - 3 (hotspots $FFE8 - $FFEB)\n"
<< " $F900 - $F9FF (R), $F800 - $F8FF (W)\n"
<< "Upper 1.5K ROM accessible @ $FA00 - $FFFF\n"
<< " Always points to last 1.5K of ROM\n"
<< "Startup segments = 0 / 0 or undetermined\n";
#if 0
// Eventually, we should query this from the debugger/disassembler
uInt16 start = (cart.myImage[size-3] << 8) | cart.myImage[size-4];
start -= start % 0x1000;
info << "Bank RORG" << " = $" << HEX4 << start << "\n";
#endif
initialize(boss, cart, info);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const char* CartridgeE7Widget::getSpotLower(int idx)
{
static constexpr std::array<const char*, 8> spot_lower = {
"#0 - ROM ($FFE0)", "#1 - ROM ($FFE1)", "#2 - ROM ($FFE2)", "#3 - ROM ($FFE3)",
"#4 - ROM ($FFE4)", "#5 - ROM ($FFE5)", "#6 - ROM ($FFE6)", "#7 - RAM ($FFE7)"
};
return spot_lower[idx];
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const char* CartridgeE7Widget::getSpotUpper(int idx)
{
static constexpr std::array<const char*, 4> spot_upper = {
"#0 - RAM ($FFE8)", "#1 - RAM ($FFE9)", "#2 - RAM ($FFEA)", "#3 - RAM ($FFEB)"
};
return spot_upper[idx];
}

View File

@ -1,45 +0,0 @@
//============================================================================
//
// 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-2021 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 CARTRIDGEE7_WIDGET_HXX
#define CARTRIDGEE7_WIDGET_HXX
#include "CartMNetworkWidget.hxx"
class CartridgeE7Widget : public CartridgeMNetworkWidget
{
public:
CartridgeE7Widget(GuiObject* boss, const GUI::Font& lfont,
const GUI::Font& nfont,
int x, int y, int w, int h,
CartridgeMNetwork& cart);
~CartridgeE7Widget() override = default;
protected:
const char* getSpotLower(int idx) override;
const char* getSpotUpper(int idx) override;
private:
// Following constructors and assignment operators not supported
CartridgeE7Widget() = delete;
CartridgeE7Widget(const CartridgeE7Widget&) = delete;
CartridgeE7Widget(CartridgeE7Widget&&) = delete;
CartridgeE7Widget& operator=(const CartridgeE7Widget&) = delete;
CartridgeE7Widget& operator=(CartridgeE7Widget&&) = delete;
};
#endif

View File

@ -15,7 +15,6 @@
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
//#include "CartE7.hxx"
#include "CartMNetwork.hxx"
#include "PopUpWidget.hxx"
#include "CartMNetworkWidget.hxx"
@ -28,6 +27,33 @@ CartridgeMNetworkWidget::CartridgeMNetworkWidget(
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
myCart{cart}
{
ostringstream info;
info << "E7 cartridge, "
<< (myCart.romBankCount() == 4 ? "four" : "eight")
<< " 2K banks ROM + 2K RAM, \n"
<< " mapped into three segments\n"
<< "Lower 2K accessible @ $F000 - $F7FF\n"
<< (myCart.romBankCount() == 4
? " ROM banks 0 - 2 (hotspots $FFE4 to $FFE6)\n"
: " ROM Banks 0 - 6 (hotspots $FFE0 to $FFE6)\n")
<< " 1K RAM bank 3 (hotspot $FFE7)\n"
<< " $F400 - $F7FF (R), $F000 - $F3FF (W)\n"
<< "256B RAM accessible @ $F800 - $F9FF\n"
<< " RAM banks 0 - 3 (hotspots $FFE8 - $FFEB)\n"
<< " $F900 - $F9FF (R), $F800 - $F8FF (W)\n"
<< "Upper 1.5K ROM accessible @ $FA00 - $FFFF\n"
<< " Always points to last 1.5K of ROM\n"
<< "Startup segments = 0 / 0 or undetermined\n";
#if 0
// Eventually, we should query this from the debugger/disassembler
uInt16 start = (cart.myImage[size - 3] << 8) | cart.myImage[size - 4];
start -= start % 0x1000;
info << "Bank RORG" << " = $" << HEX4 << start << "\n";
#endif
initialize(boss, cart, info);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -172,3 +198,31 @@ uInt8 CartridgeMNetworkWidget::internalRamGetValue(int addr)
{
return myCart.myRAM[addr];
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const char* CartridgeMNetworkWidget::getSpotLower(int idx)
{
static constexpr std::array<const char*, 4> spot_lower_8K = {
"#0 - ROM ($FFE4)", "#1 - ROM ($FFE5)", "#2 - ROM ($FFE6)", "#3 - RAM ($FFE7)"
};
static constexpr std::array<const char*, 8> spot_lower_16K = {
"#0 - ROM ($FFE0)", "#1 - ROM ($FFE1)", "#2 - ROM ($FFE2)", "#3 - ROM ($FFE3)",
"#4 - ROM ($FFE4)", "#5 - ROM ($FFE5)", "#6 - ROM ($FFE6)", "#7 - RAM ($FFE7)"
};
return myCart.romBankCount() == 4
? spot_lower_8K[idx]
: spot_lower_16K[idx];
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const char* CartridgeMNetworkWidget::getSpotUpper(int idx)
{
static constexpr std::array<const char*, 4> spot_upper = {
"#0 - RAM ($FFE8)", "#1 - RAM ($FFE9)", "#2 - RAM ($FFEA)", "#3 - RAM ($FFEB)"
};
return spot_upper[idx];
}

View File

@ -55,8 +55,8 @@ class CartridgeMNetworkWidget : public CartDebugWidget
protected:
void initialize(GuiObject* boss, CartridgeMNetwork& cart, ostringstream& info);
virtual const char* getSpotLower(int idx) = 0;
virtual const char* getSpotUpper(int idx) = 0;
virtual const char* getSpotLower(int idx);
virtual const char* getSpotUpper(int idx);
private:
void saveOldState() override;

View File

@ -124,8 +124,7 @@ Bankswitch::BSList = {{
{ "DPC" , "DPC (Pitfall II)" },
{ "DPC+" , "DPC+ (Enhanced DPC)" },
{ "E0" , "E0 (8K Parker Bros)" },
{ "E7" , "E7 (16K M Network)" },
{ "E78K" , "E78K (8K M Network)" },
{ "E7" , "E7 (8-16K M Network)" },
{ "EF" , "EF (64K H. Runner)" },
{ "EFSC" , "EFSC (64K H. Runner + RAM)" },
{ "F0" , "F0 (Dynacom Megaboy)" },
@ -207,8 +206,8 @@ Bankswitch::ExtensionMap Bankswitch::ourExtensions = {
{ "DPCP" , Bankswitch::Type::_DPCP },
{ "E0" , Bankswitch::Type::_E0 },
{ "E7" , Bankswitch::Type::_E7 },
{ "E78" , Bankswitch::Type::_E78K },
{ "E78K" , Bankswitch::Type::_E78K },
{ "E78" , Bankswitch::Type::_E7 },
{ "E78K" , Bankswitch::Type::_E7 },
{ "EF" , Bankswitch::Type::_EF },
{ "EFS" , Bankswitch::Type::_EFSC },
{ "EFSC" , Bankswitch::Type::_EFSC },
@ -271,7 +270,6 @@ Bankswitch::NameToTypeMap Bankswitch::ourNameToTypes = {
{ "DPC+" , Bankswitch::Type::_DPCP },
{ "E0" , Bankswitch::Type::_E0 },
{ "E7" , Bankswitch::Type::_E7 },
{ "E78K" , Bankswitch::Type::_E78K },
{ "EF" , Bankswitch::Type::_EF },
{ "EFSC" , Bankswitch::Type::_EFSC },
{ "F0" , Bankswitch::Type::_F0 },

View File

@ -42,10 +42,10 @@ class Bankswitch
_64IN1, _128IN1, _2K, _3E, _3EX, _3EP, _3F,
_4A50, _4K, _4KSC, _AR, _BF, _BFSC, _BUS,
_CDF, _CM, _CTY, _CV, _DF, _DFSC, _DPC,
_DPCP, _E0, _E7, _E78K, _EF, _EFSC, _F0,
_F4, _F4SC, _F6, _F6SC, _F8, _F8SC, _FA,
_FA2, _FC, _FE, _MDM, _MVC, _SB, _TVBOY,
_UA, _UASW, _WD, _WDSW, _X07,
_DPCP, _E0, _E7, _EF, _EFSC, _F0, _F4,
_F4SC, _F6, _F6SC, _F8, _F8SC, _FA, _FA2,
_FC, _FE, _MDM, _MVC, _SB, _TVBOY, _UA,
_UASW, _WD, _WDSW, _X07,
#ifdef CUSTOM_ARM
_CUSTOM,
#endif

View File

@ -39,8 +39,7 @@
#include "CartDPC.hxx"
#include "CartDPCPlus.hxx"
#include "CartE0.hxx"
#include "CartE7.hxx"
#include "CartE78K.hxx"
#include "CartMNetwork.hxx"
#include "CartEF.hxx"
#include "CartEFSC.hxx"
#include "CartF0.hxx"
@ -307,9 +306,7 @@ CartCreator::createFromImage(const ByteBuffer& image, size_t size, Bankswitch::T
case Bankswitch::Type::_E0:
return make_unique<CartridgeE0>(image, size, md5, settings);
case Bankswitch::Type::_E7:
return make_unique<CartridgeE7>(image, size, md5, settings);
case Bankswitch::Type::_E78K:
return make_unique<CartridgeE78K>(image, size, md5, settings);
return make_unique<CartridgeMNetwork>(image, size, md5, settings);
case Bankswitch::Type::_EF:
return make_unique<CartridgeEF>(image, size, md5, settings);
case Bankswitch::Type::_EFSC:

View File

@ -80,7 +80,7 @@ Bankswitch::Type CartDetector::autodetectType(const ByteBuffer& image, size_t si
else if(isProbably0840(image, size))
type = Bankswitch::Type::_0840;
else if(isProbablyE78K(image, size))
type = Bankswitch::Type::_E78K;
type = Bankswitch::Type::_E7;
else if (isProbablyWD(image,size))
type = Bankswitch::Type::_WD;
else if (isProbablyFC(image, size))

View File

@ -1,41 +0,0 @@
//============================================================================
//
// 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-2021 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 "CartE7.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeE7::CartridgeE7(const ByteBuffer& image, size_t size,
const string& md5, const Settings& settings)
: CartridgeMNetwork(image, size, md5, settings)
{
initialize(image, size);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeE7::checkSwitchBank(uInt16 address)
{
// Switch banks if necessary
if((address >= 0x0FE0) && (address <= 0x0FE7))
{
bank(address & 0x0007);
}
else if((address >= 0x0FE8) && (address <= 0x0FEB))
{
bankRAM(address & 0x0003);
}
}

View File

@ -1,85 +0,0 @@
//============================================================================
//
// 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-2021 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 CARTRIDGEE7_HXX
#define CARTRIDGEE7_HXX
class System;
#include "bspf.hxx"
#include "Cart.hxx"
#ifdef DEBUGGER_SUPPORT
#include "CartE7Widget.hxx"
#endif
#include "CartMNetwork.hxx"
/**
This is the cartridge class for 16K M-Network bankswitched games.
@author Bradford W. Mott, Thomas Jentzsch
*/
class CartridgeE7 : public CartridgeMNetwork
{
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)
*/
CartridgeE7(const ByteBuffer& image, size_t size, const string& md5,
const Settings& settings);
~CartridgeE7() 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 "CartridgeE7"; }
#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 CartridgeE7Widget(boss, lfont, nfont, x, y, w, h, *this);
}
#endif
private:
/**
Check hotspots and switch bank if triggered.
*/
void checkSwitchBank(uInt16 address) override;
private:
// Following constructors and assignment operators not supported
CartridgeE7() = delete;
CartridgeE7(const CartridgeE7&) = delete;
CartridgeE7(CartridgeE7&&) = delete;
CartridgeE7& operator=(const CartridgeE7&) = delete;
CartridgeE7& operator=(CartridgeE7&&) = delete;
};
#endif

View File

@ -1,41 +0,0 @@
//============================================================================
//
// 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-2021 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 "CartE78K.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeE78K::CartridgeE78K(const ByteBuffer& image, size_t size,
const string& md5, const Settings& settings)
: CartridgeMNetwork(image, size, md5, settings)
{
initialize(image, size);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeE78K::checkSwitchBank(uInt16 address)
{
// Switch banks if necessary
if((address >= 0x0FE4) && (address <= 0x0FE7))
{
bank(address & 0x0003);
}
else if((address >= 0x0FE8) && (address <= 0x0FEB))
{
bankRAM(address & 0x0003);
}
}

View File

@ -1,83 +0,0 @@
//============================================================================
//
// 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-2021 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 CARTRIDGE_E78K_HXX
#define CARTRIDGE_E78K_HXX
#include "bspf.hxx"
#include "Cart.hxx"
#ifdef DEBUGGER_SUPPORT
#include "CartE78KWidget.hxx"
#endif
#include "CartMNetwork.hxx"
/**
This is the cartridge class for 8K M-Network bankswitched games.
@author Bradford W. Mott, Thomas Jentzsch
*/
class CartridgeE78K : public CartridgeMNetwork
{
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)
*/
CartridgeE78K(const ByteBuffer& image, size_t size, const string& md5,
const Settings& settings);
~CartridgeE78K() 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 "CartridgeE78K"; }
#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 CartridgeE78KWidget(boss, lfont, nfont, x, y, w, h, *this);
}
#endif
private:
/**
Check hotspots and switch bank if triggered.
*/
void checkSwitchBank(uInt16 address) override;
private:
// Following constructors and assignment operators not supported
CartridgeE78K() = delete;
CartridgeE78K(const CartridgeE78K&) = delete;
CartridgeE78K(CartridgeE78K&&) = delete;
CartridgeE78K& operator=(const CartridgeE78K&) = delete;
CartridgeE78K& operator=(CartridgeE78K&&) = delete;
};
#endif

View File

@ -24,6 +24,7 @@ CartridgeMNetwork::CartridgeMNetwork(const ByteBuffer& image, size_t size,
: Cartridge(settings, md5),
mySize{size}
{
initialize(image, size);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -106,6 +107,24 @@ void CartridgeMNetwork::install(System& system)
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeMNetwork::checkSwitchBank(uInt16 address)
{
// Switch banks if necessary
if(romBankCount() == 4 && (address >= 0x0FE4) && (address <= 0x0FE7))
{
bank(address & 0x0003);
}
else if(romBankCount() == 8 && (address >= 0x0FE0) && (address <= 0x0FE7))
{
bank(address & 0x0007);
}
else if((address >= 0x0FE8) && (address <= 0x0FEB))
{
bankRAM(address & 0x0003);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 CartridgeMNetwork::peek(uInt16 address)
{

View File

@ -22,6 +22,10 @@
#include "System.hxx"
#include "bspf.hxx"
#include "Cart.hxx"
#ifdef DEBUGGER_SUPPORT
#include "CartMNetworkWidget.hxx"
#endif
/**
This is the abstract cartridge class for M-Network
@ -50,8 +54,8 @@
read port. You select which 256 byte block appears
here by accessing 1FE8 to 1FEB.
This cart reports having 8 banks; 1 for each of the possible 7
bank in the lower 2K area, and the last for RAM in the lower
This cart reports having 8 banks; one for each of the possible
7 banks in the lower 2K area, and the last for RAM in the lower
2K area."
There are 8K, 12K and 16K variations, with or without RAM.
@ -61,8 +65,6 @@
class CartridgeMNetwork : public Cartridge
{
friend class CartridgeMNetworkWidget;
friend class CartridgeE7Widget;
friend class CartridgeE78KWidget;
public:
/**
@ -163,6 +165,25 @@ class CartridgeMNetwork : public Cartridge
*/
bool poke(uInt16 address, uInt8 value) override;
/**
Get a descriptor for the device name (used in error checking).
@return The name of the object
*/
string name() const override { return "CartridgeE7"; }
#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 CartridgeMNetworkWidget(boss, lfont, nfont, x, y, w, h, *this);
}
#endif
protected:
/**
Class initialization
@ -176,6 +197,11 @@ class CartridgeMNetwork : public Cartridge
*/
void bankRAM(uInt16 bank);
/**
Check hotspots and switch bank if triggered.
*/
void checkSwitchBank(uInt16 address);
// Size of a ROM or RAM bank
static constexpr uInt32 BANK_SIZE = 0x800; // 2K
@ -190,11 +216,6 @@ class CartridgeMNetwork : public Cartridge
*/
uInt16 romSize() const;
/**
Check hotspots and switch bank if triggered.
*/
virtual void checkSwitchBank(uInt16 address) = 0;
void setAccess(uInt16 addrFrom, uInt16 size, uInt16 directOffset, uInt8* directData,
uInt16 codeOffset, System::PageAccessType type, uInt16 addrMask = 0);

View File

@ -624,12 +624,6 @@
<ClCompile Include="..\debugger\gui\CartE0Widget.cxx">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-NoDebugger|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\debugger\gui\CartE78KWidget.cxx">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-NoDebugger|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\debugger\gui\CartE7Widget.cxx">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-NoDebugger|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\debugger\gui\CartEFSCWidget.cxx">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-NoDebugger|x64'">true</ExcludedFromBuild>
</ClCompile>
@ -758,7 +752,6 @@
<ClCompile Include="..\emucore\CartFC.cxx" />
<ClCompile Include="..\emucore\CartMDM.cxx" />
<ClCompile Include="..\emucore\CartMNetwork.cxx" />
<ClCompile Include="..\emucore\CartE78K.cxx" />
<ClCompile Include="..\emucore\CartMVC.cxx" />
<ClCompile Include="..\emucore\CartTVBoy.cxx" />
<ClCompile Include="..\emucore\CartWD.cxx" />
@ -844,7 +837,6 @@
<ClCompile Include="..\emucore\CartDPC.cxx" />
<ClCompile Include="..\emucore\CartDPCPlus.cxx" />
<ClCompile Include="..\emucore\CartE0.cxx" />
<ClCompile Include="..\emucore\CartE7.cxx" />
<ClCompile Include="..\emucore\CartEF.cxx" />
<ClCompile Include="..\emucore\CartEFSC.cxx" />
<ClCompile Include="..\emucore\CartF0.cxx" />
@ -1686,12 +1678,6 @@
<ClInclude Include="..\debugger\gui\CartE0Widget.hxx">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-NoDebugger|x64'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="..\debugger\gui\CartE78KWidget.hxx">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-NoDebugger|x64'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="..\debugger\gui\CartE7Widget.hxx">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-NoDebugger|x64'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="..\debugger\gui\CartEFSCWidget.hxx">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-NoDebugger|x64'">true</ExcludedFromBuild>
</ClInclude>
@ -1831,7 +1817,6 @@
<ClInclude Include="..\emucore\CartFC.hxx" />
<ClInclude Include="..\emucore\CartMDM.hxx" />
<ClInclude Include="..\emucore\CartMNetwork.hxx" />
<ClInclude Include="..\emucore\CartE78K.hxx" />
<ClInclude Include="..\emucore\CartMVC.hxx" />
<ClInclude Include="..\emucore\CartTVBoy.hxx" />
<ClInclude Include="..\emucore\CartWD.hxx" />
@ -1939,7 +1924,6 @@
<ClInclude Include="..\emucore\CartDPC.hxx" />
<ClInclude Include="..\emucore\CartDPCPlus.hxx" />
<ClInclude Include="..\emucore\CartE0.hxx" />
<ClInclude Include="..\emucore\CartE7.hxx" />
<ClInclude Include="..\emucore\CartEF.hxx" />
<ClInclude Include="..\emucore\CartEFSC.hxx" />
<ClInclude Include="..\emucore\CartF0.hxx" />

View File

@ -153,9 +153,6 @@
<ClCompile Include="..\emucore\CartE0.cxx">
<Filter>Source Files\emucore</Filter>
</ClCompile>
<ClCompile Include="..\emucore\CartE7.cxx">
<Filter>Source Files\emucore</Filter>
</ClCompile>
<ClCompile Include="..\emucore\CartEF.cxx">
<Filter>Source Files\emucore</Filter>
</ClCompile>
@ -639,9 +636,6 @@
<ClCompile Include="..\debugger\gui\CartE0Widget.cxx">
<Filter>Source Files\debugger</Filter>
</ClCompile>
<ClCompile Include="..\debugger\gui\CartE7Widget.cxx">
<Filter>Source Files\debugger</Filter>
</ClCompile>
<ClCompile Include="..\debugger\gui\CartEFSCWidget.cxx">
<Filter>Source Files\debugger</Filter>
</ClCompile>
@ -861,15 +855,9 @@
<ClCompile Include="..\emucore\CartMNetwork.cxx">
<Filter>Source Files\emucore</Filter>
</ClCompile>
<ClCompile Include="..\emucore\CartE78K.cxx">
<Filter>Source Files\emucore</Filter>
</ClCompile>
<ClCompile Include="..\debugger\gui\CartMNetworkWidget.cxx">
<Filter>Source Files\debugger</Filter>
</ClCompile>
<ClCompile Include="..\debugger\gui\CartE78KWidget.cxx">
<Filter>Source Files\debugger</Filter>
</ClCompile>
<ClCompile Include="..\gui\TimeMachine.cxx">
<Filter>Source Files\gui</Filter>
</ClCompile>
@ -1196,9 +1184,6 @@
<ClInclude Include="..\emucore\CartE0.hxx">
<Filter>Header Files\emucore</Filter>
</ClInclude>
<ClInclude Include="..\emucore\CartE7.hxx">
<Filter>Header Files\emucore</Filter>
</ClInclude>
<ClInclude Include="..\emucore\CartEF.hxx">
<Filter>Header Files\emucore</Filter>
</ClInclude>
@ -1709,9 +1694,6 @@
<ClInclude Include="..\debugger\gui\CartE0Widget.hxx">
<Filter>Header Files\debugger</Filter>
</ClInclude>
<ClInclude Include="..\debugger\gui\CartE7Widget.hxx">
<Filter>Header Files\debugger</Filter>
</ClInclude>
<ClInclude Include="..\debugger\gui\CartEFSCWidget.hxx">
<Filter>Header Files\debugger</Filter>
</ClInclude>
@ -1976,15 +1958,9 @@
<ClInclude Include="..\emucore\CartMNetwork.hxx">
<Filter>Header Files\emucore</Filter>
</ClInclude>
<ClInclude Include="..\emucore\CartE78K.hxx">
<Filter>Header Files\emucore</Filter>
</ClInclude>
<ClInclude Include="..\debugger\gui\CartMNetworkWidget.hxx">
<Filter>Header Files\debugger</Filter>
</ClInclude>
<ClInclude Include="..\debugger\gui\CartE78KWidget.hxx">
<Filter>Header Files\debugger</Filter>
</ClInclude>
<ClInclude Include="..\gui\DeveloperDialog.hxx">
<Filter>Header Files\gui</Filter>
</ClInclude>

Binary file not shown.