From f05ce5d5ff7d650a439b363993f8b38b817d3efe Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Tue, 11 Mar 2025 16:39:44 +0100 Subject: scroll: Provide an example with sprite 0 collision MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- scroll/include/all.s | 1 + scroll/include/background.s | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) (limited to 'scroll/include') 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. -- cgit v1.2.3