I'm bashing my head against ASM at the moment, (using ASM6 to assemble) and I'd like to reach out and thank those who have given in depth responses. I'm very competent in high level languages such as javascript and C# for development, and generally get the logic in ASM after a few days of muscling through.
The new monster is nametables. Literally, I can not update my code to show a background. Even doing it the longhand way is giving me some unexpected results. I thought creating a .nam file from a capable program and using a loop to load it would work, but so far...nothing. I'm successfully .incbin-ing .chr files and .pal files, so I'm making the assumption the .nam file is loading just dandy, too...but I'll be damned if I can get anything to draw to the screen no matter what I try.
Sprites are showing. Palettes are correct. Just no background. I'm stumped and I'm going crosseyed playing with it, so hopefully someone can demonstrate my (probably very obvious) mistake(s).
Here's my very general process:
I fully, humbly admit that I may have some dramatic misconceptions about things, but man...I feel like I was really getting it very well and then bam...hit a brick wall, and despite scouring and experimenting with advice from online resources, couldn't make this simple thing work.
If anyone can shed some light on what I am doing wrong and/or glaring misconceptions I may have, please let me know!
BTW - so far this forum has rocked. Thank you so much for the help, to all of you who have helped!
The new monster is nametables. Literally, I can not update my code to show a background. Even doing it the longhand way is giving me some unexpected results. I thought creating a .nam file from a capable program and using a loop to load it would work, but so far...nothing. I'm successfully .incbin-ing .chr files and .pal files, so I'm making the assumption the .nam file is loading just dandy, too...but I'll be damned if I can get anything to draw to the screen no matter what I try.
Sprites are showing. Palettes are correct. Just no background. I'm stumped and I'm going crosseyed playing with it, so hopefully someone can demonstrate my (probably very obvious) mistake(s).
Here's my very general process:
Code:
;;;After header, I declare variables for high and low bytes:
.enum $0000
addrLo .dsb 1
addrHi .dsb 2
.ende
;;I've tried setting up the PPU prior to and after loading background,
;;neither of which had any different affect.
;; load the background:
lda $2002
lda #$20
STA $2006
LDA #$00
STA $2006
;; load nametable
LDA #>myNam
sta addrLo
lda #<myNam
sta addrHi
jsr LoadBkg
;;I've then tried putting LoadBkg just about everywhere...
;;prior to the main game loop (which is where
;;I thought I should put it...like, where I load the palatte data and whatnot),
;;IN the main game loop, in the interupts...just trial and error, really...
;; since it was not working.
LoadBkg:
ldx #4
ldy #00
loadData:
lda (addrLo),y
sta $2007
iny
bne loadData
inc addrHi
dex
bne loadData
rts
;; and then load the binaries for chr data and nam file...I
;; I've tried these both ways in case the order mattered...
;; again, trial and error.
.incbin "main.chr"
myNam: .incbin "mainBkg.nam"
.enum $0000
addrLo .dsb 1
addrHi .dsb 2
.ende
;;I've tried setting up the PPU prior to and after loading background,
;;neither of which had any different affect.
;; load the background:
lda $2002
lda #$20
STA $2006
LDA #$00
STA $2006
;; load nametable
LDA #>myNam
sta addrLo
lda #<myNam
sta addrHi
jsr LoadBkg
;;I've then tried putting LoadBkg just about everywhere...
;;prior to the main game loop (which is where
;;I thought I should put it...like, where I load the palatte data and whatnot),
;;IN the main game loop, in the interupts...just trial and error, really...
;; since it was not working.
LoadBkg:
ldx #4
ldy #00
loadData:
lda (addrLo),y
sta $2007
iny
bne loadData
inc addrHi
dex
bne loadData
rts
;; and then load the binaries for chr data and nam file...I
;; I've tried these both ways in case the order mattered...
;; again, trial and error.
.incbin "main.chr"
myNam: .incbin "mainBkg.nam"
I fully, humbly admit that I may have some dramatic misconceptions about things, but man...I feel like I was really getting it very well and then bam...hit a brick wall, and despite scouring and experimenting with advice from online resources, couldn't make this simple thing work.
If anyone can shed some light on what I am doing wrong and/or glaring misconceptions I may have, please let me know!
BTW - so far this forum has rocked. Thank you so much for the help, to all of you who have helped!