Some bugs indicated by running Stella through Coverity. Note that many

of these aren't actually bugs per-se, but are to follow good programming
practices.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3234 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2015-12-05 01:30:17 +00:00
parent 47911eff21
commit 9e23bc3580
77 changed files with 240 additions and 176 deletions

View File

@ -105,7 +105,9 @@ FilesystemNodeZIP::FilesystemNodeZIP(const string& p)
FilesystemNodeZIP::FilesystemNodeZIP(
const string& zipfile, const string& virtualpath,
shared_ptr<AbstractFSNode> realnode, bool isdir)
: _isDirectory(isdir),
: _error(ZIPERR_NONE),
_numFiles(0),
_isDirectory(isdir),
_isFile(!isdir)
{
setFlags(zipfile, virtualpath, realnode);

View File

@ -175,9 +175,6 @@ class FrameBufferSDL2 : public FrameBuffer
// Used by mapRGB (when palettes are created)
SDL_PixelFormat* myPixelFormat;
// The depth of the render buffer
uInt32 myDepth;
// Indicates that the renderer has been modified, and should be redrawn
bool myDirtyFlag;

View File

@ -41,6 +41,8 @@ SoundSDL2::SoundSDL2(OSystem& osystem)
myLastRegisterSetCycle(0),
myNumChannels(0),
myFragmentSizeLogBase2(0),
myFragmentSizeLogDiv1(0),
myFragmentSizeLogDiv2(0),
myIsMuted(true),
myVolume(100)
{

View File

@ -33,6 +33,10 @@ namespace Common {
template <class T, int MAX_SIZE = 50>
class FixedStack
{
protected:
T _stack[MAX_SIZE];
int _size;
public:
FixedStack<T, MAX_SIZE>() : _size(0) { }
@ -63,10 +67,6 @@ class FixedStack
return _stack[i];
}
protected:
T _stack[MAX_SIZE];
int _size;
private:
// Following constructors and assignment operators not supported
FixedStack(const FixedStack&) = delete;

View File

@ -107,10 +107,10 @@ DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list,
while(!myAddressQueue.empty())
{
myPC = myAddressQueue.front();
myPCBeg = myPC;
uInt16 pcBeg = myPC;
myAddressQueue.pop();
disasm(myPC, 1);
if(myPCBeg <= myPCEnd)
if(pcBeg <= myPCEnd)
{
// Tentatively mark all addresses in the range as CODE
// Note that this is a 'best-effort' approach, since
@ -119,7 +119,7 @@ DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list,
// However, addresses *specifically* marked as DATA/GFX/PGFX
// in the emulation core indicate that the CODE range has finished
// Therefore, we stop at the first such address encountered
for (uInt32 k = myPCBeg; k <= myPCEnd; k++)
for (uInt32 k = pcBeg; k <= myPCEnd; k++)
{
if(Debugger::debugger().getAccessFlags(k) &
(CartDebug::DATA|CartDebug::GFX|CartDebug::PGFX))

View File

@ -118,7 +118,7 @@ class DiStella
CartDebug::ReservedEquates& myReserved;
stringstream myDisasmBuf;
queue<uInt16> myAddressQueue;
uInt16 myOffset, myPC, myPCBeg, myPCEnd;
uInt16 myOffset, myPC, myPCEnd;
struct resource {
uInt16 start;

View File

@ -37,7 +37,10 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& lfont,
_selectedItem(-1),
_highlightedItem(-1),
_editMode(false),
_currentKeyDown(KBDK_UNKNOWN)
_currentKeyDown(KBDK_UNKNOWN),
_base(Common::Base::F_DEFAULT),
myDisasm(nullptr),
myBPState(nullptr)
{
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS;
_bgcolor = kWidColor;

View File

@ -28,7 +28,8 @@ Cartridge3E::Cartridge3E(const uInt8* image, uInt32 size,
const Settings& settings)
: Cartridge(settings),
myImage(nullptr),
mySize(size)
mySize(size),
myCurrentBank(0)
{
// Allocate array for the ROM image
myImage = new uInt8[mySize];

View File

@ -184,9 +184,6 @@ class Cartridge3E : public Cartridge
bool poke(uInt16 address, uInt8 value) override;
private:
// Indicates which bank is currently active for the first segment
uInt16 myCurrentBank;
// Pointer to a dynamically allocated ROM image of the cartridge
uInt8* myImage;
@ -196,6 +193,9 @@ class Cartridge3E : public Cartridge
// Size of the ROM image
uInt32 mySize;
// Indicates which bank is currently active for the first segment
uInt16 myCurrentBank;
private:
// Following constructors and assignment operators not supported
Cartridge3E() = delete;

View File

@ -28,7 +28,8 @@ Cartridge3F::Cartridge3F(const uInt8* image, uInt32 size,
const Settings& settings)
: Cartridge(settings),
myImage(nullptr),
mySize(size)
mySize(size),
myCurrentBank(0)
{
// Allocate array for the ROM image
myImage = new uInt8[mySize];

View File

@ -161,15 +161,15 @@ class Cartridge3F : public Cartridge
bool poke(uInt16 address, uInt8 value) override;
private:
// Indicates which bank is currently active for the first segment
uInt16 myCurrentBank;
// Pointer to a dynamically allocated ROM image of the cartridge
uInt8* myImage;
// Size of the ROM image
uInt32 mySize;
// Indicates which bank is currently active for the first segment
uInt16 myCurrentBank;
private:
// Following constructors and assignment operators not supported
Cartridge3F() = delete;

View File

@ -28,7 +28,13 @@
Cartridge4A50::Cartridge4A50(const uInt8* image, uInt32 size,
const Settings& settings)
: Cartridge(settings),
mySize(size)
mySize(size),
mySliceLow(0),
mySliceMiddle(0),
mySliceHigh(0),
myIsRomLow(true),
myIsRomMiddle(true),
myIsRomHigh(true)
{
// Copy the ROM image into my buffer
// Supported file sizes are 32/64/128K, which are duplicated if necessary

View File

@ -146,7 +146,6 @@ bool Cartridge4KSC::save(Serializer& out) const
try
{
out.putString(name());
out.putShort(myCurrentBank);
out.putByteArray(myRAM, 128);
}
catch(...)
@ -166,7 +165,6 @@ bool Cartridge4KSC::load(Serializer& in)
if(in.getString() != name())
return false;
myCurrentBank = in.getShort();
in.getByteArray(myRAM, 128);
}
catch(...)
@ -175,8 +173,5 @@ bool Cartridge4KSC::load(Serializer& in)
return false;
}
// Remember what bank we were in
bank(myCurrentBank);
return true;
}

View File

@ -29,8 +29,7 @@ class System;
#endif
/**
Cartridge class used for 4KSC games with
128 bytes of RAM. There are two 4K banks.
Cartridge class used for 4K games with 128 bytes of RAM.
*/
class Cartridge4KSC : public Cartridge
@ -130,15 +129,12 @@ class Cartridge4KSC : public Cartridge
Change the byte at the specified address to the given value
@param address The address where the value should be stored
@param value The value to be stored at the address
@param value The value to be stored at the address
@return True if the poke changed the device address space, else false
*/
bool poke(uInt16 address, uInt8 value) override;
private:
// Indicates which bank is currently active
uInt16 myCurrentBank;
// The 8K ROM image of the cartridge
uInt8 myImage[4096];

View File

@ -28,7 +28,14 @@ CartridgeAR::CartridgeAR(const uInt8* image, uInt32 size,
const Settings& settings)
: Cartridge(settings),
mySize(BSPF_max(size, 8448u)),
myLoadImages(nullptr)
myLoadImages(nullptr),
myWriteEnabled(false),
myPower(true),
myPowerRomCycle(0),
myDataHoldRegister(0),
myNumberOfDistinctAccesses(0),
myWritePending(false),
myCurrentBank(0)
{
// Create a load image buffer and copy the given image
myLoadImages = new uInt8[mySize];
@ -69,9 +76,9 @@ void CartridgeAR::reset()
// Initialize SC BIOS ROM
initializeROM();
myWriteEnabled = false;
myPower = true;
myPowerRomCycle = mySystem->cycles();
myWriteEnabled = false;
myDataHoldRegister = 0;
myNumberOfDistinctAccesses = 0;

View File

@ -225,6 +225,7 @@ class CartridgeAR : public Cartridge
// Indicates if a write is pending or not
bool myWritePending;
// Indicates which bank is currently active
uInt16 myCurrentBank;
// Fake SC-BIOS code to simulate the Supercharger load bars

View File

@ -24,7 +24,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeBF::CartridgeBF(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
: Cartridge(settings),
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(262144u, size));

View File

@ -156,12 +156,12 @@ class CartridgeBF : public Cartridge
bool poke(uInt16 address, uInt8 value) override;
private:
// Indicates which bank is currently active
uInt16 myCurrentBank;
// The 256K ROM image of the cartridge
uInt8 myImage[64 * 4096];
// Indicates which bank is currently active
uInt16 myCurrentBank;
private:
// Following constructors and assignment operators not supported
CartridgeBF() = delete;

View File

@ -24,7 +24,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeBFSC::CartridgeBFSC(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
: Cartridge(settings),
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(262144u, size));

View File

@ -155,15 +155,15 @@ class CartridgeBFSC : public Cartridge
bool poke(uInt16 address, uInt8 value) override;
private:
// Indicates which bank is currently active
uInt16 myCurrentBank;
// The 256K ROM image of the cartridge
uInt8 myImage[64 * 4096];
// The 128 bytes of RAM
uInt8 myRAM[128];
// Indicates which bank is currently active
uInt16 myCurrentBank;
private:
// Following constructors and assignment operators not supported
CartridgeBFSC() = delete;

View File

@ -26,15 +26,15 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeCM::CartridgeCM(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
: Cartridge(settings),
mySWCHA(0xFF), // portA is all 1's
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(16384u, size));
createCodeAccessBase(16384);
// On powerup, portA is all 1's, so the last bank of ROM is enabled and
// RAM is disabled
mySWCHA = 0xff;
// On powerup, the last bank of ROM is enabled and RAM is disabled
myStartBank = mySWCHA & 0x3;
}

View File

@ -242,9 +242,6 @@ class CartridgeCM : public Cartridge
// The CompuMate device which interacts with this cartridge
shared_ptr<CompuMate> myCompuMate;
// Indicates which bank is currently active
uInt16 myCurrentBank;
// The 16K ROM image of the cartridge
uInt8 myImage[16384];
@ -254,7 +251,10 @@ class CartridgeCM : public Cartridge
// Current copy of SWCHA (controls ROM/RAM accesses)
uInt8 mySWCHA;
private:
// Indicates which bank is currently active
uInt16 myCurrentBank;
private:
// Following constructors and assignment operators not supported
CartridgeCM() = delete;
CartridgeCM(const CartridgeCM&) = delete;

View File

@ -35,7 +35,8 @@ CartridgeCTY::CartridgeCTY(const uInt8* image, uInt32 size, const OSystem& osyst
myRandomNumber(0x2B435044),
myRamAccessTimeout(0),
mySystemCycles(0),
myFractionalClocks(0.0)
myFractionalClocks(0.0),
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(32768u, size));

View File

@ -272,9 +272,6 @@ class CartridgeCTY : public Cartridge
// OSsytem currently in use
const OSystem& myOSystem;
// Indicates which bank is currently active
uInt16 myCurrentBank;
// The 32K ROM image of the cartridge
uInt8 myImage[32768];
@ -313,6 +310,9 @@ class CartridgeCTY : public Cartridge
// Fractional DPC music OSC clocks unused during the last update
double myFractionalClocks;
// Indicates which bank is currently active
uInt16 myCurrentBank;
private:
// Following constructors and assignment operators not supported
CartridgeCTY() = delete;

View File

@ -24,7 +24,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeDF::CartridgeDF(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
: Cartridge(settings),
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(131072u, size));

View File

@ -156,13 +156,13 @@ class CartridgeDF : public Cartridge
bool poke(uInt16 address, uInt8 value) override;
private:
// Indicates which bank is currently active
uInt16 myCurrentBank;
// The 128K ROM image of the cartridge
uInt8 myImage[32 * 4096];
private:
// Indicates which bank is currently active
uInt16 myCurrentBank;
private:
// Following constructors and assignment operators not supported
CartridgeDF() = delete;
CartridgeDF(const CartridgeDF&) = delete;

View File

@ -24,7 +24,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeDFSC::CartridgeDFSC(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
: Cartridge(settings),
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(131072u, size));

View File

@ -155,15 +155,15 @@ class CartridgeDFSC : public Cartridge
bool poke(uInt16 address, uInt8 value) override;
private:
// Indicates which bank is currently active
uInt16 myCurrentBank;
// The 128K ROM image of the cartridge
uInt8 myImage[32 * 4096];
// The 128 bytes of RAM
uInt8 myRAM[128];
// Indicates which bank is currently active
uInt16 myCurrentBank;
private:
// Following constructors and assignment operators not supported
CartridgeDFSC() = delete;

View File

@ -28,7 +28,8 @@ CartridgeDPC::CartridgeDPC(const uInt8* image, uInt32 size,
: Cartridge(settings),
mySize(size),
mySystemCycles(0),
myFractionalClocks(0.0)
myFractionalClocks(0.0),
myCurrentBank(0)
{
// Make a copy of the entire image
memcpy(myImage, image, BSPF_min(size, 8192u + 2048u + 256u));

View File

@ -191,9 +191,6 @@ class CartridgeDPC : public Cartridge
// Pointer to the 2K display ROM image of the cartridge
uInt8* myDisplayImage;
// Indicates which bank is currently active
uInt16 myCurrentBank;
// The top registers for the data fetchers
uInt8 myTops[8];
@ -218,6 +215,9 @@ class CartridgeDPC : public Cartridge
// Fractional DPC music OSC clocks unused during the last update
double myFractionalClocks;
// Indicates which bank is currently active
uInt16 myCurrentBank;
private:
// Following constructors and assignment operators not supported
CartridgeDPC() = delete;

View File

@ -35,7 +35,8 @@ CartridgeDPCPlus::CartridgeDPCPlus(const uInt8* image, uInt32 size,
myLDAimmediate(false),
myParameterPointer(0),
mySystemCycles(0),
myFractionalClocks(0.0)
myFractionalClocks(0.0),
myCurrentBank(0)
{
// Store image, making sure it's at least 29KB
uInt32 minsize = 4096 * 6 + 4096 + 1024 + 255;

View File

@ -222,9 +222,6 @@ class CartridgeDPCPlus : public Cartridge
// Pointer to the 1K frequency table
uInt8* myFrequencyImage;
// Indicates which bank is currently active
uInt16 myCurrentBank;
// The top registers for the data fetchers
uInt8 myTops[8];
@ -270,6 +267,9 @@ class CartridgeDPCPlus : public Cartridge
// Fractional DPC music OSC clocks unused during the last update
double myFractionalClocks;
// Indicates which bank is currently active
uInt16 myCurrentBank;
private:
// Following constructors and assignment operators not supported
CartridgeDPCPlus() = delete;

View File

@ -24,7 +24,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeE7::CartridgeE7(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
: Cartridge(settings),
myCurrentRAM(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(16384u, size));

View File

@ -189,18 +189,18 @@ class CartridgeE7 : public Cartridge
void bankRAM(uInt16 bank);
private:
// Indicates which slice is in the segment
uInt16 myCurrentSlice[2];
// Indicates which 256 byte bank of RAM is being used
uInt16 myCurrentRAM;
// The 16K ROM image of the cartridge
uInt8 myImage[16384];
// The 2048 bytes of RAM
uInt8 myRAM[2048];
// Indicates which slice is in the segment
uInt16 myCurrentSlice[2];
// Indicates which 256 byte bank of RAM is being used
uInt16 myCurrentRAM;
private:
// Following constructors and assignment operators not supported
CartridgeE7() = delete;

View File

@ -24,7 +24,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeEF::CartridgeEF(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
: Cartridge(settings),
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(65536u, size));

View File

@ -159,12 +159,12 @@ class CartridgeEF : public Cartridge
bool poke(uInt16 address, uInt8 value) override;
private:
// Indicates which bank is currently active
uInt16 myCurrentBank;
// The 64K ROM image of the cartridge
uInt8 myImage[65536];
// Indicates which bank is currently active
uInt16 myCurrentBank;
private:
// Following constructors and assignment operators not supported
CartridgeEF() = delete;

View File

@ -17,14 +17,13 @@
// $Id$
//============================================================================
#include <cstring>
#include "System.hxx"
#include "CartEFSC.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeEFSC::CartridgeEFSC(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
: Cartridge(settings),
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(65536u, size));

View File

@ -159,15 +159,15 @@ class CartridgeEFSC : public Cartridge
bool poke(uInt16 address, uInt8 value) override;
private:
// Indicates which bank is currently active
uInt16 myCurrentBank;
// The 64K ROM image of the cartridge
uInt8 myImage[65536];
// The 128 bytes of RAM
uInt8 myRAM[128];
// Indicates which bank is currently active
uInt16 myCurrentBank;
private:
// Following constructors and assignment operators not supported
CartridgeEFSC() = delete;

View File

@ -24,7 +24,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeF0::CartridgeF0(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
: Cartridge(settings),
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(65536u, size));

View File

@ -162,12 +162,12 @@ class CartridgeF0 : public Cartridge
void incbank();
private:
// Indicates which bank is currently active
uInt16 myCurrentBank;
// The 64K ROM image of the cartridge
uInt8 myImage[65536];
// Indicates which bank is currently active
uInt16 myCurrentBank;
private:
// Following constructors and assignment operators not supported
CartridgeF0() = delete;

View File

@ -25,7 +25,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeF4::CartridgeF4(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
: Cartridge(settings),
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(32768u, size));

View File

@ -155,12 +155,12 @@ class CartridgeF4 : public Cartridge
bool poke(uInt16 address, uInt8 value) override;
private:
// Indicates which bank is currently active
uInt16 myCurrentBank;
// The 32K ROM image of the cartridge
uInt8 myImage[32768];
// Indicates which bank is currently active
uInt16 myCurrentBank;
private:
// Following constructors and assignment operators not supported
CartridgeF4() = delete;

View File

@ -24,7 +24,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeF4SC::CartridgeF4SC(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
: Cartridge(settings),
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(32768u, size));

View File

@ -155,15 +155,15 @@ class CartridgeF4SC : public Cartridge
bool poke(uInt16 address, uInt8 value) override;
private:
// Indicates which bank is currently active
uInt16 myCurrentBank;
// The 32K ROM image of the cartridge
uInt8 myImage[32768];
// The 128 bytes of RAM
uInt8 myRAM[128];
// Indicates which bank is currently active
uInt16 myCurrentBank;
private:
// Following constructors and assignment operators not supported
CartridgeF4SC() = delete;

View File

@ -24,7 +24,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeF6::CartridgeF6(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
: Cartridge(settings),
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(16384u, size));

View File

@ -155,12 +155,12 @@ class CartridgeF6 : public Cartridge
bool poke(uInt16 address, uInt8 value) override;
private:
// Indicates which bank is currently active
uInt16 myCurrentBank;
// The 16K ROM image of the cartridge
uInt8 myImage[16384];
// Indicates which bank is currently active
uInt16 myCurrentBank;
private:
// Following constructors and assignment operators not supported
CartridgeF6() = delete;

View File

@ -24,7 +24,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeF6SC::CartridgeF6SC(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
: Cartridge(settings),
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(16384u, size));

View File

@ -155,15 +155,15 @@ class CartridgeF6SC : public Cartridge
bool poke(uInt16 address, uInt8 value) override;
private:
// Indicates which bank is currently active
uInt16 myCurrentBank;
// The 16K ROM image of the cartridge
uInt8 myImage[16384];
// The 128 bytes of RAM
uInt8 myRAM[128];
// Indicates which bank is currently active
uInt16 myCurrentBank;
private:
// Following constructors and assignment operators not supported
CartridgeF6SC() = delete;

View File

@ -25,7 +25,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeF8::CartridgeF8(const uInt8* image, uInt32 size, const string& md5,
const Settings& settings)
: Cartridge(settings)
: Cartridge(settings),
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(8192u, size));

View File

@ -157,12 +157,12 @@ class CartridgeF8 : public Cartridge
bool poke(uInt16 address, uInt8 value) override;
private:
// Indicates which bank is currently active
uInt16 myCurrentBank;
// The 8K ROM image of the cartridge
uInt8 myImage[8192];
// Indicates which bank is currently active
uInt16 myCurrentBank;
private:
// Following constructors and assignment operators not supported
CartridgeF8() = delete;

View File

@ -24,7 +24,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeF8SC::CartridgeF8SC(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
: Cartridge(settings),
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(8192u, size));

View File

@ -155,15 +155,15 @@ class CartridgeF8SC : public Cartridge
bool poke(uInt16 address, uInt8 value) override;
private:
// Indicates which bank is currently active
uInt16 myCurrentBank;
// The 8K ROM image of the cartridge
uInt8 myImage[8192];
// The 128 bytes of RAM
uInt8 myRAM[128];
// Indicates which bank is currently active
uInt16 myCurrentBank;
private:
// Following constructors and assignment operators not supported
CartridgeF8SC() = delete;

View File

@ -24,7 +24,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeFA::CartridgeFA(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
: Cartridge(settings),
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(12288u, size));

View File

@ -155,15 +155,15 @@ class CartridgeFA : public Cartridge
bool poke(uInt16 address, uInt8 value) override;
private:
// Indicates which bank is currently active
uInt16 myCurrentBank;
// The 12K ROM image of the cartridge
uInt8 myImage[12288];
// The 256 bytes of RAM on the cartridge
uInt8 myRAM[256];
// Indicates which bank is currently active
uInt16 myCurrentBank;
private:
// Following constructors and assignment operators not supported
CartridgeFA() = delete;

View File

@ -17,8 +17,6 @@
// $Id$
//============================================================================
#include <cstring>
#include "OSystem.hxx"
#include "Serializer.hxx"
#include "System.hxx"
@ -29,7 +27,7 @@ CartridgeFA2::CartridgeFA2(const uInt8* image, uInt32 size, const OSystem& osyst
: Cartridge(osystem.settings()),
myOSystem(osystem),
myRamAccessTimeout(0),
mySize(size)
myCurrentBank(0)
{
// 29/32K version of FA2 has valid data @ 1K - 29K
if(size >= 29 * 1024)
@ -37,6 +35,8 @@ CartridgeFA2::CartridgeFA2(const uInt8* image, uInt32 size, const OSystem& osyst
image += 1024;
mySize = 28 * 1024;
}
else
mySize = BSPF_min(28 * 1024u, size);
// Copy the ROM image into my buffer
memcpy(myImage, image, mySize);

View File

@ -193,12 +193,12 @@ class CartridgeFA2 : public Cartridge
// OSsytem currently in use
const OSystem& myOSystem;
// Indicates which bank is currently active
uInt16 myCurrentBank;
// The 24K/28K ROM image of the cartridge
uInt8 myImage[28 * 1024];
// Actual usable size of the ROM image
uInt32 mySize;
// The 256 bytes of RAM on the cartridge
uInt8 myRAM[256];
@ -212,8 +212,8 @@ class CartridgeFA2 : public Cartridge
// of internal RAM to Harmony cart flash
string myFlashFile;
// Size of the ROM image
uInt32 mySize;
// Indicates which bank is currently active
uInt16 myCurrentBank;
private:
// Following constructors and assignment operators not supported

View File

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

View File

@ -172,12 +172,12 @@ class CartridgeMDM : public Cartridge
// Size of the ROM image
uInt32 mySize;
// Indicates which bank is currently active
uInt16 myCurrentBank;
// Previous Device's page access
System::PageAccess myHotSpotPageAccess[8];
// Indicates which bank is currently active
uInt16 myCurrentBank;
// Indicates whether banking has been disabled due to a bankswitch
// above bank 127
bool myBankingDisabled;

View File

@ -27,7 +27,8 @@ CartridgeSB::CartridgeSB(const uInt8* image, uInt32 size,
const Settings& settings)
: Cartridge(settings),
myImage(nullptr),
mySize(size)
mySize(size),
myCurrentBank(0)
{
// Allocate array for the ROM image
myImage = new uInt8[mySize];

View File

@ -24,7 +24,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeUA::CartridgeUA(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
: Cartridge(settings),
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(8192u, size));

View File

@ -155,15 +155,15 @@ class CartridgeUA : public Cartridge
bool poke(uInt16 address, uInt8 value) override;
private:
// Indicates which bank is currently active
uInt16 myCurrentBank;
// The 8K ROM image of the cartridge
uInt8 myImage[8192];
// Previous Device's page access
System::PageAccess myHotSpotPageAccess;
// Indicates which bank is currently active
uInt16 myCurrentBank;
private:
// Following constructors and assignment operators not supported
CartridgeUA() = delete;

View File

@ -28,7 +28,10 @@
CartridgeWD::CartridgeWD(const uInt8* image, uInt32 size,
const Settings& settings)
: Cartridge(settings),
mySize(BSPF_min(8195u, size))
mySize(BSPF_min(8195u, size)),
myCyclesAtBankswitchInit(0),
myPendingBank(0),
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, mySize);

View File

@ -214,15 +214,12 @@ class CartridgeWD : public Cartridge
void segmentThree(uInt8 slice, bool map3bytes);
private:
// Indicates which bank is currently active
uInt16 myCurrentBank;
// The 8K ROM image of the cartridge
uInt8 myImage[8195];
// Indicates the actual size of the ROM image (either 8K or 8K + 3)
uInt32 mySize;
// The 8K ROM image of the cartridge
uInt8 myImage[8195];
// The 64 bytes RAM of the cartridge
uInt8 myRAM[64];
@ -238,6 +235,9 @@ class CartridgeWD : public Cartridge
// Indicates the bank we wish to switch to in the future
uInt16 myPendingBank;
// Indicates which bank is currently active
uInt16 myCurrentBank;
// The arrangement of banks to use on each hotspot read
struct BankOrg {
uInt8 zero, one, two, three;

View File

@ -26,7 +26,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeX07::CartridgeX07(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
: Cartridge(settings),
myCurrentBank(0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(65536u, size));

View File

@ -165,12 +165,12 @@ class CartridgeX07 : public Cartridge
bool poke(uInt16 address, uInt8 value) override;
private:
// Indicates which bank is currently active
uInt16 myCurrentBank;
// The 64K ROM image of the cartridge
uInt8 myImage[65536];
// Indicates which bank is currently active
uInt16 myCurrentBank;
private:
// Following constructors and assignment operators not supported
CartridgeX07() = delete;

View File

@ -25,7 +25,9 @@
CompuMate::CompuMate(const Console& console, const Event& event,
const System& system)
: myConsole(console),
myEvent(event)
myEvent(event),
myColumn(0),
myKeyTable(nullptr)
{
// These controller pointers will be retrieved by the Console, which will
// also take ownership of them
@ -74,7 +76,7 @@ void CompuMate::update()
rp.myDigitalPinState[Controller::Three] = true;
rp.myDigitalPinState[Controller::Four] = true;
switch(myColumn)
switch(myColumn) // This is updated outside the class
{
case 0:
if (myKeyTable[KBDK_7]) lp.myDigitalPinState[Controller::Six] = false;

View File

@ -63,7 +63,9 @@ EventHandler::EventHandler(OSystem& osystem)
myAllowAllDirectionsFlag(false),
myFryingFlag(false),
myUseCtrlKeyFlag(true),
mySkipMouseMotion(true)
mySkipMouseMotion(true),
myContSnapshotInterval(0),
myContSnapshotCounter(0)
{
// Erase the key mapping array
for(int i = 0; i < KBDK_LAST; ++i)

View File

@ -49,7 +49,8 @@
FrameBuffer::FrameBuffer(OSystem& osystem)
: myOSystem(osystem),
myInitializedCount(0),
myPausedCount(0)
myPausedCount(0),
myCurrentModeList(nullptr)
{
myMsg.surface = myStatsMsg.surface = nullptr;
myMsg.enabled = myStatsMsg.enabled = false;

View File

@ -26,8 +26,16 @@ KidVid::KidVid(Jack jack, const Event& event, const System& system,
const string& rommd5)
: Controller(jack, event, system, Controller::KidVid),
myEnabled(myJack == Right),
mySampleFile(nullptr),
mySharedSampleFile(nullptr),
myFileOpened(false),
myTapeBusy(false),
myFilePointer(0),
mySongCounter(0),
myBeep(false),
mySharedData(false),
mySampleByte(0),
myGame(0),
myTape(0),
myIdx(0),
myBlock(0),

View File

@ -49,6 +49,8 @@ M6502::M6502(const Settings& settings)
: myExecutionStatus(0),
mySystem(nullptr),
mySettings(settings),
A(0), X(0), Y(0), SP(0), IR(0), PC(0),
N(false), V(false), B(false), D(false), I(false), notZ(false), C(false),
myLastAccessWasRead(true),
myNumberOfDistinctAccesses(0),
myLastAddress(0),

View File

@ -273,21 +273,6 @@ class M6502 : public Serializable
void interruptHandler();
private:
uInt8 A; // Accumulator
uInt8 X; // X index register
uInt8 Y; // Y index register
uInt8 SP; // Stack Pointer
uInt8 IR; // Instruction register
uInt16 PC; // Program Counter
bool N; // N flag for processor status register
bool V; // V flag for processor status register
bool B; // B flag for processor status register
bool D; // D flag for processor status register
bool I; // I flag for processor status register
bool notZ; // Z flag complement for processor status register
bool C; // C flag for processor status register
/**
Bit fields used to indicate that certain conditions need to be
handled such as stopping execution, fatal errors, maskable interrupts
@ -308,6 +293,21 @@ class M6502 : public Serializable
/// Reference to the settings
const Settings& mySettings;
uInt8 A; // Accumulator
uInt8 X; // X index register
uInt8 Y; // Y index register
uInt8 SP; // Stack Pointer
uInt8 IR; // Instruction register
uInt16 PC; // Program Counter
bool N; // N flag for processor status register
bool V; // V flag for processor status register
bool B; // B flag for processor status register
bool D; // D flag for processor status register
bool I; // I flag for processor status register
bool notZ; // Z flag complement for processor status register
bool C; // C flag for processor status register
/// Indicates if the last memory access was a read or not
bool myLastAccessWasRead;

View File

@ -31,6 +31,9 @@
M6532::M6532(const Console& console, const Settings& settings)
: myConsole(console),
mySettings(settings),
myTimer(0), myIntervalShift(0), myCyclesWhenTimerSet(0),
myDDRA(0), myDDRB(0), myOutA(0), myOutB(0),
myInterruptFlag(false),
myTimerFlagValid(false),
myEdgeDetectPositive(false)
{

View File

@ -29,7 +29,12 @@
DialogContainer::DialogContainer(OSystem& osystem)
: myOSystem(osystem),
myBaseDialog(nullptr),
myTime(0)
myTime(0),
myKeyRepeatTime(0),
myClickRepeatTime(0),
myButtonRepeatTime(0),
myAxisRepeatTime(0),
myHatRepeatTime(0)
{
reset();
}

View File

@ -40,6 +40,10 @@ EventMappingWidget::EventMappingWidget(GuiObject* boss, const GUI::Font& font,
myEventMode(mode),
myActionSelected(-1),
myRemapStatus(false),
myLastStick(0),
myLastAxis(0),
myLastHat(0),
myLastValue(0),
myFirstTime(true)
{
const int fontHeight = font.getFontHeight(),

View File

@ -53,6 +53,7 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
myOptionsButton(nullptr),
myQuitButton(nullptr),
myList(nullptr),
myPattern(nullptr),
myRomInfoWidget(nullptr),
mySelectedItem(0)
{

View File

@ -40,17 +40,19 @@ void FilesystemNodePOSIX::setFlags()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodePOSIX::FilesystemNodePOSIX()
: _path("/"), // The root dir.
_displayName(_path),
_isValid(true),
_isFile(false),
_isDirectory(true)
{
// The root dir.
_path = "/";
_displayName = _path;
_isValid = true;
_isDirectory = true;
_isFile = false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodePOSIX::FilesystemNodePOSIX(const string& p, bool verify)
: _isValid(true),
_isFile(false),
_isDirectory(true)
{
// Default to home directory
_path = p.length() > 0 ? p : "~";

View File

@ -79,11 +79,11 @@ class FilesystemNodePOSIX : public AbstractFSNode
AbstractFSNode* getParent() const override;
protected:
string _displayName;
string _path;
bool _isDirectory;
bool _isFile;
string _displayName;
bool _isValid;
bool _isFile;
bool _isDirectory;
private:
/**