![]() |
Routines |
| Prev: 29139 | Up: Map | Next: 29168 |
|
Used by the routines at PlayArrivalSound, PlayWarble, PlayFlutterSound, PlayHitSound and PlayBumpSound.
Makes one cycle of a square wave with the speaker. The speaker is on for as long as it is off, which is set by B: the higher it is, the lower the note.
|
||||||||||||
| PlaySquareWave | 29152 | LD A,16 | Turn the speaker on. | |||||||||
| 29154 | OUT (254),A | Send that to the speaker. | ||||||||||
| 29156 | LD A,B | Keep the half-period. | ||||||||||
| PlaySquareWave_Delay | 29157 | DJNZ PlaySquareWave_Delay | Hold this half of the cycle. | |||||||||
| 29159 | LD B,A | Restore the half-period. | ||||||||||
| 29160 | XOR A | Turn the speaker off. | ||||||||||
| 29161 | OUT (254),A | Send that to the speaker. | ||||||||||
| 29163 | LD A,B | Keep the half-period again. | ||||||||||
| PlaySquareWave_Wait | 29164 | DJNZ PlaySquareWave_Wait | Hold the other half of the cycle. | |||||||||
| 29166 | LD B,A | Restore the half-period. | ||||||||||
| 29167 | RET | Return. | ||||||||||
|
View the equivalent code in;
|
||||||||||||
| Prev: 29139 | Up: Map | Next: 29168 |