![]() |
Routines |
| Prev: 41886 | Up: Map | Next: 41917 |
|
Used by the routines at FallThroughTrapdoor, SoundsAxeThrow, SoundsSword, SoundsFireball and SoundsWeaponPop.
Plays a tone on the speaker by switching it on and off. Each cycle is a wait of the half period with the speaker on and the same wait with the speaker off.
This entry plays one cycle (a click). The entry at SoundsBeep plays the number of cycles that is in C, and the routines which follow play other tones by loading BC and jumping to it.
Writing 16 to port 254 sets the speaker bit and leaves the border black.
A single click is too short to be heard on its own, so there is no sample for it here. It is heard in the run of clicks played by SoundsWeaponPop (which has a sample), and in those played by SoundsAxeThrow, SoundsSword and SoundsFireball, and when the player falls through a trapdoor in FallThroughTrapdoor.
|
||||||||
| SoundsClick | 41896 | LD C,1 | C=1 (one cycle). | |||||
|
This entry point is used by the routines at SoundsInventory, SoundsDropItem, SoundsWalking, SoundsWalkLow, SoundsStart, SoundEffect, SoundEffectNext, SoundsAppear, SoundEffectEating and SoundsBounce.
Play C cycles of the tone.
|
||||||||
| SoundsBeep | 41898 | LD A,16 | A=16 (the speaker bit). | |||||
| 41900 | OUT (254),A | Switch the speaker on. | ||||||
| 41902 | PUSH BC | Stash the cycle counter and the half period on the stack, as the wait counts B down to zero. | ||||||
| SoundsClick_OnDelay | 41903 | DJNZ SoundsClick_OnDelay | Wait for the half period. | |||||
| 41905 | POP BC | Restore the cycle counter and the half period from the stack. | ||||||
| 41906 | PUSH BC | Stash them on the stack again. | ||||||
| 41907 | XOR A | A=0 (clear the speaker bit). | ||||||
| 41908 | OUT (254),A | Switch the speaker off. | ||||||
| SoundsClick_OffDelay | 41910 | DJNZ SoundsClick_OffDelay | Wait for the half period. | |||||
| 41912 | POP BC | Restore the cycle counter and the half period from the stack. | ||||||
| 41913 | DEC C | Decrease the cycle counter by one. | ||||||
| 41914 | JR NZ,SoundsBeep | Jump back to SoundsBeep until all of the cycles have been played. | ||||||
| 41916 | RET | Return. | ||||||
|
View the equivalent code in;
|
||||||||
| Prev: 41886 | Up: Map | Next: 41917 |