Prev: D013 Up: Map Next: D0B9
D08F: The unrolled row of a byte-aligned sprite
Entered by the JR in SPRITE_ROW, as many 8-byte units from the end as the sprite is wide. Each unit takes the next mask and image pair off the stack and does one buffer byte: cleared under the mask (CPL, OR E, CPL), the image ORed in, stored. The last unit has no INC BC, so a row leaves BC on its last byte, which is what the step patched into SPRITE_SHIFTED_RUN allows for. Knight Lore's sprite_aligned and sprite_aligned_tail.
Input
BC the buffer byte to start at
SP the sprite's next mask and image bytes
A' the rows left
SPRITE_ALIGNED_RUN D08F POP DE The first of five units
D090 LD A,(BC)
D091 CPL
D092 OR E
D093 CPL
D094 OR D
D095 LD (BC),A
D096 INC BC
D097 POP DE Three more the same
D098 LD A,(BC)
D099 CPL
D09A OR E
D09B CPL
D09C OR D
D09D LD (BC),A
D09E INC BC
D09F POP DE
D0A0 LD A,(BC)
D0A1 CPL
D0A2 OR E
D0A3 CPL
D0A4 OR D
D0A5 LD (BC),A
D0A6 INC BC
D0A7 POP DE
D0A8 LD A,(BC)
D0A9 CPL
D0AA OR E
D0AB CPL
D0AC OR D
D0AD LD (BC),A
D0AE INC BC
D0AF POP DE The fifth, without the INC BC
D0B0 LD A,(BC)
D0B1 CPL
D0B2 OR E
D0B3 CPL
D0B4 OR D
D0B5 LD (BC),A
D0B6 JP SPRITE_NEXT_ROW On to the next row
Prev: D013 Up: Map Next: D0B9