Prev: 46710 Up: Map Next: 46761
46736: Play Moving Sound
Used by the routines at HandleRemoteControlRobot and HandleChasingDome.
Plays the sound of a moving robot. The length comes from a table of four values, using bits 0 and 1 of FrameCounter, and the pitch changes with the frame.
Input
HL Address of a table of four lengths
Fetch a length from the table.
PlayMovingSound 46736 LD A,(23298) Fetch FrameCounter.
46739 AND %00000011 Keep only bits 0 and 1.
46741 CALL AddAToHL Call AddAToHL.
46744 LD C,(HL) Fetch the length of the sound.
Play a beep of a pitch made from the frame and the length.
PlayMovingSound_NextBeep 46745 LD A,(23298) Fetch FrameCounter.
46748 XOR C Combine it with the length.
46749 AND %00011111 Keep only bits 0 to 4.
46751 OR %01000000 Set bit 6.
46753 LD B,A Keep the pitch in B.
46754 CALL PlaySquareWave Call PlaySquareWave.
46757 DEC C Count down.
46758 JR NZ,PlayMovingSound_NextBeep Jump to PlayMovingSound_NextBeep until all of the beeps have been played.
46760 RET Return.
Prev: 46710 Up: Map Next: 46761