Scrolling help

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Scrolling help
by on (#12874)
Hi

I'm trying to figure out how to scroll over more than just two name tables, but what ever I'm trying won't work! Can someone just give me the basic steps I need to implement to be able to scroll over different name tables?

What I do now, is to load two name tables on startup. And in the NMI-interrupt (I do all stuff there), I wait for input and advance the scroll counter by one. Then I check if it is 255, and if it is, I load a new name table into $2000 or $2400 (depending on which is showing on the screen). It's just a big mess, and I really need a "push", some guidelines, instructions, steps, whatever!

Thanks.

by on (#12877)
You're supposed to load one row or one column into $2007 at once.

by on (#12878)
Thanks. It's horizontal scrolling by the way. Like all platform games. What do you mean? That I load one tile from each row into a name table, and the next time I load the next tile from each row?

by on (#12881)
If you're scrolling between two pre-rendered name tables (not an actual demo, just a test), then you should load all your tiles in Name Tables with rendering off, then turn the rendering on and do what you said in your original post.
In an actual game with actual level data, you would have to load metatiles on the screen when scrolling and write them to the name tables during VBlank, wich is what Tepples is talking about I think.

by on (#12882)
Well, what you're suggesting works :)

But what I was trying to say (maybe I'm not so good to explain things in english), is that I want to scroll between more than two name tables. My original idea was something like this:

- Load the two name tables on startup
- In the NMI-loop, increase scrolling on each keypress, and check if the scroll value is 255. If yes, load the third name table (from PRG-ROM) into $2000. Scroll again, and check if scroll value is 255. If yes, load the fourth name table into $2400.

However, I have a suspicion that this isn't how horizontal scrolling with more than just two name tables works...

by on (#12883)
Nah, you have to load graphics only small chunck a time.

by on (#12884)
How should I do that, and when? I take one tile from each row, and the next time I take the next tiles from each row?

Allthough, I think I'm getting it :)

by on (#12889)
You can set a bit in $2000 to advance the VRAM pointer by rows within a column instead of the normal way (columns within a row).

by on (#12922)
I think I get you point :)

by on (#12931)
Damn, I don't sem to get this :(

I have tried a lot of things! Does anyone have an example or something? Please just explain the basic steps of what I have to do. The kind of scrolling I want is the sideways scrolling like many platform games has.

EDIT: WoohoO! I fixed it! It was the damn name table bits of $2000 that needed to be taken care of. Now, everything works like a charm!