Revisiting the quest for the most accurate NES palette:

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

NewRisingSun
Posts: 1510
Joined: Thu May 19, 2005 11:30 am

Re: Revisiting the quest for the most accurate NES palette:

Post by NewRisingSun »

Do you have a flashcart?
Nope. I don't really have an overview of which one to get for a 60-pin system.
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Revisiting the quest for the most accurate NES palette:

Post by tepples »

For a 60-pin system, the EverDrive N8 should be good enough.
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: Revisiting the quest for the most accurate NES palette:

Post by lidnariq »

NewRisingSun wrote:color $31 at 319.9 degrees (nominal: 330)
color $36 at 113.1 degrees (nominal: 120)
Since I bothered to play around with the Pac-Land image and write down some numbers:
Blue $31 at 316-323° (nom: 330)
Blue $11 at 323-335° (nom: 330)
Magenta $15 at 84-90° (nom: 90)
Peach $36 at 109-117° (nom: 120)
Brown $07 at 150-158° (nom: 150)
Orange $27 at 140-146° (nom: 150)
Green $1B at 268-274° (nom: 270)

I clearly need to put more effort into filter design to reduce those ranges.
NewRisingSun
Posts: 1510
Joined: Thu May 19, 2005 11:30 am

Re: Revisiting the quest for the most accurate NES palette:

Post by NewRisingSun »

I don't use Matlab, but I can post the C source to my NTSC decoder that takes the .raw captured file and outputs a .rawraw RGB file, if that helps you.
User avatar
rainwarrior
Posts: 8731
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Revisiting the quest for the most accurate NES palette:

Post by rainwarrior »

NewRisingSun wrote:
Do you have a flashcart?
Nope. I don't really have an overview of which one to get for a 60-pin system.
The Everdrive N8 has a Famicom 60-pin option, though I can also confirm that the PowerPak and Everdrive N8 72-pin both work on a Famicom using simple 72-60 pin converters.
Great Hierophant
Posts: 780
Joined: Tue Nov 23, 2004 9:35 pm

Re: Revisiting the quest for the most accurate NES palette:

Post by Great Hierophant »

You need to perform two simple soldering mods to get the most out of your PowerPak with just about all 72-to-60 pin converters and it the stacked PowerPak and converter can get a bit wobbly, but otherwise you will be good.
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: Revisiting the quest for the most accurate NES palette:

Post by lidnariq »

NewRisingSun wrote:I don't use Matlab, but I can post the C source to my NTSC decoder that takes the .raw captured file and outputs a .rawraw RGB file, if that helps you.
Eh, the matlab/octave fragment was more for proving to myself that your methodology is correct. It clearly is, and now I think the only remaining parameter to be explored is just how much variation we should anticipate across all the hardware variants.

Is there an easy way to calculate how "non-ideal" either not a square wave or not a sine wave this is? Is the "skewness" test the right one?

Skewness of 10000 points of a sampled ideal sine wave appears to be approximately 0, but skewness of the huge patch of color $31 is 0.126 and the mean is very slightly higher than the median (Δ=0.336).
NewRisingSun
Posts: 1510
Joined: Thu May 19, 2005 11:30 am

Re: Revisiting the quest for the most accurate NES palette:

Post by NewRisingSun »

Skewness is a measure of asymmetry. A square wave with non-equal duty cycles is indeed asymmetrical, though I am not sure how this translates to the phase of the fundamental frequency. Tepples suggested hue-specific phase shifts resulting from hue-specific duty cycles. If non-equal duty cycles of a square wave translate into phase shifts at the subcarrier (fundamental) frequency, then the phase shift amount should be correlated with skewness in sign and magnitude.

For the record, I have used the same setup to measure the composite video output of a Tandy 1000 computer. It can output six hues at two luminance levels. The two levels are different for each of the hues. I measure no level-specific phase shift beyond the noise level between the two luminance levels of each hue:

Code: Select all

Color 1: 0.008638 (blue, nominal: 0)
Color 2: 223.742996 (green, nominal: 225)
Color 3: 269.025116 (cyan, nominal: 270)
Color 4: 92.503235 (red, nominal: 90)
Color 5: 46.509937 (magenta, nominal: 45)
Color 6: 180.940750 (yellow, nominal: 180)
Color 9: 359.858380 (blue, nominal: 0)
Color A: 223.127350 (green, nominal: 225)
Color B: 268.470940 (cyan, nominal: 270)
Color C: 91.619957 (red, nominal: 90)
Color D: 46.090595 (magenta, nominal: 45)
Color E: 179.678253 (yellow, nominal: 180)
This tells me that whatever I am measuring from the Famicom is not an artifact introduced by my capturing hardware, otherwise I would be measuring level-specific phase shifts in the the Tandy 1000's composite video output as well. I have attached that capture as well, in case you want to try your skewness test on that file.
Attachments
RGBI16.zip
(162.59 KiB) Downloaded 347 times
NewRisingSun
Posts: 1510
Joined: Thu May 19, 2005 11:30 am

Re: Revisiting the quest for the most accurate NES palette:

Post by NewRisingSun »

I have received my Everdrive N8. I have used "Blargg's Full Palette" to make raw capture files that show all 52 colors. The attached archive contains three files:
  • Palette-RP2C02E-RCA.raw: Signal from the yellow RCA socket at the back of the Sharp Twin Famicom AN-500B (PPU: RP2C02E-0)
  • Palette-RP2C02G-PPU.raw: Signal from the PPU's output pin of the Sharp Twin Famicom AN-505BK (PPU: RP2C02G-0)
  • Palette-RP2C02G-RCA.raw: Signal from the yellow RCA socket at the back of the Sharp Twin Famicom AN-505BK (PPU: RP2C02G-0)
I was unable to get any signal from the output pin of the RP2C02E-0.

I am posting these files without comment for now, because I am curious about what conclusions other people draw from them, before I share mine.
Attachments
FullPaletteRaw.zip
(604.33 KiB) Downloaded 369 times
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: Revisiting the quest for the most accurate NES palette:

Post by lidnariq »

My biggest observation is what I see in the first scanline of the 2C02E output of colors $1x :

At this point, I have no idea what to think any more. Colors $12, $16, and $1A are a different phase offset than the other ones, not restricted to just even or odd phases.

(Very later edit:
In Palette-RP2C02G-RCA.raw, the effective sample clock is 56ppm slow, and the correct scaler in the matlab/octave fragment is 3.9997749.
In Palette-RP2C02E-RCA.raw, the effective sample clock is 34ppm slow, and the correct scaler in the matlab/octave fragement is 3.9998625. )
Attachments
RP2C02E-scanline41.png
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Revisiting the quest for the most accurate NES palette:

Post by tepples »

Do the affected colors remain $12, $16, and $1A even across resets? Perhaps the phase might get distorted more when signal level transitions coincide with the pixel clock.
NewRisingSun
Posts: 1510
Joined: Thu May 19, 2005 11:30 am

Re: Revisiting the quest for the most accurate NES palette:

Post by NewRisingSun »

As far as I can tell, they remain the same. Attached find four different capture files from the RP2C02E, each taken after another RESET. Note that the Everdrive UI appears between the RESET and the palette test program.
Attachments
Palette-RP2C02E-RCA-4times.zip
(756.13 KiB) Downloaded 356 times
NewRisingSun
Posts: 1510
Joined: Thu May 19, 2005 11:30 am

Re: Revisiting the quest for the most accurate NES palette:

Post by NewRisingSun »

I have captured the output (see attachment) of a PAL NES with an RP2C07 PPU, from the yellow RCA socket. I have not modified the capture program itself, which is why it only captures five sixths of the 1000 ms/50Hz field. Note how the RP2C07, unlike the RP2C02, never illuminates the border area with background color 0.

The first picture shows the result I get when I use my "Simple PAL" decoder --- properly accounting for the phase shift in the V channel from scanline to scanline, but not averaging each scanline's demodulated chroma signal with the delayed previous scanline's demodulated chroma signal. If the signal is affected by phase distortion, then we should see Hanover bars - opposite hue errors from scanline to scanline:
Image
The second picture shows the result I get when I use my "Full PAL" decoder --- averaging each scanline's demodulated chroma signal with the delayed previous scanline's demodulated chroma signal:
Image
These results indicate to me that the PAL NES is just as susceptible to considerable phase shifts as the NTSC NES, but because the PAL system is designed to eliminate the effects of phase shifts, PAL televisions will display colors that are almost exactly the nominal hues minus 15.0 degrees.

Capturing regular television pictures and decoding them with my "Simple PAL" decoder exhibits only very slight Hanover bars, indicating little phase distortion:
Image
Attachments
SMB-Title-RP2C07.zip
(163.84 KiB) Downloaded 372 times
User avatar
Zepper
Formerly Fx3
Posts: 3262
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Re: Revisiting the quest for the most accurate NES palette:

Post by Zepper »

RAW... OK... but how to parse the file, as RGB or any other format?
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Revisiting the quest for the most accurate NES palette:

Post by tepples »

In case it isn't obvious to others reading this, the reason you don't get Hanover bars from a broadcast signal is the 90 degree swing of broadcast TV's color burst compared to the nonstandard 120 degree swing from the 2C07.
Post Reply