Prev: 9EF5 Up: Map Next: 9F2C
9EFE: Fade Out Playfield
Used by the routine at FadeOutAndClearPlayfield.
Dissolves the playfield, which is 1C bytes wide and A0 rows high, by sixteen passes that each clear some pixels using the patterns at DissolvePatterns.
Input
HL Position of the bottom left of the playfield
FadeOutPlayfield 9EFE CALL GetScreenAddress Find the screen address.
9F01 LD DE,$9F44 Use the patterns.
9F04 LD ($CE3A),HL Store the screen address.
9F07 LD A,$10 Set the number of passes to sixteen.
FadeOutPlayfield_Pass 9F09 EX AF,AF' Save the number of passes.
9F0A LD HL,($CE3A) Fetch the screen address of the top left.
9F0D LD C,$A0 Set the number of rows to A0.
FadeOutPlayfield_Row 9F0F LD B,$1C Set the number of bytes in a row to 1C.
9F11 PUSH HL Save the address of the start of the row.
FadeOutPlayfield_Byte 9F12 LD A,(DE) Fetch a pattern.
9F13 AND (HL) Clear some of the pixels of the byte of the screen.
9F14 LD (HL),A Store the byte.
9F15 INC L Move on to the next byte.
9F16 INC DE Move on to the next pattern.
9F17 LD A,(DE) Fetch it.
9F18 AND A Test it.
9F19 JR NZ,FadeOutPlayfield_Next Jump to FadeOutPlayfield_Next unless it is the end of the patterns.
9F1B LD DE,$9F44 Go back to the first pattern.
FadeOutPlayfield_Next 9F1E DJNZ FadeOutPlayfield_Byte Loop back to FadeOutPlayfield_Byte for each byte of the row.
9F20 POP HL Restore the address of the start of the row.
9F21 CALL MoveUpARow Move up to the next row.
9F24 DEC C Decrease the number of rows.
9F25 JR NZ,FadeOutPlayfield_Row Loop back to FadeOutPlayfield_Row for each row.
9F27 EX AF,AF' Restore the number of passes.
9F28 DEC A Decrease it.
9F29 JR NZ,FadeOutPlayfield_Pass Loop back to FadeOutPlayfield_Pass for each pass.
9F2B RET Return.
Prev: 9EF5 Up: Map Next: 9F2C