Prev: 52047 Up: Map Next: 52430
52353: 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 52353 LD A,(HL) Read the entity sprite type into A and the screen address into DE.
52354 INC HL
52355 LD E,(HL)
52356 INC HL
52357 LD D,(HL)
52358 INC HL
52359 LD B,H Stash the entity record pointer in BC and double the sprite type to form the lookup word offset.
52360 LD C,L
52361 PUSH BC
52362 ADD A,A
52363 LD C,A
52364 LD B,0 Index the sprite data table at Sprite_Pixel_Data_Table and restore the entity record pointer from the stack.
52366 LD HL,50700
52369 ADD HL,BC
52370 POP BC
52371 LD A,(HL) Load the sprite pixel data address into HL.
52372 INC HL
52373 LD H,(HL)
52374 LD L,A
52375 LD A,(DE) XOR-blit eight pixel rows of sprite data onto the screen.
52376 XOR (HL)
52377 LD (DE),A
52378 INC HL
52379 INC D
52380 LD A,(DE)
52381 XOR (HL)
52382 LD (DE),A
52383 INC HL
52384 INC D
52385 LD A,(DE)
52386 XOR (HL)
52387 LD (DE),A
52388 INC HL
52389 INC D
52390 LD A,(DE)
52391 XOR (HL)
52392 LD (DE),A
52393 INC HL
52394 INC D
52395 LD A,(DE)
52396 XOR (HL)
52397 LD (DE),A
52398 INC HL
52399 INC D
52400 LD A,(DE)
52401 XOR (HL)
52402 LD (DE),A
52403 INC HL
52404 INC D
52405 LD A,(DE)
52406 XOR (HL)
52407 LD (DE),A
52408 INC HL
52409 INC D
52410 LD A,(DE)
52411 XOR (HL)
52412 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 52413 LD A,(BC) Read the low byte of the attribute cell address from the entity record into L.
52414 INC BC
52415 LD L,A
52416 LD A,(BC)
52417 LD H,A Form the attribute cell address high byte in H.
52418 LD DE,(50405) Load the current colour byte from the colour cycle table at Colour_Cycle_Table_Pointer and write it to the attribute cell.
52422 DEC DE
52423 LD A,(DE)
52424 LD (HL),A
52425 LD H,B Write the colour, restore the entity record pointer, advance past two fields, and return.
52426 LD L,C
52427 INC HL
52428 INC HL
52429 RET Return.
Prev: 52047 Up: Map Next: 52430