Is NES/Famicom detection possible?
Posted: Thu Jul 19, 2018 11:40 am
Is it possible to programmatically tell the difference between a NES and a Famicom?
This isn't like translating a sentence from one language to another. It's a complex technical topic, and there's a whole lot of required knowledge. I made an attempt to simplify it for you in my last post, but apparently you were unsatisfied because I removed too much in that simplification. Sorry that's not good enough, but explaining it in the way you need is probably far too much work for you to reasonably request all at once.orlaisadog wrote:Also, can someone explain that post simply please?
I think there's far more clones than original systems out there at this point. This forum, though, does tend to be slightly biased toward the official Nintendo hardware, though there is a notable Dendy faction here too.orlaisadog wrote:Most people wouldn't have clones
Even though clones didn't use to be particularly prevalent in most developed countries, they were in several parts of the world. Brazil, Russia and many other countries had Famiclones almost exclusively. But nowadays, even in the US, the old hardware is constantly failing, and since the patents for the console already expired, several companies are coming up with their own take on the system and cashing in on nostalgia.orlaisadog wrote:Most people wouldn't have clones
Unless designs like this become more common. Double-ended carts were normally used to put two games on the same cartridge, but it'd be really cool if someone decided to make dual NES-Famicom carts.pubby wrote:It isn't a very useful thing to do because Famicom and NES cartridges don't fit into each other's slots...
If it's just setting the default value for language selection so that the user doesn't have to go to Options as often, the stakes aren't quite that high.rainwarrior wrote:There is a caveat to this in that there are a lot of clone devices out there. If your software is trying to do something differently based on "NES" or "Famicom" you can probably with some effort identify those two machines specifically, but it gets a whole lot harder to cover all the bases.
PowerPak has pullups on data lines, while the NES grounds the lines in question. This can be detected and worked around. EverDrive behaves more like an authentic cartridge with respect to open bus behavior.rainwarrior wrote:(Also... didn't Everdrive or PowerPak end up messing with the results of these tests in some way too?)
Do you mean something similar to the "almighthy" Hydron? It's a little bizarre and kind of messy...tokumaru wrote:it'd be really cool if someone decided to make dual NES-Famicom carts.
Code: Select all
; The PPU is mapped at $2000-$3FFF. (Addresses $2000-$2007 are
; unique; $2008-$3FFF are mirrors.) The PPU contains a dynamic
; latch called "io_db" in Visual 2C02 and "PPUGenLatch" in FCEUX,
; which holds the last value written to any PPU port. Reading a
; write-only PPU port, such as the VRAM address ($2006), returns
; the value of io_db.
lda #$FF
sta $3F16 ; Fill $3F16 (i.e. $2006) and io_db
sta $3F16 ; write twice because that's conventional for $2006
cmp $3F16 ; read io_db
bne io_db_not_supported ; NOAC clones may implement io_db wrong
; The next read is tricky. When doing an indexed read that crosses
; a 256-byte boundary, 6502 adds the index to the low byte mod 256
; and then fixes it up next cycle if there was a carry.
; Thus $3FF6 + $20 reads $3F16 then $4016. The $3F16 read
; precharges the data bus with io_db. Then the $4016 read changes
; only those controller port bits that are connected to something.
; CAUTION: Open bus works differently on some flash cartridges.
; The PowerPak has pull-up resistors that continuously precharge
; the data bus with $FF. But because this is the same value we
; stored in io_db, it will not change the test result.
ldx #$20
lda $3FF6,x ; reads $3F16 then $4016
; Bits 3-4 are open bus on a Famicom but driven on an NES based
; on two wires of controller port 1, and usually driven low.
; They probably won't both be true on an NES unless a Zapper is
; plugged into port 1 and the trigger is half-pulled.
and #$18
cmp #$18
beq is_famicom
is_nes: