Day 18 - BG Scrolling

Published: 2005-07-22
Updated: 2010-12-19
Author: Mike Huber

How?

I had already done some experimenting to see how exactly background scrolling works. It appears that (without a mapper) you can only scroll in the direction that you are (possibly aren't?) having mirroring (the ".inesmir 1" we always use).

Registers?

The background scroll port is $2005, I call it a port instead of a register because, even though it takes 2 writes, those two writes aren't used as one big number like in other registers and do two different things.

The first write to $2005 will be the vertical scroll and the second write will be the horizontal scroll (according to Fayzullin's doc).

Some things...

Unless you set-up your cartridge (.NES file) to have the 2Kb needed to use all 4 Name Tables (which I don't yet know how to do), it seems that you can only scroll a certain way. If anyone knows how it scrolls vs. mirroring or how to use all 4 Name Tables, please E-Mail me.

You will know that you are possibly scrolling the wrong way if the background moves funky or possibly disappears (happened to me).

No Code?

I'd like for you people to actually try and do it yourselves, if you do, feel free to send me some code. I know that you can do it, you have all the info you need. If enough people complain or even if enough people send me code, I'll put my code up here...

Seriously, you can do it. The basic things you need are:

  1. Variables for Vertical and Horizontal scroll.
  2. Have atleast a simple background displayed.
  3. Handle keypad presses (up,down,left,right).
  4. Write vert. and hori. scroll to $2005

This Day In Review

I've decided that tomorrow will definitely be about loading up to like 64KB easily (we will use the method to load the Zelda title screen (1KB)).

Happy Coding!,
-Mike H a.k.a GbaGuy