![]() |
Routines |
| Prev: E41B | Up: Map | Next: E48B |
|
Used by the routines at after_step_drawn and fill_flat_end_column.
Called by after_step_drawn once a piece is drawn, to fill what lies beneath it with the ground's checkerboard (DE = $55AA) or to clear it (DE = 0), and by fill_flat_end_column to clear a column four rows deep. Each column is one byte wide and climbs from HL for C pairs of rows: D is written on one pixel row and E on the row above. After each column L moves on by the piece's width in bytes (piece_dcolumn), and piece_page_y, the screen row the fill has reached, goes up by the column's height. B, the number of columns, is the number of steps of the piece drawn (piece_steps_done), so this is one column a step, each the step's width in bytes across and as tall as the fill needs, which is how the ground under a slope comes out solid.
A column is clipped to the play area: one in screen column 0 or 29 to 31 is not drawn at all (the pointer is only moved on); if the fill starts below row 183 ($B7, the bottom of the play area) the first rows are dropped and it starts at the bottom row of the play area; and near the top it is cut short by what the sum with piece_rows (the piece's height) and 24 says. The arithmetic of the top clip is read but not traced through.
|
||||||||||||||
| fill_under_slope | E41C | EXX | Into the other set: B counts this column's pairs of rows | |||||||||||
| E41D | LD B,C | |||||||||||||
| E41E | LD A,L | Off the play area (column 0, or 29 and up)? Only move on | ||||||||||||
| E41F | AND $1F | |||||||||||||
| E421 | DEC A | |||||||||||||
| E422 | CP $1C | |||||||||||||
| E424 | JR NC,fill_under_slope_3 | |||||||||||||
| E426 | LD A,(piece_page_y) | Does the fill start below the play area (row 184 or more)? | ||||||||||||
| E429 | CP $B8 | |||||||||||||
| E42B | JR C,fill_under_slope_0 | |||||||||||||
| E42D | JR Z,fill_under_slope_0 | |||||||||||||
| E42F | SUB $B7 | Then drop the rows that would lie below it | ||||||||||||
| E431 | SRL A | |||||||||||||
| E433 | NEG | |||||||||||||
| E435 | ADD A,B | |||||||||||||
| E436 | LD B,A | |||||||||||||
| E437 | LD H,$57 | And start on the play area's bottom row, $57C0 + the column | ||||||||||||
| E439 | LD A,L | |||||||||||||
| E43A | AND $1F | |||||||||||||
| E43C | OR $C0 | |||||||||||||
| E43E | LD L,A | |||||||||||||
| E43F | JP fill_under_slope_1 | |||||||||||||
| fill_under_slope_0 | E442 | LD B,A | Will the column reach above the top of the play area? | |||||||||||
| E443 | LD A,(piece_rows) | |||||||||||||
| E446 | NEG | |||||||||||||
| E448 | ADD A,B | |||||||||||||
| E449 | SUB $18 | |||||||||||||
| E44B | LD B,C | |||||||||||||
| E44C | JR NC,fill_under_slope_1 | |||||||||||||
| E44E | CPL | Then shorten it | ||||||||||||
| E44F | SRL A | |||||||||||||
| E451 | NEG | |||||||||||||
| E453 | ADD A,B | |||||||||||||
| E454 | LD B,A | |||||||||||||
| fill_under_slope_1 | E455 | LD A,(piece_page_y) | piece_page_y goes up by the column's height (two rows a pair) | |||||||||||
| E458 | SLA C | |||||||||||||
| E45A | SUB C | |||||||||||||
| E45B | SRL C | |||||||||||||
| E45D | LD (piece_page_y),A | |||||||||||||
| fill_under_slope_2 | E460 | LD (HL),D | Fill the column: D, up a row, E, up a row | |||||||||||
| E461 | DEC H | |||||||||||||
| E462 | LD (HL),E | |||||||||||||
| E463 | CALL line_up_hl | |||||||||||||
| E466 | DJNZ fill_under_slope_2 | |||||||||||||
| E468 | LD A,(piece_dcolumn) | On to the next column, by the piece's width in bytes | ||||||||||||
| E46B | ADD A,L | |||||||||||||
| E46C | LD L,A | |||||||||||||
| E46D | EXX | The next column | ||||||||||||
| E46E | DJNZ fill_under_slope | |||||||||||||
| E470 | RET | |||||||||||||
| fill_under_slope_3 | E471 | LD A,(piece_page_y) | A column off the play area: account for its height and step across | |||||||||||
| E474 | SLA B | |||||||||||||
| E476 | SUB B | |||||||||||||
| E477 | SRL B | |||||||||||||
| E479 | LD (piece_page_y),A | |||||||||||||
| E47C | LD A,(piece_dcolumn) | |||||||||||||
| E47F | ADD A,L | |||||||||||||
| E480 | LD L,A | |||||||||||||
| fill_under_slope_4 | E481 | DEC H | Move HL up by its height without drawing | |||||||||||
| E482 | CALL line_up_hl | |||||||||||||
| E485 | DJNZ fill_under_slope_4 | |||||||||||||
| E487 | EXX | The next column | ||||||||||||
| E488 | DJNZ fill_under_slope | |||||||||||||
| E48A | RET | |||||||||||||
| Prev: E41B | Up: Map | Next: E48B |