1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-04 18:29:40 +00:00

It's probably a net detriment to use a template in this scenario.

This commit is contained in:
Thomas Harte 2021-12-19 16:31:44 -05:00
parent 3a719633eb
commit 348840a2aa
2 changed files with 6 additions and 6 deletions

View File

@ -816,7 +816,7 @@ void Chipset::perform(const CPU::MC68000::Microcycle &cycle) {
}
}
template <bool allow_conversion> void Chipset::write(uint32_t address, uint16_t value) {
void Chipset::write(uint32_t address, uint16_t value, bool allow_conversion) {
#define ApplySetClear(target, mask) { \
if(value & 0x8000) { \
target |= (value & mask); \
@ -828,7 +828,7 @@ template <bool allow_conversion> void Chipset::write(uint32_t address, uint16_t
switch(address & ChipsetAddressMask) {
default:
// If there was nothing to write, perform a throwaway read.
if constexpr (allow_conversion) read<false>(address);
if(allow_conversion) read(address, false);
break;
// Raster position.
@ -1083,12 +1083,12 @@ template <bool allow_conversion> void Chipset::write(uint32_t address, uint16_t
#undef ApplySetClear
}
template <bool allow_conversion> uint16_t Chipset::read(uint32_t address) {
uint16_t Chipset::read(uint32_t address, bool allow_conversion) {
switch(address & ChipsetAddressMask) {
default:
// If there was nothing to read, perform a write.
// TODO: Rather than 0xffff, should be whatever is left on the bus, vapour-lock style.
if constexpr (allow_conversion) write<false>(address, 0xffff);
if(allow_conversion) write(address, 0xffff, false);
return 0xffff;
// Raster position.

View File

@ -108,8 +108,8 @@ class Chipset: private ClockingHint::Observer {
friend class DMADeviceBase;
// MARK: - Register read/write functions.
template <bool allow_conversion = true> uint16_t read(uint32_t address);
template <bool allow_conversion = true> void write(uint32_t address, uint16_t value);
uint16_t read(uint32_t address, bool allow_conversion = true);
void write(uint32_t address, uint16_t value, bool allow_conversion = true);
static constexpr uint32_t ChipsetAddressMask = 0x1fe;
friend class Copper;