diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-03-11 16:39:44 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-03-11 16:39:44 +0100 |
| commit | f05ce5d5ff7d650a439b363993f8b38b817d3efe (patch) | |
| tree | 6d324e019650b1936d84e3c0935192e1fb7cbb72 /scroll/include | |
| parent | 4795fcad304087a9308e024a25233873c43501be (diff) | |
| download | code.nes-f05ce5d5ff7d650a439b363993f8b38b817d3efe.tar.gz code.nes-f05ce5d5ff7d650a439b363993f8b38b817d3efe.zip | |
scroll: Provide an example with sprite 0 collision
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'scroll/include')
| -rw-r--r-- | scroll/include/all.s | 1 | ||||
| -rw-r--r-- | scroll/include/background.s | 17 |
2 files changed, 15 insertions, 3 deletions
diff --git a/scroll/include/all.s b/scroll/include/all.s index e9f059d..763feb4 100644 --- a/scroll/include/all.s +++ b/scroll/include/all.s @@ -6,6 +6,7 @@ .include "ppu.s" .include "../../shared/asm.s" .include "../../shared/joypad.s" +.include "../../shared/ppu.s" .include "reset.s" .include "palettes.s" diff --git a/scroll/include/background.s b/scroll/include/background.s index f392792..69725fd 100644 --- a/scroll/include/background.s +++ b/scroll/include/background.s @@ -27,6 +27,15 @@ DISABLED_BACKGROUND_CYCLE = $FE BACKGROUND_CYCLE_MAX = $02 + ;; The offset for metatile rows. That is, from where should the engine start + ;; counting rows of metatiles. By default it's 0, but it could be set to + ;; something else to reserve so top space for a HUD or something similar. + ;; + ;; NOTE: configurable. + .ifndef BACKGROUND_ROW_OFFSET + BACKGROUND_ROW_OFFSET = 0 + .endif + ;; Current column (or the next to be loaded by functions like ;; `load_column`). zp_cur_column = $75 @@ -51,9 +60,11 @@ lda #$00 sta zp_scroll sta Buffer::zp_vram_idx - sta zp_cur_row sta zp_cur_column + lda #BACKGROUND_ROW_OFFSET + sta zp_cur_row + rts .endproc @@ -112,7 +123,7 @@ ;; Increase the column being used and loop if we are not at the end of ;; the screen yet. - lda #0 + lda #BACKGROUND_ROW_OFFSET sta zp_cur_row inc zp_cur_column lda zp_cur_column @@ -418,7 +429,7 @@ ;; screen/level by poking the right flags. .proc prepare_next_column ;; The row index always has to be set to zero. - lda #0 + lda #BACKGROUND_ROW_OFFSET sta zp_cur_row ;; Is this the last column? If not, just quit. |
