Prev: C522 Up: Map Next: C59A
C556: Flip Wide Block Data
Used by the routine at FlipBlockData.
Flips the data of a block horizontally, as FlipBlockData does, for blocks that are wider than 10 pixels.
Input
IY The shape
The mirror of each byte is taken from the table on page F9. The count is the shape's position byte.
FlipWideBlockData C556 LD SP,HL Read the tile through the stack.
C557 LD A,(IY+$06) Step four bytes on for each unit of the position byte.
C55A LD E,A
C55B SLA E
C55D SLA E
C55F LD D,$00
C561 ADD HL,DE
C562 EX DE,HL Keep the far end of the row.
C563 LD H,$F9 Use the mirror table on page F9.
FlipWideBlockData_Loop C565 EX AF,AF' Remember how many rows remain.
C566 INC DE Flip four bytes of the tile.
C567 INC DE
C568 POP BC
C569 LD L,C
C56A LD C,(HL)
C56B LD A,(DE)
C56C LD L,A
C56D LD A,C
C56E LD (DE),A
C56F LD C,(HL)
C570 INC DE
C571 LD L,B
C572 LD B,(HL)
C573 LD A,(DE)
C574 LD L,A
C575 LD A,B
C576 LD (DE),A
C577 LD B,(HL)
C578 PUSH BC
C579 POP BC
C57A DEC DE
C57B DEC DE
C57C DEC DE
C57D POP BC
C57E LD L,C
C57F LD C,(HL)
C580 LD A,(DE)
C581 LD L,A
C582 LD A,C
C583 LD (DE),A
C584 LD C,(HL)
C585 INC DE
C586 LD L,B
C587 LD B,(HL)
C588 LD A,(DE)
C589 LD L,A
C58A LD A,B
C58B LD (DE),A
C58C LD B,(HL)
C58D PUSH BC
C58E POP BC
C58F INC DE
C590 INC DE
C591 INC DE
C592 EX AF,AF' Bring the count back.
C593 DEC A Repeat for the remaining rows.
C594 JP NZ,FlipWideBlockData_Loop
C597 JP FlipBlockData_Exit Join the end of the narrow flip.
Prev: C522 Up: Map Next: C59A