I thought i had this down. It's a bit embarrasing. I've managed sprites on their own, and backgrounds on their own. The aim is a simple still picture comprised of both sprite and bg layer.
My include list looks like this:
Palette is hardcoded for now.
BG loading code looks like this:
This this seems to put the NT where i want it (i can tell by the attribute table), but not the pattern table. If i change PPU addr to $0000 via sty PPUADDR sty PPUADDR (the way i had it originally), i can get the pattern but not the attribute/name table. What have i done to not get both?
My include list looks like this:
Code:
.segment "CHRROM"
.incbin "spritesheet.chr" ;4k
.incbin "bgsheet.chr" ;4k
.incbin "nametable.nam" ;1k
.incbin "spritesheet.chr" ;4k
.incbin "bgsheet.chr" ;4k
.incbin "nametable.nam" ;1k
Palette is hardcoded for now.
BG loading code looks like this:
Code:
lda #$90 ; CPU addr $8000+ 4kB offset
sta ptr+1
sty ptr+0 ;y reg is known to be zero
lda #$10 ;headache be here, i think?
sta PPUADDR
sty PPUADDR
ldx #20 ; + 20 pages' worth - 16 for bg chr and 4 for nt
loop:
lda (ptr), y
sta PPUDATA
iny
bne loop ; done a page yet? (y reg)
inc ptr+1
dex
bne loop ; done all pages yet? (x reg)
sta ptr+1
sty ptr+0 ;y reg is known to be zero
lda #$10 ;headache be here, i think?
sta PPUADDR
sty PPUADDR
ldx #20 ; + 20 pages' worth - 16 for bg chr and 4 for nt
loop:
lda (ptr), y
sta PPUDATA
iny
bne loop ; done a page yet? (y reg)
inc ptr+1
dex
bne loop ; done all pages yet? (x reg)
This this seems to put the NT where i want it (i can tell by the attribute table), but not the pattern table. If i change PPU addr to $0000 via sty PPUADDR sty PPUADDR (the way i had it originally), i can get the pattern but not the attribute/name table. What have i done to not get both?