Prev: C27F Up: Map Next: C33C
C331: Clip a sprite's height at the top of the play area
Used by the routines at ship_contact, colour_carried_parts and draw_carried_piece.
Images are drawn upwards from their bottom row, so one whose bottom row is near the top of the play area would run up into the panel. The play area starts at row $17: the height is cut to the rows between there and y.
Input
A The height in rows
H The y of the image's bottom row
Output
B The height to draw
clip_height_to_top C331 LD B,A Rows available (y less $17) at least the height: draw it all.
C332 LD A,H
C333 SUB $17
C335 SUB B
C336 RET NC
C337 LD A,H Otherwise only the rows available.
C338 SUB $17
C33A LD B,A
C33B RET
Prev: C27F Up: Map Next: C33C