Prev: BFD6 Up: Map Next: C036
BFDB: Draw Flipped Shifted Columns
Draws the columns of a sprite which is flipped and shifted. 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 turn the mask and the pixels round and split them in two. It works from right to left.
The jump at SpriteJumpOpcode starts here for five columns.
DrawFlippedShiftedColumns BFDB CPL Invert the screen byte.
BFDC POP DE Restore the mask into E and the pixels into D from the stack.
BFDD LD L,E Clear the screen bits under the part of the mask which is in this byte.
BFDE OR (HL)
BFDF CPL
BFE0 LD L,D Add the part of the pixels which is in this byte.
BFE1 OR (HL)
BFE2 LD (BC),A Store the byte and move on to the byte on the left.
BFE3 DEC BC
BFE4 DEC H Point H at the table for the bits which move into the next byte, and fetch that screen byte.
BFE5 LD L,E
BFE6 LD A,(BC)
BFE7 CPL Clear the screen bits under the part of the mask which has moved into it.
BFE8 OR (HL)
BFE9 CPL
BFEA LD L,D Add the part of the pixels which has moved into it.
BFEB OR (HL)
BFEC INC H Point H back at the first table.
The jump at SpriteJumpOpcode starts here for four columns.
BFED CPL Invert the screen byte.
BFEE POP DE Restore the mask into E and the pixels into D from the stack.
BFEF LD L,E Clear the screen bits under the part of the mask which is in this byte.
BFF0 OR (HL)
BFF1 CPL
BFF2 LD L,D Add the part of the pixels which is in this byte.
BFF3 OR (HL)
BFF4 LD (BC),A Store the byte and move on to the byte on the left.
BFF5 DEC BC
BFF6 DEC H Point H at the table for the bits which move into the next byte, and fetch that screen byte.
BFF7 LD L,E
BFF8 LD A,(BC)
BFF9 CPL Clear the screen bits under the part of the mask which has moved into it.
BFFA OR (HL)
BFFB CPL
BFFC LD L,D Add the part of the pixels which has moved into it.
BFFD OR (HL)
BFFE INC H Point H back at the first table.
The jump at SpriteJumpOpcode starts here for three columns.
BFFF CPL Invert the screen byte.
C000 POP DE Restore the mask into E and the pixels into D from the stack.
C001 LD L,E Clear the screen bits under the part of the mask which is in this byte.
C002 OR (HL)
C003 CPL
C004 LD L,D Add the part of the pixels which is in this byte.
C005 OR (HL)
C006 LD (BC),A Store the byte and move on to the byte on the left.
C007 DEC BC
C008 DEC H Point H at the table for the bits which move into the next byte, and fetch that screen byte.
C009 LD L,E
C00A LD A,(BC)
C00B CPL Clear the screen bits under the part of the mask which has moved into it.
C00C OR (HL)
C00D CPL
C00E LD L,D Add the part of the pixels which has moved into it.
C00F OR (HL)
C010 INC H Point H back at the first table.
The jump at SpriteJumpOpcode starts here for two columns.
C011 CPL Invert the screen byte.
C012 POP DE Restore the mask into E and the pixels into D from the stack.
C013 LD L,E Clear the screen bits under the part of the mask which is in this byte.
C014 OR (HL)
C015 CPL
C016 LD L,D Add the part of the pixels which is in this byte.
C017 OR (HL)
C018 LD (BC),A Store the byte and move on to the byte on the left.
C019 DEC BC
C01A DEC H Point H at the table for the bits which move into the next byte, and fetch that screen byte.
C01B LD L,E
C01C LD A,(BC)
C01D CPL Clear the screen bits under the part of the mask which has moved into it.
C01E OR (HL)
C01F CPL
C020 LD L,D Add the part of the pixels which has moved into it.
C021 OR (HL)
C022 INC H Point H back at the first table.
The jump at SpriteJumpOpcode starts here for one column.
C023 CPL Invert the screen byte.
C024 POP DE Restore the mask into E and the pixels into D from the stack.
C025 LD L,E Clear the screen bits under the part of the mask which is in this byte.
C026 OR (HL)
C027 CPL
C028 LD L,D Add the part of the pixels which is in this byte.
C029 OR (HL)
C02A LD (BC),A Store the byte and move on to the byte on the left.
C02B DEC BC
C02C DEC H Point H at the table for the bits which move into the next byte, and fetch that screen byte.
C02D LD L,E
C02E LD A,(BC)
C02F CPL Clear the screen bits under the part of the mask which has moved into it.
C030 OR (HL)
C031 CPL
C032 LD L,D Add the part of the pixels which has moved into it.
C033 OR (HL)
C034 INC H Point H back at the first table.
C035 LD (BC),A Store the last byte of the row.
Continue on to FinishFlippedSpriteRow.
Prev: BFD6 Up: Map Next: C036