![]() |
Routines |
| Prev: 24729 | Up: Map | Next: 24827 |
|
Plays eight groups of four square waves using PlaySquareWave. The period of each group comes from one of the first eight bytes of the ROM, with bit 7 set (so the period is never less than 128). This is the sound made when the car reaches the edge of the map.
|
||||
| SoundsBounce | 24803 | LD HL,0 | Point HL at the start of the ROM, which supplies the periods of the waves. | |
| 24806 | LD C,8 | Set the group counter to 8 one for each group of waves. | ||
| SoundsBounce_Loop | 24808 | LD E,4 | Set the wave counter to 4 for the waves in each group. | |
| 24810 | LD A,(HL) | Fetch the next ROM byte. | ||
| 24811 | INC HL | Move on to the next ROM byte. | ||
| 24812 | AND %01111111 | Keep only bits 0-6. | ||
| 24814 | OR %10000000 | Set bit 7. | ||
| 24816 | LD D,A | Set the period of the waves in this group. | ||
| SoundsBounce_Play | 24817 | CALL PlaySquareWave | Play a square wave using PlaySquareWave. | |
| 24820 | DEC E | Decrease the wave counter by one and loop back to SoundsBounce_Play until all of the waves in the group have been played. | ||
| 24821 | JR NZ,SoundsBounce_Play | |||
| 24823 | DEC C | Decrease the group counter by one and loop back to SoundsBounce_Loop until all of the groups have been played. | ||
| 24824 | JR NZ,SoundsBounce_Loop | |||
| 24826 | RET | Return. | ||
|
View the equivalent code in;
|
||||
| Prev: 24729 | Up: Map | Next: 24827 |