Prev: F8D0 Up: Map Next: F900
F8E2: Make a flat piece's shifted copies
Used by the routine at build_shifted_pieces.
For build_shifted_pieces, the two flat pieces (directions 0 and 7). A flat piece is three bytes wide and tiles: the ground under it repeats every 24 pixels. So its rows are rotated rather than shifted: the bits that would fall off the right-hand end come back in at the left (the byte that would hold them is cleared and its bits ORed into the row's first byte), and nothing is added to the width. The row pairs alternate as in the blitter blit_flat_step: left to right, then right to left. After each copy, HL' skips 48 bytes: only the first 12 rows of each 28-row copy are made here, the other 16 rows of each having come on the tape already shifted (read from the simulator). The 12 made are the three 4-row variants of the step, the ground that repeats and so can be rotated; the 16 on the tape are the four end caps, already shifted (checked in the simulator for the Graphics page) -- presumably because a cap does not tile, so rotating it would wrap its edge round to the wrong side (assumed).
At the end it patches a byte in the last row of each flat piece's copy shifted by 6 (flat_piece_shifted and flat_piece_two_shifted; to $5C and $40), perhaps to mend a pixel the rotation got wrong (not checked).
Input
HL the piece's header (two bytes: pairs of rows, width)
HL' where the copy shifted by 2 goes; the copies shifted by 4 and 6 follow, 84 bytes apart
shift_flat_piece F8E2 CALL read_piece_header_0 Read the header
This entry point is used by the routine at bit_reverse_table.
shift_flat_piece_0 F8E5 PUSH HL Back here for each shift
This entry point is used by the routine at bit_reverse_table.
shift_flat_piece_1 F8E6 LD B,C A row left to right: width + 1 bytes shifted in
F8E7 INC B
shift_flat_piece_2 F8E8 CALL shift_byte_forward
F8EB INC HL
F8EC DJNZ shift_flat_piece_2
F8EE EXX Rotate: the spill clears and ORs into the row's first byte
F8EF LD (HL),$00
F8F1 DEC HL
F8F2 DEC HL
F8F3 DEC HL
F8F4 OR (HL)
F8F5 LD (HL),A
F8F6 INC HL
F8F7 INC HL
F8F8 INC HL
F8F9 EXX
F8FA CALL shift_byte_low A row right to left: keep the first byte's low part
F8FD LD (pieces_left),A
Prev: F8D0 Up: Map Next: F900