Possible Vblank issue?

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

Post Reply
Pennywise
Posts: 70
Joined: Tue Jul 14, 2009 11:04 am

Possible Vblank issue?

Post by Pennywise »

Image

So there are two pieces of text that are loaded separately with the question first and then the answers second. But with the second part the screen gets pushed down like so for a split second. I'm not sure I really understand what's causing it, but I've stepped through the code in a debugger to isolate the problem. The only thing I've come up with is that the problem happens when the scanline says Idle and then I think when Vblank occurs, it returns to normal. Anyway the problem doesn't happen for every question and in fact I can get it to go away by shortening that text by one character.

To give a little background info this is a translation hack for a mapper 1 game.

Thanks for any help.
User avatar
koitsu
Posts: 4203
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Post by koitsu »

The answer is 2.

Regarding the "screen getting pushed down" -- probably something messing with $2005, or it could be that the VRAM write routine (for tile/text placement) is taking too long and VBlank fires in the middle.

You're going to need a romhacker who's familiar with assembly to solve the problem. :-)
User avatar
Dwedit
Posts: 4470
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Post by Dwedit »

This happens whenever you turn the screen back on during rendering time. Wait until the next vblank before you turn the screen back on.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

Dwedit wrote:This happens whenever you turn the screen back on during rendering time.
I thought this was the problem, but then he said that even one character makes a difference... The time of writing a single character is not enough to push the screen down by that much.

Then again, I can't think of anything else, so Dwedit's suggestion of waiting for VBlank before turning rendering back on should be the first thing to try.
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

tokumaru wrote:The time of writing a single character is not enough to push the screen down by that much.
Unless the single character is enough to push it past the time when T is copied to V, which IIRC is dot 304 of the pre-render line. If T isn't prepared by then (two writes to $2005), the wrong value gets copied to V.
Pennywise
Posts: 70
Joined: Tue Jul 14, 2009 11:04 am

Post by Pennywise »

I'm afraid I'm a bit lost, but what exactly is T and V? I do consider myself pretty good with NES ASM, but I've only learned what I needed to get by. Naturally, this is new to me.
User avatar
Dwedit
Posts: 4470
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Post by Dwedit »

"T" and "V" are nicknames for the latches that drive scrolling.

VRAM address and Scrolling are the same thing on the NES. The NES moves the VRAM address V around while it draws the screen so it knows where to fetch the tiles from. At the end of a scanline, it snaps the address back to the left, assigning the X bits from T to V. At the beginning of the frame, it copies all of the X and Y bits from T to V.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
User avatar
Hamtaro126
Posts: 783
Joined: Thu Jan 19, 2006 5:08 pm

Re: Possible Vblank issue?

Post by Hamtaro126 »

Pennywise wrote:Image

To give a little background info this is a translation hack for a mapper 1 game.

Thanks for any help.
Is this for the Unused Quiz Option for Bayou Billy/Mad City (Konami)?
(According to the imagename, I am correct!)

If so, This is good progress of recovery

I looked at that in BMF's Cutting Room Floor Wiki, Some wierd Easter Egg!
AKA SmilyMZX/AtariHacker.
Post Reply