Prev: 46210 Up: Map Next: 46311
46228: Handler: Theme Music
Used by the routine at Check_Music.
Input
A Music data
HL Music data address pointer
ThemeMusic 46228 INC HL Increment music data address pointer held in HL by one.
The control character 254 signifies a key change.
46229 CP 254 If A is not 254 jump to ThemeMusic_CheckKeyChange.
46231 JR NZ,ThemeMusic_CheckKeyChange
46233 XOR A A=0.
ThemeMusic_SetKey 46234 LD (46314),A Write A to Flag_ThemeMusic_KeyChange.
46237 LD (46311),HL Write HL to Pointer_MusicData.
46240 JR Check_Music Jump to Check_Music.
The control character 255 signifies a key change.
ThemeMusic_CheckKeyChange 46242 CP 255 If A is not 255 jump to ThemeMusic_0.
46244 JR NZ,ThemeMusic_0
46246 LD A,1 A=1.
46248 JR ThemeMusic_SetKey Jump to ThemeMusic_SetKey.
ThemeMusic_0 46250 PUSH AF Stash AF on the stack.
46251 LD A,(HL) A=*HL.
46252 INC HL Increment music data address pointer held in HL by one.
46253 LD (46311),HL Write HL to Pointer_MusicData.
46256 OR A If A is zero jump to ThemeMusic_3.
46257 JR Z,ThemeMusic_3
46259 LD L,A Create an offset in HL.
46260 LD H,0
46262 ADD HL,HL HL*=2.
46263 LD DE,46391 HL+=46391.
46266 ADD HL,DE
46267 LD C,(HL) C=*HL.
46268 LD B,0 B=0.
46270 INC HL Increment music data address pointer held in HL by one.
46271 LD E,(HL) E=*HL.
46272 LD D,B D=0.
46273 POP AF Restore AF from the stack.
46274 LD HL,0 HL+=0000.
ThemeMusic_1 46277 ADD HL,DE
46278 DEC A Decrease A by one.
46279 JR NZ,ThemeMusic_1 Jump to ThemeMusic_1 until A is zero.
46281 EX DE,HL Switch the DE and HL registers.
46282 CALL Play_ThemeMusic Call Play_ThemeMusic.
46285 LD A,(46313) A=*TempStore_GameOptions.
46288 CP 255 Return if A is not 255.
46290 RET NZ
ThemeMusic_2 46291 LD BC,800 BC=800.
46294 CALL Handler_GameMenuInput Call Handler_GameMenuInput.
46297 JR Check_Music Jump to Check_Music.
ThemeMusic_3 46299 LD BC,6600 BC=6600.
46302 POP AF Restore AF from the stack.
ThemeMusic_4 46303 CALL Handler_GameMenuInput Call Handler_GameMenuInput.
46306 DEC A Decrease A by one.
46307 JR NZ,ThemeMusic_4 Jump to ThemeMusic_4 until A is zero.
46309 JR ThemeMusic_2 Jump to ThemeMusic_2.
Prev: 46210 Up: Map Next: 46311