|
|
|
@@ -386,14 +386,15 @@ static int channel_update(nes_apu_Channel* channel) { |
|
|
|
static void nes_apu_run_dmc(nes_apu* apu, |
|
|
|
nes_apu_Channel* channel, |
|
|
|
int cycles) { |
|
|
|
if (channel->length <= 0 || channel->period <= 0) return; |
|
|
|
|
|
|
|
// Always do this in order to support direct load |
|
|
|
int time = apu->time; |
|
|
|
int delta = channel_update(channel); |
|
|
|
if (delta) { |
|
|
|
blip_add_delta(apu->blip, time, delta); |
|
|
|
} |
|
|
|
|
|
|
|
if (channel->length <= 0 || channel->period <= 0) return; |
|
|
|
|
|
|
|
while (cycles > 0) { |
|
|
|
int run = cycles; |
|
|
|
if (run > channel->delay) { |
|
|
|
@@ -587,7 +588,7 @@ nes_apu_Result nes_apu_run(nes_apu* apu, int cycles) { |
|
|
|
apu->frame_delay -= run; |
|
|
|
|
|
|
|
if (apu->frame_delay <= 0) { |
|
|
|
APU_LOG("APU: End of quarter frame: %d\n", apu->frame_time_elapsed); |
|
|
|
// APU_LOG("APU: End of quarter frame: %d\n", apu->frame_time_elapsed); |
|
|
|
|
|
|
|
int end = 0; |
|
|
|
int quarter_frame = 1; |
|
|
|
@@ -624,7 +625,7 @@ nes_apu_Result nes_apu_run(nes_apu* apu, int cycles) { |
|
|
|
if (end) { |
|
|
|
if (0 == apu->frame_reg) { |
|
|
|
apu->status |= apu_Status_Frame_Int; |
|
|
|
APU_LOG("APU: Frame Interrupt @ %d\n", apu->frame_time_elapsed); |
|
|
|
// APU_LOG("APU: Frame Interrupt @ %d\n", apu->frame_time_elapsed); |
|
|
|
} |
|
|
|
apu->frame = 0; |
|
|
|
apu->frame_time_elapsed = 0; |
|
|
|
|