Prev: BF83 Up: Map Next: BFB8
BF85: Draw the ship's sprite mirrored when it faces left
Used by the routine at draw_ship_image.
The ship's sprite is drawn the right way round facing right. Facing left (ship_facing bit 7) the drawing starts at its right-hand byte -- x moved by the width less one, in bytes (sprite_width), times 8 -- and runs right to left through a blitter that turns each byte round with the table at bit_reverse_table (B = $F9): direct_erase_row_mirrored for a width of 6 bytes, or one of its later entries for 5, 4, or 3 or fewer. draw_carried_piece comes in at the second instruction with the facing of the thing it draws in A.
Input
IY the blitter for drawing the right way round
Output
B $F9, the reversal table's page
HL the screen position
IY the blitter
mirror_ship_sprite BF85 LD A,(ship_facing) the ship's facing
This entry point is used by the routine at draw_carried_piece.
mirror_ship_sprite_0 BF88 LD HL,(sprite_screen_pos) the position; facing right, as it is
BF8B BIT 7,A
BF8D RET Z
BF8E LD B,$F9 the reversal table; start at the right-hand byte
BF90 LD A,(sprite_width)
BF93 DEC A
BF94 ADD A,A
BF95 ADD A,A
BF96 ADD A,A
BF97 ADD A,L
BF98 LD (sprite_screen_pos),A
BF9B LD A,(sprite_width) the blitter by the width
BF9E LD IY,direct_erase_row_mirrored
BFA2 CP $06
BFA4 RET Z
BFA5 LD IY,mirrored_erase_five
BFA9 CP $05
BFAB RET Z
BFAC LD IY,mirrored_erase_four
BFB0 CP $04
BFB2 RET Z
BFB3 LD IY,mirrored_erase_three
BFB7 RET
Prev: BF83 Up: Map Next: BFB8