![]() |
Routines |
| Prev: 41450 | Up: Map | Next: 41500 |
|
Used by the routines at ClipSecondSprite and ClipFirstSprite.
Clips a sprite so that it lies between 23 and 183 on the vertical axis, which is the playfield. The position of a sprite is its bottom row and its rows go up from there, so rows below the playfield are skipped by moving on the address of the data, and rows above it are not drawn.
|
||||||||||||||||||||||
| ClipSpriteVertically | 41467 | LD L,A | Store the vertical position. | |||||||||||||||||||
| 41468 | SUB 23 | Subtract 23, the top of the playfield. | ||||||||||||||||||||
| 41470 | SUB B | Subtract the number of rows. | ||||||||||||||||||||
| 41471 | JR NC,ClipSpriteVertically_Top | Jump to ClipSpriteVertically_Top if the sprite does not go past the top. | ||||||||||||||||||||
| 41473 | LD A,L | Fetch the vertical position. | ||||||||||||||||||||
| 41474 | SUB 23 | Subtract 23 to get the number of rows that fit. | ||||||||||||||||||||
| 41476 | LD B,A | Store it as the number of rows. | ||||||||||||||||||||
| 41477 | RET | Return. | ||||||||||||||||||||
| ClipSpriteVertically_Top | 41478 | LD A,L | Fetch the vertical position. | |||||||||||||||||||
| 41479 | SUB 183 | Subtract 183, the bottom of the playfield. | ||||||||||||||||||||
| 41481 | RET Z | Return if the sprite starts exactly at the bottom. | ||||||||||||||||||||
| 41482 | RET C | Return if the sprite starts above the bottom. | ||||||||||||||||||||
| 41483 | LD L,A | Store the number of rows that are below the bottom. | ||||||||||||||||||||
| 41484 | LD A,B | Fetch the number of rows. | ||||||||||||||||||||
| 41485 | SUB L | Take off the rows that are below the bottom. | ||||||||||||||||||||
| 41486 | LD B,A | Store it. | ||||||||||||||||||||
| 41487 | XOR A | Clear A. | ||||||||||||||||||||
| ClipSpriteVertically_Skip | 41488 | ADD A,H | Add the width for each row that is below the bottom. | |||||||||||||||||||
| 41489 | DEC L | Count down. | ||||||||||||||||||||
| 41490 | JR NZ,ClipSpriteVertically_Skip | Loop back to ClipSpriteVertically_Skip for each row. | ||||||||||||||||||||
| 41492 | EX DE,HL | Put the address of the data in HL. | ||||||||||||||||||||
| 41493 | CALL AddAToHL | Skip the data for the rows below the bottom. | ||||||||||||||||||||
| 41496 | EX DE,HL | Put the address back in DE. | ||||||||||||||||||||
| 41497 | LD L,183 | Start at the bottom of the playfield. | ||||||||||||||||||||
| 41499 | RET | Return. | ||||||||||||||||||||
| Prev: 41450 | Up: Map | Next: 41500 |