Prev: 88A3 Up: Map Next: 88E8
88B1: Read Sprite Header
Fetch the width byte from the graphic and rotate it into a pixel count.
Input
DE Graphic pointer
Read the sprite width and rotate it into a pixel count.
ReadSpriteHeader 88B1 LD A,(DE) Fetch the sprite width and move past the header.
88B2 INC DE
88B3 LD B,A
88B4 RLCA Rotate the width into a pixel count.
88B5 RLCA
88B6 RLCA
88B7 AND %11111000 Keep only bits 3-7.
88B9 ADD A,L Jump to ReadSpriteHeader_Done if adding the column does not wrap.
88BA JR NC,ReadSpriteHeader_Done
88BC RRCA Rotate the overflow back to a nibble.
88BD RRCA
88BE RRCA
88BF AND %00001111 Keep only bits 0-3.
88C1 LD C,A Store the overflow and turn it into a right-hand skip.
88C2 NEG
88C4 ADD A,$10
Store the skip and visible width, then copy the height into the draw workspace.
ReadSpriteHeader_Loop 88C6 LD ($87EE),A Write the skip to 87EE and *IX+09.
88C9 LD (IX+$09),A
88CC LD A,B Write the visible width to SpriteWidth and *IX+0B.
88CD SUB C
88CE LD B,A
88CF LD ($5E57),A
88D2 LD (IX+$0B),A
88D5 LD A,(DE) Copy the next header byte into SpriteHeight, SpriteRowsLeft and *IX+0A.
88D6 INC DE
88D7 LD ($5E58),A
88DA LD ($5E59),A
88DD LD (IX+$0A),A
88E0 JR FetchAndDraw_StoreColumn Jump to FetchAndDraw_StoreColumn.
Use no skip when the sprite does not wrap past the screen column.
ReadSpriteHeader_Done 88E2 LD A,$10 Set the skip operand to 10 (skip nothing) and clear the overflow.
88E4 LD C,$00
88E6 JR ReadSpriteHeader_Loop Jump to ReadSpriteHeader_Loop.
Prev: 88A3 Up: Map Next: 88E8