The switched duty bug on clones - an evidence

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

Moderator: Moderators

Shiru
Posts: 1161
Joined: Sat Jan 23, 2010 11:41 pm

The switched duty bug on clones - an evidence

Post by Shiru »

I heard about it many times here, but never observed the problem in real life, although I saw really many Famiclones in the past, like hundreds. Now here is an evidence created by Eugene.S and HardWareMan. I think it is a good thing to have certain information about this posted on the forum, so if someone else became interested in this in the future, he'll be able to find it.

The bug is observed on UA6527P, HA6527P and some other early 2A03 clones, except for TA-03NP1-6527P. I often heard that the bug is common for newer clones, but in fact these chips are found in really old ones, newer were all-SoC (a glop or integrated CPU+PPU T1818P and UM6561) and didn't have the bug.

Here is a recording (53MB, FLAC) of songs from Bucky O'Hare and first level of Batman. It was done from a clone with one of the buggy chips, with good audio output, and SB X-Fi soundcard on PC, without any additional processing.

Here is a test program and recordings (8MB) that were made with 6 different chips.
Last edited by Shiru on Tue Nov 08, 2011 2:44 am, edited 1 time in total.
User avatar
Dwedit
Posts: 5188
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Post by Dwedit »

I've seen enough videos on Youtube to know about this bug. Look for "Onestation", and you'll find wrong duty cycles.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
User avatar
Eugene.S
Posts: 317
Joined: Sat Apr 18, 2009 4:36 am
Location: UTC+3
Contact:

Post by Eugene.S »

And here is correct recording from TA-03NP1 6527P chip.
alternate link (mediafire)
User avatar
Bregalad
Posts: 8157
Joined: Fri Nov 12, 2004 2:49 pm
Location: Divonne-les-bains, France

Post by Bregalad »

Hey, it's pretty interesting to have an evidence, I already heard about the duty cycle swapping bug, but hearing tracks with swapped duty cycles is definitely more interesting.

Apparently, duty cycle 0 (87.5%) is emulated right, while 1 sounds like 2 (50%) and 2 sounds like 1 (75%), and 3 sounds like 1 anyways so you don't care if it's 25% or 75% (WHY Nindendo ?? They could have added one more duty cycle instead and it would increase the musical possibilities of the console !! Oh well...)

So yeah it's fun to hear the music with duty cycles swapped.
Is there an emulator that can optionally enable duty cycle swapping ?
Useless, lumbering half-wits don't scare us.
User avatar
Eugene.S
Posts: 317
Joined: Sat Apr 18, 2009 4:36 am
Location: UTC+3
Contact:

Post by Eugene.S »

Only Rocknes, but it's NTSC-only. No PAL or Dendy("Hybrid") modes.
I very like to play NTSC roms and listen nsf-music at 50FPS in Dendy-mode.
Good old memories :)
User avatar
Bregalad
Posts: 8157
Joined: Fri Nov 12, 2004 2:49 pm
Location: Divonne-les-bains, France

Post by Bregalad »

Well, in many games this swap is surprisingly unnoticeable. Many modern NES games switch duty cycles quickly during notes anyways, so this make the swap less noticeable than in old games where the just use plain notes of the same duty cycle for a whole song.

Where the swap the most noticeable is in Mega Man games and Mario games. In Mega Man games I find it actually makes sound effects better.
Useless, lumbering half-wits don't scare us.
User avatar
MottZilla
Posts: 2837
Joined: Wed Dec 06, 2006 8:18 pm

Post by MottZilla »

I don't know alot about the NES APU so I thought I'd ask, what is the equal of this to register writes. Or to put it another way, what would you do to APU writes to simulate this swapped duty cycle?

Do you just swap bits 7 and 6 on $4000 and $4004?
User avatar
Dwedit
Posts: 5188
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Post by Dwedit »

xx......:
00 = 12.5% on both
01 = 25% (or 50% on crappy clones)
10 = 50% (or 25% on crappy clones)
11 = 75% on both

So interchanging bits 6 and 7 seems to be correct.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
User avatar
MottZilla
Posts: 2837
Joined: Wed Dec 06, 2006 8:18 pm

Post by MottZilla »

Electrical engineering question then. Is it possible for a device on the bus to detect writes to the registers and swap the bits, fixing the duty cycles on clones that have them messed up?
Shiru
Posts: 1161
Joined: Sat Jan 23, 2010 11:41 pm

Post by Shiru »

I discussed this with HardWareMan few days ago, the conclusion is - no, it is not possible, because these registers are internal to the CPU, and you can't intercept writes into them.
User avatar
MottZilla
Posts: 2837
Joined: Wed Dec 06, 2006 8:18 pm

Post by MottZilla »

That's too bad. For fun though I added an option to my own emulator to swap duty cycles on the fly. As I remember with the HandiFamiEight clone I had, SMB1 has odd sound effects with swapped duty cycles. I really don't understand how anyone could have missed that mistake. Maybe they knew it but didn't bother to fix it. It's a shame since I've heard the clones are basically exact clones otherwise.
User avatar
Bregalad
Posts: 8157
Joined: Fri Nov 12, 2004 2:49 pm
Location: Divonne-les-bains, France

Post by Bregalad »

Technically a game genie style device COULD detect writes to $4000 and $4004 and invert D6 and D7 on those writes.

But I find it kind of fun how they messed up, like if this was here to say it loud "I'm a pirated game".
It's not like this changed gameplay, or even music, significantly. The more noticeable part is sound effects in SMB and Mega Man as I've said.
Useless, lumbering half-wits don't scare us.
tepples
Posts: 22915
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

How would a Game Genie change writes to the APU? The data goes from A inside the CPU to the APU ports inside the CPU. It'd have to intercept the instrument data and change that before it gets into the CPU.
Bregalad wrote:But I find it kind of fun how they messed up, like if this was here to say it loud "I'm a pirated game".
It'd be possible to "say it loud" more literally. Make a 1-bit PCM sample (not the same as 1-bit DPCM). Play it back with zeroes alternating rapidly between 50% (1/3) and 12.5% (2/3) and ones at 25%. If you can hear it, you're on a problematic clone. I'd make a demo myself, but the clones that have this problem also tend not to work with a PowerPak.
User avatar
MottZilla
Posts: 2837
Joined: Wed Dec 06, 2006 8:18 pm

Post by MottZilla »

Right, I don't know why I was thinking about the bus. Since you'd be able in theory to see the address being targeted via the bus doesn't help when the data being written is an internal cpu register which you cannot manipulate since it won't appear on the bus.
socram8888

Post by socram8888 »

Does this one have that issue?
Gold Leopard King famiclone: http://www.goear.com/listen/5e9d115/int ... lk-unknown
Original PAL NES: http://www.goear.com/listen/b7dfd64/int ... es-unknown

Image
(on top, the original NES. On the bottom this famiclone)

Actually I prefer the "happier" sound from the Famiclone
Post Reply