Page 1 of 1

Scrolling ($2005) two nametables and stop at the last one

Posted: Sat Nov 04, 2017 6:54 am
by sdm
I have a problem with scrolling two screens (two nametable in all 2KB VRAM). I just wish that at the end of the scrolling would ideally stay on the second nametable ($ 2400). Unfortunately, when the XSCROLL value reaches FF, the second screen is uneven (one pixel).

Two test roms, press any button to start scrolling.

Demo1 - inc scroll, when the value reaches FF, they stop scrolling.
Demo2 - inc scroll, when the value reaches FF, it stops scrolling and set a bit0 in $2000 to change the nametable to 2400. Here is everything ok, the screen stops evenly.

I would, however, without changing $2000 bit0, to do the scrolling so that the screen stopped perfectly on the second nametable. XSCROLL #$FF value secont screen is uneven, and once again the value of 00 is the beginning of the first nametable.

EDIT: Ok, thanks for the info, at least I'm sure now.

Re: Scrolling ($2005) two nametables and stop at the last on

Posted: Sat Nov 04, 2017 7:02 am
by thefox
Why?

(It's not possible. This is why the nametable bits in $2000 exist in the first place!)

Re: Scrolling ($2005) two nametables and stop at the last on

Posted: Sat Nov 04, 2017 7:04 am
by dougeff
The scrolling registers are working exactly as they were designed.

With X scroll set to FF, it should be 1 pixel misaligned.

Re: Scrolling ($2005) two nametables and stop at the last on

Posted: Sat Nov 04, 2017 8:06 am
by Kasumi
To elaborate:

0 shows 256 pixels of nametable 1, 0 pixels of nametable 2.
1 shows 255 pixels of nametable 1, 1 pixel of nametable 2.
2 shows 254 pixels of nametable 1, 2 pixels of nametable 2.
...
255 shows 1 pixel of nametable 1, 255 pixels of nametable 2.

That's the full range of a byte, there's not a value left for 0 pixels of nametable 1, 256 pixels of nametable 2 without changing $2000.

Re: Scrolling ($2005) two nametables and stop at the last on

Posted: Sat Nov 04, 2017 8:29 am
by tokumaru
The two name tables side by side create a 512-pixel wide area, with pixels numbered 0 through 511, which needs 9 bits to be represented. The scroll registers are only 8 bits, so they can't possibly cover the whole area by themselves. The lower bits of $2000 are effectively the "9th bits" of the scroll values, you absolutely need them if you want total control of the scroll, otherwise you'll run into situations like the one you're in right now, where you can't scroll to certain places.