.BEEP LDY #30 ; Set the length of the loop below to 30 clicks, so we ; make a total of 31 clicks in the following LDX #110 ; Set the period of the sound at 110 for a high beep .SOBEEP BIT DNOIZ ; If bit 7 of DNOIZ is non-zero, then sound is disabled, BMI SOUR ; so return from the subroutine (as SOUR contains an ; RTS) STX T3 ; Store the period in T3 .BEEPL1 LDA $C030 ; Toggle the state of the speaker (i.e. move it in or ; out) by reading the SPEAKER soft switch LDX T3 ; Loop around for T3 iterations, so the higher the DEX ; period in X, the longer the wait BNE P%-1 DEY ; Decrement the sound length in Y BNE BEEPL1 ; Loop back to make another click until we have made a ; sound consisting of Y clicks LDA $C030 ; Toggle the state of the speaker (i.e. move it in or ; out) by reading the SPEAKER soft switch .SOUR RTS ; Return from the subroutineName: BEEP [Show more] Type: Subroutine Category: Sound Summary: Make a short, high beepContext: See this subroutine in context in the source code References: This subroutine is called as follows: * Main flight loop (Part 11 of 16) calls BEEP * R5 calls BEEP * BOOP calls via SOBEEP * LASNOISE calls via SOUR * SOBLIP calls via SOUR * SOBOMB calls via SOUR * SOEXPL calls via SOUR * SOHISS calls via SOUR
Other entry points: SOBEEP Make a beep as follows: * X = the period of the beep (a bigger value means a lower pitch) * Y = the length of the beep SOUR Contains an RTS
[X]
Label BEEPL1 is local to this routine
[X]
Variable DNOIZ in workspace Option variables
Sound on/off configuration setting