Prev: 34979 Up: Map Next: 35048
34993: 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 34993 LD A,(DE) Fetch the sprite width and move past the header.
34994 INC DE
34995 LD B,A
34996 RLCA Rotate the width into a pixel count.
34997 RLCA
34998 RLCA
34999 AND %11111000 Keep only bits 3-7.
35001 ADD A,L Jump to ReadSpriteHeader_Done if adding the column does not wrap.
35002 JR NC,ReadSpriteHeader_Done
35004 RRCA Rotate the overflow back to a nibble.
35005 RRCA
35006 RRCA
35007 AND %00001111 Keep only bits 0-3.
35009 LD C,A Store the overflow and turn it into a right-hand skip.
35010 NEG
35012 ADD A,16
Store the skip and visible width, then copy the height into the draw workspace.
ReadSpriteHeader_Loop 35014 LD (34798),A Write the skip to 34798 and *IX+9.
35017 LD (IX+9),A
35020 LD A,B Write the visible width to SpriteWidth and *IX+11.
35021 SUB C
35022 LD B,A
35023 LD (24151),A
35026 LD (IX+11),A
35029 LD A,(DE) Copy the next header byte into SpriteHeight, SpriteRowsLeft and *IX+10.
35030 INC DE
35031 LD (24152),A
35034 LD (24153),A
35037 LD (IX+10),A
35040 JR FetchAndDraw_StoreColumn Jump to FetchAndDraw_StoreColumn.
Use no skip when the sprite does not wrap past the screen column.
ReadSpriteHeader_Done 35042 LD A,16 Set the skip operand to 16 (skip nothing) and clear the overflow.
35044 LD C,0
35046 JR ReadSpriteHeader_Loop Jump to ReadSpriteHeader_Loop.
Prev: 34979 Up: Map Next: 35048