2015-08-29 13:58:57 +00:00
|
|
|
.export psg_init
|
2014-11-29 13:18:48 +00:00
|
|
|
|
2015-10-02 14:50:22 +00:00
|
|
|
.include "pce.inc"
|
|
|
|
|
2016-03-06 20:26:22 +00:00
|
|
|
.segment "ONCE"
|
2014-11-29 13:18:48 +00:00
|
|
|
psg_init:
|
2015-11-17 14:14:15 +00:00
|
|
|
stz PSG_GLOBAL_PAN ; Silence global balance
|
2015-11-26 20:06:20 +00:00
|
|
|
ldx #6 - 1
|
2015-09-04 12:14:17 +00:00
|
|
|
|
2014-11-29 13:18:48 +00:00
|
|
|
psg_clear_loop:
|
2015-09-04 12:14:17 +00:00
|
|
|
stx PSG_CHAN_SELECT ; Select channel
|
|
|
|
stz PSG_FREQ_LO ; Clear frequency LSB
|
|
|
|
stz PSG_FREQ_HI ; Clear frequency MSB
|
|
|
|
stz PSG_CHAN_CTRL ; Clear volume
|
|
|
|
stz PSG_CHAN_PAN ; Clear balance
|
|
|
|
stz PSG_NOISE ; Clear noise control
|
|
|
|
stz PSG_LFO_FREQ ; Clear LFO frequency
|
|
|
|
stz PSG_LFO_CTRL ; Clear LFO control
|
2014-11-29 13:18:48 +00:00
|
|
|
|
2015-11-26 20:06:20 +00:00
|
|
|
ldy #$20
|
2015-08-29 13:58:57 +00:00
|
|
|
psg_clear_waveform:
|
2015-09-04 12:14:17 +00:00
|
|
|
stz PSG_CHAN_DATA ; Clear waveform byte
|
2015-11-26 20:06:20 +00:00
|
|
|
dey
|
2015-08-29 13:58:57 +00:00
|
|
|
bne psg_clear_waveform
|
2014-11-29 13:18:48 +00:00
|
|
|
|
2015-11-26 20:06:20 +00:00
|
|
|
dex
|
|
|
|
bpl psg_clear_loop
|
2015-08-29 13:58:57 +00:00
|
|
|
rts
|