Prev: A3E0 Up: Map Next: A3EF
A3E5: Start sound $64, the one for being caught
Used by the routines at CHECK_HIT and MUSHROOM_DRAIN.
A sound is not played here and it is not played by a scheduler either: it is spawned as an actor. This writes a sprite and a count into the record at $EAA0, and from the next frame on the dispatcher finds it there like any other creature and calls its handler, which beeps once, counts down, and frees the slot when it reaches zero.
So the second byte is a duration in frames rather than the room number the same field holds in every other record, and the sprite is one of the codes that draws nothing -- $64, $65 and $A0 are sounds wearing an actor's clothes.
Three routines share the tail with different values: sound $64 for 16 frames here, $65 for 10 from PLAY_SOUND_NEW_ROOM (a room entered) and $A0 for 16 from PLAY_SOUND_EATING (food eaten). This one is started by CHECK_HIT when a creature touches the player, and by MUSHROOM_DRAIN on every pass the player stands on a mushroom. There is one slot, so a new sound replaces one still playing. Watched live, writing $64 and $10 into the two bytes by hand makes the count fall 0C, 07, 03 over the following frames and then the slot empties itself.
Input
BC B = which sound, C = how many frames it lasts
PLAY_SOUND_CAUGHT A3E5 LD BC,$6410 This entry's sound and length.
This entry point is used by the routines at PLAY_SOUND_NEW_ROOM and PLAY_SOUND_EATING.
PLAY_SOUND_BC A3E8 LD HL,$EAA0 Sprite first, then the count -- the field an ordinary record uses for its room.
A3EB LD (HL),B
A3EC INC HL
A3ED LD (HL),C
A3EE RET
Prev: A3E0 Up: Map Next: A3EF