Prev: E4F1 Up: Map Next: E55B
E52C: Draw a two-byte-wide terrain piece, mirrored
The blitter for the pieces that climb to the left and are two bytes wide: directions 4 and 11 at shift 0 (entered one DEC L earlier, at the end of blit_mirror_three), directions 5, 6, 12 and 13 at shifts 2 to 6 (here), and the wall direction 15 at those shifts (at blit_mirror_two + 1, skipping the DEC L). It draws like the two-byte blitter at blit_two -- POP DE, two bytes left to right, up a row, two bytes right to left, up a row -- but each byte goes through the bit-reversed table at bit_reverse_table (built by build_bit_reverse), so the graphic comes out mirrored. With the graphic started one row later than its right-climbing partner's (see piece_blitters_shift2), each row's bytes arrive in the mirrored order too.
The table lookups make it about 40 T-states a pair of rows slower than the plain blitter: about 150 T-states for two rows of two bytes, against about 105.
Input
A the number of pairs of rows
HL the screen address of the bottom row's right-hand byte, plus one
SP the piece's graphic (at the variant to draw)
blit_mirror_two E52C DEC L Step left into the piece's column
E52D LD B,$F9 B' holds the table's page; B the count
E52F EXX
E530 LD B,A
blit_mirror_two_0 E531 EXX Pop two bytes; the first, mirrored, on the left
E532 POP DE
E533 LD C,E
E534 LD A,(BC)
E535 LD (HL),A
E536 INC L The second, mirrored, on its right
E537 LD C,D
E538 LD A,(BC)
E539 LD (HL),A
E53A DEC H Up a row
E53B POP DE Pop two more: the first on the right
E53C LD C,E
E53D LD A,(BC)
E53E LD (HL),A
E53F DEC L The second on the left
E540 LD C,D
E541 LD A,(BC)
E542 LD (HL),A
E543 DEC H Up a row
E544 LD A,H Into the next character row up if this one is done
E545 INC A
E546 AND $07
E548 JR NZ,blit_mirror_two_1
E54A LD A,L
E54B SUB $20
E54D LD L,A
E54E JR C,blit_mirror_two_1
E550 LD A,H
E551 ADD A,$08
E553 LD H,A
blit_mirror_two_1 E554 EXX The next pair of rows
E555 DJNZ blit_mirror_two_0
E557 EXX Leave HL as the column for the next piece (after_step_drawn)
E558 JP after_step_drawn
Prev: E4F1 Up: Map Next: E55B