Prev: 6106 Up: Map Next: 614B
611B: Sounds: Cup/ Refuel
Used by the routine at 6A9B.
SoundsCupRefuel 611B LD A,($5E29) A=GameTimer.
611E AND %00000001 Keep only bit 0.
6120 RET NZ Return every other frame.
6121 LD HL,$5E46 HL=SoundCounter.
6124 LD A,(HL) A=item ID.
6125 BIT 7,A Jump to SoundsCup if bit 7 is not set.
6127 JR NZ,SoundsCup
6129 AND A Return if item ID is zero.
612A RET Z
612B DEC A Decrease A/ item ID by one.
612C LD (HL),A Store A at SoundCounter.
612D RET Z Return if the new item ID is zero.
SoundsRefuel 612E RLCA A=A * 04.
612F RLCA
6130 AND %00011100 Keep only bits 2-4.
6132 OR %00100000 Set bit 5.
6134 LD D,A Store the result in D.
6135 LD C,$20 C=20.
SoundsCupRefuel_Loop 6137 CALL PlaySquareWave Call PlaySquareWave.
613A DEC C Decrease C by one.
613B JR NZ,SoundsCupRefuel_Loop Jump back to SoundsCupRefuel_Loop until C is zero.
613D RET Return.
SoundsCup 613E AND %01111111 Keep only bits 0-6.
6140 RET Z Return if A is now zero.
6141 DEC A Decrease A by one.
6142 OR %10000000 Set bit 7.
6144 LD (HL),A Store A at SoundCounter.
6145 AND %01111111 Keep only bits 0-6.
6147 RET Z Return if A is now zero.
6148 CPL Flip the bits.
6149 JR SoundsRefuel Jump to SoundsRefuel.
Prev: 6106 Up: Map Next: 614B