src/apu/apu.cc
/*
 * Calculates the sweep target period of the given pulse channel
 *
 * Assumes the pulse channel is non-null.
 */
Calculates the sweep target period of the given pulse channel
Assumes the pulse channel is non-null.
Calculates the sweep target period of the given pulse channel Assumes the pulse channel is non - null .
DoubleWord Apu::GetPulseTarget(ApuPulse *pulse) {
  DoubleWord period_change = pulse->timer >> (pulse->sweep
                           & PULSE_SWEEP_SHIFT_MASK);
  if (pulse->sweep & PULSE_SWEEP_NEGATE_MASK) {
    period_change = (pulse == pulse_a_) ? ~period_change : -period_change;
    period_change = (period_change + pulse->timer) & PULSE_TIMER_MASK;
  } else {
    period_change += pulse->timer;
  }
  return period_change;
}
DoubleWord Apu :: GetPulseTarget ( ApuPulse * pulse ) { DoubleWord period_change = pulse -> timer >> ( pulse -> sweep & PULSE_SWEEP_SHIFT_MASK ) ; if ( pulse -> sweep & PULSE_SWEEP_NEGATE_MASK ) { period_change = ( pulse == pulse_a_ ) ? ~ period_change : - period_change ; period_change = ( period_change + pulse -> timer ) & PULSE_TIMER_MASK ; } else { period_change += pulse -> timer ; } return period_change ; }
Calculates the sweep target period of the given pulse channel
 Assumes the pulse channel is non-null.
Calculates the sweep target period of the given pulse channel Assumes the pulse channel is non - null .
// Use the shift amount to get the period change form the timer, // then negate it if necessary. // The two pulse channels subtract the period change in different ways. // Return the resulting change.