I am attempting to render background tiles from the cc65 neschar.s, and on startup in FCEUX all I see is a blank background, whereas in the Name Table Viewer I see the expected tiles.
Can someone please explain why the background tiles are not being rendered? Thank you.
Code:
.segment "HEADER".byte "NES" ; The beginning of the HEADER of iNES header.byte $1a ; Signature of iNES header that the emulator will look for.byte $02 ; 2 * 16KB PRG (program) ROM.byte $01 ; 1 * 8KB CHR ROM .byte %00000000 ; mapper and mirroring - no mapper here due to no bank switching, no mirroring - using binary as it's easier to control.byte $0 .byte $0.byte $0.byte $0.byte $0, $0, $0, $0, $0 ; unused.segment "ZEROPAGE".segment "STARTUP".segment "CODE"hello_str: .asciiz "Hello, NES!"RESET:SEI ; disable IRQsCLD ; disable decimal modeLDX #$40STX $4017 ; disable APU frame counter IRQ - disable soundLDX #$ffTXS ; setup stack starting at FF as it decrements instead of incrementingINX ; overflow X reg to $00STX $2000 ; disable NMI - PPUCTRL regSTX $2001 ; disable rendering - PPUMASK regSTX $4010 ; disable DMC IRQsvblankwait1: ; wait for vblank to make sure PPU is readyBIT $2002 ; returns bit 7 of ppustatus reg, which holds the vblank status with 0 being no vblank, 1 being vblankBPL vblankwait1clearmem:LDA #$00STA $0000, xSTA $0100, xSTA $0300, xSTA $0400, xSTA $0500, xSTA $0600, xSTA $0700, xLDA #$feSTA $0200, x ; Set aside space in RAM for sprite dataINX BNE clearmemvblankwait2: ; PPU is ready after thisBIT $2002BPL vblankwait2initpalette:LDA $2002 ; read PPU status to reset PPU addressLDA #$3F ; Set PPU address to BG palette RAM ($3F00)STA $2006LDA #$00STA $2006LDX #4 ; Loop 4 times:STX $2007DEXBNE :-print_hello:LDA #$20STA $2006LDA #$F0STA $2006LDX #0string_loop:LDA hello_str,xBEQ set_paletteSTA $2007INXJMP string_loopset_palette:LDA #$23STA $2006LDA #$C0STA $2006LDA #0LDX #64attr_loop:STA $2007DEXBNE attr_loopLDA #0STA $2005STA $2005LDA %00001000 ; background enabledSTA $2001forever:JMP forever ; an infinite loop when init code is run;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;NMI:PHALDA #0STA $2005STA $2005LDA %00001000 ; background enabledSTA $2001PLARTI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;.segment "VECTORS".word NMI.word RESET.word 0.include "neschar.s"
Statistics: Posted by FestiveMagic — Wed Nov 06, 2024 4:19 pm — Replies 0 — Views 51