6 tile offset in "Duck Tales" when using a rope

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
6 tile offset in "Duck Tales" when using a rope
by on (#242464)
Hi guys,

I'm trying to figure out another problem, that has been keeping me busy for a few days now.
In "Duck Tales", whenever I use a rope / chain to go up or down, I get a weird 6-tile offset (see attached GIF).

When further investigating, the Y-Scroll value immediately starts at 6 when going down. First, I thought I might be doing something wrong, and that my value is wrong (even though Ice Climber works perfectly), but after a bit more research it turns out, Mesen has the same value(s) [read, the last writes to 2006]:

Code:
2006 0x24  46  70   0000
2006 0xc0  46  91   2400
2005 0x00  46 130   24c0
2005 0x00  46 151   24c0
Rendering frame
2006 0x24 246 189   0000
2006 0x00 246 213   2400
2006 0x24 251  14   2400 
2006 0x20 251  38   2400 
2006 0x27 255 180   2420
2006 0xc0 255 204   2720   
2005 0x00 257  26   27c0   
2005 0x00 257  47   27c0   
2006 0x24  46  78   0000 
2006 0xe0  46  99   2400
2005 0x00  46 138   24e0
2005 0x00  46 159   24e0
Rendering frame


24c0 -> Y-Scroll 6
24e0 -> Y-Scroll 7
etc.

This can also be seen, when looking at the PPU Viewer in Mesen, the viewport is actually lower than what is visible in the actual window.

These values are achieved through Loopy's scrolling docs, including v, t, x, w.

Can someone point out to me what I'm doing wrong? I already thought it has something to do with the UI (that seems to be 6 tiles high as well), but I can't come up with something logical.

Thank you so much in advance!
Re: 6 tile offset in "Duck Tales" when using a rope
by on (#242465)
LilaQ wrote:
This can also be seen, when looking at the PPU Viewer in Mesen, the viewport is actually lower than what is visible in the actual window.

The scroll position changes in the middle of the screen. At the bottom of Mesen's PPU viewer there is a "scanline" option. If you set this to 0, it will show you instead the scroll position for the top of the screen where the status bar is.
Re: 6 tile offset in "Duck Tales" when using a rope
by on (#242466)
Makes sense, it's static as the UI is always static. But how can I get rid of this 6 tile offset?
Re: 6 tile offset in "Duck Tales" when using a rope
by on (#242467)
Though, perhaps the problem is that when you split the Y scroll with $2006 you should be setting that position immediately? It is not relative to the top of the screen. If you set the Y scroll to 50 on scanline 70, you will see nametable line 50 on render scanline 70. It is not nametable line 50+70 as if it was relative to the top of the screen. It starts over at that split point.
Re: 6 tile offset in "Duck Tales" when using a rope
by on (#242468)
That's actually exactly the same thing I was thinking about right now. So, I should set the Y-Scroll relative to the scanline it is being set on! I will try that, thanks!
Re: 6 tile offset in "Duck Tales" when using a rope
by on (#242469)
I had to account for negative (relative) scrolling values, but now everything looks as it is supposed to be! Thanks you so much! :)