Prev: 26707 Up: Map Next: 26768
26710: Handler: Eggsplosion
Used by the routine at Handler_EggsplosionLeft.
Common handler for both left and right shell parts.
Input
DE Attribute buffer destination
HL Pointer to eggsplosion graphic data
Handler_Eggsplosion 26710 LD IX,512 Set IX to target BLACK attributes with a RED replacement attribute.
This entry point is used by the routine at Handler_Mask.
Handler_Eggsplosion_Draw 26714 PUSH DE Stash the attribute buffer pointer on the stack.
26715 EX DE,HL Switch the registers, DE and HL, containing the attribute buffer pointer and attribute buffer destination.
26716 LD B,2 Set a counter in B for 2 rows.
Handler_Eggsplosion_RowLoop 26718 PUSH BC Stash the row counter and attribute buffer pointer on the stack.
26719 PUSH HL
26720 LD B,2 Set a counter in B for 2 columns.
Handler_Eggsplosion_ColumnLoop 26722 PUSH BC Stash the column counter on the stack.
26723 LD A,(HL) Check if the attribute at this attribute buffer position matches the target colour (the low byte of IX).
26724 CP IXl
26726 PUSH HL Stash the attribute buffer pointer on the stack.
26727 JR NZ,Handler_Eggsplosion_SkipDraw Jump to Handler_Eggsplosion_SkipDraw if the attribute byte doesn't match the target attribute.
26729 LD A,IXh Load the replacement attribute byte (the high byte of IX).
26731 LD (HL),A Write the replacement attribute byte to this position.
26732 CALL ConvertAttributeToScreenBufferAddress Call ConvertAttributeToScreenBufferAddress.
26735 LD B,8 Set a line counter in B (8 lines in a UDG).
Handler_Eggsplosion_LineLoop 26737 LD A,(DE) Copy the UDG data to the screen buffer.
26738 LD (HL),A
26739 INC H Move down one pixel line in the screen buffer.
26740 INC DE Move to the next UDG graphic data byte.
26741 DJNZ Handler_Eggsplosion_LineLoop Decrease the line counter by one and loop back to Handler_Eggsplosion_LineLoop until all 8 lines of the UDG character have been drawn.
26743 JR Handler_Eggsplosion_NextColumn Jump to Handler_Eggsplosion_NextColumn.
Handler_Eggsplosion_SkipDraw 26745 LD HL,8 Add 0008 bytes to skip past this graphics data.
26748 AND A
26749 ADC HL,DE
26751 EX DE,HL
Handler_Eggsplosion_NextColumn 26752 POP HL Restore the attribute buffer pointer from the stack.
26753 INC HL Move right one attribute block.
26754 POP BC Restore the column counter from the stack.
26755 DJNZ Handler_Eggsplosion_ColumnLoop Decrease the column counter by one and loop back to Handler_Eggsplosion_ColumnLoop until both columns have been processed.
26757 POP HL Restore the attribute buffer pointer from the stack.
26758 LD C,32 Move down one row in the attribute buffer (add 0032).
26760 AND A
26761 ADC HL,BC
26763 POP BC Restore the row counter from the stack.
26764 DJNZ Handler_Eggsplosion_RowLoop Decrease the row counter by one and loop back to Handler_Eggsplosion_RowLoop until both rows have been processed.
26766 POP DE Restore the original attribute buffer pointer from the stack.
26767 RET Return.
Prev: 26707 Up: Map Next: 26768