'Cartridge.StartBank' ROM property is now used by the core.

This commit is contained in:
Stephen Anthony 2018-09-14 20:57:36 -02:30
parent f0889a26dd
commit 31f6dba87d
70 changed files with 229 additions and 263 deletions

View File

@ -99,6 +99,9 @@
* Updated PAL palette.
* Added 'Cartridge.StartBank' ROM property, to force a ROM to use a
specific bank for its reset vector.
* Added recently released 'Arkyology' prototype ROM to the database.
* For UNIX systems: in the ROM launcher, when using symlinks use the

View File

@ -3551,6 +3551,11 @@ Ms Pac-Man (Stella extended codes):
sound mods. The value must be <b>Mono</b> or <b>Stereo</b>.</td>
</tr>
<tr>
<td VALIGN="TOP"><i>Cartridge.StartBank:</i></td>
<td>Indicates which bank to use for reading the reset vector.</td>
</tr>
<tr>
<td VALIGN="TOP"><a name="PropertiesCartType"><i>Cartridge.Type:</i></a></td>
<td>Indicates the bank-switching type for the game.

View File

@ -30,7 +30,7 @@ Cartridge0840Widget::Cartridge0840Widget(
ostringstream info;
info << "0840 ECONObanking, two 4K banks\n"
<< "Startup bank = " << cart.myStartBank << "\n";
<< "Startup bank = " << cart.startBank() << "\n";
// Eventually, we should query this from the debugger/disassembler
for(uInt32 i = 0, offset = 0xFFC, spot = 0x800; i < 2;

View File

@ -37,10 +37,10 @@ Cartridge3EWidget::Cartridge3EWidget(
"First 2K (RAM) selected by writing to $3E\n"
" $F000 - $F3FF (R), $F400 - $F7FF (W)\n"
"Last 2K always points to last 2K of ROM\n";
if(cart.myStartBank < myNumRomBanks)
info << "Startup bank = " << cart.myStartBank << " (ROM)\n";
if(cart.startBank() < myNumRomBanks)
info << "Startup bank = " << cart.startBank() << " (ROM)\n";
else
info << "Startup bank = " << (cart.myStartBank-myNumRomBanks) << " (RAM)\n";
info << "Startup bank = " << (cart.startBank()-myNumRomBanks) << " (RAM)\n";
// Eventually, we should query this from the debugger/disassembler
uInt16 start = (cart.myImage[size-3] << 8) | cart.myImage[size-4];

View File

@ -30,7 +30,7 @@ Cartridge3FWidget::Cartridge3FWidget(
ostringstream info;
info << "Tigervision 3F cartridge, 2-256 2K banks\n"
<< "Startup bank = " << cart.myStartBank << " or undetermined\n"
<< "Startup bank = " << cart.startBank() << " or undetermined\n"
<< "First 2K bank selected by writing to $3F\n"
<< "Last 2K always points to last 2K of ROM\n";

View File

@ -34,7 +34,7 @@ CartridgeBFSCWidget::CartridgeBFSCWidget(
info << "256K BFSC + RAM, 64 4K banks\n"
<< "128 bytes RAM @ $F000 - $F0FF\n"
<< " $F080 - $F0FF (R), $F000 - $F07F (W)\n"
<< "Startup bank = " << cart.myStartBank << "\n";
<< "Startup bank = " << cart.startBank() << "\n";
// Eventually, we should query this from the debugger/disassembler
for(uInt32 i = 0, offset = 0xFFC, spot = 0xF80; i < 64; ++i, offset += 0x1000)

View File

@ -30,7 +30,7 @@ CartridgeBFWidget::CartridgeBFWidget(
ostringstream info;
info << "BF cartridge, 64 4K banks\n"
<< "Startup bank = " << cart.myStartBank << "\n";
<< "Startup bank = " << cart.startBank() << "\n";
// Eventually, we should query this from the debugger/disassembler
for(uInt32 i = 0, offset = 0xFFC, spot = 0xF80; i < 64; ++i, offset += 0x1000)

View File

@ -35,7 +35,7 @@ CartridgeBUSWidget::CartridgeBUSWidget(
<< "8K BUS RAM\n"
<< "BUS registers accessible @ $FFEE - $FFF3\n"
<< "Banks accessible at hotspots $FFFF to $FFFB\n"
<< "Startup bank = " << cart.myStartBank << "\n";
<< "Startup bank = " << cart.startBank() << "\n";
#if 0
// Eventually, we should query this from the debugger/disassembler

View File

@ -35,7 +35,7 @@ CartridgeCDFWidget::CartridgeCDFWidget(
<< "8K CDF RAM\n"
<< "CDF registers accessible @ $FFF0 - $FFF3\n"
<< "Banks accessible at hotspots $FFF5 to $FFFB\n"
<< "Startup bank = " << cart.myStartBank << "\n";
<< "Startup bank = " << cart.startBank() << "\n";
#if 0
// Eventually, we should query this from the debugger/disassembler

View File

@ -35,7 +35,7 @@ CartridgeCVPlusWidget::CartridgeCVPlusWidget(
<< "1024 bytes RAM @ $F000 - $F7FF\n"
<< " $F000 - $F3FF (R), $F400 - $F7FF (W)\n"
<< "2048 bytes ROM @ $F800 - $FFFF, by writing to $3D\n"
<< "Startup bank = " << cart.myStartBank << "\n";
<< "Startup bank = " << cart.startBank() << "\n";
int xpos = 10,
ypos = addBaseInformation(size, "LS_Dracon / Stephen Anthony",

View File

@ -34,7 +34,7 @@ CartridgeDFSCWidget::CartridgeDFSCWidget(
info << "128K DFSC + RAM, 32 4K banks\n"
<< "128 bytes RAM @ $F000 - $F0FF\n"
<< " $F080 - $F0FF (R), $F000 - $F07F (W)\n"
<< "Startup bank = " << cart.myStartBank << "\n";
<< "Startup bank = " << cart.startBank() << "\n";
// Eventually, we should query this from the debugger/disassembler
for(uInt32 i = 0, offset = 0xFFC, spot = 0xFC0; i < 32; ++i, offset += 0x1000)

View File

@ -30,7 +30,7 @@ CartridgeDFWidget::CartridgeDFWidget(
ostringstream info;
info << "EF 2 cartridge, 32 4K banks\n"
<< "Startup bank = " << cart.myStartBank << "\n";
<< "Startup bank = " << cart.startBank() << "\n";
// Eventually, we should query this from the debugger/disassembler
for(uInt32 i = 0, offset = 0xFFC, spot = 0xFD0; i < 32; ++i, offset += 0x1000)

View File

@ -35,7 +35,7 @@ CartridgeDPCPlusWidget::CartridgeDPCPlusWidget(
<< "DPC registers accessible @ $F000 - $F07F\n"
<< " $F000 - $F03F (R), $F040 - $F07F (W)\n"
<< "Banks accessible at hotspots $FFF6 to $FFFB\n"
<< "Startup bank = " << cart.myStartBank << "\n";
<< "Startup bank = " << cart.startBank() << "\n";
#if 0
// Eventually, we should query this from the debugger/disassembler

View File

@ -34,7 +34,7 @@ CartridgeDPCWidget::CartridgeDPCWidget(
<< "DPC registers accessible @ $F000 - $F07F\n"
<< " $F000 - $F03F (R), $F040 - $F07F (W)\n"
<< "Startup bank = " << cart.myStartBank << " or undetermined\n";
<< "Startup bank = " << cart.startBank() << " or undetermined\n";
// Eventually, we should query this from the debugger/disassembler
for(uInt32 i = 0, offset = 0xFFC, spot = 0xFF8; i < 2; ++i, offset += 0x1000)

View File

@ -34,7 +34,7 @@ CartridgeEFSCWidget::CartridgeEFSCWidget(
info << "64K H. Runner EFSC + RAM, 16 4K banks\n"
<< "128 bytes RAM @ $F000 - $F0FF\n"
<< " $F080 - $F0FF (R), $F000 - $F07F (W)\n"
<< "Startup bank = " << cart.myStartBank << "\n";
<< "Startup bank = " << cart.startBank() << "\n";
// Eventually, we should query this from the debugger/disassembler
for(uInt32 i = 0, offset = 0xFFC, spot = 0xFE0; i < 16; ++i, offset += 0x1000)

View File

@ -30,7 +30,7 @@ CartridgeEFWidget::CartridgeEFWidget(
ostringstream info;
info << "64K H. Runner EF cartridge, 16 4K banks\n"
<< "Startup bank = " << cart.myStartBank << "\n";
<< "Startup bank = " << cart.startBank() << "\n";
// Eventually, we should query this from the debugger/disassembler
for(uInt32 i = 0, offset = 0xFFC, spot = 0xFE0; i < 16; ++i, offset += 0x1000)

View File

@ -30,7 +30,7 @@ CartridgeF0Widget::CartridgeF0Widget(
ostringstream info;
info << "64K Megaboy F0 cartridge, 16 4K banks\n"
<< "Startup bank = " << cart.myStartBank << " or undetermined\n"
<< "Startup bank = " << cart.startBank() << " or undetermined\n"
<< "Bankswitch triggered by accessing $1FF0\n";
// Eventually, we should query this from the debugger/disassembler

View File

@ -34,7 +34,7 @@ CartridgeF4SCWidget::CartridgeF4SCWidget(
info << "Standard F4SC cartridge, eight 4K banks\n"
<< "128 bytes RAM @ $F000 - $F0FF\n"
<< " $F080 - $F0FF (R), $F000 - $F07F (W)\n"
<< "Startup bank = " << cart.myStartBank << " or undetermined\n";
<< "Startup bank = " << cart.startBank() << " or undetermined\n";
// Eventually, we should query this from the debugger/disassembler
for(uInt32 i = 0, offset = 0xFFC, spot = 0xFF4; i < 8; ++i, offset += 0x1000)

View File

@ -30,7 +30,7 @@ CartridgeF4Widget::CartridgeF4Widget(
ostringstream info;
info << "Standard F4 cartridge, eight 4K banks\n"
<< "Startup bank = " << cart.myStartBank << " or undetermined\n";
<< "Startup bank = " << cart.startBank() << " or undetermined\n";
// Eventually, we should query this from the debugger/disassembler
for(uInt32 i = 0, offset = 0xFFC, spot = 0xFF4; i < 8; ++i, offset += 0x1000)

View File

@ -34,7 +34,7 @@ CartridgeF6SCWidget::CartridgeF6SCWidget(
info << "Standard F6SC cartridge, four 4K banks\n"
<< "128 bytes RAM @ $F000 - $F0FF\n"
<< " $F080 - $F0FF (R), $F000 - $F07F (W)\n"
<< "Startup bank = " << cart.myStartBank << " or undetermined\n";
<< "Startup bank = " << cart.startBank() << " or undetermined\n";
// Eventually, we should query this from the debugger/disassembler
for(uInt32 i = 0, offset = 0xFFC, spot = 0xFF6; i < 4; ++i, offset += 0x1000)

View File

@ -30,7 +30,7 @@ CartridgeF6Widget::CartridgeF6Widget(
ostringstream info;
info << "Standard F6 cartridge, four 4K banks\n"
<< "Startup bank = " << cart.myStartBank << " or undetermined\n";
<< "Startup bank = " << cart.startBank() << " or undetermined\n";
// Eventually, we should query this from the debugger/disassembler
for(uInt32 i = 0, offset = 0xFFC, spot = 0xFF6; i < 4; ++i, offset += 0x1000)

View File

@ -34,7 +34,7 @@ CartridgeF8SCWidget::CartridgeF8SCWidget(
info << "Standard F8SC cartridge, two 4K banks\n"
<< "128 bytes RAM @ $F000 - $F0FF\n"
<< " $F080 - $F0FF (R), $F000 - $F07F (W)\n"
<< "Startup bank = " << cart.myStartBank << " or undetermined\n";
<< "Startup bank = " << cart.startBank() << " or undetermined\n";
// Eventually, we should query this from the debugger/disassembler
for(uInt32 i = 0, offset = 0xFFC, spot = 0xFF8; i < 2; ++i, offset += 0x1000)

View File

@ -30,7 +30,7 @@ CartridgeF8Widget::CartridgeF8Widget(
ostringstream info;
info << "Standard F8 cartridge, two 4K banks\n"
<< "Startup bank = " << cart.myStartBank << " or undetermined\n";
<< "Startup bank = " << cart.startBank() << " or undetermined\n";
// Eventually, we should query this from the debugger/disassembler
for(uInt32 i = 0, offset = 0xFFC, spot = 0xFF8; i < 2; ++i, offset += 0x1000)

View File

@ -35,7 +35,7 @@ CartridgeFA2Widget::CartridgeFA2Widget(
<< "256 bytes RAM @ $F000 - $F1FF\n"
<< " $F100 - $F1FF (R), $F000 - $F0FF (W)\n"
<< "RAM can be loaded/saved to Harmony flash by accessing $FFF4\n"
<< "Startup bank = " << cart.myStartBank << " or undetermined\n";
<< "Startup bank = " << cart.startBank() << " or undetermined\n";
// Eventually, we should query this from the debugger/disassembler
for(uInt32 i = 0, offset = 0xFFC, spot = 0xFF5; i < cart.bankCount();

View File

@ -34,7 +34,7 @@ CartridgeFAWidget::CartridgeFAWidget(
info << "CBS RAM+ FA cartridge, three 4K banks\n"
<< "256 bytes RAM @ $F000 - $F1FF\n"
<< " $F100 - $F1FF (R), $F000 - $F0FF (W)\n"
<< "Startup bank = " << cart.myStartBank << " or undetermined\n";
<< "Startup bank = " << cart.startBank() << " or undetermined\n";
// Eventually, we should query this from the debugger/disassembler
for(uInt32 i = 0, offset = 0xFFC, spot = 0xFF8; i < 3; ++i, offset += 0x1000)

View File

@ -31,7 +31,7 @@ CartridgeMDMWidget::CartridgeMDMWidget(
ostringstream info;
info << "Menu Driven Megacart, containing up to 128 4K banks\n"
<< "Startup bank = " << cart.myStartBank << "\n"
<< "Startup bank = " << cart.startBank() << "\n"
<< "\nBanks are selected by reading from $800 - $BFF, where the lower "
"byte determines the 4K bank to use.";

View File

@ -34,7 +34,7 @@ CartridgeSBWidget::CartridgeSBWidget(
<< "Hotspots are from $800 to $"
<< Common::Base::HEX2 << (0x800 + myCart.bankCount() - 1) << ", including\n"
<< "mirrors ($900, $A00, $B00, ...)\n"
<< "Startup bank = " << std::dec << cart.myStartBank << "\n";
<< "Startup bank = " << std::dec << cart.startBank() << "\n";
// Eventually, we should query this from the debugger/disassembler
for(uInt32 i = 0, offset = 0xFFC, spot = 0x800; i < myCart.bankCount();

View File

@ -30,7 +30,7 @@ CartridgeUAWidget::CartridgeUAWidget(
ostringstream info;
info << "8K UA cartridge, two 4K banks\n"
<< "Startup bank = " << cart.myStartBank << " or undetermined\n";
<< "Startup bank = " << cart.startBank() << " or undetermined\n";
// Eventually, we should query this from the debugger/disassembler
for(uInt32 i = 0, offset = 0xFFC, spot = 0x220; i < 2;

View File

@ -30,7 +30,7 @@ CartridgeX07Widget::CartridgeX07Widget(
ostringstream info;
info << "64K X07 cartridge, 16 4K banks\n"
<< "Startup bank = " << cart.myStartBank << "\n"
<< "Startup bank = " << cart.startBank() << "\n"
<< "Multiple hotspots, all below $1000\n"
<< "See documentation for further details\n";

View File

@ -27,9 +27,9 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge::Cartridge(const Settings& settings)
: mySettings(settings),
myStartBank(0),
myBankChanged(true),
myCodeAccessBase(nullptr),
myStartBank(0),
myBankLocked(false)
{
}
@ -99,16 +99,24 @@ void Cartridge::initializeRAM(uInt8* arr, uInt32 size, uInt8 val) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge::randomInitialRAM() const
uInt16 Cartridge::initializeStartBank(int defaultBank)
{
return mySettings.getBool(mySettings.getBool("dev.settings") ? "dev.ramrandom" : "plr.ramrandom");
int propsBank = myStartBankFromPropsFunc();
bool userandom = randomStartBank() || (defaultBank < 0 && propsBank < 0);
if(userandom)
return myStartBank = mySystem->randGenerator().next() % bankCount();
else if(propsBank >= 0)
return myStartBank = BSPF::clamp(propsBank, 0, bankCount() - 1);
else
return myStartBank = BSPF::clamp(defaultBank, 0, bankCount() - 1);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge::randomizeStartBank()
bool Cartridge::randomInitialRAM() const
{
if(randomStartBank())
myStartBank = mySystem->randGenerator().next() % bankCount();
return mySettings.getBool(mySettings.getBool("dev.settings") ? "dev.ramrandom" : "plr.ramrandom");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -39,6 +39,9 @@ class GuiObject;
*/
class Cartridge : public Device
{
public:
using StartBankFromPropsFunc = std::function<int()>;
public:
/**
Create a new cartridge
@ -81,6 +84,14 @@ class Cartridge : public Device
*/
uInt16 startBank() const { return myStartBank; }
/**
Set the function to use when we want to query the 'Cartridge.StartBank'
ROM property.
*/
void setStartBankFromPropsFunc(StartBankFromPropsFunc func) {
myStartBankFromPropsFunc = func;
}
/**
Answer whether the bank has changed since the last time this
method was called. Each cart class is able to override this
@ -148,7 +159,7 @@ class Cartridge : public Device
/**
Get a descriptor for the cart name.
@return The name of the object
@return The name of the cart
*/
virtual string name() const = 0;
@ -203,22 +214,27 @@ class Cartridge : public Device
void initializeRAM(uInt8* arr, uInt32 size, uInt8 val = 0) const;
/**
Checks if initial RAM randomization is enabled
Set the start bank to be used when the cart is reset. This method
will take both randomization and properties settings into account.
See the actual method for more information on the logic used.
@return Whether the initial RAM should be randomized
@param defaultBank The actual bank to use during reset
@return The bank number that was determined
*/
uInt16 initializeStartBank(int defaultBank = -1);
/**
Checks if initial RAM randomization is enabled.
@return Whether the initial RAM should be randomized
*/
bool randomInitialRAM() const;
/**
Defines the startup bank. if 'bank' is negative, a random bank will
be selected.
*/
void randomizeStartBank();
Checks if startup bank randomization is enabled.
/**
Checks if startup bank randomization is enabled
@return Whether the startup bank(s) should be randomized
@return Whether the startup bank(s) should be randomized
*/
bool randomStartBank() const;
@ -226,9 +242,6 @@ class Cartridge : public Device
// Settings class for the application
const Settings& mySettings;
// The startup bank to use (where to look for the reset vector address)
uInt16 myStartBank;
// Indicates if the bank has changed somehow (a bankswitch has occurred)
bool myBankChanged;
@ -237,6 +250,9 @@ class Cartridge : public Device
BytePtr myCodeAccessBase;
private:
// The startup bank to use (where to look for the reset vector address)
uInt16 myStartBank;
// If myBankLocked is true, ignore attempts at bankswitching. This is used
// by the debugger, when disassembling/dumping ROM.
bool myBankLocked;
@ -247,6 +263,9 @@ class Cartridge : public Device
// (ie, detected type could be '2in1' while name of cart is '4K')
string myAbout, myDetectedType, myMultiCartID;
// Used when we want the 'Cartridge.StartBank' ROM property
StartBankFromPropsFunc myStartBankFromPropsFunc;
// Following constructors and assignment operators not supported
Cartridge() = delete;
Cartridge(const Cartridge&) = delete;

View File

@ -27,16 +27,15 @@ Cartridge0840::Cartridge0840(const BytePtr& image, uInt32 size,
// Copy the ROM image into my buffer
memcpy(myImage, image.get(), std::min(8192u, size));
createCodeAccessBase(8192);
// Remember startup bank
myStartBank = 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge0840::reset()
{
initializeStartBank();
// Upon reset we switch to the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -61,7 +60,7 @@ void Cartridge0840::install(System& system)
mySystem->setPageAccess(addr, access);
// Install pages for bank 0
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -32,18 +32,16 @@ Cartridge3E::Cartridge3E(const BytePtr& image, uInt32 size,
// Copy the ROM image into my buffer
memcpy(myImage.get(), image.get(), mySize);
createCodeAccessBase(mySize + 32768);
// Remember startup bank
myStartBank = 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge3E::reset()
{
initializeRAM(myRAM, 32768);
initializeStartBank(0);
// We'll map the startup bank into the first segment upon reset
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -67,7 +65,7 @@ void Cartridge3E::install(System& system)
}
// Install pages for the startup bank into the first segment
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -31,10 +31,6 @@ Cartridge3EPlus::Cartridge3EPlus(const BytePtr& image, uInt32 size,
// Copy the ROM image into my buffer
memcpy(myImage.get(), image.get(), mySize);
createCodeAccessBase(mySize + RAM_TOTAL_SIZE);
// Remember startup bank (0 per spec, rather than last per 3E scheme).
// Set this to go to 3rd 1K Bank.
myStartBank = 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -42,6 +38,10 @@ void Cartridge3EPlus::reset()
{
initializeRAM(myRAM, RAM_TOTAL_SIZE);
// Remember startup bank (0 per spec, rather than last per 3E scheme).
// Set this to go to 3rd 1K Bank.
initializeStartBank(0);
// Initialise bank values for all ROM/RAM access
// This is used to reverse-lookup from address to bank location
for(uInt32 b = 0; b < 8; ++b)

View File

@ -32,24 +32,14 @@ Cartridge3F::Cartridge3F(const BytePtr& image, uInt32 size,
// Copy the ROM image into my buffer
memcpy(myImage.get(), image.get(), mySize);
createCodeAccessBase(mySize);
// Remember startup bank
myStartBank = bankCount() - 1; // last bank
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge3F::reset()
{
// define random startup banks
// Note: This works for all Tigervision ROMs except for one version of Polaris
// (md5: 203049f4d8290bb4521cc4402415e737) which requires 3 as startup bank
// (or non-randomized RAM). All other ROMs take care of other startup banks.
// The problematic version is most likely an incorrect dump with wrong
// startup vectors.
randomizeStartBank();
initializeStartBank(bankCount() - 1);
// We'll map the startup bank into the first segment upon reset
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -72,8 +62,7 @@ void Cartridge3F::install(System& system)
mySystem->setPageAccess(addr, access);
}
// Install pages for startup bank into the first segment
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -55,8 +55,9 @@ void CartridgeAR::reset()
// Initialize RAM
#if 0 // TODO - figure out actual behaviour of the real cart
initializeRAM(myImage, 6*1024);
#else
memset(myImage, 0, 6 * 1024);
#endif
memset(myImage, 0, 6 * 1024);
// Initialize SC BIOS ROM
initializeROM();

View File

@ -27,16 +27,15 @@ CartridgeBF::CartridgeBF(const BytePtr& image, uInt32 size,
// Copy the ROM image into my buffer
memcpy(myImage, image.get(), std::min(262144u, size));
createCodeAccessBase(262144);
// Remember startup bank
myStartBank = 1;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeBF::reset()
{
initializeStartBank(1);
// Upon reset we switch to the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -45,7 +44,7 @@ void CartridgeBF::install(System& system)
mySystem = &system;
// Install pages for the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -27,18 +27,16 @@ CartridgeBFSC::CartridgeBFSC(const BytePtr& image, uInt32 size,
// Copy the ROM image into my buffer
memcpy(myImage, image.get(), std::min(262144u, size));
createCodeAccessBase(262144);
// Remember startup bank
myStartBank = 15;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeBFSC::reset()
{
initializeRAM(myRAM, 128);
initializeStartBank(15);
// Upon reset we switch to the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -68,7 +66,7 @@ void CartridgeBFSC::install(System& system)
}
// Install pages for the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -85,7 +85,7 @@ void CartridgeBUS::reset()
setInitialState();
// Upon reset we switch to the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -98,7 +98,7 @@ void CartridgeBUS::setInitialState()
myMusicWaveformSize[i] = 27;
// BUS always starts in bank 6
myStartBank = 6;
initializeStartBank(6);
// Assuming mode starts out with Fast Fetch off and 3-Voice music,
// need to confirm with Chris
@ -132,7 +132,7 @@ void CartridgeBUS::install(System& system)
mySystem->m6532().installDelegate(system, *this);
// Install pages for the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -87,7 +87,7 @@ void CartridgeCDF::reset()
setInitialState();
// Upon reset we switch to the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -100,7 +100,7 @@ void CartridgeCDF::setInitialState()
myMusicWaveformSize[i] = 27;
// CDF always starts in bank 6
myStartBank = 6;
initializeStartBank(6);
// Assuming mode starts out with Fast Fetch off and 3-Voice music,
// need to confirm with Chris
@ -127,7 +127,7 @@ void CartridgeCDF::install(System& system)
mySystem->setPageAccess(addr, access);
// Install pages for the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -32,7 +32,7 @@ CartridgeCM::CartridgeCM(const BytePtr& image, uInt32 size,
createCodeAccessBase(16384);
// On powerup, the last bank of ROM is enabled and RAM is disabled
myStartBank = mySWCHA & 0x3;
initializeStartBank(mySWCHA & 0x3);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -41,7 +41,7 @@ void CartridgeCM::reset()
initializeRAM(myRAM, 2048);
// Upon reset we switch to the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -54,7 +54,7 @@ void CartridgeCM::install(System& system)
mySystem->m6532().installDelegate(system, *this);
// Install pages for the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -41,9 +41,6 @@ CartridgeCTY::CartridgeCTY(const BytePtr& image, uInt32 size,
// Point to the first tune
myFrequencyImage = CartCTYTunes;
// Remember startup bank (not bank 0, since that's ARM code)
myStartBank = 1;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -51,13 +48,16 @@ void CartridgeCTY::reset()
{
initializeRAM(myRAM, 64);
// Remember startup bank (not bank 0, since that's ARM code)
initializeStartBank(1);
myRAM[0] = myRAM[1] = myRAM[2] = myRAM[3] = 0xFF;
myAudioCycles = 0;
myFractionalClocks = 0.0;
// Upon reset we switch to the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -71,7 +71,7 @@ void CartridgeCTY::install(System& system)
mySystem->setPageAccess(addr, access);
// Install pages for the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -32,18 +32,16 @@ CartridgeCVPlus::CartridgeCVPlus(const BytePtr& image, uInt32 size,
// Copy the ROM image into my buffer
memcpy(myImage.get(), image.get(), mySize);
createCodeAccessBase(mySize + 1024);
// Remember startup bank
myStartBank = 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeCVPlus::reset()
{
initializeRAM(myRAM, 1024);
initializeStartBank(0);
// We'll map the startup bank into the first segment upon reset
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -79,7 +77,7 @@ void CartridgeCVPlus::install(System& system)
}
// Install pages for the startup bank into the first segment
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -31,10 +31,6 @@ CartridgeDASH::CartridgeDASH(const BytePtr& image, uInt32 size,
// Copy the ROM image into my buffer
memcpy(myImage.get(), image.get(), mySize);
createCodeAccessBase(mySize + RAM_TOTAL_SIZE);
// Remember startup bank (0 per spec, rather than last per 3E scheme).
// Set this to go to 3rd 1K Bank.
myStartBank = 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -42,6 +38,10 @@ void CartridgeDASH::reset()
{
initializeRAM(myRAM, RAM_TOTAL_SIZE);
// Remember startup bank (0 per spec, rather than last per 3E scheme).
// Set this to go to 3rd 1K Bank.
initializeStartBank(0);
// Initialise bank values for all ROM/RAM access
// This is used to reverse-lookup from address to bank location
for(uInt32 b = 0; b < 8; ++b)

View File

@ -27,16 +27,15 @@ CartridgeDF::CartridgeDF(const BytePtr& image, uInt32 size,
// Copy the ROM image into my buffer
memcpy(myImage, image.get(), std::min(131072u, size));
createCodeAccessBase(131072);
// Remember startup bank
myStartBank = 1;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeDF::reset()
{
initializeStartBank(1);
// Upon reset we switch to the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -45,7 +44,7 @@ void CartridgeDF::install(System& system)
mySystem = &system;
// Install pages for the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -27,18 +27,16 @@ CartridgeDFSC::CartridgeDFSC(const BytePtr& image, uInt32 size,
// Copy the ROM image into my buffer
memcpy(myImage, image.get(), std::min(131072u, size));
createCodeAccessBase(131072);
// Remember startup bank
myStartBank = 15;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeDFSC::reset()
{
initializeRAM(myRAM, 128);
initializeStartBank(15);
// Upon reset we switch to the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -68,7 +66,7 @@ void CartridgeDFSC::install(System& system)
}
// Install pages for the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -49,9 +49,6 @@ CartridgeDPC::CartridgeDPC(const BytePtr& image, uInt32 size,
// Initialize the DPC's random number generator register (must be non-zero)
myRandomNumber = 1;
// Remember startup bank
myStartBank = 1;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -60,11 +57,11 @@ void CartridgeDPC::reset()
myAudioCycles = 0;
myFractionalClocks = 0.0;
// define random startup bank
randomizeStartBank();
// Use random startup bank
initializeStartBank();
// Upon reset we switch to the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -78,7 +75,7 @@ void CartridgeDPC::install(System& system)
mySystem->setPageAccess(addr, access);
// Install pages for the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -62,9 +62,6 @@ CartridgeDPCPlus::CartridgeDPCPlus(const BytePtr& image, uInt32 size,
this);
setInitialState();
// DPC+ always starts in bank 5
myStartBank = 5;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -75,8 +72,11 @@ void CartridgeDPCPlus::reset()
setInitialState();
// DPC+ always starts in bank 5
initializeStartBank(5);
// Upon reset we switch to the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -120,7 +120,7 @@ void CartridgeDPCPlus::install(System& system)
mySystem->setPageAccess(addr, access);
// Install pages for the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -27,16 +27,15 @@ CartridgeEF::CartridgeEF(const BytePtr& image, uInt32 size,
// Copy the ROM image into my buffer
memcpy(myImage, image.get(), std::min(65536u, size));
createCodeAccessBase(65536);
// Remember startup bank
myStartBank = 1;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeEF::reset()
{
initializeStartBank(1);
// Upon reset we switch to the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -45,7 +44,7 @@ void CartridgeEF::install(System& system)
mySystem = &system;
// Install pages for the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -27,18 +27,16 @@ CartridgeEFSC::CartridgeEFSC(const BytePtr& image, uInt32 size,
// Copy the ROM image into my buffer
memcpy(myImage, image.get(), std::min(65536u, size));
createCodeAccessBase(65536);
// Remember startup bank
myStartBank = 15;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeEFSC::reset()
{
initializeRAM(myRAM, 128);
initializeStartBank(15);
// Upon reset we switch to the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -68,7 +66,7 @@ void CartridgeEFSC::install(System& system)
}
// Install pages for the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -27,19 +27,16 @@ CartridgeF0::CartridgeF0(const BytePtr& image, uInt32 size,
// Copy the ROM image into my buffer
memcpy(myImage, image.get(), std::min(65536u, size));
createCodeAccessBase(65536);
// Remember startup bank
myStartBank = 15;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF0::reset()
{
// define random startup bank
randomizeStartBank();
// Use random startup bank
initializeStartBank();
// Upon reset we switch to the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -48,7 +45,7 @@ void CartridgeF0::install(System& system)
mySystem = &system;
// Install pages for the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -28,19 +28,16 @@ CartridgeF4::CartridgeF4(const BytePtr& image, uInt32 size,
// Copy the ROM image into my buffer
memcpy(myImage, image.get(), std::min(32768u, size));
createCodeAccessBase(32768);
// Remember startup bank
myStartBank = 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF4::reset()
{
// define random startup bank
randomizeStartBank();
// Use random startup bank
initializeStartBank();
// Upon reset we switch to the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -49,7 +46,7 @@ void CartridgeF4::install(System& system)
mySystem = &system;
// Install pages for the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -27,21 +27,16 @@ CartridgeF4SC::CartridgeF4SC(const BytePtr& image, uInt32 size,
// Copy the ROM image into my buffer
memcpy(myImage, image.get(), std::min(32768u, size));
createCodeAccessBase(32768);
// Remember startup bank
myStartBank = 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF4SC::reset()
{
initializeRAM(myRAM, 128);
// define random startup bank
randomizeStartBank();
initializeStartBank();
// Upon reset we switch to the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -71,7 +66,7 @@ void CartridgeF4SC::install(System& system)
}
// Install pages for the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -27,19 +27,16 @@ CartridgeF6::CartridgeF6(const BytePtr& image, uInt32 size,
// Copy the ROM image into my buffer
memcpy(myImage, image.get(), std::min(16384u, size));
createCodeAccessBase(16384);
// Remember startup bank
myStartBank = 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF6::reset()
{
// define random startup bank
randomizeStartBank();
// Use random startup bank
initializeStartBank();
// Upon reset we switch to the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -48,7 +45,7 @@ void CartridgeF6::install(System& system)
mySystem = &system;
// Upon install we'll setup the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -27,21 +27,16 @@ CartridgeF6SC::CartridgeF6SC(const BytePtr& image, uInt32 size,
// Copy the ROM image into my buffer
memcpy(myImage, image.get(), std::min(16384u, size));
createCodeAccessBase(16384);
// Remember startup bank
myStartBank = 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF6SC::reset()
{
// define random startup bank
randomizeStartBank();
initializeRAM(myRAM, 128);
initializeStartBank();
// Upon reset we switch to the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -71,7 +66,7 @@ void CartridgeF6SC::install(System& system)
}
// Install pages for the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -27,28 +27,15 @@ CartridgeF8::CartridgeF8(const BytePtr& image, uInt32 size, const string& md5,
// Copy the ROM image into my buffer
memcpy(myImage, image.get(), std::min(8192u, size));
createCodeAccessBase(8192);
// Normally bank 1 is the reset bank, unless we're dealing with ROMs
// that have been incorrectly created with banks in the opposite order
myStartBank =
(md5 == "bc24440b59092559a1ec26055fd1270e" || // Private Eye [a]
md5 == "75ea60884c05ba496473c23a58edf12f" || // 8-in-1 Yars Revenge
md5 == "75ee371ccfc4f43e7d9b8f24e1266b55" || // Snow White
md5 == "74c8a6f20f8adaa7e05183f796eda796" || // Tricade Demo
md5 == "9905f9f4706223dadee84f6867ede8e3" || // Challenge
md5 == "3c7a7b3a0a7e6319b2fa0f923ef6c9af" || // Racer Prototype
md5 == "2434102f30eeb47792cf0825e368229b") // Arkyology
? 0 : 1;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF8::reset()
{
// define random startup bank
randomizeStartBank();
initializeStartBank(1);
// Upon reset we switch to the reset bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -57,7 +44,7 @@ void CartridgeF8::install(System& system)
mySystem = &system;
// Install pages for the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -27,21 +27,16 @@ CartridgeF8SC::CartridgeF8SC(const BytePtr& image, uInt32 size,
// Copy the ROM image into my buffer
memcpy(myImage, image.get(), std::min(8192u, size));
createCodeAccessBase(8192);
// Remember startup bank
myStartBank = 1;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF8SC::reset()
{
// define startup bank
randomizeStartBank();
initializeRAM(myRAM, 128);
initializeStartBank();
// Upon reset we switch to the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -71,7 +66,7 @@ void CartridgeF8SC::install(System& system)
}
// Install pages for the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -27,21 +27,16 @@ CartridgeFA::CartridgeFA(const BytePtr& image, uInt32 size,
// Copy the ROM image into my buffer
memcpy(myImage, image.get(), std::min(12288u, size));
createCodeAccessBase(12288);
// Remember startup bank
myStartBank = 2;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeFA::reset()
{
// define random startup bank
randomizeStartBank();
initializeRAM(myRAM, 256);
initializeStartBank(2);
// Upon reset we switch to the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -71,7 +66,7 @@ void CartridgeFA::install(System& system)
}
// Install pages for the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -39,21 +39,16 @@ CartridgeFA2::CartridgeFA2(const BytePtr& image, uInt32 size,
// Copy the ROM image into my buffer
memcpy(myImage, img_ptr, mySize);
createCodeAccessBase(mySize);
// Remember startup bank
myStartBank = 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeFA2::reset()
{
// define random startup bank
randomizeStartBank();
initializeRAM(myRAM, 256);
initializeStartBank();
// Upon reset we switch to the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -83,7 +78,7 @@ void CartridgeFA2::install(System& system)
}
// Install pages for the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -29,14 +29,15 @@ CartridgeFE::CartridgeFE(const BytePtr& image, uInt32 size,
// Copy the ROM image into my buffer
memcpy(myImage, image.get(), std::min(8192u, size));
createCodeAccessBase(8192);
myStartBank = 0; // Decathlon requires this, since there is no startup vector in bank 1
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeFE::reset()
{
bank(myStartBank);
// Decathlon requires this, since there is no startup vector in bank 1
initializeStartBank(0);
bank(startBank());
myLastAccessWasFE = false;
}

View File

@ -32,16 +32,15 @@ CartridgeMDM::CartridgeMDM(const BytePtr& image, uInt32 size,
// Copy the ROM image into my buffer
memcpy(myImage.get(), image.get(), mySize);
createCodeAccessBase(mySize);
// Remember startup bank
myStartBank = 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeMDM::reset()
{
initializeStartBank(0);
// Upon reset we switch to the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -66,7 +65,7 @@ void CartridgeMDM::install(System& system)
mySystem->setPageAccess(addr, access);
// Install pages for bank 0
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -38,8 +38,6 @@ void CartridgeMNetwork::initialize(const BytePtr& image, uInt32 size)
memcpy(myImage.get(), image.get(), std::min(romSize(), size));
createCodeAccessBase(romSize() + RAM_SIZE);
// Remember startup bank
myStartBank = 0;
myRAMSlice = bankCount() - 1;
}
@ -48,14 +46,14 @@ void CartridgeMNetwork::reset()
{
initializeRAM(myRAM, RAM_SIZE);
// define random startup banks
randomizeStartBank();
// Use random startup bank
initializeStartBank();
uInt32 ramBank = randomStartBank() ?
mySystem->randGenerator().next() % 4 : 0;
// Install some default banks for the RAM and first segment
bankRAM(ramBank);
bank(myStartBank);
bank(startBank());
myBankChanged = true;
}
@ -104,7 +102,7 @@ void CartridgeMNetwork::install(System& system)
// Install some default banks for the RAM and first segment
bankRAM(0);
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -31,16 +31,15 @@ CartridgeSB::CartridgeSB(const BytePtr& image, uInt32 size,
// Copy the ROM image into my buffer
memcpy(myImage.get(), image.get(), mySize);
createCodeAccessBase(mySize);
// Remember startup bank
myStartBank = bankCount() - 1;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeSB::reset()
{
initializeStartBank(bankCount() - 1);
// Upon reset we switch to the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -66,7 +65,7 @@ void CartridgeSB::install(System& system)
mySystem->setPageAccess(addr, access);
// Install pages for startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -76,7 +75,7 @@ uInt8 CartridgeSB::peek(uInt16 address)
// Switch banks if necessary
if ((address & 0x1800) == 0x0800)
bank(address & myStartBank);
bank(address & startBank());
if(!(address & 0x1000))
{
@ -96,7 +95,7 @@ bool CartridgeSB::poke(uInt16 address, uInt8 value)
// Switch banks if necessary
if((address & 0x1800) == 0x0800)
bank(address & myStartBank);
bank(address & startBank());
if(!(address & 0x1000))
{

View File

@ -27,19 +27,15 @@ CartridgeUA::CartridgeUA(const BytePtr& image, uInt32 size,
// Copy the ROM image into my buffer
memcpy(myImage, image.get(), std::min(8192u, size));
createCodeAccessBase(8192);
// Remember startup bank
myStartBank = 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeUA::reset()
{
// define startup bank
randomizeStartBank();
initializeStartBank();
// Upon reset we switch to the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -57,7 +53,7 @@ void CartridgeUA::install(System& system)
mySystem->setPageAccess(0x0240, access);
// Install pages for the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -32,21 +32,19 @@ CartridgeWD::CartridgeWD(const BytePtr& image, uInt32 size,
// Copy the ROM image into my buffer
memcpy(myImage, image.get(), mySize);
createCodeAccessBase(8192);
// Remember startup bank
myStartBank = 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeWD::reset()
{
initializeRAM(myRAM, 64);
initializeStartBank(0);
myCyclesAtBankswitchInit = 0;
myPendingBank = 0xF0; // one more than the allowable bank #
// Setup segments to some default slices
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -77,7 +75,7 @@ void CartridgeWD::install(System& system)
mySystem->tia().installDelegate(system, *this);
// Setup segments to some default slices
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -29,16 +29,15 @@ CartridgeX07::CartridgeX07(const BytePtr& image, uInt32 size,
// Copy the ROM image into my buffer
memcpy(myImage, image.get(), std::min(65536u, size));
createCodeAccessBase(65536);
// Remember startup bank
myStartBank = 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeX07::reset()
{
initializeStartBank();
// Upon reset we switch to the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -54,7 +53,7 @@ void CartridgeX07::install(System& system)
mySystem->setPageAccess(addr, access);
// Install pages for the startup bank
bank(myStartBank);
bank(startBank());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -113,6 +113,12 @@ Console::Console(OSystem& osystem, unique_ptr<Cartridge>& cart,
myLeftControl = make_unique<Joystick>(Controller::Left, myEvent, *mySystem);
myRightControl = make_unique<Joystick>(Controller::Right, myEvent, *mySystem);
// Let the cart know how to query for the 'Cartridge.StartBank' property
myCart->setStartBankFromPropsFunc([this]() {
const string& startbank = myProperties.get(Cartridge_StartBank);
return startbank == EmptyString ? -1 : atoi(startbank.c_str());
});
// We can only initialize after all the devices/components have been created
mySystem->initialize();

View File

@ -390,7 +390,7 @@ class Console : public Serializable
// Pointer to the TIA object
unique_ptr<TIA> myTIA;
// The frame manager instance that is used during emulation.
// The frame manager instance that is used during emulation
unique_ptr<AbstractFrameManager> myFrameManager;
// The audio fragment queue that connects TIA and audio driver

View File

@ -25,7 +25,7 @@
regenerated and the application recompiled.
*/
#define DEF_PROPS_SIZE 3318
#define DEF_PROPS_SIZE 3319
static const char* const DefProps[DEF_PROPS_SIZE][22] = {
{ "000509d1ed2b8d30a9d94be1b3b5febb", "Greg Zumwalt", "", "Jungle Jane (2003) (Greg Zumwalt) (Hack)", "Hack of Pitfall!", "Hack", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
@ -481,7 +481,7 @@ static const char* const DefProps[DEF_PROPS_SIZE][22] = {
{ "23fad5a125bcd4463701c8ad8a0043a9", "CCE", "C-840", "Stone Age (1983) (CCE)", "Uses the Joystick Controllers (swapped)", "", "", "", "", "A", "A", "", "YES", "", "", "", "", "", "", "220", "YES", "" },
{ "240bfbac5163af4df5ae713985386f92", "Activision, Steve Cartwright", "AX-022", "Seaquest (1983) (Activision)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "2432f33fd278dea5fe6ae94073627fcc", "CBS Electronics, Tom DiDomenico", "4L2477, 4L2482, 4L2485, 4L4171", "Blueprint (1983) (CBS Electronics) (PAL)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "" },
{ "2434102f30eeb47792cf0825e368229b", "Sparrow - Enter-Tech, Paul Walters, Rick Harris, George Hefner, Barbara Ultis", "", "Arkyology (1983) (Sparrow) (Prototype)", "ROM must be started in bank 0", "Prototype", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "2434102f30eeb47792cf0825e368229b", "Sparrow - Enter-Tech, Paul Walters, Rick Harris, George Hefner, Barbara Ultis", "", "Arkyology (1983) (Sparrow) (Prototype)", "ROM must be started in bank 0", "Prototype", "", "0", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "24385ba7f5109fbe76aadc0a375de573", "CCE", "", "Xevious (CCE)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "" },
{ "2447e17a4e18e6b609de498fe4ab52ba", "CCE", "", "Super Futebol (CCE)", "AKA RealSports Soccer", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "" },
{ "244c6de27faff527886fc7699a41c3be", "", "", "Matt Demo (PD)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
@ -816,7 +816,7 @@ static const char* const DefProps[DEF_PROPS_SIZE][22] = {
{ "3c4a6f613ca8ba27ce9e43c6c92a3128", "", "", "Qb (V0.04) (Non-Lax Version) (2001) (Retroactive)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "" },
{ "3c57748c8286cf9e821ecd064f21aaa9", "Atari, Jerome Domurat, Andrew Fuchs, Dave Staugas, Robert Vieira", "CX26118", "Millipede (1984) (Atari)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "3c72ddaf41158fdd66e4f1cb90d4fd29", "Dismac", "", "Comando Suicida (Dismac)", "AKA Chopper Command", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "3c7a7b3a0a7e6319b2fa0f923ef6c9af", "Atari - Roklan, Joe Gaucher", "", "Racer (1982) (Atari) (Prototype)", "ROM must be started in bank 0", "Prototype", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "3c7a7b3a0a7e6319b2fa0f923ef6c9af", "Atari - Roklan, Joe Gaucher", "", "Racer (1982) (Atari) (Prototype)", "ROM must be started in bank 0", "Prototype", "", "0", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "3c7a96978f52b2b15426cdd50f2c4048", "", "", "Overhead Adventure Demo 3 (PD)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "3c82e808fe0e6a006dc0c4e714d36209", "Activision, David Crane", "AG-004", "Fishing Derby (1980) (Activision) (16K)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "3c853d864a1d5534ed0d4b325347f131", "Telesys, Don 'Donyo' Ruffcorn", "1002", "Cosmic Creeps (1982) (Telesys)", "AKA Space Maze, Spaze Maze", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "" },
@ -1576,7 +1576,7 @@ static const char* const DefProps[DEF_PROPS_SIZE][22] = {
{ "75e8d8b9e9c5c67c2226dbfd77dcfa7d", "", "", "2600 Digital Clock (V b1) (PD)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "75ea128ba96ac6db8edf54b071027c4e", "Atari, David Crane", "CX26163P", "Slot Machine (32 in 1) (1988) (Atari) (PAL)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "75ea60884c05ba496473c23a58edf12f", "Atari, Howard Scott Warshaw - Sears", "CX2655 - 49-75167", "Yars' Revenge (1982) (Atari) (PAL) [a]", "ROM must be started in bank 0", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "" },
{ "75ee371ccfc4f43e7d9b8f24e1266b55", "Atari, Greg Easter, Mimi Nyden", "CX26107", "Snow White (11-09-1982) (Atari) (Prototype)", "ROM must be started in bank 0", "Prototype", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "75ee371ccfc4f43e7d9b8f24e1266b55", "Atari, Greg Easter, Mimi Nyden", "CX26107", "Snow White (11-09-1982) (Atari) (Prototype)", "ROM must be started in bank 0", "Prototype", "", "0", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "7608abdfd9b26f4a0ecec18b232bea54", "Atari, Bob Whitehead", "CX26163P", "NFL Football (32 in 1) (1988) (Atari) (PAL)", "AKA Football", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "7623a639a6fffdb246775fe2eabc8d01", "Activision, Bob Whitehead", "AG-005, CAG-005, AG-005-04", "Skiing (1980) (Activision) (8K)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "7628d3cadeee0fd2e41e68b3b8fbe229", "Atari", "CX26163P", "Fishing Derby (32 in 1) (1988) (Atari) (PAL)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
@ -2412,6 +2412,7 @@ static const char* const DefProps[DEF_PROPS_SIZE][22] = {
{ "bb756aa98b847dddc8fc170bc79f92b2", "", "", "Golf (208 in 1) (Unknown) (PAL)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "bb9f06b288b5275bc0d38b6731b2526a", "", "", "Star Fire - Meteor Dance 2 (18-11-2002) (MP)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "bbf8c7c9ed280151934aabe138e41ba7", "Amiga", "1130", "Power Play Arcade Video Game Album V (1984) (Amiga) (Prototype)", "Mogul Maniac, Surf's Up, Off Your Rocker, S.A.C. Alert", "Prototype", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "bc24440b59092559a1ec26055fd1270e", "", "", "Private Eye (1984) (Activision) [a]", "", "", "", "0", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "bc3057a35319aae3a5cd87a203736abe", "CCE", "C-845", "Time Warp (1983) (CCE)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "bc33c685e6ffced83abe7a43f30df7f9", "Dynacom", "", "Seaquest (1983) (Dynacom)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "bc4cf38a4bee45752dc466c98ed7ad09", "Atari, Douglas Neubauer, Mimi Nyden", "CX26136", "Solaris (1986) (Atari) (PAL)", "AKA Universe, Star Raiders II, The Last Starfighter", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },

View File

@ -4876,6 +4876,7 @@
"Cartridge.Name" "Racer (1982) (Atari) (Prototype)"
"Cartridge.Note" "ROM must be started in bank 0"
"Cartridge.Rarity" "Prototype"
"Cartridge.StartBank" "0"
""
"Cartridge.MD5" "3c7a96978f52b2b15426cdd50f2c4048"
@ -9543,6 +9544,7 @@
"Cartridge.Name" "Snow White (11-09-1982) (Atari) (Prototype)"
"Cartridge.Note" "ROM must be started in bank 0"
"Cartridge.Rarity" "Prototype"
"Cartridge.StartBank" "0"
""
"Cartridge.MD5" "7608abdfd9b26f4a0ecec18b232bea54"
@ -19897,6 +19899,11 @@
"Cartridge.Name" "Private Eye (CCE)"
""
"Cartridge.MD5" "bc24440b59092559a1ec26055fd1270e"
"Cartridge.Name" "Private Eye (1984) (Activision) [a]"
"Cartridge.StartBank" "0"
""
"Cartridge.MD5" "f9d51a4e5f8b48f68770c89ffd495ed1"
"Cartridge.Manufacturer" "Atari, Tod Frye, Mimi Nyden"
"Cartridge.ModelNo" "CX2657"
@ -20435,6 +20442,7 @@
"Cartridge.Name" "Arkyology (1983) (Sparrow) (Prototype)"
"Cartridge.Note" "ROM must be started in bank 0"
"Cartridge.Rarity" "Prototype"
"Cartridge.StartBank" "0"
""
"Cartridge.MD5" "93c4b910f7649b3e998bb6d8527c6f4a"