Prev: 6821 Up: Map Next: 683E
6825: Play Chirp
Used by the routine at GamePlay_Start.
Plays a short chirp of seven square wave cycles. The period of each cycle depends on a counter, and on the value of FrameCounter.
PlayChirp 6825 LD C,$07 Set the cycle counter to 07.
PlayChirp_Loop 6827 LD A,C Fetch the cycle counter.
6828 DAA Decimal adjust the counter, to vary the period of the cycle.
6829 XOR %11110000 Flip bits 4-7.
682B RLCA Rotate A left.
682C LD D,A Put the result in D (the period).
682D LD A,($5F1D) Fetch the frame counter.
6830 RRCA Divide by 08 (rotating the bits).
6831 RRCA
6832 RRCA
6833 AND %01100000 Keep only bits 5-6.
6835 XOR D Combine with the period.
6836 LD D,A Update the period.
6837 CALL PlaySquareWave Play a cycle using PlaySquareWave.
683A DEC C Decrease the cycle counter by one.
683B JR NZ,PlayChirp_Loop Loop back to PlayChirp_Loop until the cycle counter is zero.
683D RET Return.
Prev: 6821 Up: Map Next: 683E