Prev: E2B6 Up: Map Next: E2FD
E2BD: Landscape pieces: blitters and graphics at a shift of 2 pixels
The first of four tables of 16 entries, one per piece direction (the high nibble of the piece's direction-and-steps byte in its tile record, kept in (IX+3)), chosen by draw_landscape from the fine scroll position and kept in shift_table: this one for a shift of 2 pixels, piece_blitters_shift4 for 4, piece_blitters_shift6 for 6 and piece_blitters_shift0 for 0. Each entry is two words: the blitter that draws a step of the piece, which landscape_step_loop loads into IY and step_dispatch jumps to, and the step's graphic at that shift, which it keeps in piece_graphic and starts SP from.
The directions: 0 is flat, three bytes wide; 1, 2 and 3 are slopes that climb to the right (8 rows over 16 pixels, 8 rows over 8, 16 rows over 8), 4, 5 and 6 the same three climbing to the left; 7 to 13 are 0 to 6 upside down (ceilings: rock above, sky below), and 14 and 15 are a 16-row wall facing either way. Each graphic holds three variants of the step one above the other (9 or 17 rows each; 28 rows for a flat step); landscape_step_loop picks one and the count of row pairs comes in A.
Only nine graphics are stored: a step climbing to the left is its partner's graphic started one row later and drawn by a blitter that mirrors each byte through the bit-reversed table at bit_reverse_table (blit_mirror_two, blit_mirror_one). That works because the graphics zig-zag: each pair of rows is stored left to right and then right to left, so read one row later every row's bytes come in the other order. A mirrored shifted step uses the partner's graphic at the opposite shift: a slope climbing left at a shift of 2 is the right-climbing one at 6, mirrored.
The blitters: blit_flat_step for the flat steps at every shift; at shift 0 blit_two (two bytes wide), blit_one (one byte), and their mirrored twins blit_mirror_two (entered one DEC L early, at the end of blit_mirror_three) and blit_mirror_one; at shifts 2 to 6, one byte wider, blit_three (entered at its second INC L), blit_two (at its second INC L) and the mirrored blit_mirror_three (at its second DEC L) and blit_mirror_two. The walls (directions 14 and 15) enter one instruction later than the slopes, skipping the INC L or DEC L that places a slope in its column.
piece_blitters_shift2 E2BD DEFW blit_flat_step Shift 2: directions 0 (flat) and 1 (climbs right, 16 pixels)
E2BF DEFW flat_piece_shifted
E2C1 DEFW $E4A8
E2C3 DEFW slope_1_shifted
E2C5 DEFW $E4D0 Directions 2 and 3 (climb right, 8 pixels: 8 and 16 rows)
E2C7 DEFW slope_2_shifted
E2C9 DEFW $E4D0
E2CB DEFW slope_3_shifted
E2CD DEFW $E4F2 Directions 4 and 5 (climb left: mirrors of 1 and 2)
E2CF DEFW $E8C1
E2D1 DEFW blit_mirror_two
E2D3 DEFW $E7C8
E2D5 DEFW blit_mirror_two Directions 6 (mirror of 3) and 7 (flat, upside down)
E2D7 DEFW $E9FC
E2D9 DEFW blit_flat_step
E2DB DEFW flat_piece_two_shifted
E2DD DEFW $E4A8 Directions 8 and 9 (1 and 2 upside down)
E2DF DEFW slope_8_shifted
E2E1 DEFW $E4D0
E2E3 DEFW slope_9_shifted
E2E5 DEFW $E4D0 Directions 10 and 11 (3 and 4 upside down)
E2E7 DEFW slope_10_shifted
E2E9 DEFW $E4F2
E2EB DEFW $EF57
E2ED DEFW blit_mirror_two Directions 12 and 13 (5 and 6 upside down)
E2EF DEFW $EE5E
E2F1 DEFW blit_mirror_two
E2F3 DEFW $F08F
E2F5 DEFW $E4D1 Directions 14 and 15 (wall, and its mirror)
E2F7 DEFW wall_shifted
E2F9 DEFW $E52D
E2FB DEFW $ED74
Prev: E2B6 Up: Map Next: E2FD