Prev: D481 Up: Map Next: D4BB
D486: Draw Life Icon Cells
Used by the routine at DrawLivesDisplay.
Draws the life icon cell pixels into the display file. Given an icon index in A, looks up the icon cell data address from the descriptor table, then for each cell computes the screen pixel address and OR-blits the icon pixels into the display file. Used by DrawLivesDisplay to repaint the lives display.
Input
A Icon index; selects the cell data from the icon descriptor table
Draw_Life_Icon_Cells D486 ADD A,A Double the icon index to form a 16-bit table offset.
D487 LD E,A
D488 LD D,$00
D48A LD HL,$C60C Index into the icon descriptor table.
D48D ADD HL,DE
D48E LD E,(HL) Load the icon cell data address.
D48F INC HL
D490 LD D,(HL)
D491 EX DE,HL
D492 LD E,C Set DE to the source data and load the cell count into B.
D493 LD D,B
D494 LD B,(HL)
Draw_Life_Icon_Cells_Loop D495 PUSH BC Stash the loop state on the stack.
D496 INC HL Compute the pixel row for this icon cell.
D497 LD A,D
D498 ADD A,(HL)
D499 INC HL
D49A LD C,A
D49B LD A,E Compute the pixel column and stash the data pointer on the stack.
D49C ADD A,(HL)
D49D PUSH HL
D49E LD L,A Compute the row lookup address in BC.
D49F LD B,$C5
D4A1 SLA C
D4A3 RL B
D4A5 LD H,$C6 Compute the column lookup address in HL.
D4A7 SLA L
D4A9 RL H
D4AB LD A,(HL) Resolve the screen pixel address for this cell.
D4AC INC HL
D4AD LD H,(HL)
D4AE LD L,A
D4AF LD A,(BC) Combine the pixel row mask with the screen address.
D4B0 OR L
D4B1 LD L,A
D4B2 INC BC
D4B3 LD A,(BC) OR the icon pixel data into the display file.
D4B4 OR (HL)
D4B5 LD (HL),A
D4B6 POP HL Restore the data pointer and loop state, and repeat for the next cell.
D4B7 POP BC
D4B8 DJNZ Draw_Life_Icon_Cells_Loop
D4BA RET Return.
Prev: D481 Up: Map Next: D4BB