src/apu/apu.cc
/*
 * Updates the shift register of the noise channel.
 */
Updates the shift register of the noise channel.
Updates the shift register of the noise channel .
void Apu::UpdateNoiseShift(void) {
  DoubleWord feedback;
  if (noise_->period & FLAG_NOISE_MODE) {
    feedback = (noise_->shift & 0x01U) ^ ((noise_->shift >> 6U) & 0x01U);
  } else {
    feedback = (noise_->shift & 0x01U) ^ ((noise_->shift >> 1U) & 0x01U);
  }
  noise_->shift = (feedback << 14U) | (noise_->shift >> 1U);
  return;
}
void Apu :: UpdateNoiseShift ( void ) { DoubleWord feedback ; if ( noise_ -> period & FLAG_NOISE_MODE ) { feedback = ( noise_ -> shift & 0x01U ) ^ ( ( noise_ -> shift >> 6U ) & 0x01U ) ; } else { feedback = ( noise_ -> shift & 0x01U ) ^ ( ( noise_ -> shift >> 1U ) & 0x01U ) ; } noise_ -> shift = ( feedback << 14U ) | ( noise_ -> shift >> 1U ) ; return ; }
Updates the shift register of the noise channel.
Updates the shift register of the noise channel .
// Calculate the new feedback bit of the noise channel using the noise mode. // In mode 1, the new bit is bit 0 XOR bit 6. // In mode 0, the new bit is bit 0 XOR bit 1. // Shift the noise shifter and backfill with the feedback bit.