Prev: 614B Up: Map Next: 6175
6158: Sounds: Engine
Used by the routine at 6A73.
SoundsEngine 6158 LD A,($5E0D) A=Speed.
615B AND A Return if Speed is zero.
615C RET Z
615D RRCA A=Speed / 04.
615E RRCA
615F CPL Flip the bits.
6160 AND %00111111 Keep only bits 0-5.
6162 LD D,A Store the result in D.
6163 LD C,$04 C=04.
6165 LD A,($5E80) If 5E80 is 03 then jump to SoundsEngine_Loop.
6168 CP $03
616A JR Z,SoundsEngine_Loop
616C LD B,$0C B=0C.
SoundsEngine_Loop 616E CALL PlaySquareWave Call PlaySquareWave.
6171 DEC C Decrease C by one.
6172 JR NZ,SoundsEngine_Loop If C is not zero, jump to SoundsEngine_Loop.
6174 RET Return.
Prev: 614B Up: Map Next: 6175