소스 검색

Add sweep limits to APU square channels

master
Nathaniel Walizer 11 달 전
부모
커밋
4468c8aed5
1개의 변경된 파일8개의 추가작업 그리고 2개의 파일을 삭제
  1. +8
    -2
      src/apu.c

+ 8
- 2
src/apu.c 파일 보기

@@ -239,7 +239,11 @@ static inline void nes_apu_clock_sweep(nes_apu_Channel* channel,

if (channel->sweep_delay == 0) {
decrement = 0;
if ( (channel->reg[1] & apu_Square_Enable) &&
if (channel->period < 8 * nes_clock_cpu_div) {
channel->period = 0;
channel->length = 0;

} else if ( (channel->reg[1] & apu_Square_Enable) &&
0 != (channel->reg[1] & apu_Square_Shift)) {
int delta = (
apu_channel_raw_timer_value(channel) >>
@@ -249,8 +253,10 @@ static inline void nes_apu_clock_sweep(nes_apu_Channel* channel,
delta = adjust - delta;
}
channel->period += delta * nes_clock_apu_div;
if (channel->period < 0) {
if ( channel < 0 ||
channel->period > 0x7FFU * nes_clock_cpu_div) {
channel->period = 0;
channel->length = 0;
}
}
}


불러오는 중...
취소
저장