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);
@ -290,7 +287,7 @@ void CartridgeBUSWidget::loadConfig()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeBUSWidget::handleCommand(CommandSender* sender,
int cmd, int data, int id)
int cmd, int data, int id)
{
if(cmd == kBankChanged)
{

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
@ -31,10 +29,10 @@ class CartridgeBUSWidget : public CartDebugWidget
{
public:
CartridgeBUSWidget(GuiObject* boss, const GUI::Font& lfont,
const GUI::Font& nfont,
int x, int y, int w, int h,
CartridgeBUS& cart);
virtual ~CartridgeBUSWidget() { }
const GUI::Font& nfont,
int x, int y, int w, int h,
CartridgeBUS& cart);
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;

24
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"
@ -24,10 +22,10 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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)
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)
{
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);

110
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,68 +27,68 @@ class DataGridWidget;
class CartridgeCDFWidget : public CartDebugWidget
{
public:
CartridgeCDFWidget(GuiObject* boss, const GUI::Font& lfont,
const GUI::Font& nfont,
int x, int y, int w, int h,
CartridgeCDF& cart);
virtual ~CartridgeCDFWidget() { }
public:
CartridgeCDFWidget(GuiObject* boss, const GUI::Font& lfont,
const GUI::Font& nfont,
int x, int y, int w, int h,
CartridgeCDF& cart);
virtual ~CartridgeCDFWidget() = default;
private:
struct CartState {
ByteArray tops;
ByteArray bottoms;
IntArray datastreampointers;
IntArray datastreamincrements;
IntArray addressmaps;
IntArray mcounters;
IntArray mfreqs;
IntArray mwaves;
IntArray mwavesizes;
uInt32 random;
ByteArray internalram;
};
private:
struct CartState {
ByteArray tops;
ByteArray bottoms;
IntArray datastreampointers;
IntArray datastreamincrements;
IntArray addressmaps;
IntArray mcounters;
IntArray mfreqs;
IntArray mwaves;
IntArray mwavesizes;
uInt32 random;
ByteArray internalram;
};
CartridgeCDF& myCart;
PopUpWidget* myBank;
CartridgeCDF& myCart;
PopUpWidget* myBank;
DataGridWidget* myDatastreamPointers;
DataGridWidget* myDatastreamIncrements;
DataGridWidget* myMusicCounters;
DataGridWidget* myMusicFrequencies;
DataGridWidget* myMusicWaveforms;
DataGridWidget* myMusicWaveformSizes;
// done differently than in DPC+, need to rethink debugger support
// CheckboxWidget* myFastFetch;
// CheckboxWidget* myIMLDA;
CartState myOldState;
DataGridWidget* myDatastreamPointers;
DataGridWidget* myDatastreamIncrements;
DataGridWidget* myMusicCounters;
DataGridWidget* myMusicFrequencies;
DataGridWidget* myMusicWaveforms;
DataGridWidget* myMusicWaveformSizes;
// done differently than in DPC+, need to rethink debugger support
// CheckboxWidget* myFastFetch;
// CheckboxWidget* myIMLDA;
CartState myOldState;
enum { kBankChanged = 'bkCH' };
enum { kBankChanged = 'bkCH' };
private:
void saveOldState() override;
private:
void saveOldState() override;
void loadConfig() override;
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
void loadConfig() override;
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
string bankState() override;
string bankState() override;
// start of functions for Cartridge RAM tab
uInt32 internalRamSize() override;
uInt32 internalRamRPort(int start) override;
string internalRamDescription() override;
const ByteArray& internalRamOld(int start, int count) override;
const ByteArray& internalRamCurrent(int start, int count) override;
void internalRamSetValue(int addr, uInt8 value) override;
uInt8 internalRamGetValue(int addr) override;
// end of functions for Cartridge RAM tab
// start of functions for Cartridge RAM tab
uInt32 internalRamSize() override;
uInt32 internalRamRPort(int start) override;
string internalRamDescription() override;
const ByteArray& internalRamOld(int start, int count) override;
const ByteArray& internalRamCurrent(int start, int count) override;
void internalRamSetValue(int addr, uInt8 value) override;
uInt8 internalRamGetValue(int addr) override;
// end of functions for Cartridge RAM tab
// Following constructors and assignment operators not supported
CartridgeCDFWidget() = delete;
CartridgeCDFWidget(const CartridgeCDFWidget&) = delete;
CartridgeCDFWidget(CartridgeCDFWidget&&) = delete;
CartridgeCDFWidget& operator=(const CartridgeCDFWidget&) = delete;
CartridgeCDFWidget& operator=(CartridgeCDFWidget&&) = delete;
// Following constructors and assignment operators not supported
CartridgeCDFWidget() = delete;
CartridgeCDFWidget(const CartridgeCDFWidget&) = delete;
CartridgeCDFWidget(CartridgeCDFWidget&&) = delete;
CartridgeCDFWidget& operator=(const CartridgeCDFWidget&) = delete;
CartridgeCDFWidget& operator=(CartridgeCDFWidget&&) = delete;
};
#endif

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;
@ -521,19 +510,19 @@ uInt8 CartridgeBUS::busOverdrive(uInt16 address)
if (address == myBusOverdriveAddress)
{
uInt8 map = address & 0x7f;
if (map <= 0x24) // map TIA registers VSYNC thru HMBL inclusive
{
uInt32 alldatastreams = getAddressMap(map);
uInt8 datastream = alldatastreams & 0x0f; // lowest nybble has the current datastream to use
overdrive = readFromDatastream(datastream);
if (map <= 0x24) // map TIA registers VSYNC thru HMBL inclusive
{
uInt32 alldatastreams = getAddressMap(map);
uInt8 datastream = alldatastreams & 0x0f; // lowest nybble has the current datastream to use
overdrive = readFromDatastream(datastream);
// rotate map nybbles for next time
alldatastreams >>= 4;
alldatastreams |= (datastream << 28);
setAddressMap(map, alldatastreams);
// rotate map nybbles for next time
alldatastreams >>= 4;
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
}
}
myBusOverdriveAddress = 0xff; // turns off overdrive for next poke event
@ -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,13 +39,13 @@ 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
{
friend class CartridgeBUSWidget;
friend class CartridgeRamBUSWidget;
friend class CartridgeRamBUSWidget;
public:
/**
@ -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;

70
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;
@ -299,7 +287,7 @@ uInt8 CartridgeCDF::peek(uInt16 address)
}
if(FAST_FETCH_ON && peekvalue == 0xA9)
myLDAimmediateOperandAddress = address + 1;
myLDAimmediateOperandAddress = address + 1;
return peekvalue;
}
@ -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,16 +552,18 @@ bool CartridgeCDF::load(Serializer& in)
return true;
}
uInt32 CartridgeCDF::getDatastreamPointer(uInt8 index)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 CartridgeCDF::getDatastreamPointer(uInt8 index) const
{
// index &= 0x0f;
return myCDFRAM[DSxPTR + index*4 + 0] + // low byte
(myCDFRAM[DSxPTR + index*4 + 1] << 8) +
(myCDFRAM[DSxPTR + index*4 + 2] << 16) +
(myCDFRAM[DSxPTR + index*4 + 3] << 24) ; // high byte
(myCDFRAM[DSxPTR + index*4 + 1] << 8) +
(myCDFRAM[DSxPTR + index*4 + 2] << 16) +
(myCDFRAM[DSxPTR + index*4 + 3] << 24) ; // high byte
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeCDF::setDatastreamPointer(uInt8 index, uInt32 value)
{
// index &= 0x1f;
@ -584,15 +573,17 @@ 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
(myCDFRAM[DSxINC + index*4 + 1] << 8) +
(myCDFRAM[DSxINC + index*4 + 2] << 16) +
(myCDFRAM[DSxINC + index*4 + 3] << 24) ; // high byte
(myCDFRAM[DSxINC + index*4 + 1] << 8) +
(myCDFRAM[DSxINC + index*4 + 2] << 16) +
(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
@ -620,9 +611,9 @@ uInt32 CartridgeCDF::getWaveform(uInt8 index)
uInt32 result;
result = myCDFRAM[WAVEFORM + index*4 + 0] + // low byte
(myCDFRAM[WAVEFORM + index*4 + 1] << 8) +
(myCDFRAM[WAVEFORM + index*4 + 2] << 16) +
(myCDFRAM[WAVEFORM + index*4 + 3] << 24);
(myCDFRAM[WAVEFORM + index*4 + 1] << 8) +
(myCDFRAM[WAVEFORM + index*4 + 2] << 16) +
(myCDFRAM[WAVEFORM + index*4 + 3] << 24);
result -= 0x40000800;
@ -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;
}

374
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,264 +20,260 @@
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"
/**
Cartridge class used for CDF.
Cartridge class used for CDF.
THIS NEEDS TO BE UPDATED
THIS NEEDS TO BE UPDATED
There are seven 4K program banks, a 4K Display Data RAM,
1K C Varaible and Stack, and the CDF chip.
CDF chip access is mapped to $1000 - $103F.
There are seven 4K program banks, a 4K Display Data RAM,
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:
/**
Create a new cartridge using the specified image
public:
/**
Create a new cartridge using the specified image
@param image Pointer to the ROM image
@param size The size of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeCDF(const uInt8* image, uInt32 size, const Settings& settings);
@param image Pointer to the ROM image
@param size The size of the ROM image
@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:
/**
Reset device to its power-on state
*/
void reset() override;
public:
/**
Reset device to its power-on state
*/
void reset() override;
/**
Notification method invoked by the system when the console type
has changed. We need this to inform the Thumbulator that the
timing has changed.
/**
Notification method invoked by the system when the console type
has changed. We need this to inform the Thumbulator that the
timing has changed.
@param timing Enum representing the new console type
*/
void consoleChanged(ConsoleTiming timing) override;
@param timing Enum representing the new console type
*/
void consoleChanged(ConsoleTiming timing) override;
/**
Notification method invoked by the system right before the
system resets its cycle counter to zero. It may be necessary
to override this method for devices that remember cycle counts.
*/
void systemCyclesReset() override;
/**
Notification method invoked by the system right before the
system resets its cycle counter to zero. It may be necessary
to override this method for devices that remember cycle counts.
*/
void systemCyclesReset() override;
/**
Install cartridge in the specified system. Invoked by the system
when the cartridge is attached to it.
/**
Install cartridge in the specified system. Invoked by the system
when the cartridge is attached to it.
@param system The system the device should install itself in
*/
void install(System& system) override;
@param system The system the device should install itself in
*/
void install(System& system) override;
/**
Install pages for the specified bank in the system.
/**
Install pages for the specified bank in the system.
@param bank The bank that should be installed in the system
*/
bool bank(uInt16 bank) override;
@param bank The bank that should be installed in the system
*/
bool bank(uInt16 bank) override;
/**
Get the current bank.
*/
uInt16 getBank() const override;
/**
Get the current bank.
*/
uInt16 getBank() const override;
/**
Query the number of banks supported by the cartridge.
*/
uInt16 bankCount() const override;
/**
Query the number of banks supported by the cartridge.
*/
uInt16 bankCount() const override;
/**
Patch the cartridge ROM.
/**
Patch the cartridge ROM.
@param address The ROM address to patch
@param value The value to place into the address
@return Success or failure of the patch operation
*/
bool patch(uInt16 address, uInt8 value) override;
@param address The ROM address to patch
@param value The value to place into the address
@return Success or failure of the patch operation
*/
bool patch(uInt16 address, uInt8 value) override;
/**
Access the internal ROM image for this cartridge.
/**
Access the internal ROM image for this cartridge.
@param size Set to the size of the internal ROM image data
@return A pointer to the internal ROM image data
*/
const uInt8* getImage(int& size) const override;
@param size Set to the size of the internal ROM image data
@return A pointer to the internal ROM image data
*/
const uInt8* getImage(int& size) const override;
/**
Save the current state of this cart to the given Serializer.
/**
Save the current state of this cart to the given Serializer.
@param out The Serializer object to use
@return False on any errors, else true
*/
bool save(Serializer& out) const override;
@param out The Serializer object to use
@return False on any errors, else true
*/
bool save(Serializer& out) const override;
/**
Load the current state of this cart from the given Serializer.
/**
Load the current state of this cart from the given Serializer.
@param in The Serializer object to use
@return False on any errors, else true
*/
bool load(Serializer& in) override;
@param in The Serializer object to use
@return False on any errors, else true
*/
bool load(Serializer& in) override;
/**
Get a descriptor for the device name (used in error checking).
/**
Get a descriptor for the device name (used in error checking).
@return The name of the object
*/
string name() const override { return "CartridgeCDF"; }
@return The name of the object
*/
string name() const override { return "CartridgeCDF"; }
// uInt8 busOverdrive(uInt16 address) override;
/**
Used for Thumbulator to pass values back to the cartridge
*/
uInt32 thumbCallback(uInt8 function, uInt32 value1, uInt32 value2) 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
of the cart.
*/
CartDebugWidget* debugWidget(GuiObject* boss, const GUI::Font& lfont,
const GUI::Font& nfont, int x, int y, int w, int h) override
{
return new CartridgeCDFWidget(boss, lfont, nfont, x, y, w, h, *this);
}
/**
Get debugger widget responsible for accessing the inner workings
of the cart.
*/
CartDebugWidget* debugWidget(GuiObject* boss, const GUI::Font& lfont,
const GUI::Font& nfont, int x, int y, int w, int h) override
{
return new CartridgeCDFWidget(boss, lfont, nfont, x, y, w, h, *this);
}
#endif
public:
/**
Get the byte at the specified address.
public:
/**
Get the byte at the specified address.
@return The byte at the specified address
*/
uInt8 peek(uInt16 address) override;
@return The byte at the specified address
*/
uInt8 peek(uInt16 address) override;
/**
Change the byte at the specified address to the given value
/**
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
@return True if the poke changed the device address space, else false
*/
bool poke(uInt16 address, uInt8 value) override;
@param address The address where the value should be stored
@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:
/**
Sets the initial state of the DPC pointers and RAM
*/
void setInitialState();
private:
/**
Sets the initial state of the DPC pointers and RAM
*/
void setInitialState();
/**
Updates any data fetchers in music mode based on the number of
CPU cycles which have passed since the last update.
*/
void updateMusicModeDataFetchers();
/**
Updates any data fetchers in music mode based on the number of
CPU cycles which have passed since the last update.
*/
void updateMusicModeDataFetchers();
/**
Call Special Functions
*/
void callFunction(uInt8 value);
/**
Call Special Functions
*/
void callFunction(uInt8 value);
uInt32 getDatastreamPointer(uInt8 index);
void setDatastreamPointer(uInt8 index, uInt32 value);
uInt32 getDatastreamPointer(uInt8 index) const;
void setDatastreamPointer(uInt8 index, uInt32 value);
uInt32 getDatastreamIncrement(uInt8 index);
void setDatastreamIncrement(uInt8 index, uInt32 value);
uInt32 getDatastreamIncrement(uInt8 index) const;
void setDatastreamIncrement(uInt8 index, uInt32 value);
uInt8 readFromDatastream(uInt8 index);
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
uInt8 myImage[32768];
private:
// The 32K ROM image of the cartridge
uInt8 myImage[32768];
// Pointer to the 28K program ROM image of the cartridge
uInt8* myProgramImage;
// Pointer to the 28K program ROM image of the cartridge
uInt8* myProgramImage;
// Pointer to the 4K display ROM image of the cartridge
uInt8* myDisplayImage;
// Pointer to the 4K display ROM image of the cartridge
uInt8* myDisplayImage;
// Pointer to the 2K CDF driver image in RAM
uInt8* myBusDriverImage;
// Pointer to the 2K CDF driver image in RAM
uInt8* myBusDriverImage;
// The CDF 8k RAM image, used as:
// $0000 - 2K CDF driver
// $0800 - 4K Display Data
// $1800 - 2K C Variable & Stack
uInt8 myCDFRAM[8192];
// The CDF 8k RAM image, used as:
// $0000 - 2K CDF driver
// $0800 - 4K Display Data
// $1800 - 2K C Variable & Stack
uInt8 myCDFRAM[8192];
#ifdef THUMB_SUPPORT
// Pointer to the Thumb ARM emulator object
unique_ptr<Thumbulator> myThumbEmulator;
#endif
#ifdef THUMB_SUPPORT
// Pointer to the Thumb ARM emulator object
unique_ptr<Thumbulator> myThumbEmulator;
#endif
// Indicates which bank is currently active
uInt16 myCurrentBank;
// Indicates which bank is currently active
uInt16 myCurrentBank;
// System cycle count when the last update to music data fetchers occurred
Int32 mySystemCycles;
// System cycle count when the last update to music data fetchers occurred
Int32 mySystemCycles;
Int32 myARMCycles;
Int32 myARMCycles;
uInt8 mySetAddress;
uInt8 mySetAddress;
// The music mode counters
uInt32 myMusicCounters[3];
// The music mode counters
uInt32 myMusicCounters[3];
// The music frequency
uInt32 myMusicFrequencies[3];
// The music frequency
uInt32 myMusicFrequencies[3];
// The music waveform sizes
uInt8 myMusicWaveformSize[3];
// The music waveform sizes
uInt8 myMusicWaveformSize[3];
// Fractional DPC music OSC clocks unused during the last update
double myFractionalClocks;
// Fractional DPC music OSC clocks unused during the last update
double myFractionalClocks;
// Controls mode, lower nybble sets Fast Fetch, upper nybble sets audio
// -0 = Fast Fetch ON
// -F = Fast Fetch OFF
// 0- = Packed Digital Sample
// F- = 3 Voice Music
uInt8 myMode;
// Controls mode, lower nybble sets Fast Fetch, upper nybble sets audio
// -0 = Fast Fetch ON
// -F = Fast Fetch OFF
// 0- = Packed Digital Sample
// F- = 3 Voice Music
uInt8 myMode;
// set to address of #value if last byte peeked was A9 (LDA #)
uInt16 myLDAimmediateOperandAddress;
// set to address of #value if last byte peeked was A9 (LDA #)
uInt16 myLDAimmediateOperandAddress;
TIA* myTIA;
TIA* myTIA;
private:
// Following constructors and assignment operators not supported
CartridgeCDF() = delete;
CartridgeCDF(const CartridgeCDF&) = delete;
CartridgeCDF(CartridgeCDF&&) = delete;
CartridgeCDF& operator=(const CartridgeCDF&) = delete;
CartridgeCDF& operator=(CartridgeCDF&&) = delete;
private:
// Following constructors and assignment operators not supported
CartridgeCDF() = delete;
CartridgeCDF(const CartridgeCDF&) = delete;
CartridgeCDF(CartridgeCDF&&) = delete;
CartridgeCDF& operator=(const CartridgeCDF&) = delete;
CartridgeCDF& operator=(CartridgeCDF&&) = delete;
};
#endif

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();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -233,20 +227,20 @@ void Thumbulator::write16(uInt32 addr, uInt32 data)
switch(configuration)
{
// this protects 2K Harmony/Melody Drivers
// Initial section of driver is the bootstrap which copies the driver
// from ROM to RAM, so it can safely be used by the custom ARM code
// as additional RAM
// this protects 2K Harmony/Melody Drivers
// Initial section of driver is the bootstrap which copies the driver
// from ROM to RAM, so it can safely be used by the custom ARM code
// as additional RAM
case ConfigureFor::BUS:
case ConfigureFor::CDF:
if((addr > 0x40000028) && (addr < 0x40000800))
fatalError("write16", addr, "to bankswitch code area");
break;
// this protects 3K Harmony/Melody Drivers
// Initial section of driver is the bootstrap which copies the driver
// from ROM to RAM, so it can safely be used by the custom ARM code
// as additional RAM
// this protects 3K Harmony/Melody Drivers
// Initial section of driver is the bootstrap which copies the driver
// from ROM to RAM, so it can safely be used by the custom ARM code
// as additional RAM
case ConfigureFor::DPCplus:
if((addr > 0x40000028) && (addr < 0x40000c00))
fatalError("write16", addr, "to bankswitch code area");
@ -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;
@ -2206,14 +2202,14 @@ int Thumbulator::reset()
switch(configuration)
{
// future 2K Harmony/Melody drivers will most likely use these settings
// future 2K Harmony/Melody drivers will most likely use these settings
case ConfigureFor::BUS:
case ConfigureFor::CDF:
reg_norm[14] = 0x00000800; // Link Register
reg_norm[15] = 0x0000080B; // Program Counter
break;
// future 3K Harmony/Melody drivers will most likely use these settings
// future 3K Harmony/Melody drivers will most likely use these settings
case ConfigureFor::DPCplus:
reg_norm[14] = 0x00000C00; // Link Register
reg_norm[15] = 0x00000C0B; // Program Counter

View File

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

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 \