Prev: 41176 Up: Map Next: 41205
41188: Sounds: Sword
Used by the routines at Handle_Sabreman_Jumping and Handle_Collectable.
Plays 16 tones of one cycle each. The half period of each tone is the counter multiplied by 16 and exclusive ORed with 28.
SoundsSword 41188 LD D,16 Set the number of tones to 16.
SoundsSword_Loop 41190 LD A,D Fetch the tone counter, which is used to work out the half period of the tone.
41191 RLCA Rotate it left twice.
41192 RLCA
41193 XOR %00000111 Flip the low three bits.
41195 RLCA Rotate it left twice again, which makes the half period.
41196 RLCA
41197 LD B,A Store the half period in B.
41198 CALL SoundsClick Play the tone.
41201 DEC D Decrease the tone counter and loop back until all of the tones have been played.
41202 JR NZ,SoundsSword_Loop
41204 RET Return.
View the equivalent code in;
Prev: 41176 Up: Map Next: 41205