Prev: 40693 Up: Map Next: 40748
40702: Fade Out Playfield
Used by the routine at FadeOutAndClearPlayfield.
Dissolves the playfield, which is 28 bytes wide and 160 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 40702 CALL GetScreenAddress Find the screen address.
40705 LD DE,40772 Use the patterns.
40708 LD (52794),HL Store the screen address.
40711 LD A,16 Set the number of passes to sixteen.
FadeOutPlayfield_Pass 40713 EX AF,AF' Save the number of passes.
40714 LD HL,(52794) Fetch the screen address of the top left.
40717 LD C,160 Set the number of rows to 160.
FadeOutPlayfield_Row 40719 LD B,28 Set the number of bytes in a row to 28.
40721 PUSH HL Save the address of the start of the row.
FadeOutPlayfield_Byte 40722 LD A,(DE) Fetch a pattern.
40723 AND (HL) Clear some of the pixels of the byte of the screen.
40724 LD (HL),A Store the byte.
40725 INC L Move on to the next byte.
40726 INC DE Move on to the next pattern.
40727 LD A,(DE) Fetch it.
40728 AND A Test it.
40729 JR NZ,FadeOutPlayfield_Next Jump to FadeOutPlayfield_Next unless it is the end of the patterns.
40731 LD DE,40772 Go back to the first pattern.
FadeOutPlayfield_Next 40734 DJNZ FadeOutPlayfield_Byte Loop back to FadeOutPlayfield_Byte for each byte of the row.
40736 POP HL Restore the address of the start of the row.
40737 CALL MoveUpARow Move up to the next row.
40740 DEC C Decrease the number of rows.
40741 JR NZ,FadeOutPlayfield_Row Loop back to FadeOutPlayfield_Row for each row.
40743 EX AF,AF' Restore the number of passes.
40744 DEC A Decrease it.
40745 JR NZ,FadeOutPlayfield_Pass Loop back to FadeOutPlayfield_Pass for each pass.
40747 RET Return.
Prev: 40693 Up: Map Next: 40748