Some 'nullptr' updates to Cart classes.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3036 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2014-11-03 17:16:43 +00:00
parent 6f5c5b2df5
commit 3949101fb7
18 changed files with 38 additions and 39 deletions

View File

@ -28,7 +28,6 @@ AtariVox::AtariVox(Jack jack, const Event& event, const System& system,
const string& eepromfile) const string& eepromfile)
: Controller(jack, event, system, Controller::AtariVox), : Controller(jack, event, system, Controller::AtariVox),
mySerialPort((SerialPort&)port), mySerialPort((SerialPort&)port),
myEEPROM(NULL),
myShiftCount(0), myShiftCount(0),
myShiftRegister(0), myShiftRegister(0),
myLastDataWriteCycle(0) myLastDataWriteCycle(0)
@ -38,7 +37,7 @@ AtariVox::AtariVox(Jack jack, const Event& event, const System& system,
else else
myAboutString = " (invalid serial port \'" + portname + "\')"; myAboutString = " (invalid serial port \'" + portname + "\')";
myEEPROM = new MT24LC256(eepromfile, system); myEEPROM = make_ptr<MT24LC256>(eepromfile, system);
myDigitalPinState[One] = myDigitalPinState[Two] = myDigitalPinState[One] = myDigitalPinState[Two] =
myDigitalPinState[Three] = myDigitalPinState[Four] = true; myDigitalPinState[Three] = myDigitalPinState[Four] = true;
@ -50,7 +49,6 @@ AtariVox::AtariVox(Jack jack, const Event& event, const System& system,
AtariVox::~AtariVox() AtariVox::~AtariVox()
{ {
mySerialPort.closePort(); mySerialPort.closePort();
delete myEEPROM;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -106,7 +106,7 @@ class AtariVox : public Controller
SerialPort& mySerialPort; SerialPort& mySerialPort;
// The EEPROM used in the AtariVox // The EEPROM used in the AtariVox
MT24LC256* myEEPROM; unique_ptr<MT24LC256> myEEPROM;
// How many bits have been shifted into the shift register? // How many bits have been shifted into the shift register?
uInt8 myShiftCount; uInt8 myShiftCount;

View File

@ -24,7 +24,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge2K::Cartridge2K(const uInt8* image, uInt32 size, const Settings& settings) Cartridge2K::Cartridge2K(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings) : Cartridge(settings),
myImage(nullptr)
{ {
// Size can be a maximum of 2K // Size can be a maximum of 2K
if(size > 2048) size = 2048; if(size > 2048) size = 2048;

View File

@ -27,6 +27,7 @@
Cartridge3E::Cartridge3E(const uInt8* image, uInt32 size, Cartridge3E::Cartridge3E(const uInt8* image, uInt32 size,
const Settings& settings) const Settings& settings)
: Cartridge(settings), : Cartridge(settings),
myImage(nullptr),
mySize(size) mySize(size)
{ {
// Allocate array for the ROM image // Allocate array for the ROM image

View File

@ -27,6 +27,7 @@
Cartridge3F::Cartridge3F(const uInt8* image, uInt32 size, Cartridge3F::Cartridge3F(const uInt8* image, uInt32 size,
const Settings& settings) const Settings& settings)
: Cartridge(settings), : Cartridge(settings),
myImage(nullptr),
mySize(size) mySize(size)
{ {
// Allocate array for the ROM image // Allocate array for the ROM image

View File

@ -28,7 +28,8 @@ CartridgeAR::CartridgeAR(const uInt8* image, uInt32 size,
const Settings& settings) const Settings& settings)
: Cartridge(settings), : Cartridge(settings),
my6502(0), my6502(0),
mySize(BSPF_max(size, 8448u)) mySize(BSPF_max(size, 8448u)),
myLoadImages(nullptr)
{ {
// Create a load image buffer and copy the given image // Create a load image buffer and copy the given image
myLoadImages = new uInt8[mySize]; myLoadImages = new uInt8[mySize];

View File

@ -30,8 +30,8 @@ class System;
/** /**
Update of EF cartridge class used for Homestar Runner by Paul Slocum. Update of EF cartridge class used for Homestar Runner by Paul Slocum.
There are 32 4K banks (total of 128K ROM). There are 64 4K banks (total of 256K ROM).
Accessing $1FC0 - $1FDF switches to each bank. Accessing $1F80 - $1FBF switches to each bank.
@author Mike Saarna @author Mike Saarna
@version $Id$ @version $Id$
@ -159,8 +159,8 @@ class CartridgeBF : public Cartridge
// Indicates which bank is currently active // Indicates which bank is currently active
uInt16 myCurrentBank; uInt16 myCurrentBank;
// The 64K ROM image of the cartridge // The 256K ROM image of the cartridge
uInt8 myImage[262144]; uInt8 myImage[64 * 4096];
}; };
#endif #endif

View File

@ -29,8 +29,8 @@ class System;
#endif #endif
/** /**
There are 32 4K banks (total of 128K ROM) with 128 bytes of RAM. There are 64 4K banks (total of 256K ROM) with 128 bytes of RAM.
Accessing $1FD0 - $1FEF switches to each bank. Accessing $1F80 - $1FBF switches to each bank.
@author Stephen Anthony @author Stephen Anthony
@version $Id$ @version $Id$
@ -158,8 +158,8 @@ class CartridgeBFSC : public Cartridge
// Indicates which bank is currently active // Indicates which bank is currently active
uInt16 myCurrentBank; uInt16 myCurrentBank;
// The 64K ROM image of the cartridge // The 256K ROM image of the cartridge
uInt8 myImage[131072*2]; uInt8 myImage[64 * 4096];
// The 128 bytes of RAM // The 128 bytes of RAM
uInt8 myRAM[128]; uInt8 myRAM[128];

View File

@ -26,7 +26,7 @@
CartridgeCV::CartridgeCV(const uInt8* image, uInt32 size, CartridgeCV::CartridgeCV(const uInt8* image, uInt32 size,
const Settings& settings) const Settings& settings)
: Cartridge(settings), : Cartridge(settings),
myInitialRAM(0), myInitialRAM(nullptr),
mySize(size) mySize(size)
{ {
if(mySize == 2048) if(mySize == 2048)

View File

@ -24,9 +24,11 @@
#include "CartDASH.hxx" #include "CartDASH.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeDASH::CartridgeDASH(const uInt8* image, uInt32 size, const Settings& settings) : CartridgeDASH::CartridgeDASH(const uInt8* image, uInt32 size, const Settings& settings)
Cartridge(settings), mySize(size) { : Cartridge(settings),
mySize(size),
myImage(nullptr)
{
// Allocate array for the ROM image // Allocate array for the ROM image
myImage = new uInt8[mySize]; myImage = new uInt8[mySize];
@ -40,7 +42,8 @@ CartridgeDASH::CartridgeDASH(const uInt8* image, uInt32 size, const Settings& se
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeDASH::~CartridgeDASH() { CartridgeDASH::~CartridgeDASH()
{
delete[] myImage; delete[] myImage;
} }

View File

@ -159,8 +159,8 @@ class CartridgeDF : public Cartridge
// Indicates which bank is currently active // Indicates which bank is currently active
uInt16 myCurrentBank; uInt16 myCurrentBank;
// The 64K ROM image of the cartridge // The 128K ROM image of the cartridge
uInt8 myImage[131072]; uInt8 myImage[32 * 4096];
}; };
#endif #endif

View File

@ -30,7 +30,7 @@ class System;
/** /**
There are 32 4K banks (total of 128K ROM) with 128 bytes of RAM. There are 32 4K banks (total of 128K ROM) with 128 bytes of RAM.
Accessing $1FD0 - $1FEF switches to each bank. Accessing $1FC0 - $1FDF switches to each bank.
@author Stephen Anthony @author Stephen Anthony
@version $Id$ @version $Id$
@ -158,8 +158,8 @@ class CartridgeDFSC : public Cartridge
// Indicates which bank is currently active // Indicates which bank is currently active
uInt16 myCurrentBank; uInt16 myCurrentBank;
// The 64K ROM image of the cartridge // The 128K ROM image of the cartridge
uInt8 myImage[131072]; uInt8 myImage[32 * 4096];
// The 128 bytes of RAM // The 128 bytes of RAM
uInt8 myRAM[128]; uInt8 myRAM[128];

View File

@ -30,6 +30,7 @@
CartridgeDPCPlus::CartridgeDPCPlus(const uInt8* image, uInt32 size, CartridgeDPCPlus::CartridgeDPCPlus(const uInt8* image, uInt32 size,
const Settings& settings) const Settings& settings)
: Cartridge(settings), : Cartridge(settings),
myImage(nullptr),
myFastFetch(false), myFastFetch(false),
myLDAimmediate(false), myLDAimmediate(false),
myParameterPointer(0), myParameterPointer(0),
@ -59,8 +60,8 @@ CartridgeDPCPlus::CartridgeDPCPlus(const uInt8* image, uInt32 size,
#ifdef THUMB_SUPPORT #ifdef THUMB_SUPPORT
// Create Thumbulator ARM emulator // Create Thumbulator ARM emulator
myThumbEmulator = new Thumbulator((uInt16*)(myProgramImage-0xC00), myThumbEmulator = make_ptr<Thumbulator>
(uInt16*)myDPCRAM, ((uInt16*)(myProgramImage-0xC00), (uInt16*)myDPCRAM,
settings.getBool("thumb.trapfatal")); settings.getBool("thumb.trapfatal"));
#endif #endif
setInitialState(); setInitialState();
@ -73,10 +74,6 @@ CartridgeDPCPlus::CartridgeDPCPlus(const uInt8* image, uInt32 size,
CartridgeDPCPlus::~CartridgeDPCPlus() CartridgeDPCPlus::~CartridgeDPCPlus()
{ {
delete[] myImage; delete[] myImage;
#ifdef THUMB_SUPPORT
delete myThumbEmulator;
#endif
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -216,7 +216,7 @@ class CartridgeDPCPlus : public Cartridge
#ifdef THUMB_SUPPORT #ifdef THUMB_SUPPORT
// Pointer to the Thumb ARM emulator object // Pointer to the Thumb ARM emulator object
Thumbulator* myThumbEmulator; unique_ptr<Thumbulator> myThumbEmulator;
#endif #endif
// Pointer to the 1K frequency table // Pointer to the 1K frequency table

View File

@ -38,9 +38,6 @@ CartridgeFA2::CartridgeFA2(const uInt8* image, uInt32 size, const OSystem& osyst
mySize = 28 * 1024; mySize = 28 * 1024;
} }
// Allocate array for the ROM image
myImage = new uInt8[mySize];
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage, image, mySize); memcpy(myImage, image, mySize);
createCodeAccessBase(mySize); createCodeAccessBase(mySize);
@ -52,7 +49,6 @@ CartridgeFA2::CartridgeFA2(const uInt8* image, uInt32 size, const OSystem& osyst
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeFA2::~CartridgeFA2() CartridgeFA2::~CartridgeFA2()
{ {
delete[] myImage;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -197,7 +197,7 @@ class CartridgeFA2 : public Cartridge
uInt16 myCurrentBank; uInt16 myCurrentBank;
// The 24K/28K ROM image of the cartridge // The 24K/28K ROM image of the cartridge
uInt8* myImage; uInt8 myImage[28 * 1024];
// The 256 bytes of RAM on the cartridge // The 256 bytes of RAM on the cartridge
uInt8 myRAM[256]; uInt8 myRAM[256];

View File

@ -25,7 +25,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeMDM::CartridgeMDM(const uInt8* image, uInt32 size, const Settings& settings) CartridgeMDM::CartridgeMDM(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings), : Cartridge(settings),
myImage(NULL), myImage(nullptr),
mySize(size), mySize(size),
myBankingDisabled(false) myBankingDisabled(false)
{ {
@ -43,7 +43,7 @@ CartridgeMDM::CartridgeMDM(const uInt8* image, uInt32 size, const Settings& sett
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeMDM::~CartridgeMDM() CartridgeMDM::~CartridgeMDM()
{ {
delete[] myImage; myImage = NULL; delete[] myImage;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -26,6 +26,7 @@
CartridgeSB::CartridgeSB(const uInt8* image, uInt32 size, CartridgeSB::CartridgeSB(const uInt8* image, uInt32 size,
const Settings& settings) const Settings& settings)
: Cartridge(settings), : Cartridge(settings),
myImage(nullptr),
mySize(size) mySize(size)
{ {
// Allocate array for the ROM image // Allocate array for the ROM image