Prev: CB4F Up: Map Next: CCCE
CC81: Draw Spawned Entity
Used by the routines at Process_Enemy_Entity and Spawn_Primary_Wave_Enemies.
Reads the sprite type and screen address from the entity record at HL, looks up the sprite pixel data in Sprite_Pixel_Data_Table, then XOR-blits eight pixel rows onto the screen. Falls through to Draw_Spawned_Entity_Attribute to write the entity's attribute colour from the colour cycle table. Called immediately after a new entity is written to the entity list.
Draw_Spawned_Entity CC81 LD A,(HL) Read the entity sprite type into A and the screen address into DE.
CC82 INC HL
CC83 LD E,(HL)
CC84 INC HL
CC85 LD D,(HL)
CC86 INC HL
CC87 LD B,H Stash the entity record pointer in BC and double the sprite type to form the lookup word offset.
CC88 LD C,L
CC89 PUSH BC
CC8A ADD A,A
CC8B LD C,A
CC8C LD B,$00 Index the sprite data table at Sprite_Pixel_Data_Table and restore the entity record pointer from the stack.
CC8E LD HL,$C60C
CC91 ADD HL,BC
CC92 POP BC
CC93 LD A,(HL) Load the sprite pixel data address into HL.
CC94 INC HL
CC95 LD H,(HL)
CC96 LD L,A
CC97 LD A,(DE) XOR-blit eight pixel rows of sprite data onto the screen.
CC98 XOR (HL)
CC99 LD (DE),A
CC9A INC HL
CC9B INC D
CC9C LD A,(DE)
CC9D XOR (HL)
CC9E LD (DE),A
CC9F INC HL
CCA0 INC D
CCA1 LD A,(DE)
CCA2 XOR (HL)
CCA3 LD (DE),A
CCA4 INC HL
CCA5 INC D
CCA6 LD A,(DE)
CCA7 XOR (HL)
CCA8 LD (DE),A
CCA9 INC HL
CCAA INC D
CCAB LD A,(DE)
CCAC XOR (HL)
CCAD LD (DE),A
CCAE INC HL
CCAF INC D
CCB0 LD A,(DE)
CCB1 XOR (HL)
CCB2 LD (DE),A
CCB3 INC HL
CCB4 INC D
CCB5 LD A,(DE)
CCB6 XOR (HL)
CCB7 LD (DE),A
CCB8 INC HL
CCB9 INC D
CCBA LD A,(DE)
CCBB XOR (HL)
CCBC LD (DE),A
This entry point is used by the routine at Primary_Enemy_Entity_Handler.
Write the entity's current colour from the colour cycle table to the attribute cell at the entity's screen position.
Draw_Spawned_Entity_Attribute CCBD LD A,(BC) Read the low byte of the attribute cell address from the entity record into L.
CCBE INC BC
CCBF LD L,A
CCC0 LD A,(BC)
CCC1 LD H,A Form the attribute cell address high byte in H.
CCC2 LD DE,($C4E5) Load the current colour byte from the colour cycle table at Colour_Cycle_Table_Pointer and write it to the attribute cell.
CCC6 DEC DE
CCC7 LD A,(DE)
CCC8 LD (HL),A
CCC9 LD H,B Write the colour, restore the entity record pointer, advance past two fields, and return.
CCCA LD L,C
CCCB INC HL
CCCC INC HL
CCCD RET Return.
Prev: CB4F Up: Map Next: CCCE