![]() |
Routines |
| Prev: D703 | Up: Map | Next: D851 |
|
Used by the routines at blit_right_clip, blit_left_clip, blit_mirrored_left_clip, blit_mirrored_right_clip, blit_one, blit_three, blit_two, blit_mirror_three, blit_mirror_two and blit_mirror_one.
Every step blitter ends with JP after_step_drawn (HL = where the next step starts); the flat-step blitter blit_flat_step stores column_address itself and comes back to the second instruction. edge_column and column_clipped come in further down, at the step counters, for steps handled at the edges.
When a piece's last step is done the stack is put back at stack_top. That address is hard-wired: the landscape is always reached by the play loop's CALL ship_pass (2 bytes), its PUSH IY (2) and the CALL draw_landscape in scroll_landscape (2), below the game's stack top; the fly-in in start_landscape reaches it at the same depth (its CALL, a PUSH BC, the CALL).
Then what lies behind the moving landscape is repaired. The screen is never cleared: the sky is black and the inside of the ground is a $55/$AA checker, and both look the same after a move of two pixels either way, which is why the landscape scrolls in steps of two. Only the strips a moving edge uncovers need painting. Across: when the fine horizontal position comes back to a byte boundary each step has just moved into the next byte column, leaving its old one behind; a sloped piece gets that column filled step by step by fill_under_slope, with the checker ($55AA) or black (0) chosen by the scroll's direction, the piece's direction and whether it is a ceiling (piece_ceiling); a flat piece's drop ends are done by fill_flat_end_column. Up and down: if the landscape moved vertically (scroll_down), fill_behind_moving_piece fills the rows behind every drawn step. Then colour_piece colours the piece.
Then the next piece of this map cell begins (back in draw_landscape); when the cell's pieces are done, the next of the four map cells (ground_cell 0 to 3: upper-left, lower-left, upper-right, lower-right) follows, with the drawing origin moved down a cell (origin_y + $A0) or back up (origin_y + $60, i.e. - $A0), and right a cell (origin_x - $20, i.e. + $E0) for the right-hand pair. After the fourth, origin_x is put back and the landscape is done. draw_landscape jumps to both of those places too.
|
||||||||
| after_step_drawn | D711 | LD (column_address),HL | Keep it. | |||||
|
This entry point is used by the routine at flat_blit_upper_row.
|
||||||||
| after_step_drawn_0 | D714 | EXX | Count the step as drawn (D'). The flat-step blitter returns here. | |||||
| D715 | INC D | |||||||
|
This entry point is used by the routines at edge_column and flat_step_clip.
|
||||||||
| after_step_drawn_1 | D716 | LD A,(piece_steps_done) | Count it in piece_steps_done and clipped_columns too. | |||||
| D719 | INC A | |||||||
| D71A | LD (piece_steps_done),A | |||||||
| D71D | LD A,(clipped_columns) | |||||||
| D720 | INC A | |||||||
| D721 | LD (clipped_columns),A | |||||||
|
This entry point is used by the routines at column_clipped, column_at_view_left, column_at_view_right, landscape_step_loop and flat_step_clip.
|
||||||||
| after_step_drawn_2 | D724 | INC HL | Next step: its variant byte, one fewer to go. | |||||
| D725 | DEC C | |||||||
| D726 | JP NZ,landscape_step_loop | |||||||
| D729 | LD (IX+$02),D | Steps drawn, into the current-piece record. | ||||||
| D72C | LD SP,stack_top | Take the stack back from the blitters: always stack_top, the depth the landscape is called at. | ||||||
| D72F | CALL draw_flat_end_lip | A flat piece's end lip (draw_flat_end_lip). | ||||||
| D732 | LD A,(piece_steps_done) | Column fill only if steps were drawn and the fine horizontal position is on a byte boundary. | ||||||
| D735 | AND A | |||||||
| D736 | JP Z,after_step_drawn_14 | |||||||
| D739 | LD A,(origin_x) | |||||||
| D73C | AND $07 | |||||||
| D73E | JP NZ,after_step_drawn_14 | |||||||
| D741 | LD (touch_depth),A | No horizontal scroll: a flat piece needs nothing; a sloped one is filled anyway, with a scroll direction made up from its own direction (direction_flag, flipped by the ceiling flag piece_ceiling for a slope) and taken away afterwards (touch_depth says to). | ||||||
| D744 | LD A,(scroll_across) | |||||||
| D747 | AND A | |||||||
| D748 | JP NZ,after_step_drawn_4 | |||||||
| D74B | LD A,(piece_rise) | |||||||
| D74E | AND A | |||||||
| D74F | JP Z,after_step_drawn_14 | |||||||
| D752 | LD (touch_depth),A | |||||||
| D755 | LD A,(direction_flag) | |||||||
| D758 | LD B,A | |||||||
| D759 | LD A,(piece_dx_copy) | |||||||
| D75C | AND A | |||||||
| D75D | JR Z,after_step_drawn_3 | |||||||
| D75F | LD A,(piece_ceiling) | |||||||
| after_step_drawn_3 | D762 | XOR B | ||||||
| D763 | LD (scroll_across),A | |||||||
| after_step_drawn_4 | D766 | LD A,(piece_rise) | Flat piece: fill_flat_end_column. | |||||
| D769 | AND A | |||||||
| D76A | JP Z,fill_flat_end_column | |||||||
| D76D | EXX | Start from the piece's first step (first_step_address, its y from first_step_y). A vertical wall is not a ceiling here, and moves a byte against its direction. | ||||||
| D76E | LD HL,(first_step_address) | |||||||
| D771 | LD A,(first_step_y) | |||||||
| D774 | LD (piece_page_y),A | |||||||
| D777 | LD A,(piece_dx_copy) | |||||||
| D77A | AND A | |||||||
| D77B | JR NZ,after_step_drawn_5 | |||||||
| D77D | LD (piece_ceiling),A | |||||||
| D780 | LD A,(direction_flag) | |||||||
| D783 | NEG | |||||||
| D785 | LD (piece_dcolumn),A | |||||||
| after_step_drawn_5 | D788 | LD DE,$55AA | DE = the checker, or black if scroll direction, ceiling flag and piece direction say the uncovered side is sky. | |||||
| D78B | LD A,(scroll_across) | |||||||
| D78E | LD B,A | |||||||
| D78F | LD A,(piece_ceiling) | |||||||
| D792 | XOR B | |||||||
| D793 | LD B,A | |||||||
| D794 | LD A,(direction_flag) | |||||||
| D797 | XOR B | |||||||
| D798 | BIT 7,A | |||||||
| D79A | JR Z,after_step_drawn_6 | |||||||
| D79C | LD DE,$0000 | |||||||
| after_step_drawn_6 | D79F | LD A,(direction_flag) | The column to fill: just left of the piece, or past its steps, by direction. | |||||
| D7A2 | CP $FF | |||||||
| D7A4 | JR Z,after_step_drawn_8 | |||||||
| D7A6 | LD A,(scroll_across) | |||||||
| D7A9 | BIT 7,A | |||||||
| D7AB | JR NZ,after_step_drawn_7 | |||||||
| D7AD | DEC L | |||||||
| D7AE | JP after_step_drawn_11 | |||||||
| after_step_drawn_7 | D7B1 | LD A,(piece_step_y) | ||||||
| D7B4 | ADD A,L | |||||||
| D7B5 | LD L,A | |||||||
| D7B6 | JP after_step_drawn_9 | |||||||
| after_step_drawn_8 | D7B9 | LD A,(scroll_across) | ||||||
| D7BC | BIT 7,A | |||||||
| D7BE | JR NZ,after_step_drawn_10 | |||||||
| D7C0 | DEC L | |||||||
| after_step_drawn_9 | D7C1 | JP after_step_drawn_11 | ||||||
| after_step_drawn_10 | D7C4 | LD A,(piece_dcolumn) | ||||||
| D7C7 | ADD A,L | |||||||
| D7C8 | LD L,A | |||||||
| after_step_drawn_11 | D7C9 | LD A,(piece_dx_copy) | A wall is filled as one column, 16 rows a step tall. | |||||
| D7CC | AND A | |||||||
| D7CD | JR NZ,after_step_drawn_13 | |||||||
| D7CF | LD A,(piece_steps_done) | |||||||
| D7D2 | LD B,A | |||||||
| D7D3 | XOR A | |||||||
| after_step_drawn_12 | D7D4 | ADD A,$10 | ||||||
| D7D6 | DJNZ after_step_drawn_12 | |||||||
| D7D8 | LD (piece_rows),A | |||||||
| D7DB | LD A,$01 | |||||||
| D7DD | LD (piece_steps_done),A | |||||||
| after_step_drawn_13 | D7E0 | LD A,(piece_rows) | C = row pairs a step, B = steps: fill (fill_under_slope). | |||||
| D7E3 | SRL A | |||||||
| D7E5 | LD C,A | |||||||
| D7E6 | EXX | |||||||
| D7E7 | LD A,(piece_steps_done) | |||||||
| D7EA | LD B,A | |||||||
| D7EB | CALL fill_under_slope | |||||||
| D7EE | LD A,(touch_depth) | Take away a made-up scroll direction. | ||||||
| D7F1 | AND A | |||||||
| D7F2 | JR Z,after_step_drawn_14 | |||||||
| D7F4 | XOR A | |||||||
| D7F5 | LD (scroll_across),A | |||||||
|
This entry point is used by the routine at fill_flat_end_column.
|
||||||||
| after_step_drawn_14 | D7F8 | EXX | Vertical scroll this pass and steps drawn: fill the rows behind (fill_behind_moving_piece). | |||||
| D7F9 | LD A,(scroll_down) | |||||||
| D7FC | AND A | |||||||
| D7FD | JR Z,after_step_drawn_15 | |||||||
| D7FF | LD A,(clipped_columns) | |||||||
| D802 | AND A | |||||||
| D803 | JP NZ,fill_behind_moving_piece | |||||||
|
This entry point is used by the routine at fill_behind_moving_piece.
|
||||||||
| after_step_drawn_15 | D806 | CALL colour_piece | Colour the piece (colour_piece). | |||||
| D809 | EXX | |||||||
|
This entry point is used by the routine at draw_landscape.
|
||||||||
| after_step_drawn_16 | D80A | LD SP,stack_top | Stack back to stack_top; the next piece, if any are left in this map cell (pieces_left). draw_landscape jumps here for a piece it skips. | |||||
| D80D | LD HL,(next_piece) | |||||||
| D810 | LD A,(pieces_left) | |||||||
| D813 | DEC A | |||||||
| D814 | LD (pieces_left),A | |||||||
| D817 | JP NZ,draw_landscape_7 | |||||||
|
This entry point is used by the routine at draw_landscape.
|
||||||||
| after_step_drawn_17 | D81A | LD A,(ground_cell) | Next map cell of the window. draw_landscape jumps here for an empty cell. | |||||
| D81D | INC A | |||||||
| D81E | LD (ground_cell),A | |||||||
| D821 | CP $04 | |||||||
| D823 | JR Z,after_step_drawn_19 | |||||||
| D825 | BIT 0,A | Origin down a cell for a lower one, back up for an upper one. | ||||||
| D827 | LD B,$60 | |||||||
| D829 | JR Z,after_step_drawn_18 | |||||||
| D82B | LD B,$A0 | |||||||
| after_step_drawn_18 | D82D | LD A,(origin_y) | ||||||
| D830 | ADD A,B | |||||||
| D831 | LD (origin_y),A | |||||||
| D834 | LD A,(ground_cell) | Origin right a cell for the right-hand pair. | ||||||
| D837 | CP $02 | |||||||
| D839 | JP NZ,draw_landscape_2 | |||||||
| D83C | LD B,$20 | |||||||
| D83E | LD A,(origin_x) | |||||||
| D841 | SUB B | |||||||
| D842 | LD (origin_x),A | |||||||
| D845 | JP draw_landscape_2 | |||||||
| after_step_drawn_19 | D848 | LD A,(origin_x) | Done: horizontal origin put back. | |||||
| D84B | ADD A,$20 | |||||||
| D84D | LD (origin_x),A | |||||||
| D850 | RET | |||||||
| Prev: D703 | Up: Map | Next: D851 |