Something on Nestopia board ($2007 write during rendering)

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Post Reply
User avatar
85cocoa
Posts: 96
Joined: Sat Jul 22, 2006 12:06 pm
Location: USA

Something on Nestopia board ($2007 write during rendering)

Post by 85cocoa » Mon Oct 09, 2006 11:39 pm

Just to make sure everyone is aware:

http://www.bannister.org/ubb/ultimatebb ... p=1#000005

There appears to be a request to get more information on what writes to $2007 do during rendering, specifically in the context of the game "Saint Seiya - Ougon Densetsu Kanketsu Hen."
Warning: I am not a serious developer (yet), but CS and EE really interest me.
I was -_pentium5.1_- until I screwed up. This is why I screwed up. ^_^

User avatar
Zepper
Formerly Fx3
Posts: 3223
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Post by Zepper » Tue Oct 10, 2006 8:46 am

Go hack the game, trace it... *bump*

User avatar
85cocoa
Posts: 96
Joined: Sat Jul 22, 2006 12:06 pm
Location: USA

Post by 85cocoa » Wed Oct 11, 2006 1:07 am

Sorry, I don't have the skills to do that, nor the equipment to HW test, so unless a dev has something to contribute, I will allow this thread to be locked.
Warning: I am not a serious developer (yet), but CS and EE really interest me.
I was -_pentium5.1_- until I screwed up. This is why I screwed up. ^_^

User avatar
kevtris
Posts: 504
Joined: Sat Oct 29, 2005 2:09 am
Location: Indianapolis
Contact:

Re: Something on Nestopia board ($2007 write during renderin

Post by kevtris » Wed Oct 11, 2006 8:37 pm

85cocoa wrote:Just to make sure everyone is aware:

http://www.bannister.org/ubb/ultimatebb ... p=1#000005

There appears to be a request to get more information on what writes to $2007 do during rendering, specifically in the context of the game "Saint Seiya - Ougon Densetsu Kanketsu Hen."
I'm not sure about that game, but writing to 2007 during rendering is very bad news. There appears to be two "control units" so to speak on the PPU that can operate the memory interface.

The main "rendering" control interface, and the 2007 read/write control interface. The two are simply OR'd together on the control lines. It is possible to do both a read AND write cycle at the same time because of this. I used my "3 in 1 tester" to monitor the PPU's address, data, and control lines during rendering to see what happened when reads and writes were performed during rendering.

The result is very unpredictable as you can imagine, since the timing of the CPU read/write and the timing of the PPU data fetch both come into play. The net result of writing during rendering could be corruption of at least 2 memory locations and possible corruption of the address counter/pointer. Reading isn't so bad but it too could corrupt the address counter during rendering and if nothing else, cause glitchy video due to improper data being fetched for display.
/* this is a comment */

dvdmth
Posts: 354
Joined: Wed Mar 22, 2006 8:00 am

Post by dvdmth » Thu Oct 12, 2006 7:12 am

The game in question here is apparently trying to write to $3F00-3FFF during rendering. I suspect that side-effects would be minimized here since writes in this range don't go out into VRAM. On the other hand, palette memory may be adversely affected. Has any testing occurred to this regard?

User avatar
85cocoa
Posts: 96
Joined: Sat Jul 22, 2006 12:06 pm
Location: USA

Post by 85cocoa » Fri Oct 13, 2006 12:38 am

So Marty's diagnosis of the game is probably wrong?
(EDIT: Oops, I forgot about the way the PPU regs are mirrored. What I meant is that real game companies probably wouldn't try such a dangerous programming technique, so maybe the bug is really related to timing or something else.)
Warning: I am not a serious developer (yet), but CS and EE really interest me.
I was -_pentium5.1_- until I screwed up. This is why I screwed up. ^_^

Marty
Posts: 40
Joined: Fri Nov 12, 2004 5:02 am

Post by Marty » Fri Oct 13, 2006 5:59 am

Yeah, it could be related to timing as well (but that's still risky business), resulting in VRAM address trashing. I noticed that delaying the $2007 write by 4 PPU clocks (no less) also fixes the game. Incidentally, Micro Machines will cause screen-shaking in the finished course screen if $2001 writes (BG/SP enable) are delayed by 1 PPU clock. I guess PPU internals and different duty cycle timings plays a large role here. Makes me I wonder if there are more quirks for certain timed PPU register reads/writes, resulting in special behaviour similiar to the ones for the VBL flag and NMI supression.

User avatar
Zepper
Formerly Fx3
Posts: 3223
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Post by Zepper » Sat Oct 14, 2006 8:57 am

kevtris, did you analyse the cartridge board? Just to be sure we're not speaking of an emulator "obscure" bug. -_-;; You know, if this latency occurs in the NES, so it's ok.

User avatar
kevtris
Posts: 504
Joined: Sat Oct 29, 2005 2:09 am
Location: Indianapolis
Contact:

Post by kevtris » Sat Oct 14, 2006 7:49 pm

dvdmth wrote:The game in question here is apparently trying to write to $3F00-3FFF during rendering. I suspect that side-effects would be minimized here since writes in this range don't go out into VRAM. On the other hand, palette memory may be adversely affected. Has any testing occurred to this regard?
Oh, that's "legal" so to speak... if you time your writes juuuuust right, you can update the palette mid-frame. Micromachines does this as I think was already said. Micromachines uses the 2004 read to synch up, and it's insane critical. Any little timing screwup will cause you to bleed off into rendering which can cause graphic corruption.
/* this is a comment */

Bananmos
Posts: 534
Joined: Wed Mar 09, 2005 9:08 am
Contact:

Post by Bananmos » Sun Oct 15, 2006 1:02 am

Oh, that's "legal" so to speak... if you time your writes juuuuust right, you can update the palette mid-frame. Micromachines does this as I think was already said. Micromachines uses the 2004 read to synch up, and it's insane critical. Any little timing screwup will cause you to bleed off into rendering which can cause graphic corruption.
Yes it's legal, but ONLY if you turn off rendering thru $2001, in which case anything legal in vblank should be as legal mid-frame. Though you have to keep in mind that pointing $2006 to the palette registers will output the color pointed to rather than BG0. Micro Machines does turn off rendering before doing it's palette updates, and I am pretty sure there's no other way to do it.

Post Reply