From 3e7549c71f60ee1c4b49a7c09fde3b6017818089 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Tue, 4 Feb 2025 15:46:54 +0100 Subject: Ensure background/sprite tiles are spread properly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit At least on the MMC3 chip, it's important to have background tiles on the first pattern table and then sprite tiles on the second pattern table. This avoids a hardware bug on scanline IRQs. Signed-off-by: Miquel Sabaté Solà --- scroll/roulette.s | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'scroll/roulette.s') diff --git a/scroll/roulette.s b/scroll/roulette.s index ecf2569..4b13c22 100644 --- a/scroll/roulette.s +++ b/scroll/roulette.s @@ -1,6 +1,6 @@ ;;; ;; Divide the screen in three rows and make them move in different -;; directions/speed. This is achieved thanks to the MMC3 chip (check the +;; directions/speed. This is achieved thanks to the MMC3 chip (check ;; `fx/blink.s` for further information on this chip). In particular, we are ;; using the scanline IRQ mechanism provided by this chip to react to different ;; parts of the screen being rendered: @@ -208,7 +208,7 @@ reset: ;; NOTE: enable back interrupts so we can set them up later on `nmi` code. cli - lda #%10010000 + lda #%10001000 sta $2000 lda #%00011110 sta $2001 @@ -386,9 +386,9 @@ nmi: ldx #$00 stx MMC3::IRQ_DISABLE - ;; The screen is made up of 240 scan lines. Since we are dividing the screen - ;; by 3: 240 / 3 = 80. Hence, the next IRQ should happen on scanline 80, - ;; where we would need to update the scroll value through the + ;; The screen is made up of 240 visible scan lines. Since we are dividing + ;; the screen by 3: 240 / 3 = 80. Hence, the next IRQ should happen on + ;; scanline 80, where we would need to update the scroll value through the ;; `{center/bottom}_scroll` values instead. Moreover, note that ;; `MMC3::IRQ_ENABLE` accepts any value, so the same value as the two other ;; registers is just fine. @@ -493,15 +493,12 @@ irq: rti -;;; NOTE: pretty much the same as `fx/blink.s` but we also copy the same data on -;;; the second pattern table as that's the one being used for background -;;; elements. +;;; NOTE: pretty much the same as `fx/blink.s`. .segment "CHARS" .incbin "../assets/diskun0.chr" .incbin "../assets/diskun1.chr" -.incbin "../assets/diskun0.chr" -.incbin "../assets/diskun1.chr" +.res $1000, $00 ;; The 15 other 8KB portions are left empty. .res $2000, $00 -- cgit v1.2.3