![]() |
Routines |
| Prev: 58185 | Up: Map | Next: 58276 |
|
Used by the routine at Handler_Doors.
|
|||||
|
Fill the room up with water! This only occurs when opening the CYAN door in room #10.
Turn off any other sounds. Unclear why this isn't just set to 0 (the checks in Controller_GeneralSounds are from 1-6).
|
|||||
| Handler_BadDoor | 58209 | LD A,7 | Write 7 to *SoundFlag_General. | ||
| 58211 | LD (65534),A | ||||
| 58214 | LD HL,23200 | Set the starting address in the attribute buffer (23200). | |||
|
And the number of lines to fill with "sea water".
|
|||||
| 58217 | LD B,21 | B=21 (line counter). | |||
|
Start filling the room...
|
|||||
| Handler_BadDoor_Loop | 58219 | PUSH HL | Stash the attribute buffer pointer and the line counter on the stack. | ||
| 58220 | PUSH BC | ||||
| 58221 | LD B,32 | B=32 (number of character blocks in one line). | |||
|
Paint a whole line.
|
|||||
| BadDoor_FillLineLoop | 58223 | LD A,41 | Write "INK: BLUE, PAPER: CYAN " to *HL. | ||
| 58225 | LD (HL),A | ||||
| 58226 | INC HL | Increment the attribute buffer pointer by one. | |||
| 58227 | DJNZ BadDoor_FillLineLoop | Decrease the character block counter by one and loop back to BadDoor_FillLineLoop until the whole line is blue. | |||
|
This sound wave noise is like white noise, so is good for giving the impression of rushing water.
|
|||||
| 58229 | LD B,200 | B=200 (wave loop). | |||
|
Loop over the wave sound 200 times.
|
|||||
| BadDoor_Wave_Loop | 58231 | PUSH BC | Stash the wave loop on the stack. | ||
| 58232 | LD BC,65534 | BC=65534 (C points to the speaker port). | |||
| 58235 | LD A,(23504) | A=*Active_BorderColour. | |||
| 58238 | ADD A,16 | Turn on the speaker (A+=16). | |||
| 58240 | OUT (C),A | Send A to the speaker port. | |||
|
Set a random length delay.
|
|||||
| 58242 | CALL GetRandomNumber | Call GetRandomNumber. | |||
| 58245 | LD B,A | B=the random number. | |||
| BadDoor_RandomDelay_Sound | 58246 | DJNZ BadDoor_RandomDelay_Sound | Decrease the random counter by one and loop back to BadDoor_RandomDelay_Sound until it is zero. | ||
| 58248 | LD BC,65534 | Send *Active_BorderColour to the speaker port. | |||
| 58251 | LD A,(23504) | ||||
| 58254 | OUT (C),A | ||||
|
Set another random length delay.
|
|||||
| 58256 | CALL GetRandomNumber | Call GetRandomNumber. | |||
| 58259 | LD B,A | B=the random number. | |||
| BadDoor_RandomDelay_Silence | 58260 | DJNZ BadDoor_RandomDelay_Silence | Decrease the random counter by one and loop back to BadDoor_RandomDelay_Silence until it is zero. | ||
| 58262 | POP BC | Restore the wave loop from the stack. | |||
| 58263 | DJNZ BadDoor_Wave_Loop | Decrease the wave loop by one and loop back to BadDoor_Wave_Loop until the counter is zero. | |||
|
Restore our positions from the start of the main loop.
|
|||||
| 58265 | POP BC | Restore the line counter and the attribute buffer pointer from the stack. | |||
| 58266 | POP HL | ||||
|
Move "up" one line in the attribute buffer, ready to start painting again once we loop.
|
|||||
| 58267 | LD DE,32 | DE=0032. | |||
| 58270 | XOR A | Reset the flags. | |||
| 58271 | SBC HL,DE | HL-=DE (with carry). | |||
| 58273 | DJNZ Handler_BadDoor_Loop | Decrease the line counter by one and loop back to Handler_BadDoor_Loop until the whole play area is filled. | |||
|
This entry point is used by the routine at Handler_Explosion.
|
|||||
| HousekeepStackThenLoseLife | 58275 | POP BC | Restore BC from the stack. | ||
|
Continue on to LoseLife.
|
|||||
| Prev: 58185 | Up: Map | Next: 58276 |