small naming alignment between CartBUS and CartCDF

This commit is contained in:
Thomas Jentzsch 2020-04-16 18:54:29 +02:00
parent edab66de50
commit 0851a445e5
6 changed files with 76 additions and 76 deletions

View File

@ -238,7 +238,7 @@ void CartridgeBUSWidget::saveOldState()
}
for(uInt32 i = 0; i < internalRamSize(); ++i)
myOldState.internalram.push_back(myCart.myBUSRAM[i]);
myOldState.internalram.push_back(myCart.myRAM[i]);
myOldState.samplepointer.push_back(myCart.getSample());
}
@ -438,18 +438,18 @@ const ByteArray& CartridgeBUSWidget::internalRamCurrent(int start, int count)
{
myRamCurrent.clear();
for(int i = 0; i < count; i++)
myRamCurrent.push_back(myCart.myBUSRAM[start + i]);
myRamCurrent.push_back(myCart.myRAM[start + i]);
return myRamCurrent;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeBUSWidget::internalRamSetValue(int addr, uInt8 value)
{
myCart.myBUSRAM[addr] = value;
myCart.myRAM[addr] = value;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 CartridgeBUSWidget::internalRamGetValue(int addr)
{
return myCart.myBUSRAM[addr];
return myCart.myRAM[addr];
}

View File

@ -232,7 +232,7 @@ void CartridgeCDFWidget::saveOldState()
}
for(uInt32 i = 0; i < internalRamSize(); ++i)
myOldState.internalram.push_back(myCart.myCDFRAM[i]);
myOldState.internalram.push_back(myCart.myRAM[i]);
myOldState.samplepointer.push_back(myCart.getSample());
}
@ -437,20 +437,20 @@ const ByteArray& CartridgeCDFWidget::internalRamCurrent(int start, int count)
{
myRamCurrent.clear();
for(int i = 0; i < count; i++)
myRamCurrent.push_back(myCart.myCDFRAM[start + i]);
myRamCurrent.push_back(myCart.myRAM[start + i]);
return myRamCurrent;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeCDFWidget::internalRamSetValue(int addr, uInt8 value)
{
myCart.myCDFRAM[addr] = value;
myCart.myRAM[addr] = value;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 CartridgeCDFWidget::internalRamGetValue(int addr)
{
return myCart.myCDFRAM[addr];
return myCart.myRAM[addr];
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -56,16 +56,16 @@ CartridgeBUS::CartridgeBUS(const ByteBuffer& image, size_t size,
myProgramImage = myImage.data() + 4_KB;
// Pointer to BUS driver in RAM
myBusDriverImage = myBUSRAM.data();
myDriverImage = myRAM.data();
// Pointer to the display RAM
myDisplayImage = myBUSRAM.data() + DSRAM;
myDisplayImage = myRAM.data() + DSRAM;
// Create Thumbulator ARM emulator
bool devSettings = settings.getBool("dev.settings");
myThumbEmulator = make_unique<Thumbulator>(
reinterpret_cast<uInt16*>(myImage.data()),
reinterpret_cast<uInt16*>(myBUSRAM.data()),
reinterpret_cast<uInt16*>(myRAM.data()),
static_cast<uInt32>(myImage.size()),
devSettings ? settings.getBool("dev.thumb.trapfatal") : false, Thumbulator::ConfigureFor::BUS, this
);
@ -76,7 +76,7 @@ CartridgeBUS::CartridgeBUS(const ByteBuffer& image, size_t size,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeBUS::reset()
{
initializeRAM(myBUSRAM.data() + 2_KB, 6_KB);
initializeRAM(myRAM.data() + 2_KB, 6_KB);
// BUS always starts in bank 6
initializeStartBank(6);
@ -95,7 +95,7 @@ void CartridgeBUS::reset()
void CartridgeBUS::setInitialState()
{
// Copy initial BUS driver to Harmony RAM
std::copy_n(myImage.begin(), 2_KB, myBusDriverImage);
std::copy_n(myImage.begin(), 2_KB, myDriverImage);
myMusicWaveformSize.fill(27);
@ -254,7 +254,7 @@ uInt8 CartridgeBUS::peek(uInt16 address)
if (sampleaddress < 0x8000)
peekvalue = myImage[sampleaddress];
else if (sampleaddress >= 0x40000000 && sampleaddress < 0x40002000) // check for RAM
peekvalue = myBUSRAM[sampleaddress - 0x40000000];
peekvalue = myRAM[sampleaddress - 0x40000000];
else
peekvalue = 0;
@ -552,7 +552,7 @@ bool CartridgeBUS::save(Serializer& out) const
out.putShort(myBankOffset);
// Harmony RAM
out.putByteArray(myBUSRAM.data(), myBUSRAM.size());
out.putByteArray(myRAM.data(), myRAM.size());
// Addresses for bus override logic
out.putShort(myBusOverdriveAddress);
@ -593,7 +593,7 @@ bool CartridgeBUS::load(Serializer& in)
myBankOffset = in.getShort();
// Harmony RAM
in.getByteArray(myBUSRAM.data(), myBUSRAM.size());
in.getByteArray(myRAM.data(), myRAM.size());
// Addresses for bus override logic
myBusOverdriveAddress = in.getShort();
@ -633,40 +633,40 @@ uInt32 CartridgeBUS::getDatastreamPointer(uInt8 index) const
{
// index &= 0x0f;
return myBUSRAM[DSxPTR + index*4 + 0] + // low byte
(myBUSRAM[DSxPTR + index*4 + 1] << 8) +
(myBUSRAM[DSxPTR + index*4 + 2] << 16) +
(myBUSRAM[DSxPTR + index*4 + 3] << 24) ; // high byte
return myRAM[DSxPTR + index*4 + 0] + // low byte
(myRAM[DSxPTR + index*4 + 1] << 8) +
(myRAM[DSxPTR + index*4 + 2] << 16) +
(myRAM[DSxPTR + index*4 + 3] << 24) ; // high byte
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeBUS::setDatastreamPointer(uInt8 index, uInt32 value)
{
// index &= 0x0f;
myBUSRAM[DSxPTR + index*4 + 0] = value & 0xff; // low byte
myBUSRAM[DSxPTR + index*4 + 1] = (value >> 8) & 0xff;
myBUSRAM[DSxPTR + index*4 + 2] = (value >> 16) & 0xff;
myBUSRAM[DSxPTR + index*4 + 3] = (value >> 24) & 0xff; // high byte
myRAM[DSxPTR + index*4 + 0] = value & 0xff; // low byte
myRAM[DSxPTR + index*4 + 1] = (value >> 8) & 0xff;
myRAM[DSxPTR + index*4 + 2] = (value >> 16) & 0xff;
myRAM[DSxPTR + index*4 + 3] = (value >> 24) & 0xff; // high byte
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 CartridgeBUS::getDatastreamIncrement(uInt8 index) const
{
// index &= 0x0f;
return myBUSRAM[DSxINC + index*4 + 0] + // low byte
(myBUSRAM[DSxINC + index*4 + 1] << 8) +
(myBUSRAM[DSxINC + index*4 + 2] << 16) +
(myBUSRAM[DSxINC + index*4 + 3] << 24) ; // high byte
return myRAM[DSxINC + index*4 + 0] + // low byte
(myRAM[DSxINC + index*4 + 1] << 8) +
(myRAM[DSxINC + index*4 + 2] << 16) +
(myRAM[DSxINC + index*4 + 3] << 24) ; // high byte
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 CartridgeBUS::getAddressMap(uInt8 index) const
{
// index &= 0x0f;
return myBUSRAM[DSMAPS + index*4 + 0] + // low byte
(myBUSRAM[DSMAPS + index*4 + 1] << 8) +
(myBUSRAM[DSMAPS + index*4 + 2] << 16) +
(myBUSRAM[DSMAPS + index*4 + 3] << 24) ; // high byte
return myRAM[DSMAPS + index*4 + 0] + // low byte
(myRAM[DSMAPS + index*4 + 1] << 8) +
(myRAM[DSMAPS + index*4 + 2] << 16) +
(myRAM[DSMAPS + index*4 + 3] << 24) ; // high byte
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -686,10 +686,10 @@ uInt32 CartridgeBUS::getWaveform(uInt8 index) const
uInt32 result;
result = myBUSRAM[WAVEFORM + index*4 + 0] + // low byte
(myBUSRAM[WAVEFORM + index*4 + 1] << 8) +
(myBUSRAM[WAVEFORM + index*4 + 2] << 16) +
(myBUSRAM[WAVEFORM + index*4 + 3] << 24); // high byte
result = myRAM[WAVEFORM + index*4 + 0] + // low byte
(myRAM[WAVEFORM + index*4 + 1] << 8) +
(myRAM[WAVEFORM + index*4 + 2] << 16) +
(myRAM[WAVEFORM + index*4 + 3] << 24); // high byte
result -= 0x40000800;
@ -704,10 +704,10 @@ uInt32 CartridgeBUS::getSample()
{
uInt32 result;
result = myBUSRAM[WAVEFORM + 0] + // low byte
(myBUSRAM[WAVEFORM + 1] << 8) +
(myBUSRAM[WAVEFORM + 2] << 16) +
(myBUSRAM[WAVEFORM + 3] << 24); // high byte
result = myRAM[WAVEFORM + 0] + // low byte
(myRAM[WAVEFORM + 1] << 8) +
(myRAM[WAVEFORM + 2] << 16) +
(myRAM[WAVEFORM + 3] << 24); // high byte
return result;
}
@ -722,10 +722,10 @@ uInt32 CartridgeBUS::getWaveformSize(uInt8 index) const
void CartridgeBUS::setAddressMap(uInt8 index, uInt32 value)
{
// index &= 0x0f;
myBUSRAM[DSMAPS + index*4 + 0] = value & 0xff; // low byte
myBUSRAM[DSMAPS + index*4 + 1] = (value >> 8) & 0xff;
myBUSRAM[DSMAPS + index*4 + 2] = (value >> 16) & 0xff;
myBUSRAM[DSMAPS + index*4 + 3] = (value >> 24) & 0xff; // high byte
myRAM[DSMAPS + index*4 + 0] = value & 0xff; // low byte
myRAM[DSMAPS + index*4 + 1] = (value >> 8) & 0xff;
myRAM[DSMAPS + index*4 + 2] = (value >> 16) & 0xff;
myRAM[DSMAPS + index*4 + 3] = (value >> 24) & 0xff; // high byte
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -220,13 +220,13 @@ class CartridgeBUS : public Cartridge
uInt8* myDisplayImage{nullptr};
// Pointer to the 2K BUS driver image in RAM
uInt8* myBusDriverImage{nullptr};
uInt8* myDriverImage{nullptr};
// The BUS 8k RAM image, used as:
// $0000 - 2K BUS driver
// $0800 - 4K Display Data
// $1800 - 2K C Variable & Stack
std::array<uInt8, 8_KB> myBUSRAM;
std::array<uInt8, 8_KB> myRAM;
// Pointer to the Thumb ARM emulator object
unique_ptr<Thumbulator> myThumbEmulator;

View File

@ -72,10 +72,10 @@ CartridgeCDF::CartridgeCDF(const ByteBuffer& image, size_t size,
myProgramImage = myImage.data() + 4_KB;
// Pointer to CDF driver in RAM
myBusDriverImage = myCDFRAM.data();
myDriverImage = myRAM.data();
// Pointer to the display RAM
myDisplayImage = myCDFRAM.data() + DSRAM;
myDisplayImage = myRAM.data() + DSRAM;
setupVersion();
@ -83,7 +83,7 @@ CartridgeCDF::CartridgeCDF(const ByteBuffer& image, size_t size,
bool devSettings = settings.getBool("dev.settings");
myThumbEmulator = make_unique<Thumbulator>(
reinterpret_cast<uInt16*>(myImage.data()),
reinterpret_cast<uInt16*>(myCDFRAM.data()),
reinterpret_cast<uInt16*>(myRAM.data()),
static_cast<uInt32>(myImage.size()),
devSettings ? settings.getBool("dev.thumb.trapfatal") : false, thumulatorConfiguration(myCDFSubtype), this);
@ -93,7 +93,7 @@ CartridgeCDF::CartridgeCDF(const ByteBuffer& image, size_t size,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeCDF::reset()
{
initializeRAM(myCDFRAM.data()+2_KB, myCDFRAM.size()-2_KB);
initializeRAM(myRAM.data()+2_KB, myRAM.size()-2_KB);
// CDF always starts in bank 6
initializeStartBank(6);
@ -111,7 +111,7 @@ void CartridgeCDF::reset()
void CartridgeCDF::setInitialState()
{
// Copy initial CDF driver to Harmony RAM
std::copy_n(myImage.begin(), 2_KB, myBusDriverImage);
std::copy_n(myImage.begin(), 2_KB, myDriverImage);
myMusicWaveformSize.fill(27);
@ -255,7 +255,7 @@ uInt8 CartridgeCDF::peek(uInt16 address)
if (sampleaddress < 0x8000)
peekvalue = myImage[sampleaddress];
else if (sampleaddress >= 0x40000000 && sampleaddress < 0x40002000) // check for RAM
peekvalue = myCDFRAM[sampleaddress - 0x40000000];
peekvalue = myRAM[sampleaddress - 0x40000000];
else
peekvalue = 0;
@ -508,7 +508,7 @@ bool CartridgeCDF::save(Serializer& out) const
out.putShort(myJMPoperandAddress);
// Harmony RAM
out.putByteArray(myCDFRAM.data(), myCDFRAM.size());
out.putByteArray(myRAM.data(), myRAM.size());
// Audio info
out.putIntArray(myMusicCounters.data(), myMusicCounters.size());
@ -548,7 +548,7 @@ bool CartridgeCDF::load(Serializer& in)
myJMPoperandAddress = in.getShort();
// Harmony RAM
in.getByteArray(myCDFRAM.data(), myCDFRAM.size());
in.getByteArray(myRAM.data(), myRAM.size());
// Audio info
in.getIntArray(myMusicCounters.data(), myMusicCounters.size());
@ -577,10 +577,10 @@ uInt32 CartridgeCDF::getDatastreamPointer(uInt8 index) const
{
uInt16 address = myDatastreamBase + index * 4;
return myCDFRAM[address + 0] + // low byte
(myCDFRAM[address + 1] << 8) +
(myCDFRAM[address + 2] << 16) +
(myCDFRAM[address + 3] << 24) ; // high byte
return myRAM[address + 0] + // low byte
(myRAM[address + 1] << 8) +
(myRAM[address + 2] << 16) +
(myRAM[address + 3] << 24) ; // high byte
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -588,10 +588,10 @@ void CartridgeCDF::setDatastreamPointer(uInt8 index, uInt32 value)
{
uInt16 address = myDatastreamBase + index * 4;
myCDFRAM[address + 0] = value & 0xff; // low byte
myCDFRAM[address + 1] = (value >> 8) & 0xff;
myCDFRAM[address + 2] = (value >> 16) & 0xff;
myCDFRAM[address + 3] = (value >> 24) & 0xff; // high byte
myRAM[address + 0] = value & 0xff; // low byte
myRAM[address + 1] = (value >> 8) & 0xff;
myRAM[address + 2] = (value >> 16) & 0xff;
myRAM[address + 3] = (value >> 24) & 0xff; // high byte
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -599,10 +599,10 @@ uInt32 CartridgeCDF::getDatastreamIncrement(uInt8 index) const
{
uInt16 address = myDatastreamIncrementBase + index * 4;
return myCDFRAM[address + 0] + // low byte
(myCDFRAM[address + 1] << 8) +
(myCDFRAM[address + 2] << 16) +
(myCDFRAM[address + 3] << 24) ; // high byte
return myRAM[address + 0] + // low byte
(myRAM[address + 1] << 8) +
(myRAM[address + 2] << 16) +
(myRAM[address + 3] << 24) ; // high byte
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -610,10 +610,10 @@ uInt32 CartridgeCDF::getWaveform(uInt8 index) const
{
uInt16 address = myWaveformBase + index * 4;
uInt32 result = myCDFRAM[address + 0] + // low byte
(myCDFRAM[address + 1] << 8) +
(myCDFRAM[address + 2] << 16) +
(myCDFRAM[address + 3] << 24); // high byte
uInt32 result = myRAM[address + 0] + // low byte
(myRAM[address + 1] << 8) +
(myRAM[address + 2] << 16) +
(myRAM[address + 3] << 24); // high byte
result -= (0x40000000 + DSRAM);
@ -628,10 +628,10 @@ uInt32 CartridgeCDF::getSample()
{
uInt16 address = myWaveformBase;
uInt32 result = myCDFRAM[address + 0] + // low byte
(myCDFRAM[address + 1] << 8) +
(myCDFRAM[address + 2] << 16) +
(myCDFRAM[address + 3] << 24); // high byte
uInt32 result = myRAM[address + 0] + // low byte
(myRAM[address + 1] << 8) +
(myRAM[address + 2] << 16) +
(myRAM[address + 3] << 24); // high byte
return result;
}

View File

@ -220,13 +220,13 @@ class CartridgeCDF : public Cartridge
uInt8* myDisplayImage{nullptr};
// Pointer to the 2K CDF driver image in RAM
uInt8* myBusDriverImage{nullptr};
uInt8* myDriverImage{nullptr};
// The CDF 8k RAM image, used as:
// $0000 - 2K CDF driver
// $0800 - 4K Display Data
// $1800 - 2K C Variable & Stack
std::array<uInt8, 8_KB> myCDFRAM;
std::array<uInt8, 8_KB> myRAM;
// Pointer to the Thumb ARM emulator object
unique_ptr<Thumbulator> myThumbEmulator;