Page 1 of 1
Background Screwup (Source Provided)
Posted: Sun Apr 04, 2010 9:16 pm
by 67726e
I just want to start by apologizing for the 'spamming' with my noob questions (or am I on par with the standard noob?). Anyway, I have read over the Nerdy Nights tutorials and have spent plenty of time exorcising the GBAGuy tut from my mind. My problem isn't the setup, but rather the results. For some reason the background loads the 'Sprite' Pattern table rather than the 'Background' table. I have the code set to load just the first row with background color tiles and just let the rest load the default 00 tile.
http://nesmods.com/resources/Maze.zip
The .zip file has everything including the .chr file and all my other dev crap that I am using while I work on my first game.
Posted: Sun Apr 04, 2010 9:35 pm
by 3gengames
If you wana see spamming, I probably asked 30 questions in a row before I started doing alot of stuff so definently don't feel bad, as long as it's constructive, nobody cares how mayny questions that you ask as long as you do good with the information you've recieved ^_^
I have no idea as I don't really know backgrounds yet or alot of stuff but make sure that the nametable for the background is (For my setup) 2000-23C0, And 23C0 to 2400 is the attributes. That allways messes with me XD
Posted: Mon Apr 05, 2010 7:17 am
by 67726e
Weird thing is I went through the Nerdy Nights tutorials and I even tried copying the exact code from those tuts into my code and it still didn't work. Perhaps I just screwed something up when I wrote to $2000 and $2001 but that is all I can think of (and if anyone reads my source I realized I have game code within the NMI)
Posted: Mon Apr 05, 2010 7:24 am
by Ian A
I think you're doing something funky with the pattern tables you're reading from.
The first thing you do in the NMI is load the value from 2002 and store it at 2000
i.e.
LDA $2002
STA $2000
Which undos what you did in LOADATTLOOP:
i.e.
LDA #%10010000 ; enable NMI, sprites from Pattern Table 1
STA $2000
LDA #%00011110 ; enable sprites
STA $2001
So you might be setting the background table to 0, the pattern table to 1, and then setting them both back to table 0 again. Which you probably don't want.
Posted: Mon Apr 05, 2010 7:35 am
by 67726e
Aah, that solved it. Thanks a lot. I guess thats what I get for staying up till 1 working on my code. Although I found a post on this forum that mentioned something about reading from $2002 and writing to $2000. I can't find it at the moment but I will post it if I find it.
Posted: Mon Apr 05, 2010 8:25 am
by tokumaru
67726e wrote:Although I found a post on this forum that mentioned something about reading from $2002 and writing to $2000.
I have never seen that, and I don't think this would ever be useful.
What might have happened is someone outlined the things that have to be done during VBlank, like this:
.read from $2002;
.write to $2000;
.write to $2005;
And you misinterpreted it, thinking you had to write the value read from the other register, while in fact you have to write your own PPU configuration.
Posted: Mon Apr 05, 2010 8:26 am
by 67726e
That is exactly what happened.