Prev: D486 Up: Map Next: D4F1
D4BB: Erase Life Icon Cells
Used by the routine at DrawLivesDisplay.
Clears the display file cells that make up one life icon. Mirrors the structure of Draw_Life_Icon_Cells but uses CPL and AND to erase each pixel cell rather than OR-blitting it. Given an icon index in A, the routine looks up the cell data address, then for each cell computes the screen pixel address and removes the icon pixels.
Input
A Icon index; selects the cell data from the icon descriptor table
Erase_Life_Icon_Cells D4BB ADD A,A Double the icon index to form a 16-bit table offset.
D4BC LD E,A
D4BD LD D,$00
D4BF LD HL,$C60C Index into the icon descriptor table.
D4C2 ADD HL,DE
D4C3 LD E,(HL) Load the icon cell data address.
D4C4 INC HL
D4C5 LD D,(HL)
D4C6 EX DE,HL
D4C7 LD E,C Set DE to the source data and load the cell count into B.
D4C8 LD D,B
D4C9 LD B,(HL)
Erase_Life_Icon_Cells_Loop D4CA PUSH BC Stash the loop state on the stack.
D4CB INC HL Compute the pixel row for this icon cell.
D4CC LD A,D
D4CD ADD A,(HL)
D4CE INC HL
D4CF LD C,A
D4D0 LD A,E Compute the pixel column and stash the data pointer on the stack.
D4D1 ADD A,(HL)
D4D2 PUSH HL
D4D3 LD L,A Compute the row lookup address in BC.
D4D4 LD B,$C5
D4D6 SLA C
D4D8 RL B
D4DA LD H,$C6 Compute the column lookup address in HL.
D4DC SLA L
D4DE RL H
D4E0 LD A,(HL) Resolve the screen pixel address for this cell.
D4E1 INC HL
D4E2 LD H,(HL)
D4E3 LD L,A
D4E4 LD A,(BC) Combine the pixel row mask with the screen address.
D4E5 OR L
D4E6 LD L,A
D4E7 INC BC
D4E8 LD A,(BC) Erase the icon pixel data from the display file.
D4E9 CPL
D4EA AND (HL)
D4EB LD (HL),A
D4EC POP HL Restore the data pointer and loop state, and repeat for the next cell.
D4ED POP BC
D4EE DJNZ Erase_Life_Icon_Cells_Loop
D4F0 RET Return.
Prev: D486 Up: Map Next: D4F1