23 #ifndef WAVEFORMGENERATOR_H
24 #define WAVEFORMGENERATOR_H
26 #include "siddefs-fp.h"
53 int shift_register_reset;
60 int no_noise_or_noise_output;
69 int floating_output_ttl;
93 void clock_shift_register();
95 void write_shift_register();
97 void reset_shift_register();
99 void set_noise_output();
134 shift_register_reset(0),
139 no_noise_or_noise_output(no_noise | noise_output),
143 floating_output_ttl(0),
209 unsigned char readOSC() {
return (
unsigned char) (waveform_output >> 4); }
234 #if RESID_INLINING || defined(WAVEFORMGENERATOR_CPP)
242 if (shift_register_reset != 0 && -- shift_register_reset == 0) {
243 reset_shift_register();
247 pulse_output = 0xfff;
250 const int accumulator_next = (accumulator + freq) & 0xffffff;
251 const int accumulator_bits_set = ~accumulator & accumulator_next;
252 accumulator = accumulator_next;
255 msb_rising = (accumulator_bits_set & 0x800000) != 0;
259 if ((accumulator_bits_set & 0x080000) != 0) {
263 else if (shift_pipeline != 0 && -- shift_pipeline == 0) {
264 clock_shift_register();
275 const int ix = (accumulator ^ (ringModulator->accumulator & ring_msb_mask)) >> 12;
276 waveform_output = wave[ix] & (no_pulse | pulse_output) & no_noise_or_noise_output;
277 if (waveform > 0x8) {
279 write_shift_register();
283 if (floating_output_ttl != 0 && -- floating_output_ttl == 0) {
300 pulse_output = ((accumulator >> 12) >= pw) ? 0xfff : 0x000;
304 return dac[waveform_output];