Skip to content

Commit

Permalink
Merged in reSID from VICE 3.8 (#781)
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkwhoffmann committed Jan 29, 2024
1 parent 3654fdd commit d83aa14
Show file tree
Hide file tree
Showing 3 changed files with 279 additions and 273 deletions.
2 changes: 1 addition & 1 deletion Emulator/Components/SID/resid/filter.cc
Expand Up @@ -259,7 +259,7 @@ Filter::Filter()
//
// m*2^N*x = x_n - m*2^N*xmin
//
scaled_voltage[fi.opamp_voltage_size - 1 - i][0] = int(N16*(fi.opamp_voltage[i][1] - fi.opamp_voltage[i][0] + denorm)/2 + 0.5);
scaled_voltage[fi.opamp_voltage_size - 1 - i][0] = int((N16*(fi.opamp_voltage[i][1] - fi.opamp_voltage[i][0]) + (1 << 16))/2 + 0.5);
scaled_voltage[fi.opamp_voltage_size - 1 - i][1] = N31*(fi.opamp_voltage[i][0] - vmin);
}

Expand Down
18 changes: 12 additions & 6 deletions Emulator/Components/SID/resid/wave.cc
Expand Up @@ -27,7 +27,7 @@ namespace reSID

// Number of cycles after which the shift register is reset
// when the test bit is set.
const cycle_count SHIFT_REGISTER_RESET_START_6581 = 9768; // 0x8000
const cycle_count SHIFT_REGISTER_RESET_START_6581 = 35000; // 0x8000
const cycle_count SHIFT_REGISTER_RESET_BIT_6581 = 1000;
const cycle_count SHIFT_REGISTER_RESET_START_8580 = 2519864; // 0x950000
const cycle_count SHIFT_REGISTER_RESET_BIT_8580 = 315000;
Expand Down Expand Up @@ -172,22 +172,28 @@ void WaveformGenerator::writePW_HI(reg8 pw_hi)
bool do_pre_writeback(reg8 waveform_prev, reg8 waveform, bool is6581)
{
// no writeback without combined waveforms
if (likely(waveform_prev <= 0x8))
if (likely(waveform_prev <= 0x8)) {
return false;
}
#if 0
// This need more investigation
if (waveform == 8)
if (waveform == 8) {
return false;
}
#endif
if (waveform_prev == 0xc) {
if (is6581)
if (is6581) {
return false;
else if ((waveform != 0x9) && (waveform != 0xe))
} else if ((waveform != 0x9) && (waveform != 0xe)) {
return false;
}
}
// What's happening here?
if (is6581 &&
((((waveform_prev & 0x3) == 0x1) && ((waveform & 0x3) == 0x2))
|| (((waveform_prev & 0x3) == 0x2) && ((waveform & 0x3) == 0x1))))
|| (((waveform_prev & 0x3) == 0x2) && ((waveform & 0x3) == 0x1)))) {
return false;
}
// ok do the writeback
return true;
}
Expand Down

0 comments on commit d83aa14

Please sign in to comment.