Prev: F6B5 Up: Map Next: F723
F6DB: Music: Theme Tune
Used by the routine at Handler_Interrupts.
MusicThemeTune F6DB LD A,($FFF8) Jump to MusicThemeTune_Housekeeping if *MusicOnOff is equal to 00.
F6DE CP $00
F6E0 JR Z,MusicThemeTune_Housekeeping
F6E2 PUSH BC Stash BC on the stack.
F6E3 LD A,($FE88) C=*InterruptCounter.
F6E6 LD C,A
F6E7 LD A,($FFF7) A=*FFF7.
F6EA AND C Merge the bits from C.
F6EB POP BC Restore BC from the stack.
F6EC JR NZ,MusicThemeTune_Housekeeping Jump to MusicThemeTune_Housekeeping if {} is not zero.
F6EE PUSH BC Stash BC, DE and HL on the stack.
F6EF PUSH DE
F6F0 PUSH HL
F6F1 LD HL,($FFF9) HL=*MusicPointerThemeMusic.
F6F4 LD A,(HL) Fetch a byte of music data and store it in A.
Are we at the end?
F6F5 CP $FF Jump to MusicResetThemeTune if the termination character (FF) has been reached.
F6F7 JP Z,MusicResetThemeTune
F6FA LD E,A E=the music data byte from A.
F6FB INC HL Increment the music data pointer by one.
F6FC LD A,(HL) D=*HL.
F6FD LD D,A
F6FE INC HL Increment music data pointer by one.
F6FF LD A,(HL) C=*HL.
F700 LD C,A
F701 INC HL Increment music data pointer by one.
F702 LD A,(HL) B=*HL.
F703 LD B,A
F704 INC HL Increment the music data pointer by one and write it to *MusicPointerThemeMusic ready for the next interrupt generation.
F705 LD ($FFF9),HL
F708 LD A,E Jump to MusicThemeTune_NoNote if DE is zero.
F709 OR D
F70A JR Z,MusicThemeTune_NoNote
F70C CALL PlayWave1 Call PlayWave1.
MusicThemeTune_NoNote F70F POP HL Restore HL, DE and BC from the stack.
F710 POP DE
F711 POP BC
MusicThemeTune_Housekeeping F712 POP AF Restore AF and AF from the stack.
F713 POP AF
F714 CALL $0038 Call MASK_INT.
F717 POP IY Restore IY from the stack.
F719 EI Enable interrupts.
F71A RET Return.
Resets the theme tune pointer back to the beginning of the data.
MusicResetThemeTune F71B LD HL,$FA00 Write MelodyData_ThemeTune to *MusicPointerThemeMusic.
F71E LD ($FFF9),HL
F721 JR MusicThemeTune_NoNote Jump to MusicThemeTune_NoNote.
Prev: F6B5 Up: Map Next: F723