Prev: 6853 Up: Map Next: 6890
6856: 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 6856 LD IX,$0200 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 685A PUSH DE Stash the attribute buffer pointer on the stack.
685B EX DE,HL Switch the registers, DE and HL, containing the attribute buffer pointer and attribute buffer destination.
685C LD B,$02 Set a counter in B for 02 rows.
Handler_Eggsplosion_RowLoop 685E PUSH BC Stash the row counter and attribute buffer pointer on the stack.
685F PUSH HL
6860 LD B,$02 Set a counter in B for 02 columns.
Handler_Eggsplosion_ColumnLoop 6862 PUSH BC Stash the column counter on the stack.
6863 LD A,(HL) Check if the attribute at this attribute buffer position matches the target colour (the low byte of IX).
6864 CP IXl
6866 PUSH HL Stash the attribute buffer pointer on the stack.
6867 JR NZ,Handler_Eggsplosion_SkipDraw Jump to Handler_Eggsplosion_SkipDraw if the attribute byte doesn't match the target attribute.
6869 LD A,IXh Load the replacement attribute byte (the high byte of IX).
686B LD (HL),A Write the replacement attribute byte to this position.
686C CALL ConvertAttributeToScreenBufferAddress Call ConvertAttributeToScreenBufferAddress.
686F LD B,$08 Set a line counter in B (08 lines in a UDG).
Handler_Eggsplosion_LineLoop 6871 LD A,(DE) Copy the UDG data to the screen buffer.
6872 LD (HL),A
6873 INC H Move down one pixel line in the screen buffer.
6874 INC DE Move to the next UDG graphic data byte.
6875 DJNZ Handler_Eggsplosion_LineLoop Decrease the line counter by one and loop back to Handler_Eggsplosion_LineLoop until all 08 lines of the UDG character have been drawn.
6877 JR Handler_Eggsplosion_NextColumn Jump to Handler_Eggsplosion_NextColumn.
Handler_Eggsplosion_SkipDraw 6879 LD HL,$0008 Add 0008 bytes to skip past this graphics data.
687C AND A
687D ADC HL,DE
687F EX DE,HL
Handler_Eggsplosion_NextColumn 6880 POP HL Restore the attribute buffer pointer from the stack.
6881 INC HL Move right one attribute block.
6882 POP BC Restore the column counter from the stack.
6883 DJNZ Handler_Eggsplosion_ColumnLoop Decrease the column counter by one and loop back to Handler_Eggsplosion_ColumnLoop until both columns have been processed.
6885 POP HL Restore the attribute buffer pointer from the stack.
6886 LD C,$20 Move down one row in the attribute buffer (add 0020).
6888 AND A
6889 ADC HL,BC
688B POP BC Restore the row counter from the stack.
688C DJNZ Handler_Eggsplosion_RowLoop Decrease the row counter by one and loop back to Handler_Eggsplosion_RowLoop until both rows have been processed.
688E POP DE Restore the original attribute buffer pointer from the stack.
688F RET Return.
Prev: 6853 Up: Map Next: 6890