PPUMASK emphasize bits on NTSC and PAL

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

User avatar
DRW
Posts: 2225
Joined: Sat Sep 07, 2013 2:59 pm

PPUMASK emphasize bits on NTSC and PAL

Post by DRW »

The NESDev wiki says that the emphasize bits for red and green are switched around on a PAL console:
Bit 5 emphasizes red on the NTSC PPU, and green on the PAL & Dendy PPUs.
Bit 6 emphasizes green on the NTSC PPU, and red on the PAL & Dendy PPUs.
Source: https://wiki.nesdev.com/w/index.php?tit ... rs#PPUMASK

But it looks like none of the most popular emulators (fceux, Nestopia, Nintendulator) implements the PAL switch.

I made a little test program where I can go through all eight emphasize values with the d-pad. And no matter if I set the emulator to PAL or NTSC (of course, I do a hard reset after switching the region if the emulator doesn't already do it itself), the first value is always the red tint. PAL and NTSC behave identically.

So, is this a thing that all the emulators missed to implement? Or is this an error in the wiki? Or am I misunderstanding anything here?
My game "City Trouble":
Gameplay video: https://youtu.be/Eee0yurkIW4
Download (ROM, manual, artworks): http://www.denny-r-walter.de/city.html
User avatar
Quietust
Posts: 1920
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Re: PPUMASK emphasize bits on NTSC and PAL

Post by Quietust »

DRW wrote:But it looks like none of the most popular emulators (fceux, Nestopia, Nintendulator) implements the PAL switch.
Nintendulator definitely does, but only in the "unstable" 0.975 build.

I really need to just go ahead and release that version, whether or not it's "complete" enough (the original plan was to incorporate discoveries from Visual 2A03/2C02, but those have been rather infrequent).
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: PPUMASK emphasize bits on NTSC and PAL

Post by rainwarrior »

Reasons why you might see it in very few emulators:
  • Wasn't really a well known thing in this community until August 2014 (and didn't appear in the wiki before then): thread
  • Not a lot of games use emphasis, and almost none use emphasis bits for individual colours (e.g. usually all 3 at once for dimming, or cycling through all 3 quickly). The most notable game that does use an individual one (Noah's Ark) only uses blue.
  • Since it doesn't affect timing or CPU emulation, it's a purely cosmetic effect. Getting it wrong has a very isolated effect on the colour and doesn't break anything else.
User avatar
DRW
Posts: 2225
Joined: Sat Sep 07, 2013 2:59 pm

Re: PPUMASK emphasize bits on NTSC and PAL

Post by DRW »

Maybe this should be put into the bug tracker at
https://sourceforge.net/p/fceultra/bugs
(It requires you to register, otherwise I would have done it myself.)

I assume it should be a pretty mundane issue to fix for someone who knows the code and knows where to look at it. So, maybe it gets done for the next version if they are informed.
My game "City Trouble":
Gameplay video: https://youtu.be/Eee0yurkIW4
Download (ROM, manual, artworks): http://www.denny-r-walter.de/city.html
calima
Posts: 1745
Joined: Tue Oct 06, 2015 10:16 am

Re: PPUMASK emphasize bits on NTSC and PAL

Post by calima »

SF doesn't spam you, they're quite decent with the current owners again.
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: PPUMASK emphasize bits on NTSC and PAL

Post by rainwarrior »

If you need the functionality now, in FCEUX you can use 512 entry palettes to customize emphasis behaviour. If you're looking for colour accuracy you'd probably want to use a separate palette for NTSC and PAL anyway. It's not like the flipped emphasis is the only difference in colour, everything's a different hue at least.

There are some RGB PPU palettes that come with it that do this, for example, but I don't think any of the included palettes are for PAL. Does anyone know a good PAL palette generator? (Or just a good reference palette?) I only know of NTSC ones like Bisqwit's or Drag's.

Yes, the code that expands 64 entry palettes to the internal 512 version should flip the bits for PAL though, as a very minimal approximation. It doesn't currently do this. (Probably there should be separate settings for PAL / NTSC mode palettes, so it will automatically switch when you change modes.)
User avatar
DRW
Posts: 2225
Joined: Sat Sep 07, 2013 2:59 pm

Re: PPUMASK emphasize bits on NTSC and PAL

Post by DRW »

rainwarrior wrote:If you need the functionality now
I myself don't need the functionality at all. It's merely about emulator accuracy and since fceux is still developed, pointing the developers to this issue might actually fix it.
My game "City Trouble":
Gameplay video: https://youtu.be/Eee0yurkIW4
Download (ROM, manual, artworks): http://www.denny-r-walter.de/city.html
Pokun
Posts: 2681
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: PPUMASK emphasize bits on NTSC and PAL

Post by Pokun »

The emphasis swap also applies to certain PAL Famiclones so it should probably go with the "Dendy mode" too. Then there is the duty cycle swap in these CPU clones (that FCEUX apparently already emulates in the next version).

For emulator accuracy, I'd also like if there were options for disabling the readability of $2004 and the looped noise feature of the APU to emulate earlier PPU and CPU revisions.
User avatar
DRW
Posts: 2225
Joined: Sat Sep 07, 2013 2:59 pm

Re: PPUMASK emphasize bits on NTSC and PAL

Post by DRW »

Pokun wrote:to emulate earlier PPU and CPU revisions.
The NES has different PPU and CPU revisions? I alwas thought the NES versions only differ regarding the lockout chip, but otherwise work identically.
My game "City Trouble":
Gameplay video: https://youtu.be/Eee0yurkIW4
Download (ROM, manual, artworks): http://www.denny-r-walter.de/city.html
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: PPUMASK emphasize bits on NTSC and PAL

Post by lidnariq »

The very earliest of NESes—launch ones, I think, and basically no later—use the 2A03E and 2C02E.

We should probably have a page somewhere on the wiki keeping track of which revisions are in what hardware, and what functional changes happened.
User avatar
DRW
Posts: 2225
Joined: Sat Sep 07, 2013 2:59 pm

Re: PPUMASK emphasize bits on NTSC and PAL

Post by DRW »

lidnariq wrote:The very earliest of NESes—launch ones, I think, and basically no later—use the 2A03E and 2C02E.
And what would that mean in practice, i.e. for the funcationality of the games?
My game "City Trouble":
Gameplay video: https://youtu.be/Eee0yurkIW4
Download (ROM, manual, artworks): http://www.denny-r-walter.de/city.html
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: PPUMASK emphasize bits on NTSC and PAL

Post by lidnariq »

I think I remember reading that the the 2C02E lacks readback from $2004?

The 2A03E does have the tonal noise mode.
Pokun
Posts: 2681
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: PPUMASK emphasize bits on NTSC and PAL

Post by Pokun »

Yeah Codemaster games often rely on reading the $2004, which does not work on, I guess, half of the Famicoms and maybe early NTSC NES systems. I guess this is because Codemaster reverse-engineered the NES so they had no idea that reading $2004 was bad for compatibility.
I remember these jumpy menus in Micro Machines happened in Nesticle too, so I guess it didn't allow reading $2004.

They say $2004 became readable from revision G-0 and later PPUs.
Looped noise feature was added to revision E CPUs or sometime earlier. The unrevised RP2A03 used in VS systems and certain non-VS System arcade boards as a sound chip (like the Donkey Kong 3 and Punch Out arcade boards) does reportedly not have looped noise. I suspect very early Famicoms also doesn't have looped noise.

My Famicom is the very common 1984 HVC-CPU-07 (round buttons, rough bottom) and has a RP2A03E CPU and RP2C02E-0 PPU. As expected, looped noise works but reading $2004 does not.
DRW wrote: The NES has different PPU and CPU revisions?
I guess most revisions was just changes to the dye that lowered manufacturing costs, but some had new features, and these are the ones we currently know about.
User avatar
Quietust
Posts: 1920
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Re: PPUMASK emphasize bits on NTSC and PAL

Post by Quietust »

Pokun wrote:The unrevised RP2A03 used in VS systems and certain non-VS System arcade boards as a sound chip (like the Donkey Kong 3 and Punch Out arcade boards) does reportedly not have looped noise.
Such a chip was depackaged and photographed some time ago, and I was able to confirm by visual inspection that the looped noise was definitely not present - the LFSR's feedback was hardwired to use the last 2 bits, and the flip-flop for $400E.7 was entirely absent.
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
User avatar
Eugene.S
Posts: 317
Joined: Sat Apr 18, 2009 4:36 am
Location: UTC+3
Contact:

Re: PPUMASK emphasize bits on NTSC and PAL

Post by Eugene.S »

Emphasis bit swap already emulated in FCEUX.
But it's user controlled, not automatic:

Image

About audio:
Dendy mode don't have "swap duty cycles" by default
because only certain CPUs/NOACs (UA6527P, T1818) have this bug,
but some other chips (TA-03NP1-6527P CPU, for example) is correct.
Post Reply