Prev: D36F Up: Map Next: D424
D37F: Configure sound channel and mixer register
Used by the routines at 9683, 9807, 99E3, 9BA7, 9D2D, 9E15, 9E3D, A0F8, B54C, B5A8, B810, CFB5, D204 and D22C.
Input
DE Sound data address
D37F PUSH IY Save IY, IX and BC
D381 PUSH IX
D383 PUSH BC
D384 PUSH DE Copy DE into IY
D385 POP IY
D387 CALL $D390 Configure sound channel and mixer register
D38A POP BC Restore IY, IX and BC
D38B POP IX
D38D POP IY
D38F RET
Configure sound channel and mixer register
D390 LD A,(IY+$00) Set IX to the base address for the channel to configure
D393 DEC A
D394 SLA A
D396 SLA A
D398 SLA A
D39A LD C,A
D39B LD B,$00
D39D LD IX,$D5CA
D3A1 ADD IX,BC
D3A3 LD A,(IY+$02) Set number of tones
D3A6 LD (IX+$00),A
D3A9 LD A,(IY+$06) Set variation counter
D3AC LD (IX+$01),A
D3AF PUSH IY Set address for sound data
D3B1 POP HL
D3B2 LD BC,$0006
D3B5 ADD HL,BC
D3B6 LD (IX+$02),L
D3B9 LD (IX+$03),H
D3BC LD A,(IY+$04) Set base fine and coarse pitch
D3BF LD (IX+$04),A
D3C2 LD A,(IY+$05)
D3C5 LD (IX+$05),A
D3C8 LD A,(IY+$03) Set channel volume
D3CB LD (IX+$07),A
D3CE LD A,(IY+$01) Set A to the data mixer
D3D1 CP $00 Jump forward if not zero
D3D3 JP NZ,$D3E9
D3D6 LD B,(IY+$00) Disable noise for selected channel
D3D9 LD C,$04
D3DB SLA C
D3DD DJNZ $D3DB
D3DF LD A,($D5ED) Disable noise for the selected channel into the current data mixer
D3E2 OR C
D3E3 LD ($D5ED),A
D3E6 JP $D41A Send this data to the mixer register
D3E9 LD A,($D5ED) Set B the current data mixer
D3EC LD B,A
D3ED LD A,(IY+$00) if channel 1 then disable tone in channel 1 and enable noise in channel 1
D3F0 CP $01
D3F2 JP NZ,$D3FC
D3F5 RES 3,B
D3F7 SET 0,B
D3F9 JP $D40C Jump to update data mixer
D3FC CP $02 if channel 2 then disable tone in channel 2 and enable noise in channel 2
D3FE JP NZ,$D408
D401 RES 4,B
D403 SET 1,B
D405 JP $D40C Jump to update data mixer
D408 RES 5,B if channel 3 then disable tone in channel 3 and enable noise in channel 3
D40A SET 2,B
D40C LD A,B Update data mixer
D40D LD ($D5ED),A
D410 CALL $D41A Send this data to the mixer register
D413 LD A,(IY+$01) Copy noise/tone enable/disable
D416 LD (IX+$06),A
D419 RET
This entry point is used by the routine at D346.
D41A LD A,($D5ED)
D41D LD D,$07
D41F LD E,A
D420 CALL $D4F1
D423 RET
Prev: D36F Up: Map Next: D424