2015-08-29 15:58:57 +02:00
|
|
|
.export psg_init
|
2014-11-29 14:18:48 +01:00
|
|
|
|
2015-10-02 10:50:22 -04:00
|
|
|
.include "pce.inc"
|
|
|
|
|
2016-03-06 21:26:22 +01:00
|
|
|
.segment "ONCE"
|
2014-11-29 14:18:48 +01:00
|
|
|
psg_init:
|
2015-11-17 09:14:15 -05:00
|
|
|
stz PSG_GLOBAL_PAN ; Silence global balance
|
2015-11-26 15:06:20 -05:00
|
|
|
ldx #6 - 1
|
2015-09-04 14:14:17 +02:00
|
|
|
|
2014-11-29 14:18:48 +01:00
|
|
|
psg_clear_loop:
|
2015-09-04 14:14:17 +02: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 14:18:48 +01:00
|
|
|
|
2015-11-26 15:06:20 -05:00
|
|
|
ldy #$20
|
2015-08-29 15:58:57 +02:00
|
|
|
psg_clear_waveform:
|
2015-09-04 14:14:17 +02:00
|
|
|
stz PSG_CHAN_DATA ; Clear waveform byte
|
2015-11-26 15:06:20 -05:00
|
|
|
dey
|
2015-08-29 15:58:57 +02:00
|
|
|
bne psg_clear_waveform
|
2014-11-29 14:18:48 +01:00
|
|
|
|
2015-11-26 15:06:20 -05:00
|
|
|
dex
|
|
|
|
bpl psg_clear_loop
|
2015-08-29 15:58:57 +02:00
|
|
|
rts
|