| ← 9695 | Map | 96EB → |
969C: Draw the side border wall
|
Paints the side border wall down the playfield edge opposite the bat.
Every cell it paints is stamped dirty, so the blit blit_dirty_cells carries the wall to the screen.
|
|||
|
Each row takes its two tile codes from the side-wall tile pattern.
|
|||
| draw_side_wall | 969C | LD A,(bat_side) | The bat's side picks the band's edge, and the wall takes the other one. Either edge starts at tile-map row 4. |
| 969F | OR A | ||
| 96A0 | JR Z,draw_side_wall_0 | ||
| 96A2 | LD HL,TILEMAP_BASE+$9E | A non-zero side takes the right edge, column 30. | |
| 96A5 | JR draw_side_wall_1 | ||
| draw_side_wall_0 | 96A7 | LD HL,TILEMAP_BASE+$80 | A zero side takes the left edge, column 0. |
| draw_side_wall_1 | 96AA | PUSH HL | Hold the anchor for the passes below. |
| 96AB | INC H | Point HL' (alternate) at the anchor's own cell in the work buffer, three INC H steps above it. Restore HL to the tile-map anchor, and re-save the anchor for the attribute pass. | |
| 96AC | INC H | ||
| 96AD | INC H | ||
| 96AE | PUSH HL | ||
| 96AF | EXX | ||
| 96B0 | POP HL | ||
| 96B1 | EXX | ||
| 96B2 | POP HL | ||
| 96B3 | PUSH HL | ||
| 96B4 | LD DE,side_wall_tiles | Source: the 36-cell wall pattern, two tile codes per row | |
| 96B7 | LD B,$12 | Walk the wall band's full height. | |
| draw_side_wall_2 | 96B9 | LD A,(DE) | Write the row's two tile codes into the left and right cells and stamp both work-buffer cells dirty. The blit copies a cell while its count is non-zero. |
| 96BA | LD (HL),A | ||
| 96BB | INC HL | ||
| 96BC | INC DE | ||
| 96BD | EXX | ||
| 96BE | LD (HL),$02 | ||
| 96C0 | INC HL | ||
| 96C1 | EXX | ||
| 96C2 | LD A,(DE) | ||
| 96C3 | LD (HL),A | ||
| 96C4 | DEC HL | ||
| 96C5 | INC DE | ||
| 96C6 | EXX | ||
| 96C7 | LD (HL),$02 | ||
| 96C9 | DEC HL | ||
| 96CA | CALL advance_buffer_row | Step the tile-map and work-buffer pointers down one 32-column row each. | |
| 96CD | EXX | ||
| 96CE | CALL advance_buffer_row | ||
| 96D1 | DJNZ draw_side_wall_2 | ||
| 96D3 | POP HL | Reload the anchor and convert it to its attribute-file address once, from the anchor alone. The tile-map page maps to the attribute-file page, and the low byte (cell offset) stays. The per-row step then moves the attribute pointer down rows 4–21. The attribute file is contiguous, so it walks the attribute pages in lockstep with the tile-map pages. | |
| 96D4 | LD A,H | ||
| 96D5 | AND $03 | ||
| 96D7 | RRCA | ||
| 96D8 | RRCA | ||
| 96D9 | RRCA | ||
| 96DA | ADD A,$58 | ||
| 96DC | LD H,A | ||
| 96DD | LD B,$12 | ||
| draw_side_wall_3 | 96DF | LD (HL),$45 | Color the band straight in the attribute file, for all 18 rows. The left column is bright cyan ink on black paper, the right column bright green ink. |
| 96E1 | INC L | ||
| 96E2 | LD (HL),$44 | ||
| 96E4 | DEC L | ||
| 96E5 | CALL advance_buffer_row | ||
| 96E8 | DJNZ draw_side_wall_3 | ||
| 96EA | RET | ||
| ← 9695 | Map | 96EB → |
