Prev: E349 Up: Map Next: E3A4
E361: Handler: Bad Door
Used by the routine at Handler_Doors.
Fill the room up with water! This only occurs when opening the CYAN door in room #10.
room-filling-with-water-animation
Turn off any other sounds. Unclear why this isn't just set to 00 (the checks in Controller_GeneralSounds are from 01-06).
Handler_BadDoor E361 LD A,$07 Write 07 to *SoundFlag_General.
E363 LD ($FFFE),A
E366 LD HL,$5AA0 Set the starting address in the attribute buffer (5AA0).
And the number of lines to fill with "sea water".
E369 LD B,$15 B=15 (line counter).
Start filling the room...
Handler_BadDoor_Loop E36B PUSH HL Stash the attribute buffer pointer and the line counter on the stack.
E36C PUSH BC
E36D LD B,$20 B=20 (number of character blocks in one line).
Paint a whole line.
BadDoor_FillLineLoop E36F LD A,$29 Write "INK: BLUE, PAPER: CYAN " to *HL.
E371 LD (HL),A
E372 INC HL Increment the attribute buffer pointer by one.
E373 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.
E375 LD B,$C8 B=C8 (wave loop).
Loop over the wave sound C8 times.
BadDoor_Wave_Loop E377 PUSH BC Stash the wave loop on the stack.
E378 LD BC,$FFFE BC=FFFE (C points to the speaker port).
E37B LD A,($5BD0) A=*Active_BorderColour.
E37E ADD A,$10 Turn on the speaker (A+=10).
E380 OUT (C),A Send A to the speaker port.
Set a random length delay.
E382 CALL GetRandomNumber Call GetRandomNumber.
E385 LD B,A B=the random number.
BadDoor_RandomDelay_Sound E386 DJNZ BadDoor_RandomDelay_Sound Decrease the random counter by one and loop back to BadDoor_RandomDelay_Sound until it is zero.
E388 LD BC,$FFFE Send *Active_BorderColour to the speaker port.
E38B LD A,($5BD0)
E38E OUT (C),A
Set another random length delay.
E390 CALL GetRandomNumber Call GetRandomNumber.
E393 LD B,A B=the random number.
BadDoor_RandomDelay_Silence E394 DJNZ BadDoor_RandomDelay_Silence Decrease the random counter by one and loop back to BadDoor_RandomDelay_Silence until it is zero.
E396 POP BC Restore the wave loop from the stack.
E397 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.
E399 POP BC Restore the line counter and the attribute buffer pointer from the stack.
E39A POP HL
Move "up" one line in the attribute buffer, ready to start painting again once we loop.
E39B LD DE,$0020 DE=0020.
E39E XOR A Reset the flags.
E39F SBC HL,DE HL-=DE (with carry).
E3A1 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 E3A3 POP BC Restore BC from the stack.
Continue on to LoseLife.
Prev: E349 Up: Map Next: E3A4