Adapt access checks to modified BSS section.

This commit is contained in:
Christian Speckner 2019-03-19 21:08:35 +01:00
parent dc4dd6ac94
commit 81eeec5fae
4 changed files with 38 additions and 14 deletions

View File

@ -37,6 +37,25 @@
#define FAST_FETCH_ON ((myMode & 0x0F) == 0)
#define DIGITAL_AUDIO_ON ((myMode & 0xF0) == 0)
namespace {
Thumbulator::ConfigureFor thumulatorConfiguration(CartridgeCDF::CDFSubtype subtype)
{
switch (subtype) {
case CartridgeCDF::CDFSubtype::CDF0:
return Thumbulator::ConfigureFor::CDF;
case CartridgeCDF::CDFSubtype::CDF1:
return Thumbulator::ConfigureFor::CDF1;
case CartridgeCDF::CDFSubtype::CDFJ:
return Thumbulator::ConfigureFor::CDFJ;
default:
throw runtime_error("unreachable");
}
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeCDF::CartridgeCDF(const BytePtr& image, uInt32 size,
const string& md5, const Settings& settings)
@ -61,14 +80,13 @@ CartridgeCDF::CartridgeCDF(const BytePtr& image, uInt32 size,
// Pointer to the display RAM
myDisplayImage = myCDFRAM + DSRAM;
setVersion();
setupVersion();
// Create Thumbulator ARM emulator
bool devSettings = settings.getBool("dev.settings");
myThumbEmulator = make_unique<Thumbulator>(
reinterpret_cast<uInt16*>(myImage), reinterpret_cast<uInt16*>(myCDFRAM), 32768,
devSettings ? settings.getBool("dev.thumb.trapfatal") : false, myCDFSubtype == CDFSubtype::CDF0 ?
Thumbulator::ConfigureFor::CDF : Thumbulator::ConfigureFor::CDF1, this);
devSettings ? settings.getBool("dev.thumb.trapfatal") : false, thumulatorConfiguration(myCDFSubtype), this);
setInitialState();
}
@ -644,7 +662,7 @@ uInt8 CartridgeCDF::readFromDatastream(uInt8 index)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeCDF::setVersion()
void CartridgeCDF::setupVersion()
{
uInt8 subversion = 0;

View File

@ -45,6 +45,14 @@ class CartridgeCDF : public Cartridge
friend CartridgeCDFInfoWidget;
friend class CartridgeRamCDFWidget;
public:
enum class CDFSubtype {
CDF0,
CDF1,
CDFJ
};
public:
/**
Create a new cartridge using the specified image
@ -199,15 +207,7 @@ class CartridgeCDF : public Cartridge
uInt32 getWaveform(uInt8 index) const;
uInt32 getWaveformSize(uInt8 index) const;
uInt32 getSample();
void setVersion();
private:
enum class CDFSubtype {
CDF0,
CDF1,
CDFJ
};
void setupVersion();
private:
// The 32K ROM image of the cartridge

View File

@ -369,6 +369,9 @@ bool Thumbulator::isProtected(uInt32 addr)
case ConfigureFor::CDF1:
return (addr < 0x0800) && (addr > 0x0028) && !((addr >= 0x00a0) && (addr < (0x00a0 + 284)));
case ConfigureFor::CDFJ:
return (addr < 0x0800) && (addr > 0x0028) && !((addr >= 0x0098) && (addr < (0x0098 + 292)));
case ConfigureFor::BUS:
return (addr < 0x06d8) && (addr > 0x0028);
}
@ -1412,6 +1415,7 @@ int Thumbulator::execute()
break;
case ConfigureFor::CDF1:
case ConfigureFor::CDFJ:
// this subroutine interface is used in the CDF driver,
// it starts at address 0x00000750
// _SetNote:
@ -2517,6 +2521,7 @@ int Thumbulator::reset()
case ConfigureFor::BUS:
case ConfigureFor::CDF:
case ConfigureFor::CDF1:
case ConfigureFor::CDFJ:
reg_norm[14] = 0x00000800; // Link Register
reg_norm[15] = 0x0000080B; // Program Counter
break;

View File

@ -51,10 +51,11 @@ class Thumbulator
public:
// control cartridge specific features of the Thumbulator class,
// such as the start location for calling custom code
enum ConfigureFor {
enum class ConfigureFor {
BUS, // cartridges of type BUS
CDF, // cartridges of type CDF
CDF1, // cartridges of type CDF version 1
CDFJ, // cartrdiges of type CDFJ
DPCplus // cartridges of type DPC+
};