Prev: C3F4 Up: Map Next: C435
C400: Play Movement Sound
Used by the routine at SpeedPlayerUp.
Plays a short tick, which is alternately high and low, once every few frames. The ticks are made twice as often when the object is moving quickly.
The sounds played by this routine are:
Speed Sound
Movement Sound
Input
IX Object
Count a step and choose the rate from the speed.
PlayMovementSound C400 LD HL,$BBF8 Point HL at the sound counter.
C403 INC (HL) Add one to the counter.
C404 LD A,(IX+$05) Fetch the speed of the object.
C407 CP $0C Jump to PlayMovementSound_Fast if the object is moving quickly.
C409 JR NC,PlayMovementSound_Fast
Jump to PlayMovementSound_Low to make the low tick unless bit 2 of the step counter is set.
C40B LD A,(HL) Fetch the counter.
C40C BIT 2,A Jump to PlayMovementSound_Low unless bit 2 of the counter is set.
C40E JR Z,PlayMovementSound_Low
C410 AND %00000011 Keep the lowest two bits.
C412 RET NZ Return unless they are clear.
C413 LD BC,$4004 Choose the high tone.
C416 JR PlayTone Play it.
Play the low tone of a slow movement.
PlayMovementSound_Low C418 AND %00000011 Keep the lowest two bits.
C41A RET NZ Return unless they are clear.
C41B LD BC,$6004 Choose the low tone.
C41E JR PlayTone Play it.
Play a tone every other frame when the object is going fast.
PlayMovementSound_Fast C420 LD A,(HL) Fetch the counter.
C421 BIT 1,A Jump to PlayMovementSound_FastLow unless bit 1 of the counter is set.
C423 JR Z,PlayMovementSound_FastLow
C425 AND %00000001 Keep the lowest bit.
C427 RET NZ Return unless it is clear.
C428 LD BC,$4004 Choose the high tone.
C42B JR PlayTone Play it.
Play the low tone of a fast movement.
PlayMovementSound_FastLow C42D AND %00000001 Keep the lowest bit.
C42F RET NZ Return unless it is clear.
C430 LD BC,$6004 Choose the low tone.
C433 JR PlayTone Play it.
View the equivalent code in;
Prev: C3F4 Up: Map Next: C435