Prev: D990 Up: Map Next: DB26
D9A8: Fill the rows a vertically scrolled piece has uncovered
Used by the routine at after_step_drawn.
When the landscape has moved up or down by vertical_step_size pixels (2 or 4) this pass, each drawn step of the piece leaves that many rows of its old place uncovered: below it when the landscape moved up, above when it moved down. Starting from the first drawn step (first_step_x), this paints them step by step (fill_next_step with IY = fill_two_rows for 2 rows, fill_four_rows for 4) with the checker ($55AA) for ground or black for sky -- the other way round for a ceiling piece (piece_ceiling). The width per step is its byte advance (piece_step_y), adjusted for the shift, a reversing piece and drop caps (landscape_end_pieces, adjust_fill_for_scroll).
fill_behind_moving_piece D9A8 LD IY,fill_four_rows Two rows or four.
D9AC LD A,(vertical_step_size)
D9AF CP $04
D9B1 JR Z,fill_behind_moving_piece_0
D9B3 LD IY,fill_two_rows
fill_behind_moving_piece_0 D9B7 LD DE,$0000 Black or checker by the direction and the ceiling flag.
D9BA LD A,(scroll_down)
D9BD LD B,A
D9BE LD A,(piece_ceiling)
D9C1 XOR B
D9C2 BIT 7,A
D9C4 JR Z,fill_behind_moving_piece_1
D9C6 LD DE,$55AA
fill_behind_moving_piece_1 D9C9 LD HL,(first_step_x) Start at the first drawn step.
D9CC LD A,(piece_dx_copy)
D9CF AND A
D9D0 JR NZ,fill_behind_moving_piece_4
D9D2 LD A,(direction_flag) A vertical wall: filled as one tall step; nothing if it is moving the wrong way.
D9D5 CP $01
D9D7 JR Z,fill_behind_moving_piece_2
D9D9 LD A,L
D9DA ADD A,$07
D9DC LD L,A
fill_behind_moving_piece_2 D9DD LD A,(clipped_columns)
D9E0 LD B,A
D9E1 XOR A
fill_behind_moving_piece_3 D9E2 ADD A,$10
D9E4 DJNZ fill_behind_moving_piece_3
D9E6 LD (piece_rows),A
D9E9 LD A,$01
D9EB LD (clipped_columns),A
D9EE LD DE,$55AA
D9F1 LD A,(direction_flag)
D9F4 LD B,A
D9F5 LD A,(scroll_across)
D9F8 AND A
D9F9 JR Z,fill_behind_moving_piece_4
D9FB XOR B
D9FC BIT 7,A
D9FE JP NZ,after_step_drawn_15
fill_behind_moving_piece_4 DA01 LD A,(scroll_down) Start above the step (moving down) or below it (moving up).
DA04 BIT 7,A
DA06 LD A,(vertical_step_size)
DA09 JR NZ,fill_behind_moving_piece_5
DA0B LD A,(piece_rows)
DA0E NEG
fill_behind_moving_piece_5 DA10 ADD A,H
DA11 LD H,A
DA12 LD (piece_page_y),A
DA15 LD (saved_speed),HL Keep the start for landscape_end_pieces.
DA18 LD A,(piece_rise) Flat piece: moved by the horizontal scroll, and filled as a single strip as wide as all its steps (1 + 3 a step, in piece_step_y, and less one into the operand of the LD A,n near the end of landscape_end_pieces).
DA1B AND A
DA1C JR NZ,fill_behind_moving_piece_9
DA1E LD A,(scroll_across)
DA21 NEG
DA23 ADD A,L
DA24 LD L,A
DA25 LD A,(clipped_columns)
DA28 LD B,A
DA29 LD A,$01
DA2B LD (clipped_columns),A
DA2E LD A,(last_step_in_border)
DA31 AND A
DA32 JR Z,fill_behind_moving_piece_6
DA34 LD A,(piece_extra_b)
DA37 AND $7F
DA39 CP $13
DA3B JR NZ,fill_behind_moving_piece_6
DA3D LD A,E
DA3E AND A
DA3F JR Z,fill_behind_moving_piece_6
DA41 LD A,$01
DA43 JR fill_behind_moving_piece_8
fill_behind_moving_piece_6 DA45 LD A,$01
fill_behind_moving_piece_7 DA47 ADD A,$03
DA49 DJNZ fill_behind_moving_piece_7
fill_behind_moving_piece_8 DA4B LD (piece_step_y),A
DA4E DEC A
DA4F LD ($8384),A
fill_behind_moving_piece_9 DA52 LD A,(piece_dx_copy) No step set up and not a wall: moved by the horizontal scroll; a piece that reverses (piece_clip) turns direction_flag round; off a byte boundary the strip is a byte wider.
DA55 AND A
DA56 JP Z,fill_behind_moving_piece_15
DA59 LD A,(IX+$01)
DA5C AND A
DA5D JR NZ,fill_behind_moving_piece_15
DA5F LD A,E
DA60 AND A
DA61 JR Z,fill_behind_moving_piece_10
DA63 LD A,(piece_clip)
DA66 AND A
DA67 JR Z,fill_behind_moving_piece_10
DA69 LD A,H
DA6A CP $1F
DA6C JR NC,fill_behind_moving_piece_11
fill_behind_moving_piece_10 DA6E LD A,(scroll_across)
DA71 NEG
DA73 ADD A,L
DA74 LD L,A
fill_behind_moving_piece_11 DA75 LD A,(piece_clip)
DA78 AND A
DA79 JR Z,fill_behind_moving_piece_15
DA7B CP $01
DA7D JR Z,fill_behind_moving_piece_13
DA7F LD A,(direction_flag)
DA82 CP $01
DA84 JR Z,fill_behind_moving_piece_14
fill_behind_moving_piece_12 DA86 NEG
DA88 LD (direction_flag),A
DA8B JR fill_behind_moving_piece_14
fill_behind_moving_piece_13 DA8D LD A,(direction_flag)
DA90 CP $01
DA92 JR Z,fill_behind_moving_piece_12
fill_behind_moving_piece_14 DA94 LD A,L
DA95 AND $07
DA97 JR Z,fill_behind_moving_piece_15
DA99 LD A,(piece_step_y)
DA9C INC A
DA9D LD (piece_step_y),A
fill_behind_moving_piece_15 DAA0 LD A,(piece_rise) Flat piece: width adjusted for drop caps (landscape_end_pieces).
DAA3 AND A
DAA4 CALL Z,landscape_end_pieces
DAA7 LD B,$00 Screen address of the start; x from $F0 is the character row before.
DAA9 LD A,L
DAAA LD (scratch_count),A
DAAD CP $F0
DAAF JR C,fill_behind_moving_piece_16
DAB1 LD L,B
DAB2 INC B
fill_behind_moving_piece_16 DAB3 CALL pixel_to_screen
DAB6 LD A,L
DAB7 SUB B
DAB8 LD L,A
DAB9 LD A,(piece_step_y) C = width; nudge the start column by the piece's and the scroll's directions.
DABC LD C,A
DABD LD A,(piece_dx_copy)
DAC0 AND A
DAC1 JP Z,fill_behind_moving_piece_21
DAC4 LD A,(piece_rise)
DAC7 AND A
DAC8 JR Z,fill_behind_moving_piece_18
DACA LD A,(IX+$01)
DACD AND A
DACE JP Z,fill_behind_moving_piece_19
DAD1 LD A,(scratch_count)
DAD4 AND $07
DAD6 JP NZ,fill_behind_moving_piece_19
DAD9 LD A,(scroll_across)
DADC AND A
DADD JR Z,fill_behind_moving_piece_17
DADF LD B,A
DAE0 LD A,(scroll_down)
DAE3 XOR B
DAE4 LD B,A
DAE5 LD A,(direction_flag)
DAE8 XOR B
DAE9 BIT 7,A
DAEB JR Z,fill_behind_moving_piece_17
DAED DEC L
DAEE LD A,(scroll_across)
DAF1 BIT 7,A
DAF3 JR Z,fill_behind_moving_piece_17
DAF5 INC L
DAF6 INC L
fill_behind_moving_piece_17 DAF7 JP fill_behind_moving_piece_21
fill_behind_moving_piece_18 DAFA LD A,(IX+$01)
DAFD AND A
DAFE CALL Z,adjust_fill_for_scroll
DB01 JR fill_behind_moving_piece_21
fill_behind_moving_piece_19 DB03 LD A,(piece_rise)
DB06 AND A
DB07 JR Z,fill_behind_moving_piece_21
DB09 LD A,(direction_flag)
DB0C CP $01
DB0E LD A,(scroll_down)
DB11 JR NZ,fill_behind_moving_piece_20
DB13 NEG
fill_behind_moving_piece_20 DB15 BIT 7,A
DB17 JR Z,fill_behind_moving_piece_21
DB19 INC L
fill_behind_moving_piece_21 DB1A EXX B = steps: fill behind them, then on to colouring.
DB1B LD A,(clipped_columns)
DB1E LD B,A
DB1F CALL fill_next_step
DB22 EXX
DB23 JP after_step_drawn_15
Prev: D990 Up: Map Next: DB26