Prev: 29860 Up: Map Next: 30098
30052: Clear Sprite Area
Clears a sprite area from the screen, skipping positions occupied by the player ship (INK:YELLOW, PAPER:BLACK (BRIGHT)) or (WHITE).
Input
DE Screen buffer address
ClearSpriteArea 30052 CALL ConvertScreenToAttributeBufferAddress Call ConvertScreenToAttributeBufferAddress.
30055 EX DE,HL Exchange the DE and HL registers.
30056 LD E,1 Set the row counter to 1.
30058 LD B,3 Set a column counter in B for 3 columns.
ClearSpriteArea_ColumnLoop 30060 PUSH BC Stash the column counter on the stack.
30061 LD A,(HL) Jump to ClearSpriteArea_NextColumn if *HL is equal to INK:YELLOW, PAPER:BLACK (BRIGHT) or WHITE.
30062 CP 70
30064 JR Z,ClearSpriteArea_NextColumn
30066 CP 7
30068 JR Z,ClearSpriteArea_NextColumn
30070 LD (HL),0 Write 0 to *HL.
30072 PUSH HL Stash HL on the stack.
30073 CALL ConvertAttributeToScreenBufferAddress Call ConvertAttributeToScreenBufferAddress.
30076 LD B,8 Set a line counter in B (8 lines in a UDG).
30078 XOR A A=0.
ClearSpriteArea_LineLoop 30079 LD (HL),A Write A to *HL.
30080 INC H Increment H by one.
30081 DJNZ ClearSpriteArea_LineLoop Decrease the line counter by one and loop back to ClearSpriteArea_LineLoop until all 8 lines of the UDG character have been cleared.
30083 POP HL Restore HL from the stack.
ClearSpriteArea_NextColumn 30084 INC HL Increment HL by one.
30085 POP BC Restore BC from the stack.
30086 DJNZ ClearSpriteArea_ColumnLoop Decrease counter by one and loop back to ClearSpriteArea_ColumnLoop until counter is zero.
30088 LD A,E Return if E is zero.
30089 OR A
30090 RET Z
30091 LD C,30 C=30.
30093 ADD HL,BC HL+=BC.
30094 DEC E Decrease E by one.
30095 INC B Increment B by one.
30096 JR ClearSpriteArea_ColumnLoop Jump to ClearSpriteArea_ColumnLoop.
Prev: 29860 Up: Map Next: 30098