Is NES/Famicom detection possible?

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
orlaisadog
Posts: 166
Joined: Thu May 31, 2018 11:12 am
Location: Bristol, England

Re: Is NES/Famicom detection possible?

Post by orlaisadog »

tokumaru wrote:that I go through an entire post without understanding a single word of it! Seriously, it could just as well be written in Polish and I would have gotten just as much information from it.
I seem to have a habit of using quotes from you, tokumaru...
By the way, I mean the one lidnariq linked.
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Is NES/Famicom detection possible?

Post by tokumaru »

I did not write that!
User avatar
rainwarrior
Posts: 8734
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Is NES/Famicom detection possible?

Post by rainwarrior »

You did but it was 5 years ago and in a different context:
https://forums.nesdev.com/viewtopic.php ... 51#p122051
User avatar
orlaisadog
Posts: 166
Joined: Thu May 31, 2018 11:12 am
Location: Bristol, England

Re: Is NES/Famicom detection possible?

Post by orlaisadog »

Well done on finding the post
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Is NES/Famicom detection possible?

Post by tokumaru »

Holy crap!
User avatar
koitsu
Posts: 4201
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: Is NES/Famicom detection possible?

Post by koitsu »

OT: I miss blargg. :(
Pokun
Posts: 2681
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Is NES/Famicom detection possible?

Post by Pokun »

I'm with Rainwarrior. Tepple's system detecting program is very cool and I like it very much, but I'm also not sure how it could be useful for normal homebrew. Defaulting the language wouldn't be very useful since so many people have Famicoms outside Japan, and PAL systems and Famiclones are in all sorts of countries. This is a case when computer programs are trying to be "smart" and end up irritating the user because it doesn't work as it should.

Things like controller II START and SELECT buttons, microphone and double zappers are problems that are probably best avoided by never assuming the user have access to all that. If a game is using the microphone, just make sure there are another way to do the same thing without the microphone (like in Takeshi no Chousenjou: Press DOWN and A buttons on Controller II and after that the A button on Controller II will act as shouting into the mic).

NTSC, PAL, Famiclone and RGB PPU detection is probably far more useful as it could default some necessary settings that may not be clear for the user. But that would also require access to adjust these settings manually in case of being "smart" doesn't work. Personally I made settings for PAL pitch, PAL speed, PAL tint, duty cycle swap and RGB tint so the user can mix and match those settings depending on needs.
tokumaru wrote: Seriously though, there are a few characteristics that can only be found in Famicoms, such as the inability to read from OAM, but that's just because the Famicom is older and the earlier units used older revisions of the PPU and CPU, but after the NES was introduced, they probably shared the exact same chips.
Famicom's with the earlier APU (without looped noise mode) are seemingly quite rare since Nintendo took back most of the earliest square button systems. The PPU where $2004 being write only is probably more common though. Most Famicoms I've seen are HVC-CPU-05 or later, and they usually have the newer CPU but maybe about half have the newer PPU.
orlaisadog wrote:Most of the time? Just assume it's a normal NES, which is most common! Simple!
Not a chance! 60-pin systems (non-Nes) are far more common.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Is NES/Famicom detection possible?

Post by lidnariq »

Pokun wrote:Famicom's with the earlier APU (without looped noise mode) are seemingly quite rare since Nintendo took back most of the earliest square button systems. The PPU where $2004 being write only is probably more common though. Most Famicoms I've seen are HVC-CPU-05 or later, and they usually have the newer CPU but maybe about half have the newer PPU.
To spell this out explicitly:
1- 2A03letterless has no tonal noise
2- 2A03E,G,H, 2A07 and 2A07A have tonal noise

3- 2C02A,B,C,D,E, 2C03, 2C04, 2C05 cannot read from $2004
4- 2C02G can, but writes to $2003 corrupt sprite memory
5- 2C07, 2C07A can both read and write to $2004, writes to $2003 work as intended, but sprite memory is inaccessible sometimes, regardless of whether a picture is being drawn
6- 2C02H - who knows
Pokun wrote:Not a chance! 60-pin systems (non-Nes) are far more common.
Over the years, there might be comparable numbers of 2C02-based and cartridge-accepting famiclone systems. Wikipedia claims 62M authentic NESes/Famicom, of which more than half are in the US, more than a third are in Japan, and the remaining 1/7th are probably the authentic PAL consoles.

On the other hand, we know of more than 377 famiclones, and I bet none sold fewer than 50k units. 377·50k=18M all by itself, comparable to the number of authentic Famicoms.
Pokun
Posts: 2681
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Is NES/Famicom detection possible?

Post by Pokun »

Yeah, so in other words it's not very simple at all.
User avatar
orlaisadog
Posts: 166
Joined: Thu May 31, 2018 11:12 am
Location: Bristol, England

Re: Is NES/Famicom detection possible?

Post by orlaisadog »

Pokun wrote:PAL systems
What do you mean? How does that affect it? Personally I'd set PAL language to English, but I live in England so I might be biased.
Pokun wrote:
orlaisadog wrote:Most of the time? Just assume it's a normal NES, which is most common! Simple!
Not a chance! 60-pin systems (non-Nes) are far more common.
I meant NES-001 vs NES-101. Also that was a joke.
User avatar
orlaisadog
Posts: 166
Joined: Thu May 31, 2018 11:12 am
Location: Bristol, England

Re: Is NES/Famicom detection possible?

Post by orlaisadog »

Also, if we're so concerned about these clones (more than the originals) should we call this site "NesCloneDev"?
Pokun
Posts: 2681
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Is NES/Famicom detection possible?

Post by Pokun »

It's just that there are many people growing up with clones and still use them, and their behaviour is well known, so there is really no reason not to support them and limit your audience.

I'm not talking about languages, as I said that is very hard to guess for the user (generally using simple English in menus and such should be fine I think, that's what early Famicom games did anyway despite Japanese not being good at English). I'm talking about hardware differences that you as the programmer needs to consider if you want your game to behave the same on all systems.
Some of the basic differences are:
-PAL systems runs in 50 Hz (so you have to make your game run faster, including music tempo or it will sound different on PAL systems).
-PAL system has different sound frequencies (so you have to use a separate pitch table for your music notes or your sound will sound different on PAL systems).
-PAL swaps green and red color emphasis (so you have to consider this if you use the emphasis feature).
-PAL has longer vblank (just don't use the extra vblank time if you want your game to be NTSC-compatible)
-PAL requires OAM-DMA to happen early in vblank (just do your OAM-DMA early and you are good to go for all systems).
-UMC-based Famiclones has a mix of NTSC and PAL settings. For example they use PAL speed and NTSC pitch.
-UMC-based Famiclones swaps duty cycle 25% and 50% settings for pulse channels (so you have to make your sound engine swap these automatically if swapped duty cycle option is checked).
-RGB PPU uses color emphasis differently (so you might not want to use it the same way if the user has a Famicom Titler or other RGB-PPU machine).

My approach is to have all required settings as selectable options in an options menu. Then the player can for example turn on PAL speed and turn off PAL pitch if he has a Famiclone. If he has a PAL NES he would turn on both, and turn off both if he has NTSC and so on.
orlaisadog wrote:
Pokun wrote:
orlaisadog wrote:Most of the time? Just assume it's a normal NES, which is most common! Simple!
Not a chance! 60-pin systems (non-Nes) are far more common.
I meant NES-001 vs NES-101. Also that was a joke.
I see.
zzo38
Posts: 1096
Joined: Mon Feb 07, 2011 12:46 pm

Re: Is NES/Famicom detection possible?

Post by zzo38 »

I am not sure why you need to tell the difference between NES and AV Famicom, but telling the difference from NES and RF Famicom would be more useful, because RF Famicom has a microphone and does not have player 2 START and SELECT button.

The only thing about AV Famicom is that the controller ports don't connect all of the pins, but this is probably unimportant.

The fact that the cartridge doesn't fit also seems unimportant (an adapter will be used if needed), although if you are making a NES cartridge, maybe you can detect from the SYSTEM CLK pin if you need to tell the difference from NES and AV Famicom.
(Free Hero Mesh - FOSS puzzle game engine)
User avatar
orlaisadog
Posts: 166
Joined: Thu May 31, 2018 11:12 am
Location: Bristol, England

Re: Is NES/Famicom detection possible?

Post by orlaisadog »

Pokun wrote: My approach is to have all required settings as selectable options in an options menu. Then the player can for example turn on PAL speed and turn off PAL pitch if he has a Famiclone.
That isn't very user-friendly. You also can't detect 377 Famiclones.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Is NES/Famicom detection possible?

Post by tepples »

zzo38 wrote:The only thing about AV Famicom is that the controller ports don't connect all of the pins, but this is probably unimportant.
Except in something like Zap Ruder that's designed for two Zappers. In addition, Famicom plays mapper audio; NES doesn't without a mod, and I don't know what 72-pin famiclones do.
zzo38 wrote:although if you are making a NES cartridge, maybe you can detect from the SYSTEM CLK pin if you need to tell the difference from NES and AV Famicom.
I'm not sure 72-pin famiclones even pass SYSTEM CLK.
Post Reply