I just finished to implement infinite scrolling yeah ! after 15 hours of headache.
NOW i want split scroll of course ( the bottom part NOT moving at all ).
Any ideass??
https://www.nesdev.org/wiki/PPU_scrolli ... 2FY_scroll
is it the right article? so complicated to read.
Code:
OFFSET_BACKGROUND_HORIZONTAL:;; Clear PPU address registers (only when needed, after scroll update);LDA #$00;STA PPU_VRAM_ADDR;STA PPU_VRAM_ADDR; Set initial scroll to 0 for the static status barLDA #$00STA PPU_SCROLL ; Horizontal scrollSTA PPU_SCROLL ; Vertical scroll;; Wait for Sprite 0 hit to clear (from the previous frame)WaitNotSprite0:LDA PPU_STATUS ; Read PPU status registerAND #%01000000 ; Check sprite 0 hit flag (bit 6)BNE WaitNotSprite0 ; Wait until sprite 0 hit flag is cleared;; Wait for Sprite 0 to be hitWaitSprite0:LDA PPU_STATUS ; Read PPU status registerAND #%01000000 ; Check sprite 0 hit flag (bit 6)BEQ WaitSprite0 ; Wait until sprite 0 hit flag is set; Small delay to let the scanline finish drawingLDX #$20 ; Adjust delay for timingWaitScanline:DEXBNE WaitScanline; Increment and apply infinite horizontal scroll for the backgroundINC offset_value ; Increment horizontal scroll variableLDA offset_valueSTA PPU_SCROLL ; Write horizontal scroll register (horizontal scroll)LDA #$00 ; No vertical scrollingSTA PPU_SCROLL ; Write vertical scroll register;; Check if offset_value has wrapped to $00LDA offset_valueCMP #$00 ; Compare offset_value to $00BNE SKIPNAMETABLEUPDATE ; If not $00, skip nametable update; Toggle nametable between 00 and 11LDA toggle_flagCMP #$01BNE set_nametable00; Set nametable to 11 (bits 0 and 1 = 11)set_nametable11:LDA #%10010011STA PPU_CTRL ; Update PPU control registerLDA #$00 ; Reset toggle flagSTA toggle_flag ; Update toggle flagRTSset_nametable00:; Set nametable to 00 (bits 0 and 1 = 00)LDA #%10010000STA PPU_CTRL ; Update PPU control registerLDA #$01 ; Set toggle flag to 1STA toggle_flag ; Update toggle flagRTSSKIPNAMETABLEUPDATE: ;; Return from su
Any ideass??
https://www.nesdev.org/wiki/PPU_scrolli ... 2FY_scroll
is it the right article? so complicated to read.
Statistics: Posted by v.depatie — Thu Jan 16, 2025 12:47 am — Replies 2 — Views 69