zeta0134 / LuaGB

A gameboy emulator written in pure Lua. Work in progress.
BSD 3-Clause "New" or "Revised" License
412 stars 35 forks source link

blargg: cgb_sound: 02-len ctr #29

Open zeta0134 opened 5 years ago

zeta0134 commented 5 years ago

blargg_cgb_sound_length

The failing tests involve some conditions that should disable the channel that are unrelated to length counters expiring. (Go figure.) The relevant test code blargg is using is here:

     set_test 13,"Disabling DAC should disable channel immediately"
     call begin
     delay_apu 2    ; clocks length to 2
     call should_be_on
     wchn 0,$00     ; if wave channel, this disables DAC
     wchn 2,$07     ; if square/noise channel, this disables DAC
     call should_be_off

     set_test 14,"Disabled DAC should prevent enable at trigger"
     call begin
     wchn 0,$00     ; if wave channel, this disables DAC
     wchn 2,$07     ; if square/noise channel, this disables DAC
     wchn 4,$80     ; triggers channel but doesn't enable it
     call should_be_off

     set_test 15,"Enabling DAC shouldn't re-enable channel"
     wchn 0,$80     ; if wave channel, this enables DAC
     wchn 2,$10     ; if square/noise channel, this enables DAC
     call begin
     delay_apu 2
     call should_be_on
     wchn 0,$00     ; if wave channel, this disables DAC
     wchn 2,$00     ; if square/noise channel, this disables DAC
     call should_be_off
     wchn 0,$80     ; if wave channel, this enables DAC
     wchn 2,$10     ; if square/noise channel, this enables DAC
     call should_be_off

I knew about the wave channel's DAC, so that's an easy fix. I did not know that volume = 0 on the square/noise channels had any effect; that's interesting!