Prev: FB79 Up: Map Next: FC0E
FB81: Play Theme Tune
Used by the routine at ResetThemeTune.
PlayThemeTune FB81 LD HL,$FB55 HL=FB55.
FB84 CALL $FB5E Call FB5E.
FB87 LD ($FB52),A Write A to *FB52.
FB8A LD HL,$FB59 HL=FB59.
FB8D CALL $FB5E Call FB5E.
FB90 LD ($FB53),A Write A to *FB53.
FB93 LD HL,$FB52 HL=FB52.
FB96 CALL $FB6B Call FB6B.
FB99 RL E Rotate E left.
FB9B JP C,$FC44 Jump to FC44 if {} is lower.
FB9E PUSH HL Stash HL on the stack.
FB9F LD HL,$FB53 HL=FB53.
FBA2 CALL $FB6B Call FB6B.
FBA5 POP DE Restore DE from the stack.
FBA6 LD A,H A=H.
FBA7 DEC A Decrease A by one.
FBA8 JR NZ,PlayThemeTune_0 Jump to PlayThemeTune_0 if A is not zero.
FBAA LD A,D A=D.
FBAB DEC A Decrease A by one.
FBAC JR Z,PlayThemeTune_6 Jump to PlayThemeTune_6 if A is zero.
PlayThemeTune_0 FBAE LD A,($FB5D) A=*FB5D.
FBB1 LD C,A C=A.
FBB2 LD B,$00 B=00.
FBB4 LD A,($FB54) A=*FB54.
FBB7 EX AF,AF' Exchange the AF register with the shadow AF register.
FBB8 LD A,($FB54) A=*FB54.
FBBB LD IXh,D
FBBD LD D,$10
PlayThemeTune_1 FBBF NOP
FBC0 NOP
PlayThemeTune_2 FBC1 EX AF,AF'
FBC2 DEC E
FBC3 OUT ($FE),A
FBC5 JR NZ,PlayThemeTune_4
FBC7 LD E,IXh
FBC9 XOR D
FBCA EX AF,AF'
FBCB DEC L
FBCC JP NZ,PlayThemeTune_5
PlayThemeTune_3 FBCF OUT ($FE),A
FBD1 LD L,H
FBD2 XOR D
FBD3 DJNZ PlayThemeTune_1
FBD5 INC C
FBD6 JP NZ,PlayThemeTune_2
FBD9 RET
FBDA LD H,C
FBDB LD H,H
FBDC LD H,C
FBDD LD L,L
PlayThemeTune_4 FBDE JR Z,PlayThemeTune_4
FBE0 EX AF,AF'
FBE1 DEC L
FBE2 JP Z,PlayThemeTune_3
PlayThemeTune_5 FBE5 OUT ($FE),A
FBE7 NOP
FBE8 NOP
FBE9 DJNZ PlayThemeTune_1
FBEB INC C
FBEC JP NZ,PlayThemeTune_2
FBEF RET
PlayThemeTune_6 FBF0 LD A,($FB5D) A=*FB5D.
FBF3 CPL Invert the bits in A.
FBF4 LD C,A C=A.
This entry point is used by the routine at FC44.
PlayThemeTune_7 FBF5 PUSH BC Stash BC and AF on the stack.
FBF6 PUSH AF
FBF7 LD B,$00 B=00.
PlayThemeTune_8 FBF9 PUSH HL Stash HL on the stack.
FBFA LD HL,$0000 HL=0000.
FBFD SRA (HL) Shift *HL right three positions (with carry).
FBFF SRA (HL)
FC01 SRA (HL)
FC03 NOP No operation.
FC04 POP HL Restore HL from the stack.
FC05 DJNZ PlayThemeTune_8 Decrease counter by one and loop back to PlayThemeTune_8 until counter is zero.
FC07 DEC C Decrease C by one.
FC08 JP NZ,PlayThemeTune_8 Jump to PlayThemeTune_8 until C is zero.
FC0B POP AF Restore AF and BC from the stack.
FC0C POP BC
FC0D RET Return.
Prev: FB79 Up: Map Next: FC0E