Prev: D4B8 Up: Map Next: D588
D4CB: Draw a sloped step whole, or decide how it is clipped at the left edge
Used by the routines at landscape_step_loop and slope_step_at_right_edge.
Steps whose screen x is from -8 to 6 hang over the play area's left edge (column 0 is the border, and x from $F0 is "negative": columns 30 and 31 of the same character row). Anything else is drawn whole (with fold_column_step for a vertical wall). A clipped step uses blit_left_clip (dispatch 8) for a piece running right, or blit_mirrored_left_clip (dispatch 11) for one running left; the bytes to skip and the columns to draw are patched into those blitters' JRs, and for blit_left_clip the next step's column into move_across_kept, according to the column the step starts in.
All the clipped cases ran in the build's sessions.
slope_step_at_left_edge D4CB LD A,(piece_x) Not near the left edge: draw whole.
D4CE ADD A,$08
D4D0 CP $0F
D4D2 JR C,slope_step_at_left_edge_0
D4D4 LD A,(piece_dx_copy)
D4D7 AND A
D4D8 JP NZ,draw_step
D4DB CALL fold_column_step
D4DE JP draw_step
slope_step_at_left_edge_0 D4E1 LD A,(direction_flag) A piece running left: further on.
D4E4 CP $01
D4E6 JR Z,slope_step_at_left_edge_6
D4E8 LD A,(column_address) Running right: by the column in column_address ($1D, $1E or another).
D4EB AND $1F
D4ED CP $1D
D4EF JR Z,slope_step_at_left_edge_4
D4F1 CP $1E
D4F3 JR Z,slope_step_at_left_edge_5
slope_step_at_left_edge_1 D4F5 LD A,(piece_dx_copy) Another column: skip one graphic byte (first JR in blit_left_clip at 1), draw the last column of a two-byte step (second JR at $2C), the next step's column from the byte advance (move_across_kept); dispatch 8.
D4F8 AND A
D4F9 CALL Z,fold_column_step
D4FC LD A,(piece_dcolumn)
D4FF LD (move_across_kept),A
D502 LD A,$2C
D504 LD ($DBC6),A
slope_step_at_left_edge_2 D507 LD A,$01
D509 LD ($DBC1),A
slope_step_at_left_edge_3 D50C LD A,$08
D50E LD ($D702),A
D511 JP draw_step
slope_step_at_left_edge_4 D514 LD A,$01 $1D: skip two graphic bytes (first JR at 0), draw the last column of a three-byte step (second JR at $30); the next step's column from 1.
D516 LD (move_across_kept),A
D519 XOR A
D51A LD ($DBC1),A
D51D LD A,$30
D51F LD ($DBC6),A
D522 JP slope_step_at_left_edge_3
slope_step_at_left_edge_5 D525 LD A,($D480) $1E off a byte boundary: skip one byte, draw the last two columns (second JR at 0).
D528 CP $01
D52A JR Z,slope_step_at_left_edge_1
D52C LD A,(piece_dcolumn)
D52F LD (move_across_kept),A
D532 XOR A
D533 LD ($DBC6),A
D536 JP slope_step_at_left_edge_2
slope_step_at_left_edge_6 D539 LD A,(piece_dcolumn) A piece running left: by the column the step starts in.
D53C LD B,A
D53D LD A,(column_address)
D540 SUB B
D541 AND $1F
D543 CP $02
D545 JR Z,slope_step_at_left_edge_8
D547 CP $03 Another column off a byte boundary: skip one byte, two columns (first JR in blit_mirrored_left_clip at 1, second at 0); dispatch 11.
D549 JR Z,slope_step_at_left_edge_9
D54B LD A,($D480)
D54E CP $01
D550 JR Z,slope_step_at_left_edge_8
D552 XOR A
D553 LD ($DC14),A
D556 INC A
slope_step_at_left_edge_7 D557 LD ($DC0C),A
D55A LD A,$0B
D55C LD ($D702),A
D55F JP draw_step
slope_step_at_left_edge_8 D562 LD A,(piece_dx_copy) Column 2, or on a byte boundary: skip one byte, one column (second JR at $26).
D565 AND A
D566 CALL Z,fold_column_step
D569 LD A,$26
D56B LD ($DC14),A
D56E LD A,$01
D570 JP slope_step_at_left_edge_7
slope_step_at_left_edge_9 D573 LD A,D Column 3: skip two bytes, one column (first JR at 0, second at $2A); with no step drawn yet, column_address goes a character row back.
D574 AND A
D575 JR NZ,slope_step_at_left_edge_10
D577 LD A,(column_address)
D57A SUB $20
D57C LD (column_address),A
slope_step_at_left_edge_10 D57F LD A,$2A
D581 LD ($DC14),A
D584 XOR A
D585 JP slope_step_at_left_edge_7
Prev: D4B8 Up: Map Next: D588