RGB output from composite PPU

Discuss hardware-related topics, such as development cartridges, CopyNES, PowerPak, EPROMs, or whatever.

Moderators: B00daW, Moderators

Post Reply
User avatar
thefox
Posts: 3141
Joined: Mon Jan 03, 2005 10:36 am
Location: Tampere, Finland
Contact:

RGB output from composite PPU

Post by thefox » Sun Dec 02, 2012 11:24 pm

Here's a project I've been working on for the last week or two. It's a normal NTSC NES (with composite PPU) with some hooks into an FPGA board. Result: Pixel perfect RGB output through VGA. At this point the project is pretty much done and seems to be working reliably, I've thrown a ton of games at it without problems.

The moire artifacts in the images were caused by the camera.
board.jpg
smb1.jpg
smb2.jpg
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi

User avatar
TmEE
Posts: 712
Joined: Wed Feb 13, 2008 9:10 am
Location: Estonia, Rapla city (50 and 60Hz compatible :P)
Contact:

Re: RGB output from composite PPU

Post by TmEE » Sun Dec 02, 2012 11:53 pm

Pretty !

lidnariq
Posts: 8791
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: RGB output from composite PPU

Post by lidnariq » Mon Dec 03, 2012 12:46 am

Awesome! Does it handle emphasis? Do you have a full 256x240 pixel buffer, or are you managing this with just one or two scanlines of memory? If the latter, how do you deal with the intermittently missing prerender pixel? What hardware is on your FPGA board?

User avatar
Jeroen
Posts: 982
Joined: Tue Jul 03, 2007 1:49 pm

Re: RGB output from composite PPU

Post by Jeroen » Mon Dec 03, 2012 4:57 am

Care to explain the technical details? NICE

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

Re: RGB output from composite PPU

Post by tepples » Mon Dec 03, 2012 7:43 am

Ignoring emphasis, it can be done by sampling the minimum level, maximum level, and phase over an entire pixel period and determining the intended palette entry from there.

User avatar
koitsu
Posts: 4216
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: RGB output from composite PPU

Post by koitsu » Mon Dec 03, 2012 8:03 am

Totally awesome, thefox! Looks gorgeous!

User avatar
keropi
Posts: 66
Joined: Fri Jul 13, 2012 2:06 am
Location: Greece

Re: RGB output from composite PPU

Post by keropi » Mon Dec 03, 2012 9:22 am

awesome :mrgreen:
will you be releasing details so people can (hopefully) build it?

User avatar
thefox
Posts: 3141
Joined: Mon Jan 03, 2005 10:36 am
Location: Tampere, Finland
Contact:

Re: RGB output from composite PPU

Post by thefox » Mon Dec 03, 2012 10:04 am

Thanks for the comments.
lidnariq wrote:Awesome! Does it handle emphasis? Do you have a full 256x240 pixel buffer, or are you managing this with just one or two scanlines of memory? If the latter, how do you deal with the intermittently missing prerender pixel? What hardware is on your FPGA board?
Emphasis is in the lookup table right now (9 bit index) so it works OK, I dumped the palette from Nintendulator. I used two scanline buffers. VGA timing is slightly off because NES only renders 240 scanlines and because of the missing dot, but my TV doesn't seem to care. I don't know if that's an exception or a common thing for displays.

The FPGA board is Altera DE2.
Jeroen wrote:Care to explain the technical details? NICE
Maybe in the future. :)
keropi wrote:awesome :mrgreen:
will you be releasing details so people can (hopefully) build it?
I don't know yet, right now it's not easy to build because it relies on DE2 (which costs $500, or about $250 for academic users). Also I have never designed a PCB before so there are lot of details that I don't know about when it comes to building a standalone version (like PCB manufacturing, board stuffing, level conversion, cheapest parts to use, etc).
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi

User avatar
blargg
Posts: 3715
Joined: Mon Sep 27, 2004 8:33 am
Location: Central Texas, USA
Contact:

Re: RGB output from composite PPU

Post by blargg » Mon Dec 03, 2012 10:23 am

My guess is that the ribbon to the NES intercepts the clock to the PPU and perhaps NMI so the external board can know when to sample video output and where it is in each pixel. Then it's just a matter of output levels at various points in the pixel and a lookup table, I imagine. I think that the original estimate of this being prohibitively expensive was on using just the composite output, nothing tapping into the PPU clock.

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

Re: RGB output from composite PPU

Post by tepples » Mon Dec 03, 2012 10:56 am

The PPU clock can be recovered from the sync and color burst. Perhaps the tapping is just to ensure an even cleaner clock signal.

User avatar
blargg
Posts: 3715
Joined: Mon Sep 27, 2004 8:33 am
Location: Central Texas, USA
Contact:

Re: RGB output from composite PPU

Post by blargg » Mon Dec 03, 2012 11:32 am

Or like I said because it would be prohibitively expensive to implement the clock recovery in an FPGA (via oversampling? or a PLL that very quickly locks on?).

lidnariq
Posts: 8791
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: RGB output from composite PPU

Post by lidnariq » Mon Dec 03, 2012 12:26 pm

thefox wrote:VGA timing is slightly off because NES only renders 240 scanlines and because of the missing dot, but my TV doesn't seem to care. I don't know if that's an exception or a common thing for displays.
My LCD PC monitor is just fine with only receiving 524 total lines for VGA, but is really cranky about any jitter in its hsync-locked PLL pixel clock recovery circuit. Hence the question about the missing pixel :)

How many blocks does your design take?
blargg wrote:Or like I said because it would be prohibitively expensive to implement the clock recovery in an FPGA (via oversampling? or a PLL that very quickly locks on?).
I never considered trying to do this without access to the PPU Clock, although I guess you might be able to use an 8x PLL from /RD or ALE...

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

Re: RGB output from composite PPU

Post by tepples » Mon Dec 03, 2012 12:40 pm

How is sync to color burst accomplished in an actual TV?

lidnariq
Posts: 8791
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: RGB output from composite PPU

Post by lidnariq » Mon Dec 03, 2012 3:08 pm

After high-precision crystals became available, but before this was all done in digital, I believe it goes something like this:
* Retriggerable one-shot for the period after hsync ends
* One-shot output directly drives crystal with color burst as input
* After one-shot is done crystal is reconnected to itself

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

Re: RGB output from composite PPU

Post by tepples » Mon Dec 03, 2012 5:23 pm

So as I see it, a circuit with no connection to NES internals would involve a 6*CB crystal to lock to the color burst and derive the PPU clock from that.

Post Reply