Prev: F45A Up: Map Next: F4EC
F488: Draw Colour Flash Rectangle
Used by the routine at Extra_Life_Flash.
Renders one frame of the extra life colour flash animation. The frame index in A controls the inset from the edges: 0B paints a narrow band near the centre of the attribute area; 00 fills the full screen border. Each call fills the top row, the left and right border cells of each middle row, and the bottom row with the flash colour.
Input
A Frame index (00-0B); lower values produce a wider rectangle
Draw_Colour_Flash_Rectangle F488 LD HL,$5800 Point to the start of the attribute area.
F48B LD C,A Copy the frame index to BC and DE.
F48C LD B,$00
F48E LD E,A
F48F LD D,$00
F491 SLA E Shift DE left by 05 to compute the attribute row offset.
F493 RL D
F495 SLA E
F497 RL D
F499 SLA E
F49B RL D
F49D SLA E
F49F RL D
F4A1 SLA E
F4A3 RL D
F4A5 ADD HL,DE Point to the starting attribute cell for this frame.
F4A6 ADD HL,BC
F4A7 PUSH HL Stash the starting attribute address on the stack.
F4A8 LD A,$20 Calculate the top row fill width and set the loop counter.
F4AA SUB C
F4AB SUB C
F4AC LD B,A
F4AD LD ($C506),A Save the row fill width.
F4B0 LD A,($C507) Load the flash colour.
Fill the top row of the rectangle.
Draw_Colour_Flash_Rectangle_Top F4B3 LD (HL),A Fill the top row with the flash colour.
F4B4 INC HL
F4B5 DJNZ Draw_Colour_Flash_Rectangle_Top
F4B7 POP HL Restore the row pointer and advance to the next attribute row.
F4B8 LD DE,$0020
F4BB ADD HL,DE
F4BC LD A,$16 Calculate the middle row count; jump to Draw_Colour_Flash_Rectangle_Bottom if none.
F4BE SUB C
F4BF SUB C
F4C0 JR Z,Draw_Colour_Flash_Rectangle_Bottom
F4C2 LD B,A Set the middle section row counter.
F4C3 LD A,($C506) Calculate the stride to the far border cell and save it.
F4C6 DEC A
F4C7 LD E,A
F4C8 LD D,$00
F4CA LD ($C504),DE
F4CE LD A,($C507) Load the flash colour.
For each middle row, paint the left and right border cells.
Draw_Colour_Flash_Rectangle_Middle F4D1 PUSH HL Paint the left and right border cells and advance to the next row.
F4D2 LD (HL),A
F4D3 LD DE,($C504)
F4D7 ADD HL,DE
F4D8 LD (HL),A
F4D9 POP HL
F4DA LD DE,$0020
F4DD ADD HL,DE
F4DE DJNZ Draw_Colour_Flash_Rectangle_Middle
Fill the bottom row of the rectangle.
Draw_Colour_Flash_Rectangle_Bottom F4E0 LD A,($C506) Set up to fill the bottom row with the flash colour.
F4E3 LD B,A
F4E4 LD A,($C507)
Draw_Colour_Flash_Rectangle_Bottom_Fill F4E7 LD (HL),A Fill the bottom row with the flash colour.
F4E8 INC HL
F4E9 DJNZ Draw_Colour_Flash_Rectangle_Bottom_Fill
F4EB RET Return.
Prev: F45A Up: Map Next: F4EC