Prev: A21C Up: Map Next: A234
A223: Read Sprite Header
Used by the routines at ClipSecondSprite and ClipFirstSprite.
Reads the width and the number of rows from the header of a sprite and works out which of the routines that draw sprites to use. Sprites that are not aligned to a byte (a horizontal position that has bits 1 and 2 not both clear) need a routine that shifts the sprite, which are the first five entries of the tables at EraseRoutineTable and DrawRoutineTable.
Input
DE Address of the sprite
L Horizontal position
Output
B Number of rows
C Index of the routine that draws the sprite
DE Address of the first row of data
H Width in bytes
ReadSpriteHeader A223 LD A,(DE) Fetch the width.
A224 LD H,A Store it in H.
A225 LD C,A Copy it to C.
A226 DEC C Take one off to get the index for a sprite that must be shifted.
A227 INC DE Move on to the number of rows.
A228 LD A,(DE) Fetch it.
A229 LD B,A Store it in B.
A22A INC DE Move on to the data.
A22B LD A,L Fetch the horizontal position.
A22C AND %00000110 Only bits 1 and 2.
A22E RET NZ Return if the sprite must be shifted.
A22F LD A,$05 Add five to the index for a sprite that is aligned.
A231 ADD A,C Store it in C.
A232 LD C,A
A233 RET Return.
Prev: A21C Up: Map Next: A234