Prev: BE85 Up: Map Next: BEE5
BE8A: Draw Shifted Columns
Draws the columns of a sprite which is shifted to the right by two, four or six pixels. There is a piece of code for each of up to five columns of the sprite, and the code for the width of the sprite is where the jump at SpriteJumpOpcode starts. Each piece puts a column into two bytes of the buffer, using the table for the shift to split the mask and the pixels in two. The buffer address is in BC.
The jump at SpriteJumpOpcode starts here for five columns.
DrawShiftedColumns BE8A CPL Invert the screen byte, and fetch the mask into E and the pixels into D.
BE8B POP DE
BE8C LD L,E Clear the screen bits under the part of the mask which is in this byte.
BE8D OR (HL)
BE8E CPL
BE8F LD L,D Add the part of the pixels which is in this byte.
BE90 OR (HL)
BE91 LD (BC),A Store the byte and move on to the next.
BE92 INC BC
BE93 INC H Point H at the table for the bits which move into the next byte, and fetch that screen byte.
BE94 LD L,E
BE95 LD A,(BC)
BE96 CPL Clear the screen bits under the part of the mask which has moved into it.
BE97 OR (HL)
BE98 CPL
BE99 LD L,D Add the part of the pixels which has moved into it.
BE9A OR (HL)
BE9B DEC H Point H back at the first table.
The jump at SpriteJumpOpcode starts here for four columns.
BE9C CPL Invert the screen byte, and fetch the mask into E and the pixels into D.
BE9D POP DE
BE9E LD L,E Clear the screen bits under the part of the mask which is in this byte.
BE9F OR (HL)
BEA0 CPL
BEA1 LD L,D Add the part of the pixels which is in this byte.
BEA2 OR (HL)
BEA3 LD (BC),A Store the byte and move on to the next.
BEA4 INC BC
BEA5 INC H Point H at the table for the bits which move into the next byte, and fetch that screen byte.
BEA6 LD L,E
BEA7 LD A,(BC)
BEA8 CPL Clear the screen bits under the part of the mask which has moved into it.
BEA9 OR (HL)
BEAA CPL
BEAB LD L,D Add the part of the pixels which has moved into it.
BEAC OR (HL)
BEAD DEC H Point H back at the first table.
The jump at SpriteJumpOpcode starts here for three columns.
BEAE CPL Invert the screen byte, and fetch the mask into E and the pixels into D.
BEAF POP DE
BEB0 LD L,E Clear the screen bits under the part of the mask which is in this byte.
BEB1 OR (HL)
BEB2 CPL
BEB3 LD L,D Add the part of the pixels which is in this byte.
BEB4 OR (HL)
BEB5 LD (BC),A Store the byte and move on to the next.
BEB6 INC BC
BEB7 INC H Point H at the table for the bits which move into the next byte, and fetch that screen byte.
BEB8 LD L,E
BEB9 LD A,(BC)
BEBA CPL Clear the screen bits under the part of the mask which has moved into it.
BEBB OR (HL)
BEBC CPL
BEBD LD L,D Add the part of the pixels which has moved into it.
BEBE OR (HL)
BEBF DEC H Point H back at the first table.
The jump at SpriteJumpOpcode starts here for two columns.
BEC0 CPL Invert the screen byte, and fetch the mask into E and the pixels into D.
BEC1 POP DE
BEC2 LD L,E Clear the screen bits under the part of the mask which is in this byte.
BEC3 OR (HL)
BEC4 CPL
BEC5 LD L,D Add the part of the pixels which is in this byte.
BEC6 OR (HL)
BEC7 LD (BC),A Store the byte and move on to the next.
BEC8 INC BC
BEC9 INC H Point H at the table for the bits which move into the next byte, and fetch that screen byte.
BECA LD L,E
BECB LD A,(BC)
BECC CPL Clear the screen bits under the part of the mask which has moved into it.
BECD OR (HL)
BECE CPL
BECF LD L,D Add the part of the pixels which has moved into it.
BED0 OR (HL)
BED1 DEC H Point H back at the first table.
The jump at SpriteJumpOpcode starts here for one column.
BED2 CPL Invert the screen byte, and fetch the mask into E and the pixels into D.
BED3 POP DE
BED4 LD L,E Clear the screen bits under the part of the mask which is in this byte.
BED5 OR (HL)
BED6 CPL
BED7 LD L,D Add the part of the pixels which is in this byte.
BED8 OR (HL)
BED9 LD (BC),A Store the byte and move on to the next.
BEDA INC BC
BEDB INC H Point H at the table for the bits which move into the next byte, and fetch that screen byte.
BEDC LD L,E
BEDD LD A,(BC)
BEDE CPL Clear the screen bits under the part of the mask which has moved into it.
BEDF OR (HL)
BEE0 CPL
BEE1 LD L,D Add the part of the pixels which has moved into it.
BEE2 OR (HL)
BEE3 DEC H Point H back at the first table.
BEE4 LD (BC),A Store the last byte of the row.
Continue on to FinishSpriteRow.
View the equivalent code in;
Prev: BE85 Up: Map Next: BEE5