![]() |
Routines |
| Prev: A1EA | Up: Map | Next: A21C |
|
Used by the routines at new_sprite_header and old_sprite_header.
Sprites are drawn upwards from their bottom row, inside the lines $18-$B7 (24 to 183): below the panel at the top and above the bottom row of the screen. A sprite reaching above line $18 has its height cut so that its top row is $18; one reaching below line $B7 has its bottom rows skipped (the graphic is stored bottom row first, so DE moves on by width times the rows cut) and its y put at $B7. A sprite wholly outside is not caught here; place_on_screen decides what is visible.
|
||||||||||||||||||||
| clip_sprite_rows | A1FB | LD L,A | Does the top row reach above line $18? | |||||||||||||||||
| A1FC | SUB $17 | |||||||||||||||||||
| A1FE | SUB B | |||||||||||||||||||
| A1FF | JR NC,clip_sprite_rows_0 | |||||||||||||||||||
| A201 | LD A,L | Yes: draw only the rows from y up to line $18 | ||||||||||||||||||
| A202 | SUB $17 | |||||||||||||||||||
| A204 | LD B,A | |||||||||||||||||||
| A205 | RET | |||||||||||||||||||
| clip_sprite_rows_0 | A206 | LD A,L | Does the bottom row lie below line $B7? Return if not | |||||||||||||||||
| A207 | SUB $B7 | |||||||||||||||||||
| A209 | RET Z | |||||||||||||||||||
| A20A | RET C | |||||||||||||||||||
| A20B | LD L,A | Rows below: take them off the height | ||||||||||||||||||
| A20C | LD A,B | |||||||||||||||||||
| A20D | SUB L | |||||||||||||||||||
| A20E | LD B,A | |||||||||||||||||||
| A20F | XOR A | Skip them in the graphic: width times the rows cut | ||||||||||||||||||
| clip_sprite_rows_1 | A210 | ADD A,H | ||||||||||||||||||
| A211 | DEC L | |||||||||||||||||||
| A212 | JR NZ,clip_sprite_rows_1 | |||||||||||||||||||
| A214 | EX DE,HL | |||||||||||||||||||
| A215 | CALL add_a_to_hl | |||||||||||||||||||
| A218 | EX DE,HL | |||||||||||||||||||
| A219 | LD L,$B7 | And draw from line $B7 | ||||||||||||||||||
| A21B | RET | |||||||||||||||||||
| Prev: A1EA | Up: Map | Next: A21C |