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

View File

@ -8,13 +8,11 @@
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa // 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 // and the Stella Team
// //
// See the file "License.txt" for information on usage and redistribution of // See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: CartBUSWidget.hxx 3131 2015-01-01 03:49:32Z stephena $
//============================================================================ //============================================================================
#ifndef CARTRIDGEBUS_WIDGET_HXX #ifndef CARTRIDGEBUS_WIDGET_HXX
@ -34,7 +32,7 @@ class CartridgeBUSWidget : public CartDebugWidget
const GUI::Font& nfont, const GUI::Font& nfont,
int x, int y, int w, int h, int x, int y, int w, int h,
CartridgeBUS& cart); CartridgeBUS& cart);
virtual ~CartridgeBUSWidget() { } virtual ~CartridgeBUSWidget() = default;
private: private:
struct CartState { struct CartState {

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

@ -8,13 +8,11 @@
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa // 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 // and the Stella Team
// //
// See the file "License.txt" for information on usage and redistribution of // See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: CartCDFWidget.cxx 3131 2015-01-01 03:49:32Z stephena $
//============================================================================ //============================================================================
#include "CartCDF.hxx" #include "CartCDF.hxx"
@ -211,7 +209,7 @@ void CartridgeCDFWidget::loadConfig()
// I = Increment // I = Increment
// F = Fractional // F = Fractional
uInt32 pointervalue = myCart.getDatastreamPointer(i) >> 12; Int32 pointervalue = myCart.getDatastreamPointer(i) >> 12;
alist.push_back(0); vlist.push_back(pointervalue); alist.push_back(0); vlist.push_back(pointervalue);
changed.push_back(pointervalue != myOldState.datastreampointers[i]); changed.push_back(pointervalue != myOldState.datastreampointers[i]);
} }
@ -220,7 +218,7 @@ void CartridgeCDFWidget::loadConfig()
alist.clear(); vlist.clear(); changed.clear(); alist.clear(); vlist.clear(); changed.clear();
for(int i = 0; i < 32; ++i) 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); alist.push_back(0); vlist.push_back(incrementvalue);
changed.push_back(incrementvalue != myOldState.datastreamincrements[i]); changed.push_back(incrementvalue != myOldState.datastreamincrements[i]);
} }
@ -230,7 +228,7 @@ void CartridgeCDFWidget::loadConfig()
for(int i = 0; i < 3; ++i) for(int i = 0; i < 3; ++i)
{ {
alist.push_back(0); vlist.push_back(myCart.myMusicCounters[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); myMusicCounters->setList(alist, vlist, changed);
@ -238,7 +236,7 @@ void CartridgeCDFWidget::loadConfig()
for(int i = 0; i < 3; ++i) for(int i = 0; i < 3; ++i)
{ {
alist.push_back(0); vlist.push_back(myCart.myMusicFrequencies[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); myMusicFrequencies->setList(alist, vlist, changed);
@ -246,7 +244,7 @@ void CartridgeCDFWidget::loadConfig()
for(int i = 0; i < 3; ++i) for(int i = 0; i < 3; ++i)
{ {
alist.push_back(0); vlist.push_back(myCart.getWaveform(i) >> 5); 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); myMusicWaveforms->setList(alist, vlist, changed);
@ -254,7 +252,7 @@ void CartridgeCDFWidget::loadConfig()
for(int i = 0; i < 3; ++i) for(int i = 0; i < 3; ++i)
{ {
alist.push_back(0); vlist.push_back(myCart.getWaveformSize(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); myMusicWaveformSizes->setList(alist, vlist, changed);

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

@ -8,13 +8,11 @@
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa // 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 // and the Stella Team
// //
// See the file "License.txt" for information on usage and redistribution of // See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: CartCDFWidget.hxx 3131 2015-01-01 03:49:32Z stephena $
//============================================================================ //============================================================================
#ifndef CARTRIDGECDF_WIDGET_HXX #ifndef CARTRIDGECDF_WIDGET_HXX
@ -34,7 +32,7 @@ public:
const GUI::Font& nfont, const GUI::Font& nfont,
int x, int y, int w, int h, int x, int y, int w, int h,
CartridgeCDF& cart); CartridgeCDF& cart);
virtual ~CartridgeCDFWidget() { } virtual ~CartridgeCDFWidget() = default;
private: private:
struct CartState { struct CartState {

View File

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

View File

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

View File

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

View File

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

View File

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

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

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

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

@ -8,13 +8,11 @@
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa // 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 // and the Stella Team
// //
// See the file "License.txt" for information on usage and redistribution of // See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: CartCDF.hxx 3131 2015-01-01 03:49:32Z stephena $
//============================================================================ //============================================================================
#ifndef CARTRIDGE_CDF_HXX #ifndef CARTRIDGE_CDF_HXX
@ -27,6 +25,7 @@ class Thumbulator;
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
#include "CartCDFWidget.hxx" #include "CartCDFWidget.hxx"
#endif #endif
#include "bspf.hxx" #include "bspf.hxx"
#include "Cart.hxx" #include "Cart.hxx"
@ -40,8 +39,8 @@ class Thumbulator;
1K C Varaible and Stack, and the CDF chip. 1K C Varaible and Stack, and the CDF chip.
CDF chip access is mapped to $1000 - $103F. CDF chip access is mapped to $1000 - $103F.
@author Darrell Spice Jr, Chris Walton, Fred Quimby, Stephen Anthony, Bradford W. Mott Authors: Darrell Spice Jr, Chris Walton, Fred Quimby,
@version $Id: CartCDF.hxx 3131 2015-01-01 03:49:32Z stephena $ Stephen Anthony, Bradford W. Mott
*/ */
class CartridgeCDF : public Cartridge class CartridgeCDF : public Cartridge
{ {
@ -57,11 +56,7 @@ public:
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
CartridgeCDF(const uInt8* image, uInt32 size, const Settings& settings); CartridgeCDF(const uInt8* image, uInt32 size, const Settings& settings);
virtual ~CartridgeCDF() = default;
/**
Destructor
*/
virtual ~CartridgeCDF();
public: public:
/** /**
@ -157,7 +152,6 @@ public:
*/ */
uInt32 thumbCallback(uInt8 function, uInt32 value1, uInt32 value2) override; uInt32 thumbCallback(uInt8 function, uInt32 value1, uInt32 value2) override;
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
/** /**
Get debugger widget responsible for accessing the inner workings Get debugger widget responsible for accessing the inner workings
@ -204,16 +198,16 @@ private:
*/ */
void callFunction(uInt8 value); void callFunction(uInt8 value);
uInt32 getDatastreamPointer(uInt8 index); uInt32 getDatastreamPointer(uInt8 index) const;
void setDatastreamPointer(uInt8 index, uInt32 value); void setDatastreamPointer(uInt8 index, uInt32 value);
uInt32 getDatastreamIncrement(uInt8 index); uInt32 getDatastreamIncrement(uInt8 index) const;
void setDatastreamIncrement(uInt8 index, uInt32 value); void setDatastreamIncrement(uInt8 index, uInt32 value);
uInt8 readFromDatastream(uInt8 index); uInt8 readFromDatastream(uInt8 index);
uInt32 getWaveform(uInt8 index); uInt32 getWaveform(uInt8 index) const;
uInt32 getWaveformSize(uInt8 index); uInt32 getWaveformSize(uInt8 index) const;
private: private:
// The 32K ROM image of the cartridge // The 32K ROM image of the cartridge

View File

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

View File

@ -81,6 +81,11 @@ class Thumbulator
*/ */
static void trapFatalErrors(bool enable) { trapOnFatal = enable; } 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); void setConsoleTiming(ConsoleTiming timing);
private: private:

View File

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