Page 1 of 3
The switched duty bug on clones - an evidence
Posted: Mon Nov 07, 2011 8:01 pm
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.
Posted: Mon Nov 07, 2011 8:30 pm
by Dwedit
I've seen enough videos on Youtube to know about this bug. Look for "Onestation", and you'll find wrong duty cycles.
Posted: Tue Nov 08, 2011 2:59 am
by Eugene.S
And here is
correct recording from TA-03NP1 6527P chip.
alternate
link (mediafire)
Posted: Sat Nov 12, 2011 2:21 pm
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 ?
Posted: Sat Nov 12, 2011 2:51 pm
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

Posted: Sat Nov 12, 2011 4:10 pm
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.
Posted: Sat Nov 12, 2011 10:32 pm
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?
Posted: Sat Nov 12, 2011 11:37 pm
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.
Posted: Sat Nov 12, 2011 11:41 pm
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?
Posted: Sat Nov 12, 2011 11:52 pm
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.
Posted: Sun Nov 13, 2011 12:15 am
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.
Posted: Sun Nov 13, 2011 3:32 am
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.
Posted: Sun Nov 13, 2011 6:34 am
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.
Posted: Sun Nov 13, 2011 12:15 pm
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.
Posted: Tue Nov 29, 2011 8:08 am
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

(on top, the original NES. On the bottom this famiclone)
Actually I prefer the "happier" sound from the Famiclone