Prev: 75AD Up: Map Next: 7616
75B7: Handler: Pheenix
Used by the routine at Handler_AliensMovement_Spawning.
This is a fairly dogmatic sprite drawing routine, and hopefully this will explain why there are empty blocks seemingly randomly in the Pheenix sprite data.
This routine always assumes the Pheenix sprite data looks like this:
X X X
X
However the sprites aren't always in that format, sometimes they have a single row of 02 UDGs - so in order to use the same routine the sprites "share" empty UDGs, so although something is written, it's just all 00.
Lastly, to conserve on space - some UDGs are less than 08 line bytes, they just share the bytes from the following sprite data. So some sprites end with empty bytes, and some start with empty bytes (which are shared between each).
Input
DE Screen buffer sprite destination
Display frame 01 (the egg stage).
Handler_Pheenix_01 75B7 LD HL,$60E7 HL=Graphics_Pheenix_01.
75BA JR Handler_Pheenix_SingleRow Jump to Handler_Pheenix_SingleRow.
This entry point is used by the routine at Handler_AliensMovement_Spawning.
Display frame 02 (the egg breaking apart).
Handler_Pheenix_02 75BC LD HL,$60FF HL=Graphics_Pheenix_02.
Handler for single row sprites (as the second row is invisible).
Handler_Pheenix_SingleRow 75BF LD BC,$0505 Set BC to CYAN / CYAN (centre and righthand blocks of the top and only row).
75C2 XOR A Write BLACK to the low byte of IX (the lefthand block of the top row - which is an empty block).
75C3 LD IXl,A
75C5 JR Handler_Pheenix_Draw Jump to Handler_Pheenix_Draw.
This entry point is used by the routine at Handler_AliensMovement_Spawning.
Display frame 03 (the broken egg with a baby Pheenix).
Handler_Pheenix_03 75C7 LD HL,$611F HL=Graphics_Pheenix_03.
75CA LD B,$05 Set B to CYAN (righthand block of top row/ shell colour).
75CC LD A,($667D) C=*Pheenix_Colour_01 (the centre colour of the top row/ Pheenix body).
75CF LD C,A
75D0 JR Handler_Pheenix_SetColour Jump to Handler_Pheenix_SetColour.
This entry point is used by the routine at Handler_AliensMovement_Spawning.
Display frame 05 (Pheenix wings "up").
Handler_Pheenix_05 75D2 LD HL,$6185 HL=Graphics_Pheenix_05.
75D5 JR Handler_Pheenix_LoadColours Jump to Handler_Pheenix_LoadColours.
This entry point is used by the routine at Handler_AliensMovement_Spawning.
Display frame 04 (Pheenix wings "down").
Handler_Pheenix_04 75D7 LD HL,$615B HL=Graphics_Pheenix_04.
This entry point is used by the routine at Handler_BirdAlien_01.
Handler_Pheenix_LoadColours 75DA LD BC,($667D) Set B to *Pheenix_Colour_01 (righthand block of top row) and set C to *Pheenix_Colour_02 (middle block of top row).
Handler_Pheenix_SetColour 75DE LD IXl,B Write B to the low byte of IX which is used for colouring the lefthand block of the top row.
Handler_Pheenix_Draw 75E0 PUSH DE Stash the screen buffer destination, colour pair and screen buffer destination (again) on the stack.
75E1 PUSH BC
75E2 PUSH DE
All Pheenix sprites are 03 columns in the top row.
75E3 LD B,$03 Set a counter in B for 03 columns.
Handler_Pheenix_ColumnLoop 75E5 PUSH BC Stash the column counter and screen buffer pointer on the stack.
75E6 PUSH DE
Draw the UDG to the screen buffer.
75E7 LD B,$08 Set a line counter in B (08 lines in a UDG).
Handler_Pheenix_LineLoop 75E9 LD A,(HL) Copy the UDG data to the screen buffer.
75EA LD (DE),A
75EB INC HL Move to the next UDG graphic data byte.
75EC INC D Move down one pixel line in the screen buffer.
75ED DJNZ Handler_Pheenix_LineLoop Decrease the line counter by one and loop back to Handler_Pheenix_LineLoop until all 08 lines of the UDG character have been drawn.
75EF POP DE Restore the original screen buffer location from the stack.
75F0 INC DE Move right one character block.
75F1 POP BC Restore the column counter from the stack.
75F2 DJNZ Handler_Pheenix_ColumnLoop Decrease the column counter by one and loop back to Handler_Pheenix_ColumnLoop until all three columns of this row have been drawn.
75F4 POP DE Restore the screen buffer destination and colour pair from the stack.
75F5 POP BC
75F6 PUSH HL Stash the UDG data pointer on the stack.
75F7 CALL ConvertScreenToAttributeBufferAddress Call ConvertScreenToAttributeBufferAddress.
75FA EX DE,HL Exchange the DE and HL registers.
Colour the top row of the Pheenix sprite.
75FB LD A,IXl Write the colour held by the low byte of IX to the attribute buffer pointer.
75FD LD (HL),A
75FE INC HL Move right one attribute block.
75FF LD (HL),C Write the colour held by C to the attribute buffer pointer.
7600 INC HL Move right one attribute block.
7601 LD (HL),B Write the colour held by B to the attribute buffer pointer.
Colour the bottom row of the Pheenix sprite (feet, or an empty block).
7602 LD BC,$001F Move the attribute buffer pointer to the row below the current row and left one attribute block (by adding 001F).
7605 ADD HL,BC
7606 LD (HL),$06 Write YELLOW to the attribute buffer pointer.
7608 CALL ConvertAttributeToScreenBufferAddress Call ConvertAttributeToScreenBufferAddress.
Now draw the bottom row (feet, or empty block).
760B POP DE Restore the UDG pointer from the stack.
Draw the UDG to the screen buffer.
760C LD B,$08 Set a line counter in B (08 lines in a UDG).
Handler_Pheenix_BottomRowLoop 760E LD A,(DE) Copy the UDG data to the screen buffer.
760F LD (HL),A
7610 INC H Move down one pixel line in the screen buffer.
7611 INC DE Move to the next UDG graphic data byte.
7612 DJNZ Handler_Pheenix_BottomRowLoop Decrease the line counter by one and loop back to Handler_Pheenix_BottomRowLoop until all 08 lines of the UDG character have been drawn.
7614 POP DE Restore the original screen buffer location from the stack.
7615 RET Return.
Prev: 75AD Up: Map Next: 7616