Page 12 of 14

Re: MMC1,2,3,4/Sunsoft-5B reproduction circuit boards. INL-R

Posted: Tue Feb 18, 2014 1:37 pm
by yogi
@ Ladnariq Glad we're 'Good'.
My main direction with the YM2413 was motivated by the similarity with VRC7 and the fact that INL had interest in a VRC repo board. Fitting a CPLD with the FM core is a task and in a hope to see a FM cart, this chip seemed the closest fit to the direction INL was going.
You are right that there can/would be Op Error and some confusion as to the two FM expansions using the same mapper but again one is a very close subset of the other. Just some reassigning of instrument names and adding support for the increased channel count, but I could be over simplifying things.
so a game that fit on a 360K floppy is still comparable to a 256 KiB NES game
Point taken. But I will point to the 8bit ISA bus speed as a factor also. Don't remember the historic specs but 4-8MHz springs to mind, which is a factor of ~4-6 improvement in though-put compared to the NES.
How much this will impact things, can only guess. Just by my gut, seems like some of the signature sound of Adlib music will be lost to some extent.
And why should FamiTracker support the OPLL instead? It's not like either was ever used during the FC's commercial life. If you want a general purpose retro softsynth, Deflemask and many other retro trackers are out there.

This I can't really agree with. If a tool supports VRC7 then it supports a sub set of the YM2413. In fact I'm guessing that some of the framework for VRC7 FM emus were adapted from existing YM2413 code (Konami was producing games on the MSX (YM2413 sound) before Nintendo). It's a far closer match than an OPL2 IMO. There's much to say about all the great softs out there but as good as their emus are, there is a 'need' to hear it on real silicon.
Good info on the DAC, there may be hope for a replacement. I'm just going by the similar OPL3 and the MBFM hardware design. Just seems like the Yamaha OPLs and DACs are a 'hand and glove' design :)
@ rainwarrior
In regards to
instrument patches aren't really a significant burden on data size compared to pattern data. OPL2 wouldn't even create significantly more patch data, there's only about 1 more byte of data (extra waveform selection, and an output level control for the carrier). The 14 patches you get "for free" with the VRC7 are worth 112 bytes, if you're using all of them.
I'll take your judgement as well as Tepples' on this. It just seems that comparing the restricted OPLL to the OPL2 is difficult. The OPL2 is completely configurable where as the OPLL was, by design, minimized for ease of use. Or was it only cost savings? To me the OPLL looks more like it was trimmed to fit into the PSG model of sound production.
The OPLL saw far more use on smaller, slower systems where as the more complex chips were on faster machines, just cost? I don't know but I don't mind having several option in my 'stable' :)
Not married to the YM2413, just thought it fit better with an NES without major changes. But looks like there is interest and support for a really out of the box expansion. 'More FM for the World' :)

Re: MMC1,2,3,4/Sunsoft-5B reproduction circuit boards. INL-R

Posted: Tue Feb 18, 2014 1:58 pm
by tepples
yogi wrote:But I will point to the 8bit ISA bus speed as a factor also. Don't remember the historic specs but 4-8MHz springs to mind, which is a factor of ~4-6 improvement in though-put compared to the NES.
You fell for the MHz myth. The 6502 does much more in each cycle than an 8088 does; I direct you to any Spectrum vs. C64 flame war. On how many of those cycles is the PC actually transferring data?
The OPL2 is completely configurable where as the OPLL was, by design, minimized for ease of use. Or was it only cost savings?
It might have been cost savings. Consider the APU in the 2A03: cost of ROM vs. RAM, no fine-grained period control for noise and DMC, no destination address for DMA, etc.

Re: MMC1,2,3,4/Sunsoft-5B reproduction circuit boards. INL-R

Posted: Tue Feb 18, 2014 2:02 pm
by lidnariq
yogi wrote:It just seems that comparing the restricted OPLL to the OPL2 is difficult. The OPL2 is completely configurable where as the OPLL was, by design, minimized for ease of use. Or was it only cost savings? To me the OPLL looks more like it was trimmed to fit into the PSG model of sound production.
Definitely cost savings; 1kbit of RAM is significantly more expensive than the corresponding 1kbit of ROM and 200 bits of RAM. Also, the integration of the substantially cheaper (multiplexing) DAC, rather than using an adder and a separate discrete one.

Honestly, the complexity of configuring a OPL2 voice is equivalent to configuring the OPLL's custom patch (registers 0-7) and the channel configuration registers (0x10, 0x20, 0x30). Then duplicate that once for each of the 9 channels in the OPL2.

Re: MMC1,2,3,4/Sunsoft-5B reproduction circuit boards. INL-R

Posted: Tue Feb 18, 2014 2:19 pm
by rainwarrior
Also, on most frames you don't need to configure anything. The tendancy is to use the same patch on a single channel for lengthy stretches. CPU usage for controlling FM chips under typical usage is far less than the with the macro-driven approach typical for 2A03 where every frame requires an update.


Yogi, the VRC7 code in Famitracker (and several other things that support VRC7) is a commonly available YM2413 emulation written by Mitsutaka Okazaki in 2001, simply with the custom patch set put in. It's not custom written for Famitracker at all, just a drop-in solution, really. This is why it'd actually be pretty easy to drop-in an OPL2 emulator in its place. Not a lot of code is needed to interface with this kinda thing, just a few lines to initialize and recieve the emulated sound, and another few lines to map the 2A03 CPU writes to the registers of the OPL emulation.

Re: MMC1,2,3,4/Sunsoft-5B reproduction circuit boards. INL-R

Posted: Tue Feb 18, 2014 3:59 pm
by infiniteneslives
infiniteneslives wrote:The VRC7 method of interfacing with a YM2413 (OPLL) does seem a little cumbersome.
Well I think I only really looked at the vrc7 audio wiki to come to that conclusion. Looking over things again, it's uber simple to configure the CPLD to interface with the OPLL. The only real difference in the interface comapared to the VRC7 would be the wait. You wouldn't have the wait restriction with my implementation, writes could be back to back successive.

It's literally just one logic function:

Code: Select all

If CPU A14-12==0b001 & PRG/CE==0 & PRGR/W==0 & CPU A4==1
   Take OPLL pins /CS and /WE low
else
   Take em high.
The A0 pin would get connected directly to CPU A5 and that's pretty much it.

Just need a good solution for mixing the melody and rhythm together, perhaps the same mixing circuit I have for the AY-3-8910 would suffice?

I'd probably interface the OP2 the same way and tie the /RD pin high. One other support peice the OP2 needs in comparison to the OPLL besides a DAC is an input clock, but that's not a big deal. The OP2 also has the benefit of /IRQ generation which might be handy.

FWIW I picked up a few YM3812's and YM3014's for playing around with as well.

The best platform/mapper for this I don't feel is something like a VRC7. Afterall we're not after the PRG/CHR bankswitching or counter. Just the sound for the purposes of this right now. In that light I'd say it better belongs on my stripped down NSF mapper. The VRC7's port choice of $9010/9030 is convenient in the fact that it doesn't conflict with many other common mapper ports. So with this you could fairly easily tack on any OP to any common mapper if you really wanted to.

This setup on the NSF mapper wouldn't be a VRC7 variant. It'd just be an extension of the NSF mapper which currently doesn't have definitions for the OPLL or OPL2. It just uses the same port locations because it's convenient. So that might make some people happy as well. You pick and define your OP, the port definitions are the same.

Re: MMC1,2,3,4/Sunsoft-5B reproduction circuit boards. INL-R

Posted: Tue Feb 18, 2014 4:05 pm
by yogi
tepples wrote:You fell for the MHz myth. The 6502 does much more in each cycle than an 8088 does; I direct you to any Spectrum vs. C64 flame war. On how many of those cycles is the PC actually transferring data?
:) I guess a lot of my concerns stem from my background with the Atari 800. 6502 processing is effectively within the VBlank period and halted during GITA access. Not a problem on the NES if I understand.
Lidnariq wrote: Definitely cost savings; 1kbit of RAM is significantly more expensive than the corresponding 1kbit of ROM and 200 bits of RAM. Also, the integration of the substantially cheaper (multiplexing) DAC, rather than using an adder and a separate discrete one.
All good points; I'm sure I've glossed over a lot of factors and money usually trumps other concerns in business.
Lidnariq wrote: Honestly, the complexity of configuring a OPL2 voice is equivalent to configuring the OPLL's custom patch (registers 0-7) and the channel configuration registers (0x10, 0x20, 0x30). Then duplicate that once for each of the 9 channels in the OPL2.
rainwarrior wrote:Also, on most frames you don't need to configure anything. The tendancy is to use the same patch on a single channel for lengthy stretches. CPU usage for controlling FM chips under typical usage is far less than the with the macro-driven approach typical for 2A03 where every frame requires an update.
Well, I'll bow to your collective opinion. I don't necessarily love the OPLL (I've been a sucker for OPL3 music for a long time) and if you all feel an OPL2 wouldn't be a dog, cool.
What are your feelings with the YM2612, Sega Gen FM? 6 voices vs the 9 on the OPL2. Build in DAC, some homebrew tools & Sega community development. Seems same price on Ebay, $3-$10 and would eat less board space. Thought?
Yogi

Re: MMC1,2,3,4/Sunsoft-5B reproduction circuit boards. INL-R

Posted: Tue Feb 18, 2014 5:20 pm
by yogi
@infiniteneslives Don't know if you need any of this?
Here is an Arduino shield w/YM2413 that may assist with the output mixing
http://htlab.net/products/electronics/ym2413-shield-1/
and
http://htlab.net/wp-content/uploads/201 ... er_1.0.pdf
Looks like a basic opamp mixer. Using a quad but could just as well use a dual opamp.
As well as this
http://etim.net.au/smsfm/smsfm.html
Master system FM mod

Re: MMC1,2,3,4/Sunsoft-5B reproduction circuit boards. INL-R

Posted: Tue Feb 18, 2014 9:58 pm
by infiniteneslives
yogi wrote:@infiniteneslives Don't know if you need any of this?
Thanks, this does help out.
http://htlab.net/wp-content/uploads/201 ... er_1.0.pdf Looks like a basic opamp mixer. Using a quad but could just as well use a dual opamp.
Looks like they did do the mixing with resistors similar to how I was thinking, and a coupling capacitor into the amp stage. Correct me if I'm wrong, but those opamps don't have much todo with mixing, they're solely amplifying. Assuming the output strength of the OPL's is comparable to the YM2149, they will need some amplification though.
What are your feelings with the YM2612, Sega Gen FM? 6 voices vs the 9 on the OPL2. Build in DAC, some homebrew tools & Sega community development. Seems same price on Ebay, $3-$10 and would eat less board space. Thought?
Well considering things in the scope of a NSF board, and not some variant of the VRC7 mapper, I think there's room for pretty much anything of this sort.
One other support peice the OP2 needs in comparison to the OPLL besides a DAC is an input clock, but that's not a big deal.
This isn't exactly accurate. The YM2413 has a built in oscillator, so it only needs an external crystal. The OPL2 and YM2612 need an external oscillator. Sourcing the exact xtal for the OPLL was no prob. I found what I believe is close enough to exact for the OPL2 with 3.579545Mhz. Finding a 7.67Mhz oscillator for the YM2612 on the other hand... Best I can do with digikey is a 7.5Mhz with a lead date of Apr-22nd, and it running w/3.3v supply... :(

Having just dealt with sourcing the components for everything the OPLL is the clear winner of the three in this front. They're all pretty comparable on ebay for the actual chip.
YM2412: readily available xtal, No DAC, op needs mixed if you want the rhythm.
YM3812: readily available oscillator, needs external DAC YM3014 or similar (costs more than synth), no mixing needed.
YM2612: oscillator hard to find, No DAC, needs mixed if you want left and right channels together.

I didn't bother acquiring the YM2612 like I did the other two, mostly due to not wanting to deal with the oscillator issues. Maybe I'll consider it come April.. The YM3812 isn't too bad really, it is a little more expensive, but the added cost also buys more capability.

Re: MMC1,2,3,4/Sunsoft-5B reproduction circuit boards. INL-R

Posted: Tue Feb 18, 2014 10:28 pm
by tepples
Is it possible to create a phase locked loop or something that multiplies M2 by 2 to get 3.58 MHz or by 4 to get 7.16 MHz?

Re: MMC1,2,3,4/Sunsoft-5B reproduction circuit boards. INL-R

Posted: Tue Feb 18, 2014 10:59 pm
by lidnariq
infiniteneslives wrote:Finding a 7.67Mhz oscillator for the YM2612 on the other hand... Best I can do with digikey is a 7.5Mhz with a lead date of Apr-22nd, and it running w/3.3v supply... :(
Apparently the 7.67MHz of the Genesis is supposed to be NTSC×15÷7. (bluh). Obviously a PLL could be used, but that would hurt.

You can get 15.36MHz xtals pretty easily, and apparently US patent #4980655 (long expired) details a method for using a 74HC74 to both drive a crystal and divide its output by 2. That gets you to within 2 cents of correct, too. And it looks like the 74HC74 shouldn't have any problems at those frequencies.

(Unfortunately, the 74'4060, almost explicitly designed for this task, doesn't have a divider output smaller than ÷16)
YM3812: readily available oscillator, needs external DAC YM3014 or similar (costs more than synth), no mixing needed.
Hm. The complexity of translating the bitstream to ordinary I²S is definitely within the range of the least CPLD, if not just a microcontroller. And the cheapest I²S DAC I can find is also about a dollar.

Then again, new old stock or working pulls of the YMF262 (OPL3) are also about the same cost as the YM3812 on ebay, and its DAC looks to be usually cheaper than the OPL3.

Re: MMC1,2,3,4/Sunsoft-5B reproduction circuit boards. INL-R

Posted: Wed Feb 19, 2014 12:06 am
by yogi
infiniteneslives wrote: Thanks, this does help out.
well I've been searching and have some links for OPL2 designs also.
A DIY Adlib card
http://www.malinov.com/Home/sergeys-pro ... -opl2-card
A midi synth
http://kikyoya.files.wordpress.com/2013 ... =465&h=303
The C64 Sound Expander
http://kikyoya.files.wordpress.com/2013 ... =465&h=303
Yamaha Datasheets attached
Looks like they did do the mixing with resistors similar to how I was thinking, and a coupling capacitor into the amp stage. Correct me if I'm wrong, but those opamps don't have much todo with mixing, they're solely amplifying. Assuming the output strength of the OPL's is comparable to the YM2149, they will need some amplification though.
The RCs on each pin are low pass filters, just prior to the mixing Rs. The first stage is summing for the mix and the second is a buffer. Must have the summing for the mix and isolation; could may be do without the buffer amp but there isn't much point, not saving any pins with a single opamp package.
The OPL2 and YM2612 need an external oscillator. Sourcing the exact xtal for the OPLL was no prob. I found what I believe is close enough to exact for the OPL2 with 3.579545Mhz. Finding a 7.67Mhz oscillator for the YM2612 on the other hand... Best I can do with digikey is a 7.5Mhz with a lead date of Apr-22nd, and it running w/3.3v supply... :(
If there's room, could build a xtal osc with a Schmidt Trig inverted, but it adds a 14p package. I'll look into this.
An added note for the OPL2, it needs a buffer amp on the DAC's output and another amp for the DAC's sample/hold section as per the DS.
Having just dealt with sourcing the components for everything the OPLL is the clear winner of the three in this front. They're all pretty comparable on ebay for the actual chip.
YM2412: readily available xtal, No DAC, op needs mixed if you want the rhythm.
YM3812: readily available oscillator, needs external DAC YM3014 or similar (costs more than synth), no mixing needed.
YM2612: oscillator hard to find, No DAC, needs mixed if you want left and right channels together.

I didn't bother acquiring the YM2612 like I did the other two, mostly due to not wanting to deal with the oscillator issues. Maybe I'll consider it come April.. The YM3812 isn't too bad really, it is a little more expensive, but the added cost also buys more capability.
Another option for OPL2 parts could be finding a SB or SB2 card at a good price. If snagged at $10 that would be comparable to the HK chips, and no worries about clones/fakes, just have to be concerned with IF IT WORKS :) (so may be it's the same as the HK chips?!?!)
Yea, If you want to drop the 2612 that's cool, I'm feeling much better about the OPL2. I ran across the C64 Sound Expansion; uses a OPL (1) and the favored mod was to drop in a OPL2. So, for me, it's kind of a proof of concept 6502 wise. This was the first application I've seen using the OPL2 on a 8bitter, I guess the cost was the main stumbling block BITD.
Thanks for your great work,
Yogi

Re: MMC1,2,3,4/Sunsoft-5B reproduction circuit boards. INL-R

Posted: Wed Feb 19, 2014 1:03 am
by lidnariq
tepples wrote:Is it possible to create a phase locked loop or something that multiplies M2 by 2 to get 3.58 MHz or by 4 to get 7.16 MHz?
This is a bit of a tangent, but it should be able to devise a simple multiplying PLL using a 74HC4046 (VCO will PLL) and a divider of some sort (e.g. 74HC4059, 74'393, &c). The original CD4046 isn't very useful: it's only viable up to 1.5-2MHz. But this later 74 series version of it claims to be good for up to 17MHz.

Fixed odd multiples are more easily done using an LC tank and a few inverters.

Anyway, 2×NTSC colorburst is 14/15 of the Genesis's nominal frequency, so things will be off by 120 cents.

Re: MMC1,2,3,4/Sunsoft-5B reproduction circuit boards. INL-R

Posted: Wed Feb 19, 2014 9:08 am
by tepples
All that means is that playback code will need an Amiga tuning table instead of the one for the Genesis. The NTSC and PAL Amiga computers have CPUs clocked at what amounts to four times M2 on the Famicom and Dendy respectively.

Re: MMC1,2,3,4/Sunsoft-5B reproduction circuit boards. INL-R

Posted: Wed Feb 19, 2014 2:15 pm
by yogi
3_5MHz Pierce Osc.png
3_5MHz Pierce Osc.png (6.13 KiB) Viewed 5799 times
OK so here is a simple Pierce Osc @3.579545. My Xtal is 3579.454KHz
I used 4.7M instead of 1M @ R1
1.8K instead 2.2K @R2
C1=C2=22pf
and a 74hct14
One could delete the second inverter gate butit's nice as a buffer.
There is a ton of examples on the net but this was a help with the theroy
http://www.mpdigest.com/issue/articles/ ... efault.asp
Started up first try; DMM reading 3.581MHz but I couldn't put it on a scope to test further :)
Yogi

Re: MMC1,2,3,4/Sunsoft-5B reproduction circuit boards. INL-R

Posted: Wed Feb 19, 2014 2:58 pm
by yogi
lidnariq wrote: You can get 15.36MHz xtals pretty easily, and apparently US patent #4980655 (long expired) details a method for using a 74HC74 to both drive a crystal and divide its output by 2. That gets you to within 2 cents of correct, too. And it looks like the 74HC74 shouldn't have any problems at those frequencies.
Good call, do you have a link to it? Search on Patent Office site only turns up an Expiration notice.
Depending on the costs could just use a xtal osc can into the FF also (so a quick search is not promising for can osc). About the same board real estate.
Yogi