Some updates to the last BUS/CDF commit:

- update some code to the '5.0' way of doing things
  - allow compilation in Linux
  - whitespace/tab fixes to match main codebase
  - add some extra comments
  - test compile under gcc 6 and clang 5, and fix some warnings
This commit is contained in:
Stephen Anthony 2017-03-24 18:02:08 -02:30
parent 7c6821dfcb
commit 95c7b30a45
16 changed files with 693 additions and 719 deletions

View File

@ -8,13 +8,11 @@
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2015 by Bradford W. Mott, Stephen Anthony
// Copyright (c) 1995-2017 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: CartBUSWidget.cxx 3131 2015-01-01 03:49:32Z stephena $
//============================================================================
#include "CartBUS.hxx"
@ -149,7 +147,6 @@ CartridgeBUSWidget::CartridgeBUSWidget(
myZPSTY = new CheckboxWidget(boss, _font, xpos, ypos, "Zero Page STY");
myZPSTY->setTarget(this);
myZPSTY->setEditable(false);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -226,7 +223,7 @@ void CartridgeBUSWidget::loadConfig()
// I = Increment
// F = Fractional
uInt32 pointervalue = myCart.getDatastreamPointer(i) >> 12;
Int32 pointervalue = myCart.getDatastreamPointer(i) >> 12;
alist.push_back(0); vlist.push_back(pointervalue);
changed.push_back(pointervalue != myOldState.datastreampointers[i]);
}
@ -235,7 +232,7 @@ void CartridgeBUSWidget::loadConfig()
alist.clear(); vlist.clear(); changed.clear();
for(int i = 0; i < 16; ++i)
{
uInt32 incrementvalue = myCart.getDatastreamIncrement(i);
Int32 incrementvalue = myCart.getDatastreamIncrement(i);
alist.push_back(0); vlist.push_back(incrementvalue);
changed.push_back(incrementvalue != myOldState.datastreamincrements[i]);
}
@ -244,7 +241,7 @@ void CartridgeBUSWidget::loadConfig()
alist.clear(); vlist.clear(); changed.clear();
for(int i = 0; i < 40; ++i)
{
uInt32 mapvalue = myCart.getAddressMap(i);
Int32 mapvalue = myCart.getAddressMap(i);
alist.push_back(0); vlist.push_back(mapvalue);
changed.push_back(mapvalue != myOldState.addressmaps[i]);
}
@ -270,7 +267,7 @@ void CartridgeBUSWidget::loadConfig()
for(int i = 0; i < 3; ++i)
{
alist.push_back(0); vlist.push_back(myCart.getWaveform(i) >> 5);
changed.push_back((myCart.getWaveform(i) >> 5) != myOldState.mwaves[i]);
changed.push_back((myCart.getWaveform(i) >> 5) != uInt32(myOldState.mwaves[i]));
}
myMusicWaveforms->setList(alist, vlist, changed);
@ -278,7 +275,7 @@ void CartridgeBUSWidget::loadConfig()
for(int i = 0; i < 3; ++i)
{
alist.push_back(0); vlist.push_back(myCart.getWaveformSize(i));
changed.push_back((myCart.getWaveformSize(i)) != myOldState.mwavesizes[i]);
changed.push_back((myCart.getWaveformSize(i)) != uInt32(myOldState.mwavesizes[i]));
}
myMusicWaveformSizes->setList(alist, vlist, changed);

View File

@ -8,13 +8,11 @@
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2015 by Bradford W. Mott, Stephen Anthony
// Copyright (c) 1995-2017 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: CartBUSWidget.hxx 3131 2015-01-01 03:49:32Z stephena $
//============================================================================
#ifndef CARTRIDGEBUS_WIDGET_HXX
@ -34,7 +32,7 @@ class CartridgeBUSWidget : public CartDebugWidget
const GUI::Font& nfont,
int x, int y, int w, int h,
CartridgeBUS& cart);
virtual ~CartridgeBUSWidget() { }
virtual ~CartridgeBUSWidget() = default;
private:
struct CartState {
@ -67,7 +65,7 @@ class CartridgeBUSWidget : public CartDebugWidget
enum { kBankChanged = 'bkCH' };
private:
private:
void saveOldState() override;
void loadConfig() override;

20
src/debugger/gui/CartCDFWidget.cxx Executable file → Normal file
View File

@ -8,13 +8,11 @@
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2015 by Bradford W. Mott, Stephen Anthony
// Copyright (c) 1995-2017 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: CartCDFWidget.cxx 3131 2015-01-01 03:49:32Z stephena $
//============================================================================
#include "CartCDF.hxx"
@ -26,8 +24,8 @@
CartridgeCDFWidget::CartridgeCDFWidget(
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
int x, int y, int w, int h, CartridgeCDF& cart)
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
myCart(cart)
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
myCart(cart)
{
uInt16 size = 8 * 4096;
@ -211,7 +209,7 @@ void CartridgeCDFWidget::loadConfig()
// I = Increment
// F = Fractional
uInt32 pointervalue = myCart.getDatastreamPointer(i) >> 12;
Int32 pointervalue = myCart.getDatastreamPointer(i) >> 12;
alist.push_back(0); vlist.push_back(pointervalue);
changed.push_back(pointervalue != myOldState.datastreampointers[i]);
}
@ -220,7 +218,7 @@ void CartridgeCDFWidget::loadConfig()
alist.clear(); vlist.clear(); changed.clear();
for(int i = 0; i < 32; ++i)
{
uInt32 incrementvalue = myCart.getDatastreamIncrement(i);
Int32 incrementvalue = myCart.getDatastreamIncrement(i);
alist.push_back(0); vlist.push_back(incrementvalue);
changed.push_back(incrementvalue != myOldState.datastreamincrements[i]);
}
@ -230,7 +228,7 @@ void CartridgeCDFWidget::loadConfig()
for(int i = 0; i < 3; ++i)
{
alist.push_back(0); vlist.push_back(myCart.myMusicCounters[i]);
changed.push_back(myCart.myMusicCounters[i] != (uInt32)myOldState.mcounters[i]);
changed.push_back(myCart.myMusicCounters[i] != uInt32(myOldState.mcounters[i]));
}
myMusicCounters->setList(alist, vlist, changed);
@ -238,7 +236,7 @@ void CartridgeCDFWidget::loadConfig()
for(int i = 0; i < 3; ++i)
{
alist.push_back(0); vlist.push_back(myCart.myMusicFrequencies[i]);
changed.push_back(myCart.myMusicFrequencies[i] != (uInt32)myOldState.mfreqs[i]);
changed.push_back(myCart.myMusicFrequencies[i] != uInt32(myOldState.mfreqs[i]));
}
myMusicFrequencies->setList(alist, vlist, changed);
@ -246,7 +244,7 @@ void CartridgeCDFWidget::loadConfig()
for(int i = 0; i < 3; ++i)
{
alist.push_back(0); vlist.push_back(myCart.getWaveform(i) >> 5);
changed.push_back((myCart.getWaveform(i) >> 5) != myOldState.mwaves[i]);
changed.push_back((myCart.getWaveform(i) >> 5) != uInt32(myOldState.mwaves[i]));
}
myMusicWaveforms->setList(alist, vlist, changed);
@ -254,7 +252,7 @@ void CartridgeCDFWidget::loadConfig()
for(int i = 0; i < 3; ++i)
{
alist.push_back(0); vlist.push_back(myCart.getWaveformSize(i));
changed.push_back((myCart.getWaveformSize(i)) != myOldState.mwavesizes[i]);
changed.push_back((myCart.getWaveformSize(i)) != uInt32(myOldState.mwavesizes[i]));
}
myMusicWaveformSizes->setList(alist, vlist, changed);

16
src/debugger/gui/CartCDFWidget.hxx Executable file → Normal file
View File

@ -8,13 +8,11 @@
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2015 by Bradford W. Mott, Stephen Anthony
// Copyright (c) 1995-2017 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: CartCDFWidget.hxx 3131 2015-01-01 03:49:32Z stephena $
//============================================================================
#ifndef CARTRIDGECDF_WIDGET_HXX
@ -29,14 +27,14 @@ class DataGridWidget;
class CartridgeCDFWidget : public CartDebugWidget
{
public:
public:
CartridgeCDFWidget(GuiObject* boss, const GUI::Font& lfont,
const GUI::Font& nfont,
int x, int y, int w, int h,
CartridgeCDF& cart);
virtual ~CartridgeCDFWidget() { }
virtual ~CartridgeCDFWidget() = default;
private:
private:
struct CartState {
ByteArray tops;
ByteArray bottoms;
@ -61,13 +59,13 @@ private:
DataGridWidget* myMusicWaveforms;
DataGridWidget* myMusicWaveformSizes;
// done differently than in DPC+, need to rethink debugger support
// CheckboxWidget* myFastFetch;
// CheckboxWidget* myIMLDA;
// CheckboxWidget* myFastFetch;
// CheckboxWidget* myIMLDA;
CartState myOldState;
enum { kBankChanged = 'bkCH' };
private:
private:
void saveOldState() override;
void loadConfig() override;

View File

@ -690,6 +690,7 @@ void DataGridWidget::endEditMode()
editString().insert(0, 1, '#');
break;
case Common::Base::F_DEFAULT:
default:
break;
}
}

View File

@ -111,6 +111,7 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& lfont,
return (c >= '0' && c <= '9') || c == ' ';
case Common::Base::F_DEFAULT:
default:
return false;
}
return false;

View File

@ -31,6 +31,8 @@ MODULE_OBJS := \
src/debugger/gui/Cart4KWidget.o \
src/debugger/gui/Cart4KSCWidget.o \
src/debugger/gui/CartARWidget.o \
src/debugger/gui/CartBUSWidget.o \
src/debugger/gui/CartCDFWidget.o \
src/debugger/gui/CartCMWidget.o \
src/debugger/gui/CartCTYWidget.o \
src/debugger/gui/CartCVWidget.o \

View File

@ -8,13 +8,11 @@
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2015 by Bradford W. Mott, Stephen Anthony
// Copyright (c) 1995-2017 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: CartBUS.cxx 3131 2015-01-01 03:49:32Z stephena $
//============================================================================
#include <cstring>
@ -61,11 +59,8 @@ CartridgeBUS::CartridgeBUS(const uInt8* image, uInt32 size,
#ifdef THUMB_SUPPORT
// Create Thumbulator ARM emulator
myThumbEmulator = make_ptr<Thumbulator>
((uInt16*)myImage, (uInt16*)myBUSRAM,
settings.getBool("thumb.trapfatal"),
Thumbulator::ConfigureFor::BUS,
this);
myThumbEmulator = make_ptr<Thumbulator>((uInt16*)myImage, (uInt16*)myBUSRAM,
settings.getBool("thumb.trapfatal"), Thumbulator::ConfigureFor::BUS, this);
#endif
setInitialState();
@ -76,18 +71,12 @@ CartridgeBUS::CartridgeBUS(const uInt8* image, uInt32 size,
myBusStuff = false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeBUS::~CartridgeBUS()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeBUS::reset()
{
// Initialize RAM
if(mySettings.getBool("ramrandom"))
for(uInt32 t = 2048; t < 8192; ++t)
myBUSRAM[t] = mySystem->randGenerator().next();
initializeRAM(myBUSRAM+2048, 8192-2048);
else
memset(myBUSRAM+2048, 0, 8192-2048);
@ -328,6 +317,8 @@ uInt8 CartridgeBUS::peek(uInt16 address)
return peekvalue;
}
}
return 0; // make compiler happy
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -343,7 +334,6 @@ bool CartridgeBUS::poke(uInt16 address, uInt8 value)
mySystem->m6532().poke(address, value);
else if(!(lowAddress & 0x200))
mySystem->tia().poke(address, value);
}
else
{
@ -506,7 +496,6 @@ const uInt8* CartridgeBUS::getImage(int& size) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 CartridgeBUS::busOverdrive(uInt16 address)
{
uInt8 overdrive = 0xff;
@ -532,7 +521,7 @@ uInt8 CartridgeBUS::busOverdrive(uInt16 address)
alldatastreams |= (datastream << 28);
setAddressMap(map, alldatastreams);
// overdrive |= 0x7c; // breaks bus stuffing to match hobo's system
// overdrive |= 0x7c; // breaks bus stuffing to match hobo's system
}
}
@ -542,10 +531,8 @@ uInt8 CartridgeBUS::busOverdrive(uInt16 address)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 CartridgeBUS::thumbCallback(uInt8 function, uInt32 value1, uInt32 value2)
{
switch (function)
{
case 0:
@ -573,7 +560,6 @@ uInt32 CartridgeBUS::thumbCallback(uInt8 function, uInt32 value1, uInt32 value2)
return 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeBUS::save(Serializer& out) const
{
@ -629,7 +615,8 @@ bool CartridgeBUS::load(Serializer& in)
return true;
}
uInt32 CartridgeBUS::getDatastreamPointer(uInt8 index)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 CartridgeBUS::getDatastreamPointer(uInt8 index) const
{
// index &= 0x0f;
@ -639,6 +626,7 @@ uInt32 CartridgeBUS::getDatastreamPointer(uInt8 index)
(myBUSRAM[DSxPTR + index*4 + 3] << 24) ; // high byte
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeBUS::setDatastreamPointer(uInt8 index, uInt32 value)
{
// index &= 0x0f;
@ -648,7 +636,8 @@ void CartridgeBUS::setDatastreamPointer(uInt8 index, uInt32 value)
myBUSRAM[DSxPTR + index*4 + 3] = (value >> 24) & 0xff; // high byte
}
uInt32 CartridgeBUS::getDatastreamIncrement(uInt8 index)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 CartridgeBUS::getDatastreamIncrement(uInt8 index) const
{
// index &= 0x0f;
return myBUSRAM[DSxINC + index*4 + 0] + // low byte
@ -657,6 +646,7 @@ uInt32 CartridgeBUS::getDatastreamIncrement(uInt8 index)
(myBUSRAM[DSxINC + index*4 + 3] << 24) ; // high byte
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeBUS::setDatastreamIncrement(uInt8 index, uInt32 value)
{
// index &= 0x0f;
@ -666,7 +656,8 @@ void CartridgeBUS::setDatastreamIncrement(uInt8 index, uInt32 value)
myBUSRAM[DSxINC + index*4 + 3] = (value >> 24) & 0xff; // high byte
}
uInt32 CartridgeBUS::getAddressMap(uInt8 index)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 CartridgeBUS::getAddressMap(uInt8 index) const
{
// index &= 0x0f;
return myBUSRAM[DSMAPS + index*4 + 0] + // low byte
@ -675,7 +666,8 @@ uInt32 CartridgeBUS::getAddressMap(uInt8 index)
(myBUSRAM[DSMAPS + index*4 + 3] << 24) ; // high byte
}
uInt32 CartridgeBUS::getWaveform(uInt8 index)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 CartridgeBUS::getWaveform(uInt8 index) const
{
// instead of 0, 1, 2, etc. this returned
// 0x40000800 for 0
@ -704,11 +696,13 @@ uInt32 CartridgeBUS::getWaveform(uInt8 index)
return result;
}
uInt32 CartridgeBUS::getWaveformSize(uInt8 index)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 CartridgeBUS::getWaveformSize(uInt8 index) const
{
return myMusicWaveformSize[index];
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeBUS::setAddressMap(uInt8 index, uInt32 value)
{
// index &= 0x0f;
@ -718,16 +712,19 @@ void CartridgeBUS::setAddressMap(uInt8 index, uInt32 value)
myBUSRAM[DSMAPS + index*4 + 3] = (value >> 24) & 0xff; // high byte
}
bool CartridgeBUS::getBusStuffFlag(void)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeBUS::getBusStuffFlag(void) const
{
return myBusStuff;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeBUS::setBusStuffFlag(bool value)
{
myBusStuff = value;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 CartridgeBUS::readFromDatastream(uInt8 index)
{
// Pointers are stored as:
@ -747,4 +744,3 @@ uInt8 CartridgeBUS::readFromDatastream(uInt8 index)
setDatastreamPointer(index, pointer);
return value;
}

View File

@ -8,13 +8,11 @@
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2015 by Bradford W. Mott, Stephen Anthony
// Copyright (c) 1995-2017 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: CartBUS.hxx 3131 2015-01-01 03:49:32Z stephena $
//============================================================================
#ifndef CARTRIDGE_BUS_HXX
@ -22,7 +20,7 @@
class System;
#ifdef THUMB_SUPPORT
class Thumbulator;
class Thumbulator;
#endif
#ifdef DEBUGGER_SUPPORT
#include "CartBUSWidget.hxx"
@ -41,8 +39,8 @@ class Thumbulator;
1K C Varaible and Stack, and the BUS chip.
BUS chip access is mapped to $1000 - $103F.
@author Darrell Spice Jr, Chris Walton, Fred Quimby, Stephen Anthony, Bradford W. Mott
@version $Id: CartBUS.hxx 3131 2015-01-01 03:49:32Z stephena $
Authors: Darrell Spice Jr, Chris Walton, Fred Quimby,
Stephen Anthony, Bradford W. Mott
*/
class CartridgeBUS : public Cartridge
{
@ -58,11 +56,7 @@ class CartridgeBUS : public Cartridge
@param settings A reference to the various settings (read-only)
*/
CartridgeBUS(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
*/
virtual ~CartridgeBUS();
virtual ~CartridgeBUS() = default;
public:
/**
@ -205,22 +199,22 @@ class CartridgeBUS : public Cartridge
*/
void callFunction(uInt8 value);
uInt32 getDatastreamPointer(uInt8 index);
uInt32 getDatastreamPointer(uInt8 index) const;
void setDatastreamPointer(uInt8 index, uInt32 value);
uInt32 getDatastreamIncrement(uInt8 index);
uInt32 getDatastreamIncrement(uInt8 index) const;
void setDatastreamIncrement(uInt8 index, uInt32 value);
uInt32 getAddressMap(uInt8 index);
uInt32 getAddressMap(uInt8 index) const;
void setAddressMap(uInt8 index, uInt32 value);
bool getBusStuffFlag(void);
bool getBusStuffFlag(void) const;
void setBusStuffFlag(bool value);
uInt8 readFromDatastream(uInt8 index);
uInt32 getWaveform(uInt8 index);
uInt32 getWaveformSize(uInt8 index);
uInt32 getWaveform(uInt8 index) const;
uInt32 getWaveformSize(uInt8 index) const;
private:
// The 32K ROM image of the cartridge
@ -275,7 +269,7 @@ class CartridgeBUS : public Cartridge
// Flags that Bus Stuffing is active
bool myBusStuff;
private:
private:
// Following constructors and assignment operators not supported
CartridgeBUS() = delete;
CartridgeBUS(const CartridgeBUS&) = delete;

50
src/emucore/CartCDF.cxx Executable file → Normal file
View File

@ -8,20 +8,19 @@
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2015 by Bradford W. Mott, Stephen Anthony
// Copyright (c) 1995-2017 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: CartCDF.cxx 3131 2015-01-01 03:49:32Z stephena $
//============================================================================
#include <cstring>
#ifdef DEBUGGER_SUPPORT
#include "Debugger.hxx"
#include "Debugger.hxx"
#endif
#include "System.hxx"
#include "Thumbulator.hxx"
#include "CartCDF.hxx"
@ -35,14 +34,13 @@
#define FAST_FETCH_ON ((myMode & 0x0F) == 0)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeCDF::CartridgeCDF(const uInt8* image, uInt32 size,
const Settings& settings)
: Cartridge(settings),
mySystemCycles(0),
myARMCycles(0),
myFractionalClocks(0.0)
: Cartridge(settings),
mySystemCycles(0),
myARMCycles(0),
myFractionalClocks(0.0)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, std::min(32768u, size));
@ -61,11 +59,8 @@ myFractionalClocks(0.0)
myDisplayImage = myCDFRAM + DSRAM;
#ifdef THUMB_SUPPORT
// Create Thumbulator ARM emulator
myThumbEmulator = make_ptr<Thumbulator>
((uInt16*)myImage, (uInt16*)myCDFRAM,
settings.getBool("thumb.trapfatal"),
Thumbulator::ConfigureFor::CDF,
this);
myThumbEmulator = make_ptr<Thumbulator>((uInt16*)myImage, (uInt16*)myCDFRAM,
settings.getBool("thumb.trapfatal"), Thumbulator::ConfigureFor::CDF, this);
#endif
setInitialState();
@ -77,18 +72,12 @@ myFractionalClocks(0.0)
myMode = 0xFF;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeCDF::~CartridgeCDF()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeCDF::reset()
{
// Initialize RAM
if(mySettings.getBool("ramrandom"))
for(uInt32 t = 2048; t < 8192; ++t)
myCDFRAM[t] = mySystem->randGenerator().next();
initializeRAM(myCDFRAM+2048, 8192-2048);
else
memset(myCDFRAM+2048, 0, 8192-2048);
@ -219,7 +208,6 @@ uInt8 CartridgeCDF::peek(uInt16 address)
}
myLDAimmediateOperandAddress = 0;
if(address <= 0x20)
{
uInt8 result = 0;
@ -478,7 +466,6 @@ const uInt8* CartridgeCDF::getImage(int& size) const
uInt32 CartridgeCDF::thumbCallback(uInt8 function, uInt32 value1, uInt32 value2)
{
switch (function)
{
case 0:
@ -565,7 +552,8 @@ bool CartridgeCDF::load(Serializer& in)
return true;
}
uInt32 CartridgeCDF::getDatastreamPointer(uInt8 index)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 CartridgeCDF::getDatastreamPointer(uInt8 index) const
{
// index &= 0x0f;
@ -575,6 +563,7 @@ uInt32 CartridgeCDF::getDatastreamPointer(uInt8 index)
(myCDFRAM[DSxPTR + index*4 + 3] << 24) ; // high byte
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeCDF::setDatastreamPointer(uInt8 index, uInt32 value)
{
// index &= 0x1f;
@ -584,7 +573,8 @@ void CartridgeCDF::setDatastreamPointer(uInt8 index, uInt32 value)
myCDFRAM[DSxPTR + index*4 + 3] = (value >> 24) & 0xff; // high byte
}
uInt32 CartridgeCDF::getDatastreamIncrement(uInt8 index)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 CartridgeCDF::getDatastreamIncrement(uInt8 index) const
{
// index &= 0x1f;
return myCDFRAM[DSxINC + index*4 + 0] + // low byte
@ -593,6 +583,7 @@ uInt32 CartridgeCDF::getDatastreamIncrement(uInt8 index)
(myCDFRAM[DSxINC + index*4 + 3] << 24) ; // high byte
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeCDF::setDatastreamIncrement(uInt8 index, uInt32 value)
{
// index &= 0x1f;
@ -602,8 +593,8 @@ void CartridgeCDF::setDatastreamIncrement(uInt8 index, uInt32 value)
myCDFRAM[DSxINC + index*4 + 3] = (value >> 24) & 0xff; // high byte
}
uInt32 CartridgeCDF::getWaveform(uInt8 index)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 CartridgeCDF::getWaveform(uInt8 index) const
{
// instead of 0, 1, 2, etc. this returned
// 0x40000800 for 0
@ -632,11 +623,13 @@ uInt32 CartridgeCDF::getWaveform(uInt8 index)
return result;
}
uInt32 CartridgeCDF::getWaveformSize(uInt8 index)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 CartridgeCDF::getWaveformSize(uInt8 index) const
{
return myMusicWaveformSize[index];
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 CartridgeCDF::readFromDatastream(uInt8 index)
{
// Pointers are stored as:
@ -656,4 +649,3 @@ uInt8 CartridgeCDF::readFromDatastream(uInt8 index)
setDatastreamPointer(index, pointer);
return value;
}

48
src/emucore/CartCDF.hxx Executable file → Normal file
View File

@ -8,13 +8,11 @@
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2015 by Bradford W. Mott, Stephen Anthony
// Copyright (c) 1995-2017 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: CartCDF.hxx 3131 2015-01-01 03:49:32Z stephena $
//============================================================================
#ifndef CARTRIDGE_CDF_HXX
@ -22,11 +20,12 @@
class System;
#ifdef THUMB_SUPPORT
class Thumbulator;
class Thumbulator;
#endif
#ifdef DEBUGGER_SUPPORT
#include "CartCDFWidget.hxx"
#include "CartCDFWidget.hxx"
#endif
#include "bspf.hxx"
#include "Cart.hxx"
@ -40,15 +39,15 @@ class Thumbulator;
1K C Varaible and Stack, and the CDF chip.
CDF chip access is mapped to $1000 - $103F.
@author Darrell Spice Jr, Chris Walton, Fred Quimby, Stephen Anthony, Bradford W. Mott
@version $Id: CartCDF.hxx 3131 2015-01-01 03:49:32Z stephena $
*/
Authors: Darrell Spice Jr, Chris Walton, Fred Quimby,
Stephen Anthony, Bradford W. Mott
*/
class CartridgeCDF : public Cartridge
{
friend class CartridgeCDFWidget;
friend class CartridgeRamCDFWidget;
public:
public:
/**
Create a new cartridge using the specified image
@ -57,13 +56,9 @@ public:
@param settings A reference to the various settings (read-only)
*/
CartridgeCDF(const uInt8* image, uInt32 size, const Settings& settings);
virtual ~CartridgeCDF() = default;
/**
Destructor
*/
virtual ~CartridgeCDF();
public:
public:
/**
Reset device to its power-on state
*/
@ -150,14 +145,13 @@ public:
*/
string name() const override { return "CartridgeCDF"; }
// uInt8 busOverdrive(uInt16 address) override;
// uInt8 busOverdrive(uInt16 address) override;
/**
Used for Thumbulator to pass values back to the cartridge
*/
uInt32 thumbCallback(uInt8 function, uInt32 value1, uInt32 value2) override;
#ifdef DEBUGGER_SUPPORT
/**
Get debugger widget responsible for accessing the inner workings
@ -170,7 +164,7 @@ public:
}
#endif
public:
public:
/**
Get the byte at the specified address.
@ -187,7 +181,7 @@ public:
*/
bool poke(uInt16 address, uInt8 value) override;
private:
private:
/**
Sets the initial state of the DPC pointers and RAM
*/
@ -204,18 +198,18 @@ private:
*/
void callFunction(uInt8 value);
uInt32 getDatastreamPointer(uInt8 index);
uInt32 getDatastreamPointer(uInt8 index) const;
void setDatastreamPointer(uInt8 index, uInt32 value);
uInt32 getDatastreamIncrement(uInt8 index);
uInt32 getDatastreamIncrement(uInt8 index) const;
void setDatastreamIncrement(uInt8 index, uInt32 value);
uInt8 readFromDatastream(uInt8 index);
uInt32 getWaveform(uInt8 index);
uInt32 getWaveformSize(uInt8 index);
uInt32 getWaveform(uInt8 index) const;
uInt32 getWaveformSize(uInt8 index) const;
private:
private:
// The 32K ROM image of the cartridge
uInt8 myImage[32768];
@ -234,10 +228,10 @@ private:
// $1800 - 2K C Variable & Stack
uInt8 myCDFRAM[8192];
#ifdef THUMB_SUPPORT
#ifdef THUMB_SUPPORT
// Pointer to the Thumb ARM emulator object
unique_ptr<Thumbulator> myThumbEmulator;
#endif
#endif
// Indicates which bank is currently active
uInt16 myCurrentBank;
@ -273,7 +267,7 @@ private:
TIA* myTIA;
private:
private:
// Following constructors and assignment operators not supported
CartridgeCDF() = delete;
CartridgeCDF(const CartridgeCDF&) = delete;

View File

@ -85,6 +85,7 @@ string Thumbulator::run()
return statusMsg.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Thumbulator::setConsoleTiming(ConsoleTiming timing)
{
// this sets how many ticks of the Harmony/Melody clock
@ -104,22 +105,15 @@ void Thumbulator::setConsoleTiming(ConsoleTiming timing)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Thumbulator::updateTimer(uInt32 cycles)
{
double increment;
increment = cycles * timing_factor;
if (T1TCR & 1) // bit 0 controls timer on/off
{
T1TC += uInt32(increment);
}
T1TC += uInt32(cycles * timing_factor);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string Thumbulator::run(uInt32 cycles)
{
updateTimer(cycles);
return this->run();
return run();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -1099,10 +1093,11 @@ int Thumbulator::execute()
// bx r4 // bx instruction at 0x000006ee
// address to test for is + 4 due to pipelining
#define BUS_SetNote (0x000006e2 + 4)
#define BUS_ResetWave (0x000006e6 + 4)
#define BUS_GetWavePtr (0x000006ea + 4)
#define BUS_SetWaveSize (0x000006ee + 4)
#define BUS_SetNote (0x000006e2 + 4)
#define BUS_ResetWave (0x000006e6 + 4)
#define BUS_GetWavePtr (0x000006ea + 4)
#define BUS_SetWaveSize (0x000006ee + 4)
if (pc == BUS_SetNote)
{
@ -1130,13 +1125,14 @@ int Thumbulator::execute()
}
else
{
// just for testing
#if 0 // uncomment this for testing
uInt32 r0 = read_register(0);
uInt32 r1 = read_register(1);
uInt32 r2 = read_register(2);
uInt32 r3 = read_register(3);
uInt32 r4 = read_register(4);
myCartridge->thumbCallback(255,0,0);
#endif
myCartridge->thumbCallback(255, 0, 0);
}
break;

View File

@ -81,6 +81,11 @@ class Thumbulator
*/
static void trapFatalErrors(bool enable) { trapOnFatal = enable; }
/**
Inform the Thumbulator class about the console currently in use,
which is used to accurately determine how many 6507 cycles have
passed while ARM code is being executed.
*/
void setConsoleTiming(ConsoleTiming timing);
private:

View File

@ -13,6 +13,8 @@ MODULE_OBJS := \
src/emucore/Cart4K.o \
src/emucore/Cart4KSC.o \
src/emucore/CartAR.o \
src/emucore/CartBUS.o \
src/emucore/CartCDF.o \
src/emucore/CartCM.o \
src/emucore/CartCTY.o \
src/emucore/CartCV.o \