Prev: D5D7 Up: Map Next: D682
D5E7: Configure sound channel and mixer register
Used by the routines at 969B, 981F, 9AC5, 9C3B, 9D1F, 9D47, 9F5F, B506, B562, B64E, D215, D46C and D494.
Input
DE Sound data address
D5E7 PUSH IY Save IY, IX and BC
D5E9 PUSH IX
D5EB PUSH BC
D5EC PUSH DE Copy DE into IY
D5ED POP IY
D5EF CALL $D5F8 Configure sound channel and mixer register
D5F2 POP BC Restore IY, IX and BC
D5F3 POP IX
D5F5 POP IY
D5F7 RET
Configure sound channel and mixer register
D5F8 LD A,(IY+$00) Set IX to the base address for the channel to configure
D5FB DEC A
D5FC SLA A
D5FE SLA A
D600 SLA A
D602 LD C,A
D603 LD B,$00
D605 LD IX,$D832
D609 ADD IX,BC
D60B LD A,(IY+$02) Set number of tones
D60E LD (IX+$00),A
D611 LD A,(IY+$06) Set variation counter
D614 LD (IX+$01),A
D617 PUSH IY Set address for sound data
D619 POP HL
D61A LD BC,$0006
D61D ADD HL,BC
D61E LD (IX+$02),L
D621 LD (IX+$03),H
D624 LD A,(IY+$04) Set base fine and coarse pitch
D627 LD (IX+$04),A
D62A LD A,(IY+$05)
D62D LD (IX+$05),A
D630 LD A,(IY+$03) Set channel volume
D633 LD (IX+$07),A
D636 LD A,(IY+$01) Set A to the data mixer
D639 CP $00 Jump forward if not zero
D63B JP NZ,$D651
D63E LD B,(IY+$00) Disable noise for selected channel
D641 LD C,$04
D643 SLA C
D645 DJNZ $D643
D647 LD A,($D855) Disable noise for the selected channel into the current data mixer
D64A OR C
D64B LD ($D855),A
D64E JP $D682 Send this data to the mixer register
D651 LD A,($D855) Set B the current data mixer
D654 LD B,A
D655 LD A,(IY+$00) if channel 1 then disable tone in channel 1 and enable noise in channel 1
D658 CP $01
D65A JP NZ,$D664
D65D RES 3,B
D65F SET 0,B
D661 JP $D674 Jump to update data mixer
D664 CP $02 if channel 2 then disable tone in channel 2 and enable noise in channel 2
D666 JP NZ,$D670
D669 RES 4,B
D66B SET 1,B
D66D JP $D674 Jump to update data mixer
D670 RES 5,B if channel 3 then disable tone in channel 3 and enable noise in channel 3
D672 SET 2,B
D674 LD A,B Update data mixer
D675 LD ($D855),A
D678 CALL $D682 Send this data to the mixer register
D67B LD A,(IY+$01) Copy noise/tone enable/disable
D67E LD (IX+$06),A
D681 RET
Prev: D5D7 Up: Map Next: D682