Prev: 50466 Up: Map Next: 50586
50518: 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 16 pixels.
Input
IY The shape
The mirror of each byte is taken from the table on page 249. The count is the shape's position byte.
FlipWideBlockData 50518 LD SP,HL Read the tile through the stack.
50519 LD A,(IY+6) Step four bytes on for each unit of the position byte.
50522 LD E,A
50523 SLA E
50525 SLA E
50527 LD D,0
50529 ADD HL,DE
50530 EX DE,HL Keep the far end of the row.
50531 LD H,249 Use the mirror table on page 249.
FlipWideBlockData_Loop 50533 EX AF,AF' Remember how many rows remain.
50534 INC DE Flip four bytes of the tile.
50535 INC DE
50536 POP BC
50537 LD L,C
50538 LD C,(HL)
50539 LD A,(DE)
50540 LD L,A
50541 LD A,C
50542 LD (DE),A
50543 LD C,(HL)
50544 INC DE
50545 LD L,B
50546 LD B,(HL)
50547 LD A,(DE)
50548 LD L,A
50549 LD A,B
50550 LD (DE),A
50551 LD B,(HL)
50552 PUSH BC
50553 POP BC
50554 DEC DE
50555 DEC DE
50556 DEC DE
50557 POP BC
50558 LD L,C
50559 LD C,(HL)
50560 LD A,(DE)
50561 LD L,A
50562 LD A,C
50563 LD (DE),A
50564 LD C,(HL)
50565 INC DE
50566 LD L,B
50567 LD B,(HL)
50568 LD A,(DE)
50569 LD L,A
50570 LD A,B
50571 LD (DE),A
50572 LD B,(HL)
50573 PUSH BC
50574 POP BC
50575 INC DE
50576 INC DE
50577 INC DE
50578 EX AF,AF' Bring the count back.
50579 DEC A Repeat for the remaining rows.
50580 JP NZ,FlipWideBlockData_Loop
50583 JP FlipBlockData_Exit Join the end of the narrow flip.
Prev: 50466 Up: Map Next: 50586