![]() |
Routines |
| Prev: 26587 | Up: Map | Next: 26712 |
|
If the player's ship needs to move, erase and redraw it. The ypos adjustment typically comes from the keypress routine, and will be -1 to move a pixel left, or 1 to move a pixel right. This code is used in a more contrived manner to animate a new ship when an extra life is awarded.
Used by the routines at handle_inputs and new_player_ship.
|
||||||||
| redraw_player_ship | 26675 | LD A,(_YPOS_ADJUST) | Player ship position adjustment, -1, 0 or 1 | |||||
| 26678 | OR A | Ship doesn't need to move, just return | ||||||
| 26679 | RET Z | |||||||
| 26680 | JP P,redraw_player_ship_0 | 1 has an odd number of bits. -1, even. A=0 if moving right, A=1 if moving left. | ||||||
| 26683 | XOR A | |||||||
| redraw_player_ship_0 | 26684 | LD IX,_PLAYER_XPOS | IX points to player ship pos, X | |||||
| 26688 | CALL select_clear_player_ship_sprite | Select clear sprite data based on A, into HL | ||||||
| 26691 | LD A,1 | Mode clear | ||||||
| 26693 | CALL sprite_draw_or_clear | Clear sprite side pixels, leaves HL at draw sprite data | ||||||
| 26696 | XOR A | Mode set | ||||||
| 26697 | CALL sprite_draw_or_clear | Draw sprite side pixels | ||||||
| 26700 | LD A,(_YPOS_ADJUST) | Pick up adjustment again and add it to the current xpos value. Adding -1 or 1 makes it the correct position value. Then write it back out. | ||||||
| 26703 | LD B,A | |||||||
| 26704 | LD A,(_PLAYER_XPOS) | |||||||
| 26707 | ADD A,B | |||||||
| 26708 | LD (_PLAYER_XPOS),A | |||||||
| 26711 | RET | |||||||
| Prev: 26587 | Up: Map | Next: 26712 |