UI flicker in Super Mario Bros / follow-up problem in IC

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Post Reply
LilaQ
Posts: 23
Joined: Mon Sep 02, 2019 3:28 pm

UI flicker in Super Mario Bros / follow-up problem in IC

Post by LilaQ » Mon Sep 02, 2019 3:40 pm

Hi guys,

I've been working on my NES emu for a few days now, and I have encountered a problem. It is very similar to this one here https://forums.nesdev.com/viewtopic.php?f=3&t=10762

As soon as the pixel 0,0 enters the 2nd Nametable, the UI starts to flicker, because of multiple writes of the base nametable address in PPUCTRL. Some of them are 0x2000 (as it is supposed to be, as the UI is still on NT1) and 0x2400 (which it should only be for everything below the UI).

I have a GIF of this right here

Image

(Don't mind the 'cut off' part, that was a sprite zero problem that has been fixed by now)

So, I thought I was able to fix this, by resetting the base nametable address [bits] to zero => 0x2000 on VBLANK. This will fix the flicker on Super Mario Bros., but will be responsible for a follow up bug in Ice Climber.

I was implementing Y-Scrolling in Ice Climber, when I realized this. With the reset-hack still in place, the upward-scrolls in Ice Climber will have glitches at the top, as soon as it is inside NT2 [again]. (Note, this is only coarse-scroll for now, fine-scroll has not been implemented yet)

Image

When I remove this hack, the Y-Scroll happens as it is supposed to.

Image

Now I am a bit stumped on how to proceed, and what might cause this exactly.

Side note: I did not implement the LoopyV/T stuff, as it confuses the hell out of me (I'm not a native speaker), and I'm not quite sure if I would have to refactor my whole PPU.
E.g. right now, the first write to 0x2005 is stored as uint8_t variable called scr_x. 'coarse x' is scr_x / 8 right now, 'fine x' is scr_x % 8. And in the loopy description I can't even figure out where to pull this from :-(

Any help would be greatly appreciated. Will provide logs, screenshots, whatever is necessary.

Thanks in advance!

LilaQ

tepples
Posts: 21809
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: UI flicker in Super Mario Bros / follow-up problem in I

Post by tepples » Tue Sep 03, 2019 5:52 am

How are you emulating the effect of writes to $2006 on the base nametable address? Are you doing it through the t and v as described in The skinny on NES scrolling?

User avatar
Dwedit
Posts: 4247
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: UI flicker in Super Mario Bros / follow-up problem in I

Post by Dwedit » Tue Sep 03, 2019 8:53 am

PPUCTRL affects "Loopy T" only, not "Loopy V".
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!

LilaQ
Posts: 23
Joined: Mon Sep 02, 2019 3:28 pm

Re: UI flicker in Super Mario Bros / follow-up problem in I

Post by LilaQ » Tue Sep 03, 2019 10:40 am

I tried to implement the "v" and "t" mechanism now (as I didn't to this before), but now my Nametables don't get populated at all.

I did something like this before that:

Code: Select all

//0x2006
void writePPUADDR(int adr) {
PPUADDR = adr
}
//0x2007
void writePPUDATA(int data) {
VRAM[PPUDATA] = data
}
Am I just supposed to use "v" instead of PPUADDR now? Sorry, but this really confuses me.

LilaQ
Posts: 23
Joined: Mon Sep 02, 2019 3:28 pm

Re: UI flicker in Super Mario Bros / follow-up problem in I

Post by LilaQ » Tue Sep 03, 2019 11:03 am

Also, how will this affect the wrong base nametable address in PPUCTRL? :| :?:

LilaQ
Posts: 23
Joined: Mon Sep 02, 2019 3:28 pm

Re: UI flicker in Super Mario Bros / follow-up problem in I

Post by LilaQ » Wed Sep 04, 2019 6:43 am

Okay, so I managed to get the flicker away with the use of v and t, to get the proper base nametable address.

Can someone please do me a favor, and tell me the coarse Y-scroll value of ice climbers, as soon as the game screen appears (where the bird is)? Mine is at 19, but it seems like it's supposed to be 18 - or 20 (I am one tile off).

Thanks!

Post Reply