Prev: B676 Up: Map Next: B6A9
B690: 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 B690 LD A,($5B02) Fetch FrameCounter.
B693 AND %00000011 Keep only bits 0 and 1.
B695 CALL AddAToHL Call AddAToHL.
B698 LD C,(HL) Fetch the length of the sound.
Play a beep of a pitch made from the frame and the length.
PlayMovingSound_NextBeep B699 LD A,($5B02) Fetch FrameCounter.
B69C XOR C Combine it with the length.
B69D AND %00011111 Keep only bits 0 to 4.
B69F OR %01000000 Set bit 6.
B6A1 LD B,A Keep the pitch in B.
B6A2 CALL PlaySquareWave Call PlaySquareWave.
B6A5 DEC C Count down.
B6A6 JR NZ,PlayMovingSound_NextBeep Jump to PlayMovingSound_NextBeep until all of the beeps have been played.
B6A8 RET Return.
Prev: B676 Up: Map Next: B6A9