File: SFX PSG routine.txt - Tab length: 1 2 4 8 - Lines: on off - No wrap: on off

This is the routine that plays a SFX;
This routine is used for the in game sound fx (like shooting) <<<<<<<<<<<<

In SCC-BLAFFER I use ONLY channel 3 for PSG (drums) channel 1 and 2 are unused.
What do I need to change in the routine below to let it leave channel 3 untouched ?

;+----- Set all PSG regs.-----+ ;SEE (Sound Effects Editor)
SETPSG:
 LD IX,PSGREG
 LD E,0  ;Start reg.0
 INC HL  ;[skip event byte]

;

 LD B,3   ;First 6 reg. [sound frequency]
STPS.0: PUSH BC
 LD C,(HL) ;reg. $00, $02 or $04  -> Fine tune : A,B & C channels
 INC HL
 LD B,(HL) ;reg. $01, $03 or $05  -> Coarse tune : A,B & C channels
 BIT 7,(HL) ;check and handle Tuning
 CALL NZ,TUNWUP
 BIT 6,(HL)
 CALL NZ,TUNWDW
 INC HL
 LD A,C
 CALL WRTPSG
 LD A,B
 AND $0F
 CALL WRTPSG
 POP BC
 DJNZ STPS.0

 LD A,(HL) ;reg. $06 [Rustle frequency]       -> Noise channel ?
 INC HL
 BIT 7,A
 CALL NZ,TUN_UP
 BIT 6,A
 CALL NZ,TUN_DW
 AND $1F
 CALL WRTPSG

 LD A,(HL) ;reg. $07 [set channel ON/OFF]       ->Mixer :/EN noise /EN A /EN B /EN C
 AND $3F
 OR $80  ;set bit 7 is necessary to write the PSG!! ---> pour SSG/YM2610 : idem ??? pas sur !
 INC HL
 CALL WRTPSG

 LD B,3  ;reg.  $08-$0A [Volume  Channels A,B & C]
STPS.1: PUSH BC
 LD A,(HL)
 INC HL
 BIT 5,A
 JP NZ,STPS.2 ;Volume pattern is set.
 LD C,A
 AND $0F
 BIT 7,C
 CALL NZ,TUN_UP
 BIT 6,C
 CALL NZ,VOL_DW
 CALL FIXVOL ;       Volume est param�trable !!
STPS.2: AND $1F
 CALL WRTPSG
 POP BC
 DJNZ STPS.1

 LD B,3  ; reg $0B-$0D [volume effect] ->Volume envelope period fine tune/coarse tune & Volume envelop shape
STPS_2: LD A,(HL)
 INC HL
 CALL WRTPSG
 DJNZ STPS_2
 RET


; Tuning
;- byte
TUN_UP: ADD A,(IX) ; Up
 RET
TUN_DW: SUB (IX) ; Down
 NEG
 RET
;- word
TUNWUP: PUSH HL
 LD L,(IX)
 LD H,(IX+1)
 ADD HL,BC
 PUSH HL
 POP BC
 POP HL
 RET
TUNWDW: PUSH HL
 LD L,(IX)
 LD H,(IX+1)
 XOR A
 SBC HL,BC
 PUSH HL
 POP BC
 POP HL
 RET

; Volume Down
VOL_DW: AND $0F
 LD B,A
 LD A,(IX+0)
 SUB B
 RET NC
 XOR A
 RET


; Make relative volume (depending on "SEEVOL"
; In: A, volume
; Out: A, new volume [seevol - (15-volume)]
FIXVOL: AND $0F
 LD B,A
 LD A,15
 SUB B
 LD C,A
 LD A,(SEEVOL)
 AND $0F
 SUB C
 RET NC
 XOR A
 RET


; Write PSG (not ROM-BIOS compatible!)
; In: A, data
; E, port
; IX, PSG store table
; Out: E+1
; IX+1
WRTPSG: LD (IX),A
 INC IX
 PUSH AF
 LD A,E
 OUT ($A0),A  ; pour MSX /port $A0(write) register Write port -> A modifier NEOGEO :OUT ($4),A
 INC E
 POP AF
 OUT ($A1),A  ; pour MSX /port $A1(write) Value Write port -> A modifier NEOGEO :OUT ($5),A
 RET


;+----------------------------< Work Area >------------------------------------+
; reg. 0 1 2 3 4 5 6 7 8 9 A B C D
PSGREG: DB 0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; - PSG port store buffer -