Prev: 9B87 Up: Map Next: 9BD9
9B99: Sound player
Used by the routine at interrupt_routine_1.
sound_player 9B99 CALL all_channels_data_to_psg Send data for all channels to PSG
9B9C CALL execute_sound_fx_commands Execute commands for all sound fx channels
9B9F LD A,(is_tune_playing) Is tune playing?
9BA2 AND A ...
9BA3 RET Z Return if not
9BA4 CALL dampen_all_tune_channels Dampen all tune channels
9BA7 LD HL,sound_player_countdown Decrement overall countdown
9BAA DEC (HL) ...
9BAB RET NZ Return if not 0
9BAC LD (HL),$05 Reset countdown
This entry point is used by the routine at L9BD9.
sound_player_0 9BAE LD IX,tune_data_buffer_1 First tune data buffer
9BB2 LD B,$04 4 channels
9BB4 LD A,(tune_index) Get tune index
9BB7 CP $03 If < 3
9BB9 JR C,process_tune_byte Then jump to the standard handler code
Special processing when tune index >= 3
9BBB DEC (IX+$05) Decrement countdown for channel
9BBE JR NZ,L9BFD_0 If not 0 then jump ahead and return into standard code
A countdown of 0 when tune index >= 3 would take us here
9BC0 LD (IX+$05),$04 Reset countdown to 4 instead of 5
9BC4 LD L,(IX+$01) Get tune address LSB
9BC7 LD H,(IX+$02) Get tune address MSB
This entry point is used by the routines at L9BD9 and L9BF8.
sound_player_1 9BCA LD A,(HL) Get tune byte
9BCB INC HL Next tune address (always points to next)
9BCC AND A Was the byte zero?
9BCD JR NZ,L9BFD If not, jump ahead
9BCF LD A,(HL) Get next tune byte
9BD0 INC HL Next tune address
9BD1 AND A Was the byte zero?
9BD2 JR NZ,L9BD9 If not, jump ahead
Two zeros only appear at the end of tune_data_24
9BD4 LD HL,tune_data_24 Jump back and repeat with tune_data_24
9BD7 JR sound_player_1 ...
Prev: 9B87 Up: Map Next: 9BD9