![]() |
Routines |
| Prev: 28483 | Up: Map | Next: 28637 |
|
Used by the routines at DrawShip, Handler_ShipMovement, Handler_MoveShip_Left and Handler_MoveShip_Right.
Updates the two attribute rows that surround the player's ship. If the shield is active and bit 2 of the shield timer is set, white (INK:WHITE,
PAPER:BLACK) is used to create a flashing visual effect; otherwise the default colour (INK:YELLOW,
PAPER:BLACK (BRIGHT)) is written.
|
||||
|
Bail out if a collision/ explosion is active, otherwise fetch the player attribute position and check the shield flags.
|
||||
| Handler_UpdateShipPosition | 28563 | LD A,(26276) | Jump to Handler_PlayerBullets if *Flag_Collision is not zero. | |
| 28566 | OR A | |||
| 28567 | JP NZ,Handler_PlayerBullets | |||
| 28570 | LD HL,(26349) | Load the player attribute address from PlayerAttributeBufferPosition into HL. | ||
| 28573 | LD A,(26259) | Jump to UpdateShip_SetDefaultColour if the shield flag *Flag_Shield is zero. | ||
| 28576 | OR A | |||
| 28577 | JR Z,UpdateShip_SetDefaultColour | |||
| 28579 | LD A,(26260) | Jump to UpdateShip_SetDefaultColour if bit 2 of the shield timer *ShieldTimer is clear. | ||
| 28582 | BIT 2,A | |||
| 28584 | JR Z,UpdateShip_SetDefaultColour | |||
|
Choose the attribute byte to write: white (INK:WHITE,
PAPER:BLACK) when shield is active with timer bit 2 set, or default (INK:YELLOW,
PAPER:BLACK (BRIGHT)).
|
||||
| 28586 | LD A,7 | Load INK:WHITE, PAPER:BLACK into A (white for shield effect). | ||
| 28588 | JR UpdateShip_SetupRows | Jump to UpdateShip_SetupRows. | ||
|
The shield is not active - use the standard ship colour.
|
||||
| UpdateShip_SetDefaultColour | 28590 | LD A,70 | Load INK:YELLOW, PAPER:BLACK (BRIGHT) into A. | |
|
Prepare to write two rows of attributes (above and below the ship).
|
||||
| UpdateShip_SetupRows | 28592 | LD B,2 | Set a row counter in B for 2 rows. | |
| UpdateShip_RowLoop | 28594 | PUSH BC | Stash the row counter and attribute pointer on the stack. | |
| 28595 | PUSH HL | |||
| 28596 | DEC L | Move left one attribute cell (point to column before ship). | ||
| 28597 | PUSH AF | Stash the attribute byte on the stack. | ||
| 28598 | CP 70 | Jump to UpdateShip_BlankLeft if the colour is INK:YELLOW, PAPER:BLACK (BRIGHT). | ||
| 28600 | JR Z,UpdateShip_BlankLeft | |||
| 28602 | CP 7 | Jump to UpdateShip_WriteRow if the colour is not WHITE (no need to blank). | ||
| 28604 | JR NZ,UpdateShip_WriteRow | |||
| UpdateShip_BlankLeft | 28606 | LD (HL),0 | Write 0 to the left neighbour attribute (clear highlight). | |
| UpdateShip_WriteRow | 28608 | POP AF | Restore the attribute byte from the stack. | |
| 28609 | INC L | Move right to the first ship column. | ||
| 28610 | LD B,3 | Set a width counter in B for 3 columns. | ||
| UpdateShip_WriteColumns | 28612 | LD (HL),A | Write the chosen colour to *HL. | |
| 28613 | INC HL | Move to the next column. | ||
| 28614 | DJNZ UpdateShip_WriteColumns | Decrease the width counter by one and loop back to UpdateShip_WriteColumns until all 3 columns are updated. | ||
|
Clean up the right-hand neighbour attribute if required.
|
||||
| 28616 | PUSH AF | Stash the attribute byte on the stack. | ||
| 28617 | LD A,(HL) | Jump to UpdateShip_BlankRight if the neighbour already holds INK:YELLOW, PAPER:BLACK (BRIGHT). | ||
| 28618 | CP 70 | |||
| 28620 | JR Z,UpdateShip_BlankRight | |||
| 28622 | CP 7 | Jump to UpdateShip_NextRow if the neighbour is not WHITE (nothing to clear). | ||
| 28624 | JR NZ,UpdateShip_NextRow | |||
| UpdateShip_BlankRight | 28626 | LD (HL),0 | Write 0 to the right neighbour attribute. | |
| UpdateShip_NextRow | 28628 | POP AF | Restore the attribute byte and attribute pointer from the stack. | |
| 28629 | POP HL | |||
| 28630 | SET 5,L | Move down one attribute row (set bit 5 of L). | ||
| 28632 | POP BC | Restore the row counter from the stack. | ||
| 28633 | DJNZ UpdateShip_RowLoop | Decrease the row counter by one and loop back to UpdateShip_RowLoop until both rows are processed. | ||
| 28635 | JR Handler_PlayerBullets | Jump to Handler_PlayerBullets. | ||
|
Continue on to Handler_PlayerBullets.
|
||||
| Prev: 28483 | Up: Map | Next: 28637 |