Prev: 30125 Up: Map Next: 30230
30135: 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 2 UDGs - so in order to use the same routine the sprites "share" empty UDGs, so although something is written, it's just all 0.
Lastly, to conserve on space - some UDGs are less than 8 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 1 (the egg stage).
Handler_Pheenix_01 30135 LD HL,24807 HL=Graphics_Pheenix_01.
30138 JR Handler_Pheenix_SingleRow Jump to Handler_Pheenix_SingleRow.
This entry point is used by the routine at Handler_AliensMovement_Spawning.
Display frame 2 (the egg breaking apart).
Handler_Pheenix_02 30140 LD HL,24831 HL=Graphics_Pheenix_02.
Handler for single row sprites (as the second row is invisible).
Handler_Pheenix_SingleRow 30143 LD BC,1285 Set BC to CYAN / CYAN (centre and righthand blocks of the top and only row).
30146 XOR A Write BLACK to the low byte of IX (the lefthand block of the top row - which is an empty block).
30147 LD IXl,A
30149 JR Handler_Pheenix_Draw Jump to Handler_Pheenix_Draw.
This entry point is used by the routine at Handler_AliensMovement_Spawning.
Display frame 3 (the broken egg with a baby Pheenix).
Handler_Pheenix_03 30151 LD HL,24863 HL=Graphics_Pheenix_03.
30154 LD B,5 Set B to CYAN (righthand block of top row/ shell colour).
30156 LD A,(26237) C=*Pheenix_Colour_01 (the centre colour of the top row/ Pheenix body).
30159 LD C,A
30160 JR Handler_Pheenix_SetColour Jump to Handler_Pheenix_SetColour.
This entry point is used by the routine at Handler_AliensMovement_Spawning.
Display frame 5 (Pheenix wings "up").
Handler_Pheenix_05 30162 LD HL,24965 HL=Graphics_Pheenix_05.
30165 JR Handler_Pheenix_LoadColours Jump to Handler_Pheenix_LoadColours.
This entry point is used by the routine at Handler_AliensMovement_Spawning.
Display frame 4 (Pheenix wings "down").
Handler_Pheenix_04 30167 LD HL,24923 HL=Graphics_Pheenix_04.
This entry point is used by the routine at Handler_BirdAlien_01.
Handler_Pheenix_LoadColours 30170 LD BC,(26237) 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 30174 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 30176 PUSH DE Stash the screen buffer destination, colour pair and screen buffer destination (again) on the stack.
30177 PUSH BC
30178 PUSH DE
All Pheenix sprites are 3 columns in the top row.
30179 LD B,3 Set a counter in B for 3 columns.
Handler_Pheenix_ColumnLoop 30181 PUSH BC Stash the column counter and screen buffer pointer on the stack.
30182 PUSH DE
Draw the UDG to the screen buffer.
30183 LD B,8 Set a line counter in B (8 lines in a UDG).
Handler_Pheenix_LineLoop 30185 LD A,(HL) Copy the UDG data to the screen buffer.
30186 LD (DE),A
30187 INC HL Move to the next UDG graphic data byte.
30188 INC D Move down one pixel line in the screen buffer.
30189 DJNZ Handler_Pheenix_LineLoop Decrease the line counter by one and loop back to Handler_Pheenix_LineLoop until all 8 lines of the UDG character have been drawn.
30191 POP DE Restore the original screen buffer location from the stack.
30192 INC DE Move right one character block.
30193 POP BC Restore the column counter from the stack.
30194 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.
30196 POP DE Restore the screen buffer destination and colour pair from the stack.
30197 POP BC
30198 PUSH HL Stash the UDG data pointer on the stack.
30199 CALL ConvertScreenToAttributeBufferAddress Call ConvertScreenToAttributeBufferAddress.
30202 EX DE,HL Exchange the DE and HL registers.
Colour the top row of the Pheenix sprite.
30203 LD A,IXl Write the colour held by the low byte of IX to the attribute buffer pointer.
30205 LD (HL),A
30206 INC HL Move right one attribute block.
30207 LD (HL),C Write the colour held by C to the attribute buffer pointer.
30208 INC HL Move right one attribute block.
30209 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).
30210 LD BC,31 Move the attribute buffer pointer to the row below the current row and left one attribute block (by adding 0031).
30213 ADD HL,BC
30214 LD (HL),6 Write YELLOW to the attribute buffer pointer.
30216 CALL ConvertAttributeToScreenBufferAddress Call ConvertAttributeToScreenBufferAddress.
Now draw the bottom row (feet, or empty block).
30219 POP DE Restore the UDG pointer from the stack.
Draw the UDG to the screen buffer.
30220 LD B,8 Set a line counter in B (8 lines in a UDG).
Handler_Pheenix_BottomRowLoop 30222 LD A,(DE) Copy the UDG data to the screen buffer.
30223 LD (HL),A
30224 INC H Move down one pixel line in the screen buffer.
30225 INC DE Move to the next UDG graphic data byte.
30226 DJNZ Handler_Pheenix_BottomRowLoop Decrease the line counter by one and loop back to Handler_Pheenix_BottomRowLoop until all 8 lines of the UDG character have been drawn.
30228 POP DE Restore the original screen buffer location from the stack.
30229 RET Return.
Prev: 30125 Up: Map Next: 30230