1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-11 11:30:13 +00:00

Update sound driver

git-svn-id: svn://svn.cc65.org/cc65/trunk@5974 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
karri 2013-01-28 17:42:18 +00:00
parent 8a7b84247c
commit 0137681d77

View File

@ -1099,8 +1099,7 @@ set0: ldy SndOffsets,x
_IFPL _IFPL
jmp set0 jmp set0
_ENDIF _ENDIF
rts rts
_lynx_snd_play: _lynx_snd_play:
sta ptr1 sta ptr1
@ -1109,136 +1108,140 @@ _lynx_snd_play:
tax tax
lda ptr1 lda ptr1
ldy ptr1+1 ldy ptr1+1
php php
pha pha
lda SndActive,x lda SndActive,x
_IFNE _IFNE
dec SndReqStop,x dec SndReqStop,x
lda #1 lda #1
sta SndDelay,x sta SndDelay,x
start0: lda SndActive,x start0: lda SndActive,x
bne start0 bne start0
_ENDIF _ENDIF
bra start1 bra start1
SndStartSoundx: SndStartSoundx:
php php
pha pha
start1:
start1: sei sei
pla pla
sta SndPtrLo,x sta SndPtrLo,x
tya tya
sta SndPtrHi,x sta SndPtrHi,x
lda #1 lda #1
sta SndDelay,x sta SndDelay,x
stz SndEnvVol,x stz SndEnvVol,x
stz SndEnvFrq,x stz SndEnvFrq,x
stz SndEnvWave,x stz SndEnvWave,x
sta SndActive,x sta SndActive,x
stz SndReqStop,x stz SndReqStop,x
plp plp
rts rts
SndStartSound2: SndStartSound2:
pha pha
lda SndActive,x ; check default
lda SndActive,x ; check default beq start20 ; inactive => ok
beq start20 ; inactive => ok phx
phx ldx #3 ; search free channel
ldx #3 ; search free channel start21:
start21: lda SndActive,x lda SndActive,x
beq start22 ; found => beq start22 ; found =>
dex dex
bpl start21 bpl start21
plx ; not found plx ; not found
dec SndReqStop,x ; stop default-channel dec SndReqStop,x ; stop default-channel
lda #1 lda #1
sta SndDelay,x sta SndDelay,x
start23: lda SndActive,x start23:
bne start23 lda SndActive,x
bra start20 bne start23
start22: pla ; clear stack bra start20
start22:
start20: pla pla ; clear stack
phx start20:
jsr SndStartSoundx ; launch new sound pla
plx phx
rts jsr SndStartSoundx ; launch new sound
plx
rts
_lynx_snd_stop: _lynx_snd_stop:
ldx #3 ldx #3
lda SndActive,x lda SndActive,x
_IFNE _IFNE
stop0: dec SndReqStop,x stop0: dec SndReqStop,x
lda #1 lda #1
sta SndDelay,x sta SndDelay,x
stop1: lda SndActive,x stop1: lda SndActive,x
bne stop1 bne stop1
_ENDIF _ENDIF
dex dex
bpl stop0 bpl stop0
rts rts
SndStopChannel: _lynx_snd_stop_channel:
lda SndActive,x lda SndActive,x
_IFNE _IFNE
dec SndReqStop,x dec SndReqStop,x
lda #1 lda #1
sta SndDelay,x sta SndDelay,x
stopc1: lda SndActive,x stopc1: lda SndActive,x
bne stopc1 bne stopc1
_ENDIF _ENDIF
rts rts
SndChannelsActive: _lynx_snd_active:
ldx #3 ldx #3
lda #0 lda #0
act0: ldy SndActive,x act0: ldy SndActive,x
_IFNE _IFNE
ora SndMask,x ora SndMask,x
_ENDIF _ENDIF
dex dex
bpl act0 bpl act0
rts rts
_lynx_snd_pause:
php
sei
lda STIMCTLA
sta SndPauseOff1+1
stz STIMCTLA
lda MSTEREO
sta SndPauseOff2+1
lda #$ff
sta MSTEREO
lda #$18
trb AUD0CTLA
trb AUD1CTLA
trb AUD2CTLA
trb AUD3CTLA
plp
rts
_lynx_snd_pause: php _lynx_snd_continue:
sei php
lda STIMCTLA sei
sta SndPauseOff1+1 SndPauseOff1:
stz STIMCTLA lda #0 ; Selbsmodifizierter Code!!!
lda MSTEREO sta STIMCTLA
sta SndPauseOff2+1 SndPauseOff2:
lda #$ff lda #0 ; Selbsmodifizierter Code!!!
sta MSTEREO sta MSTEREO
lda #$18
trb AUD0CTLA
trb AUD1CTLA
trb AUD2CTLA
trb AUD3CTLA
plp
rts
lda #$18
tsb AUD0CTLA
tsb AUD1CTLA
tsb AUD2CTLA
tsb AUD3CTLA
_lynx_snd_continue: php plp
sei rts
SndPauseOff1: lda #0 ; Selbsmodifizierter Code!!!
sta STIMCTLA
SndPauseOff2: lda #0 ; Selbsmodifizierter Code!!!
sta MSTEREO
lda #$18 .rodata
tsb AUD0CTLA
tsb AUD1CTLA
tsb AUD2CTLA
tsb AUD3CTLA
plp SndMask:
rts .byte 1,2,4,8
.rodata
SndMask: .byte 1,2,4,8
SndPrescaler: SndPrescaler:
.byte $00,$06,$06,$06,$06,$05,$05,$05,$05,$05,$05,$05,$04,$04,$04,$04 .byte $00,$06,$06,$06,$06,$05,$05,$05,$05,$05,$05,$05,$04,$04,$04,$04