Prev: 46315 Up: Map Next: 46391
46341: Play Theme Music
Used by the routine at ThemeMusic.
Play_ThemeMusic 46341 LD A,(46314) If Flag_ThemeMusic_KeyChange is zero jump to Play_ThemeMusic_KeyChange.
46344 OR A
46345 JR Z,Play_ThemeMusic_KeyChange
46347 LD H,B H=B.
46348 LD L,C L=C.
46349 JR Play_ThemeMusic_Sound Jump to Play_ThemeMusic_Sound.
Play_ThemeMusic_KeyChange 46351 LD H,B H=B.
46352 LD L,C L=C.
46353 SRA B
46355 RR C
46357 ADD HL,BC HL+=BC.
46358 SRA B
46360 RR C
46362 ADD HL,BC HL+=BC.
46363 SRA B
46365 RR C
46367 ADD HL,BC HL+=BC.
Flip speaker on (set bit 4).
Play_ThemeMusic_Sound 46368 LD A,%00010000 A=16 (speaker on = bit 4).
46370 OUT (254),A
46372 CALL Handler_GameMenuInput Call Handler_GameMenuInput.
Flip speaker off (unset bit 4).
46375 XOR A A=0 (speaker off).
46376 OUT (254),A
46378 PUSH BC Stash BC on the stack.
46379 LD B,H B=H.
46380 LD C,L C=L.
46381 CALL Handler_GameMenuInput Call Handler_GameMenuInput.
46384 POP BC Restore BC from the stack.
46385 DEC DE Decrease DE by one.
46386 LD A,D Jump to Play_ThemeMusic_Sound until DE is zero.
46387 OR E
46388 JR NZ,Play_ThemeMusic_Sound
46390 RET Return.
Prev: 46315 Up: Map Next: 46391