Removed some redundant includes in various Cart classes.

Introduced Cartridge::initializeRAM() method, to eliminate duplicate
blocks of code in every bankswitch scheme that uses extra RAM.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3316 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2016-08-24 23:57:07 +00:00
parent be2f6f5b64
commit 883971985e
48 changed files with 84 additions and 277 deletions

View File

@ -18,8 +18,6 @@
//============================================================================
#include <fstream>
#include <cstring>
#include <sstream>
#include <cmath>
#include "bspf.hxx"

View File

@ -76,6 +76,7 @@ using std::array;
using std::vector;
using std::make_pair;
using std::runtime_error;
using std::memcpy;
// Common array types
using IntArray = std::vector<Int32>;

View File

@ -209,27 +209,8 @@ string Cartridge3EPlusWidget::bankState()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge3EPlusWidget::updateUIState()
{
// Set contents for actual banks number and type
for(int i = 0; i < 4; ++i)
{
uInt16 segment = myCart.segmentInUse[i];
if(segment == myCart.BANK_UNDEFINED)
{
myBankNumber[i]->clearSelection();
myBankType[i]->clearSelection();
}
else
{
int bankno = segment & myCart.BIT_BANK_MASK;
const char* banktype = segment & myCart.BITMASK_ROMRAM ? "RAM" : "ROM";
myBankNumber[i]->setSelected(bankno);
myBankType[i]->setSelected(banktype);
}
}
// Set description for each 512b bank state
// Set description for each 512b bank state (@ each index)
// Set contents for actual banks number and type (@ each even index)
for(int i = 0; i < 8; ++i)
{
uInt16 bank = myCart.bankInUse[i];
@ -237,6 +218,11 @@ void Cartridge3EPlusWidget::updateUIState()
if(bank == myCart.BANK_UNDEFINED) // never accessed
{
myBankState[i]->setText("Undefined");
if(i % 2 == 0)
{
myBankNumber[i/2]->clearSelection();
myBankType[i/2]->clearSelection();
}
}
else
{
@ -257,6 +243,12 @@ void Cartridge3EPlusWidget::updateUIState()
<< (bankno << myCart.RAM_BANK_TO_POWER) << " (R)";
myBankState[i]->setText(buf.str());
}
if(i % 2 == 0)
{
myBankNumber[i/2]->setSelected(bankno);
myBankType[i/2]->setSelected("RAM");
}
}
else
{
@ -272,6 +264,12 @@ void Cartridge3EPlusWidget::updateUIState()
<< (bankno << myCart.RAM_BANK_TO_POWER);
myBankState[i]->setText(buf.str());
}
if(i % 2 == 0)
{
myBankNumber[i/2]->setSelected(bankno);
myBankType[i/2]->setSelected("ROM");
}
}
}
}

View File

@ -17,9 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include <sstream>
#include "bspf.hxx"
#include "Cart.hxx"
#include "Cart0840.hxx"
@ -364,6 +361,16 @@ void Cartridge::createCodeAccessBase(uInt32 size)
#endif
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge::initializeRAM(uInt8* arr, uInt32 size, uInt8 val) const
{
if(mySettings.getBool("ramrandom"))
for(uInt32 i = 0; i < size; ++i)
arr[i] = mySystem->randGenerator().next();
else
memset(arr, val, size);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string Cartridge::autodetectType(const uInt8* image, uInt32 size)
{

View File

@ -210,6 +210,15 @@ class Cartridge : public Device
*/
void createCodeAccessBase(uInt32 size);
/**
Fill the given RAM array with (possibly random) data.
@param arr Pointer to the RAM array
@param size The size of the RAM array
@param val If provided, the value to store in the RAM array
*/
void initializeRAM(uInt8* arr, uInt32 size, uInt8 val = 0) const;
private:
/**
Get an image pointer and size for a ROM that is part of a larger,

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "System.hxx"
#include "Cart0840.hxx"

View File

@ -17,15 +17,12 @@
// $Id$
//============================================================================
#include <cstring>
#include "System.hxx"
#include "Cart2K.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge2K::Cartridge2K(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings),
myImage(nullptr)
: Cartridge(settings)
{
// Size can be a maximum of 2K
if(size > 2048) size = 2048;

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "System.hxx"
#include "TIA.hxx"
#include "Cart3E.hxx"
@ -27,7 +25,6 @@
Cartridge3E::Cartridge3E(const uInt8* image, uInt32 size,
const Settings& settings)
: Cartridge(settings),
myImage(nullptr),
mySize(size),
myCurrentBank(0)
{
@ -45,12 +42,7 @@ Cartridge3E::Cartridge3E(const uInt8* image, uInt32 size,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge3E::reset()
{
// Initialize RAM
if(mySettings.getBool("ramrandom"))
for(uInt32 i = 0; i < 32768; ++i)
myRAM[i] = mySystem->randGenerator().next();
else
memset(myRAM, 0, 32768);
initializeRAM(myRAM, 32768);
// We'll map the startup bank into the first segment upon reset
bank(myStartBank);

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "System.hxx"
#include "TIA.hxx"
#include "Cart3EPlus.hxx"
@ -43,20 +41,13 @@ Cartridge3EPlus::Cartridge3EPlus(const uInt8* image, uInt32 size, const Settings
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge3EPlus::reset()
{
// Initialize RAM
if (mySettings.getBool("ramrandom"))
for (uInt32 i = 0; i < RAM_TOTAL_SIZE; ++i)
myRAM[i] = mySystem->randGenerator().next();
else
memset(myRAM, 0, RAM_TOTAL_SIZE);
initializeRAM(myRAM, RAM_TOTAL_SIZE);
// 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++)
{
for(uInt32 b = 0; b < 8; ++b)
bankInUse[b] = BANK_UNDEFINED; // bank is undefined and inaccessible!
segmentInUse[b/2] = BANK_UNDEFINED;
}
initializeBankState();
// We'll map the startup banks 0 and 3 from the image into the third 1K bank upon reset
@ -75,16 +66,14 @@ void Cartridge3EPlus::install(System& system)
// we need to chain any accesses below 0x40 to the TIA. Our poke() method
// does this via mySystem->tiaPoke(...), at least until we come up with a
// cleaner way to do it).
for (uInt32 i = 0x00; i < 0x40; i += (1 << System::PAGE_SHIFT))
for(uInt32 i = 0x00; i < 0x40; i += (1 << System::PAGE_SHIFT))
mySystem->setPageAccess(i >> System::PAGE_SHIFT, access);
// 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++)
{
for(uInt32 b = 0; b < 8; ++b)
bankInUse[b] = BANK_UNDEFINED; // bank is undefined and inaccessible!
segmentInUse[b/2] = BANK_UNDEFINED;
}
initializeBankState();
// Setup the last segment (of 4, each 1K) to point to the first ROM slice
@ -103,13 +92,13 @@ uInt8 Cartridge3EPlus::peek(uInt16 address)
uInt32 bank = (address >> (ROM_BANK_TO_POWER - 1)) & 7; // convert to 512 byte bank index (0-7)
uInt16 imageBank = bankInUse[bank]; // the ROM/RAM bank that's here
if (imageBank == BANK_UNDEFINED) // an uninitialised bank?
if(imageBank == BANK_UNDEFINED) // an uninitialised bank?
{
// accessing invalid bank, so return should be... random?
value = mySystem->randGenerator().next();
}
else if (imageBank & BITMASK_ROMRAM) // a RAM bank
else if(imageBank & BITMASK_ROMRAM) // a RAM bank
{
// Reading from the write port triggers an unwanted write
value = mySystem->getDataBusState(0xFF);
@ -138,10 +127,10 @@ bool Cartridge3EPlus::poke(uInt16 address, uInt8 value)
// Check for write to the bank switch address. RAM/ROM and bank # are encoded in 'value'
// There are NO mirrored hotspots.
if (address == BANK_SWITCH_HOTSPOT_RAM)
if(address == BANK_SWITCH_HOTSPOT_RAM)
changed = bankRAM(value);
else if (address == BANK_SWITCH_HOTSPOT_ROM)
else if(address == BANK_SWITCH_HOTSPOT_ROM)
changed = bankROM(value);
// Pass the poke through to the TIA. In a real Atari, both the cart and the
@ -156,16 +145,15 @@ bool Cartridge3EPlus::poke(uInt16 address, uInt8 value)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge3EPlus::bankRAM(uInt8 bank)
{
if (bankLocked()) // debugger can lock RAM
if(bankLocked()) // debugger can lock RAM
return false;
//cerr << "bankRAM " << int(bank) << endl;
// Each RAM bank uses two slots, separated by 0x200 in memory -- one read, one write.
bankRAMSlot(bank | BITMASK_ROMRAM | 0);
bankRAMSlot(bank | BITMASK_ROMRAM | BITMASK_LOWERUPPER);
// Remember that this hotspot was accessed for RAM
segmentInUse[(bank >> BANK_BITS) & 3] = bank | BITMASK_ROMRAM;
return myBankChanged = true;
}
@ -177,8 +165,8 @@ void Cartridge3EPlus::bankRAMSlot(uInt16 bank)
bool upper = bank & BITMASK_LOWERUPPER; // is this the read or write port
uInt32 startCurrentBank = currentBank << RAM_BANK_TO_POWER; // Effectively * 512 bytes
cerr << "raw bank=" << std::dec << currentBank << endl
<< "startCurrentBank=$" << std::hex << startCurrentBank << endl;
//cerr << "raw bank=" << std::dec << currentBank << endl
// << "startCurrentBank=$" << std::hex << startCurrentBank << endl;
// Setup the page access methods for the current bank
System::PageAccess access(this, System::PA_READ);
@ -196,9 +184,9 @@ cerr << "raw bank=" << std::dec << currentBank << endl
uInt32 start = 0x1000 + (bankNumber << (RAM_BANK_TO_POWER+1)) + (upper ? RAM_WRITE_OFFSET : 0);
uInt32 end = start + RAM_BANK_SIZE - 1;
cerr << "bank RAM: " << bankNumber << " -> " << (bankNumber * 2 + (upper ? 1 : 0)) << (upper ? " (W)" : " (R)") << endl
<< "start=" << std::hex << start << ", end=" << end << endl << endl;
for (uInt32 address = start; address <= end; address += (1 << System::PAGE_SHIFT))
//cerr << "bank RAM: " << bankNumber << " -> " << (bankNumber * 2 + (upper ? 1 : 0)) << (upper ? " (W)" : " (R)") << endl
// << "start=" << std::hex << start << ", end=" << end << endl << endl;
for(uInt32 address = start; address <= end; address += (1 << System::PAGE_SHIFT))
{
if(upper)
access.directPokeBase = &myRAM[startCurrentBank + (address & (RAM_BANK_SIZE - 1))];
@ -213,7 +201,7 @@ cerr << "bank RAM: " << bankNumber << " -> " << (bankNumber * 2 + (upper ? 1 : 0
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge3EPlus::bankROM(uInt8 bank)
{
if (bankLocked()) // debugger can lock ROM
if(bankLocked()) // debugger can lock ROM
return false;
// Map ROM bank image into the system into the correct slot
@ -222,9 +210,6 @@ bool Cartridge3EPlus::bankROM(uInt8 bank)
bankROMSlot(bank | 0);
bankROMSlot(bank | BITMASK_LOWERUPPER);
// Remember that this hotspot was accessed for ROM
segmentInUse[(bank >> BANK_BITS) & 3] = bank;
return myBankChanged = true;
}
@ -245,7 +230,7 @@ void Cartridge3EPlus::bankROMSlot(uInt16 bank)
uInt32 start = 0x1000 + (bankNumber << ROM_BANK_TO_POWER) + (upper ? ROM_BANK_SIZE / 2 : 0);
uInt32 end = start + ROM_BANK_SIZE / 2 - 1;
for (uInt32 address = start; address <= end; address += (1 << System::PAGE_SHIFT))
for(uInt32 address = start; address <= end; address += (1 << System::PAGE_SHIFT))
{
access.directPeekBase = &myImage[startCurrentBank + (address & (ROM_BANK_SIZE - 1))];
access.codeAccessBase = &myCodeAccessBase[startCurrentBank + (address & (ROM_BANK_SIZE - 1))];
@ -326,7 +311,6 @@ bool Cartridge3EPlus::save(Serializer& out) const
{
out.putString(name());
out.putShortArray(bankInUse, 8);
out.putShortArray(segmentInUse, 4);
out.putByteArray(myRAM, RAM_TOTAL_SIZE);
}
catch (...)
@ -345,7 +329,6 @@ bool Cartridge3EPlus::load(Serializer& in)
if (in.getString() != name())
return false;
in.getShortArray(bankInUse, 8);
in.getShortArray(segmentInUse, 4);
in.getByteArray(myRAM, RAM_TOTAL_SIZE);
}
catch (...)

View File

@ -155,7 +155,6 @@ class Cartridge3EPlus: public Cartridge
static constexpr uInt16 BANK_UNDEFINED = 0x8000; // bank is undefined and inaccessible
uInt16 bankInUse[8]; // bank being used for ROM/RAM (eight 512 byte areas)
uInt16 segmentInUse[4]; // set by bank methods, to know which hotspot was accessed
static constexpr uInt16 BANK_SWITCH_HOTSPOT_RAM = 0x3E; // writes to this address cause bankswitching
static constexpr uInt16 BANK_SWITCH_HOTSPOT_ROM = 0x3F; // writes to this address cause bankswitching

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "System.hxx"
#include "TIA.hxx"
#include "Cart3F.hxx"
@ -27,7 +25,6 @@
Cartridge3F::Cartridge3F(const uInt8* image, uInt32 size,
const Settings& settings)
: Cartridge(settings),
myImage(nullptr),
mySize(size),
myCurrentBank(0)
{
@ -98,9 +95,7 @@ bool Cartridge3F::poke(uInt16 address, uInt8 value)
// Switch banks if necessary
if(address <= 0x003F)
{
bank(value);
}
// Pass the poke through to the TIA. In a real Atari, both the cart and the
// TIA see the address lines, and both react accordingly. In Stella, each
@ -114,7 +109,8 @@ bool Cartridge3F::poke(uInt16 address, uInt8 value)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge3F::bank(uInt16 bank)
{
if(bankLocked()) return false;
if(bankLocked())
return false;
// Make sure the bank they're asking for is reasonable
if((uInt32(bank) << 11) < mySize)

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "System.hxx"
#include "M6532.hxx"
#include "TIA.hxx"
@ -59,12 +57,7 @@ Cartridge4A50::Cartridge4A50(const uInt8* image, uInt32 size,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge4A50::reset()
{
// Initialize RAM
if(mySettings.getBool("ramrandom"))
for(uInt32 i = 0; i < 32768; ++i)
myRAM[i] = mySystem->randGenerator().next();
else
memset(myRAM, 0, 32768);
initializeRAM(myRAM, 32768);
mySliceLow = mySliceMiddle = mySliceHigh = 0;
myIsRomLow = myIsRomMiddle = myIsRomHigh = true;

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "System.hxx"
#include "Cart4K.hxx"

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "System.hxx"
#include "Cart4KSC.hxx"
@ -34,12 +32,8 @@ Cartridge4KSC::Cartridge4KSC(const uInt8* image, uInt32 size, const Settings& se
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge4KSC::reset()
{
// Initialize RAM
if(mySettings.getBool("ramrandom"))
for(uInt32 i = 0; i < 128; ++i)
myRAM[i] = mySystem->randGenerator().next();
else
memset(myRAM, 0, 128);
initializeRAM(myRAM, 128);
myBankChanged = true;
}

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "M6502.hxx"
#include "System.hxx"
#include "CartAR.hxx"
@ -28,7 +26,6 @@ CartridgeAR::CartridgeAR(const uInt8* image, uInt32 size,
const Settings& settings)
: Cartridge(settings),
mySize(std::max(size, 8448u)),
myLoadImages(nullptr),
myWriteEnabled(false),
myPower(true),
myPowerRomCycle(0),
@ -60,10 +57,7 @@ void CartridgeAR::reset()
{
// Initialize RAM
#if 0 // TODO - figure out actual behaviour of the real cart
if(mySettings.getBool("ramrandom"))
for(uInt32 i = 0; i < 6 * 1024; ++i)
myImage[i] = mySystem->randGenerator().next();
else
initializeRAM(myImage, 6*1024);
#endif
memset(myImage, 0, 6 * 1024);

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "System.hxx"
#include "CartBF.hxx"

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "System.hxx"
#include "CartBFSC.hxx"
@ -38,12 +36,7 @@ CartridgeBFSC::CartridgeBFSC(const uInt8* image, uInt32 size, const Settings& se
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeBFSC::reset()
{
// Initialize RAM
if(mySettings.getBool("ramrandom"))
for(uInt32 i = 0; i < 128; ++i)
myRAM[i] = mySystem->randGenerator().next();
else
memset(myRAM, 0, 128);
initializeRAM(myRAM, 128);
// Upon reset we switch to the startup bank
bank(myStartBank);

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "CompuMate.hxx"
#include "System.hxx"
#include "M6532.hxx"
@ -41,12 +39,7 @@ CartridgeCM::CartridgeCM(const uInt8* image, uInt32 size, const Settings& settin
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeCM::reset()
{
// Initialize RAM
if(mySettings.getBool("ramrandom"))
for(uInt32 i = 0; i < 2048; ++i)
myRAM[i] = mySystem->randGenerator().next();
else
memset(myRAM, 0, 2048);
initializeRAM(myRAM, 2048);
// Upon reset we switch to the startup bank
bank(myStartBank);

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "OSystem.hxx"
#include "Serializer.hxx"
#include "System.hxx"
@ -52,12 +50,7 @@ CartridgeCTY::CartridgeCTY(const uInt8* image, uInt32 size, const OSystem& osyst
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeCTY::reset()
{
// Initialize RAM
if(mySettings.getBool("ramrandom"))
for(uInt32 i = 0; i < 64; ++i)
myRAM[i] = mySystem->randGenerator().next();
else
memset(myRAM, 0, 64);
initializeRAM(myRAM, 64);
myRAM[0] = myRAM[1] = myRAM[2] = myRAM[3] = 0xFF;

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "System.hxx"
#include "CartCV.hxx"
@ -26,7 +24,6 @@
CartridgeCV::CartridgeCV(const uInt8* image, uInt32 size,
const Settings& settings)
: Cartridge(settings),
myInitialRAM(nullptr),
mySize(size)
{
if(mySize == 2048)
@ -58,14 +55,7 @@ void CartridgeCV::reset()
memcpy(myRAM, myInitialRAM.get(), 1024);
}
else
{
// Initialize RAM
if(mySettings.getBool("ramrandom"))
for(uInt32 i = 0; i < 1024; ++i)
myRAM[i] = mySystem->randGenerator().next();
else
memset(myRAM, 0, 1024);
}
initializeRAM(myRAM, 1024);
myBankChanged = true;
}

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "System.hxx"
#include "TIA.hxx"
#include "CartCVPlus.hxx"
@ -27,7 +25,6 @@
CartridgeCVPlus::CartridgeCVPlus(const uInt8* image, uInt32 size,
const Settings& settings)
: Cartridge(settings),
myImage(nullptr),
mySize(size),
myCurrentBank(0)
{
@ -45,12 +42,7 @@ CartridgeCVPlus::CartridgeCVPlus(const uInt8* image, uInt32 size,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeCVPlus::reset()
{
// Initialize RAM
if(mySettings.getBool("ramrandom"))
for(uInt32 i = 0; i < 1024; ++i)
myRAM[i] = mySystem->randGenerator().next();
else
memset(myRAM, 0, 1024);
initializeRAM(myRAM, 1024);
// We'll map the startup bank into the first segment upon reset
bank(myStartBank);

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "System.hxx"
#include "TIA.hxx"
#include "CartDASH.hxx"
@ -43,16 +41,11 @@ CartridgeDASH::CartridgeDASH(const uInt8* image, uInt32 size, const Settings& se
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeDASH::reset()
{
// Initialize RAM
if (mySettings.getBool("ramrandom"))
for (uInt32 i = 0; i < RAM_TOTAL_SIZE; ++i)
myRAM[i] = mySystem->randGenerator().next();
else
memset(myRAM, 0, RAM_TOTAL_SIZE);
initializeRAM(myRAM, RAM_TOTAL_SIZE);
// 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++)
for(uInt32 b = 0; b < 8; b++)
{
bankInUse[b] = BANK_UNDEFINED; // bank is undefined and inaccessible!
segmentInUse[b/2] = BANK_UNDEFINED;

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "System.hxx"
#include "CartDF.hxx"

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "System.hxx"
#include "CartDFSC.hxx"
@ -38,12 +36,7 @@ CartridgeDFSC::CartridgeDFSC(const uInt8* image, uInt32 size, const Settings& se
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeDFSC::reset()
{
// Initialize RAM
if(mySettings.getBool("ramrandom"))
for(uInt32 i = 0; i < 128; ++i)
myRAM[i] = mySystem->randGenerator().next();
else
memset(myRAM, 0, 128);
initializeRAM(myRAM, 128);
// Upon reset we switch to the startup bank
bank(myStartBank);

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "System.hxx"
#include "CartDPC.hxx"

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#ifdef DEBUGGER_SUPPORT
#include "Debugger.hxx"
#endif
@ -30,7 +28,6 @@
CartridgeDPCPlus::CartridgeDPCPlus(const uInt8* image, uInt32 size,
const Settings& settings)
: Cartridge(settings),
myImage(nullptr),
myFastFetch(false),
myLDAimmediate(false),
myParameterPointer(0),

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "System.hxx"
#include "CartE0.hxx"

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "System.hxx"
#include "CartE7.hxx"
@ -38,12 +36,7 @@ CartridgeE7::CartridgeE7(const uInt8* image, uInt32 size, const Settings& settin
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeE7::reset()
{
// Initialize RAM
if(mySettings.getBool("ramrandom"))
for(uInt32 i = 0; i < 2048; ++i)
myRAM[i] = mySystem->randGenerator().next();
else
memset(myRAM, 0, 2048);
initializeRAM(myRAM, 2048);
// Install some default banks for the RAM and first segment
bankRAM(0);

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "System.hxx"
#include "CartEF.hxx"

View File

@ -36,12 +36,7 @@ CartridgeEFSC::CartridgeEFSC(const uInt8* image, uInt32 size, const Settings& se
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeEFSC::reset()
{
// Initialize RAM
if(mySettings.getBool("ramrandom"))
for(uInt32 i = 0; i < 128; ++i)
myRAM[i] = mySystem->randGenerator().next();
else
memset(myRAM, 0, 128);
initializeRAM(myRAM, 128);
// Upon reset we switch to the startup bank
bank(myStartBank);

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "System.hxx"
#include "CartF0.hxx"

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "Random.hxx"
#include "System.hxx"
#include "CartF4.hxx"

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "System.hxx"
#include "CartF4SC.hxx"
@ -38,12 +36,7 @@ CartridgeF4SC::CartridgeF4SC(const uInt8* image, uInt32 size, const Settings& se
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF4SC::reset()
{
// Initialize RAM
if(mySettings.getBool("ramrandom"))
for(uInt32 i = 0; i < 128; ++i)
myRAM[i] = mySystem->randGenerator().next();
else
memset(myRAM, 0, 128);
initializeRAM(myRAM, 128);
// Upon reset we switch to the startup bank
bank(myStartBank);

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "System.hxx"
#include "CartF6.hxx"

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "System.hxx"
#include "CartF6SC.hxx"
@ -38,12 +36,7 @@ CartridgeF6SC::CartridgeF6SC(const uInt8* image, uInt32 size, const Settings& se
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF6SC::reset()
{
// Initialize RAM
if(mySettings.getBool("ramrandom"))
for(uInt32 i = 0; i < 128; ++i)
myRAM[i] = mySystem->randGenerator().next();
else
memset(myRAM, 0, 128);
initializeRAM(myRAM, 128);
// Upon reset we switch to the startup bank
bank(myStartBank);

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "System.hxx"
#include "CartF8.hxx"

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "System.hxx"
#include "CartF8SC.hxx"
@ -38,12 +36,7 @@ CartridgeF8SC::CartridgeF8SC(const uInt8* image, uInt32 size, const Settings& se
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF8SC::reset()
{
// Initialize RAM
if(mySettings.getBool("ramrandom"))
for(uInt32 i = 0; i < 128; ++i)
myRAM[i] = mySystem->randGenerator().next();
else
memset(myRAM, 0, 128);
initializeRAM(myRAM, 128);
// Upon reset we switch to the startup bank
bank(myStartBank);

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "System.hxx"
#include "CartFA.hxx"
@ -38,12 +36,7 @@ CartridgeFA::CartridgeFA(const uInt8* image, uInt32 size, const Settings& settin
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeFA::reset()
{
// Initialize RAM
if(mySettings.getBool("ramrandom"))
for(uInt32 i = 0; i < 256; ++i)
myRAM[i] = mySystem->randGenerator().next();
else
memset(myRAM, 0, 256);
initializeRAM(myRAM, 256);
// Upon reset we switch to the startup bank
bank(myStartBank);

View File

@ -47,12 +47,7 @@ CartridgeFA2::CartridgeFA2(const uInt8* image, uInt32 size, const OSystem& osyst
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeFA2::reset()
{
// Initialize RAM
if(mySettings.getBool("ramrandom"))
for(uInt32 i = 0; i < 256; ++i)
myRAM[i] = mySystem->randGenerator().next();
else
memset(myRAM, 0, 256);
initializeRAM(myRAM, 256);
// Upon reset we switch to the startup bank
bank(myStartBank);

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "System.hxx"
#include "CartFE.hxx"

View File

@ -18,7 +18,6 @@
//============================================================================
#include <cassert>
#include <cstring>
#include "System.hxx"
#include "CartMC.hxx"
@ -49,12 +48,7 @@ CartridgeMC::CartridgeMC(const uInt8* image, uInt32 size,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeMC::reset()
{
// Initialize RAM
if(mySettings.getBool("ramrandom"))
for(uInt32 i = 0; i < 32768; ++i)
myRAM[i] = mySystem->randGenerator().next();
else
memset(myRAM, 0, 32768);
initializeRAM(myRAM, 32768);
myBankChanged = true;
}

View File

@ -17,15 +17,12 @@
// $Id$
//============================================================================
#include <cstring>
#include "System.hxx"
#include "CartMDM.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeMDM::CartridgeMDM(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings),
myImage(nullptr),
mySize(size),
myCurrentBank(0),
myBankingDisabled(false)

View File

@ -17,8 +17,6 @@
// $Id: CartSB.cxx,v 1.0 2007/10/11
//============================================================================
#include <cstring>
#include "System.hxx"
#include "CartSB.hxx"
@ -26,7 +24,6 @@
CartridgeSB::CartridgeSB(const uInt8* image, uInt32 size,
const Settings& settings)
: Cartridge(settings),
myImage(nullptr),
mySize(size),
myCurrentBank(0)
{

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "System.hxx"
#include "CartUA.hxx"

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "TIA.hxx"
#include "M6502.hxx"
#include "System.hxx"
@ -44,12 +42,7 @@ CartridgeWD::CartridgeWD(const uInt8* image, uInt32 size,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeWD::reset()
{
// Initialize RAM
if(mySettings.getBool("ramrandom"))
for(uInt32 i = 0; i < 64; ++i)
myRAM[i] = mySystem->randGenerator().next();
else
memset(myRAM, 0, 64);
initializeRAM(myRAM, 64);
myCyclesAtBankswitchInit = 0;
myPendingBank = 0xF0; // one more than the allowable bank #

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "System.hxx"
#include "M6532.hxx"
#include "TIA.hxx"

View File

@ -17,9 +17,7 @@
// $Id$
//============================================================================
#include <cassert>
#include <cstdio>
#include <cstring>
#include <fstream>
#include "System.hxx"

View File

@ -17,10 +17,6 @@
// $Id$
//============================================================================
#include <cassert>
#include <cstdlib>
#include <cstring>
#include "bspf.hxx"
#ifdef DEBUGGER_SUPPORT