Quantcast
Channel: nesdev.org
Viewing all articles
Browse latest Browse all 746

Dynamic Palette Update Changes Scrolling

$
0
0
Hello all,

Longtime lurker here, but fairly new to NES development. I'm working on a game where I want the palette to dynamically change after the player scores a point (not a lot going on so I'm executing the code during V-blank, not anything fancy like H-blank). The code does what I want except it messes with the scroll and shifts the screen a seemingly arbitrary amount the first time the code runs. I thought scroll happened with writes to $2005 so I'm really confused why this behavior is present, so any insight would be appreciated. Thanks!

Code:

update_dynamic_palette:        ;setup dynamic palette        lda palette1        ;Check to loop back to blue and skip monochrome colors        cmp #$0C                bcc +        lda #$01        sta palette1        +        inc palette1        lda palette1        adc #$10        sta palette2        adc #$10        sta palette3               ;read PPU to reset latch        lda $2002         ;set PPU address        lda #$3F        ldx #$00        sta $2006        stx $2006        ;load first palette from palette variables        lda #$3F        sta $2007        lda palette1        sta $2007        lda palette2        sta $2007        lda palette3        sta $2007        rts

Statistics: Posted by prototype6 — Sun Apr 07, 2024 10:51 am — Replies 1 — Views 98



Viewing all articles
Browse latest Browse all 746

Trending Articles