![]() |
Routines |
| Prev: D588 | Up: Map | Next: D703 |
|
Used by the routines at landscape_step_loop, set_right_clip_columns, slope_lose_last_column, use_mirrored_right_clip, slope_step_at_left_edge and flat_step_clip.
The draw shared by every direction, reached from landscape_step_loop, set_right_clip_columns, slope_lose_last_column, use_mirrored_right_clip, slope_step_at_left_edge and flat_step_clip (which jumps into it past the first lines with DE already holding a cap's graphic offset). It turns the variant into a graphic address and loads SP with it. If the step hangs below the play area (piece_y from $B8) it pops the rows below the edge away and starts at the bottom row; if it reaches above the top it shortens the row count (and, for a slope, cuts the piece short, since pieces only climb). Then the JR at the end, whose displacement was set to 0, 2, 5, 8 or 11 (0 by landscape_step_loop, the others by the clipping set-ups), lands on one of the five jumps at step_dispatch: the step's own blitter (IY) or one of the four edge-clipping blitters.
Every blitter is entered with A = row pairs to draw, HL = the screen address less the step's byte advance, SP = the first graphic byte, and ends by jumping to after_step_drawn with HL where the next step will start.
|
||||||||||
| draw_step | D672 | LD A,E | Normal graphic: the offset from this direction's variant row (piece_offsets + 2 * variant). | |||||||
| D673 | EXX | |||||||||
| D674 | LD HL,(piece_offsets) | |||||||||
| D677 | LD E,A | |||||||||
| D678 | SLA E | |||||||||
| D67A | LD D,$00 | |||||||||
| D67C | ADD HL,DE | |||||||||
| D67D | LD E,(HL) | |||||||||
|
This entry point is used by the routine at flat_step_clip.
|
||||||||||
| draw_step_0 | D67E | LD HL,(piece_graphic) | SP = the step's graphic. (A cap's offset joins here.) | |||||||
| D681 | ADD HL,DE | |||||||||
| D682 | LD SP,HL | |||||||||
| D683 | LD A,(half_rows) | E = row pairs. Does the step hang below the play area (piece_y from $B8)? | ||||||||
| D686 | LD E,A | |||||||||
| D687 | LD A,(piece_y) | |||||||||
| D68A | CP $B8 | |||||||||
| D68C | JP C,draw_step_3 | |||||||||
| D68F | SUB $B7 | It does: lose half the overhang in row pairs, and pop those rows of the graphic away (D POPs a row pair: the byte advance, plus one for a sloped step off a byte boundary). | ||||||||
| D691 | LD B,A | |||||||||
| D692 | SRL B | |||||||||
| D694 | LD A,E | |||||||||
| D695 | SUB B | |||||||||
| D696 | LD E,A | |||||||||
| D697 | LD A,(piece_step_y) | |||||||||
| D69A | LD D,A | |||||||||
| D69B | LD A,(piece_rise) | |||||||||
| D69E | AND A | |||||||||
| D69F | JR Z,draw_step_1 | |||||||||
| D6A1 | LD A,(IX+$00) | |||||||||
| D6A4 | AND $07 | |||||||||
| D6A6 | JR Z,draw_step_1 | |||||||||
| D6A8 | INC D | |||||||||
| draw_step_1 | D6A9 | LD A,D | ||||||||
| draw_step_2 | D6AA | POP HL | ||||||||
| D6AB | DEC A | |||||||||
| D6AC | JR NZ,draw_step_2 | |||||||||
| D6AE | DJNZ draw_step_1 | |||||||||
| D6B0 | LD H,$57 | Start at the play area's bottom row (pixel row $B7) in the step's column. | ||||||||
| D6B2 | LD A,(column_address) | |||||||||
| D6B5 | LD L,A | |||||||||
| D6B6 | LD A,(piece_dcolumn) | |||||||||
| D6B9 | ADD A,L | |||||||||
| D6BA | AND $1F | |||||||||
| D6BC | OR $C0 | |||||||||
| D6BE | LD L,A | |||||||||
| D6BF | LD A,(piece_dcolumn) | |||||||||
| D6C2 | NEG | |||||||||
| D6C4 | ADD A,L | |||||||||
| D6C5 | LD L,A | |||||||||
| D6C6 | LD A,($D702) | For the mirrored left-clipping blitter a column past 28 belongs to the character row above. | ||||||||
| D6C9 | CP $0B | |||||||||
| D6CB | JP NZ,draw_step_6 | |||||||||
| D6CE | LD A,L | |||||||||
| D6CF | CP $DD | |||||||||
| D6D1 | JP C,draw_step_6 | |||||||||
| D6D4 | LD A,L | |||||||||
| D6D5 | SUB $20 | |||||||||
| D6D7 | LD L,A | |||||||||
| D6D8 | JP draw_step_6 | |||||||||
| draw_step_3 | D6DB | LD B,A | Not below: does the step reach above the top row ($18)? | |||||||
| D6DC | LD A,(piece_rows) | |||||||||
| D6DF | NEG | |||||||||
| D6E1 | ADD A,B | |||||||||
| D6E2 | SUB $18 | |||||||||
| D6E4 | JP NC,draw_step_5 | |||||||||
| D6E7 | CPL | It does: shorten it; a slope's piece is cut to at most one more step (C' = 2 unless already 1). | ||||||||
| D6E8 | SRL A | |||||||||
| D6EA | NEG | |||||||||
| D6EC | ADD A,E | |||||||||
| D6ED | LD E,A | |||||||||
| D6EE | LD A,(piece_rise) | |||||||||
| D6F1 | AND A | |||||||||
| D6F2 | JR Z,draw_step_5 | |||||||||
| D6F4 | EXX | |||||||||
| D6F5 | LD A,C | |||||||||
| D6F6 | CP $01 | |||||||||
| D6F8 | JR Z,draw_step_4 | |||||||||
| D6FA | LD C,$02 | |||||||||
| draw_step_4 | D6FC | EXX | ||||||||
| draw_step_5 | D6FD | LD HL,(column_address) | HL = the screen address kept for this step. | |||||||
| draw_step_6 | D700 | LD A,E | A = row pairs to draw. | |||||||
| draw_step_7 | D701 | JR draw_step_7 | Patched dispatch: displacement 0, 2, 5, 8 or 11 lands on one of the five jumps that follow. | |||||||
| Prev: D588 | Up: Map | Next: D703 |