Prev: 54406 Up: Map Next: 54513
54459: 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 54459 ADD A,A Double the icon index to form a 16-bit table offset.
54460 LD E,A
54461 LD D,0
54463 LD HL,50700 Index into the icon descriptor table.
54466 ADD HL,DE
54467 LD E,(HL) Load the icon cell data address.
54468 INC HL
54469 LD D,(HL)
54470 EX DE,HL
54471 LD E,C Set DE to the source data and load the cell count into B.
54472 LD D,B
54473 LD B,(HL)
Erase_Life_Icon_Cells_Loop 54474 PUSH BC Stash the loop state on the stack.
54475 INC HL Compute the pixel row for this icon cell.
54476 LD A,D
54477 ADD A,(HL)
54478 INC HL
54479 LD C,A
54480 LD A,E Compute the pixel column and stash the data pointer on the stack.
54481 ADD A,(HL)
54482 PUSH HL
54483 LD L,A Compute the row lookup address in BC.
54484 LD B,197
54486 SLA C
54488 RL B
54490 LD H,198 Compute the column lookup address in HL.
54492 SLA L
54494 RL H
54496 LD A,(HL) Resolve the screen pixel address for this cell.
54497 INC HL
54498 LD H,(HL)
54499 LD L,A
54500 LD A,(BC) Combine the pixel row mask with the screen address.
54501 OR L
54502 LD L,A
54503 INC BC
54504 LD A,(BC) Erase the icon pixel data from the display file.
54505 CPL
54506 AND (HL)
54507 LD (HL),A
54508 POP HL Restore the data pointer and loop state, and repeat for the next cell.
54509 POP BC
54510 DJNZ Erase_Life_Icon_Cells_Loop
54512 RET Return.
Prev: 54406 Up: Map Next: 54513