|
ForumsSega Master System / Mark III / Game GearSG-1000 / SC-3000 / SF-7000 / OMV |
Home - Forums - Games - Scans - Maps - Cheats - Credits Music - Videos - Development - Hacks - Translations - Homebrew |
Goto page 1, 2 Next |
Author | Message |
---|---|
|
New FM Enabled Power Base Converter Prototype
Posted: Sat Mar 01, 2014 9:12 pm
|
Here's my first prototype for an FM enabled Power Base Converter.
I had the idea to make this after seeing etim's FM sound expansion module for the SMS - why not have the ability to hear FM sound for a SMS game on Megadrive/Genesis as well? To sum up the design, here are the major components: -YM2413 stand-alone IC -Altera CPLD to handle address decoding (I eventually want to implement stack initialization code in here just like on the official Power Base Converter (VHDL code attached) -Quad Opamp to amplify the RO and MO outputs of the YM2413 and drive the SL and SR inputs on the Megadrive cartridge port I will release the schematic once I've fixed all the hardware bugs! Check out the FM PBC in action in this video: http://youtu.be/7OiDo46SAxU As noted in the video there are still bugs to iron out in this first prototype. The most prominent bug is that Double Dragon crashes at the first level. Does anyone have any suggestions as to why this is happening? For those of you who are VHDL inclined, I've attached my current working copy of the code. Note that there are 3 modes of operation which I've written: -mode 0: FM always enabled, no stack init code -mode 1: FM always enabled, original PBC stack init code -mode 2: FM can be enabled/disabled by my own stack init code I've yet to even attempt testing modes 1 & 2, I will get to these once I have solved all of the audio circuit issues. Mode 1 contains the same stack initialization code as the original PBC. Mode 2 contains code which I've written which will hopefully initialize the stack and enable/disable the FM module through joypad input. |
|
|
Posted: Sat Mar 01, 2014 11:17 pm |
Update 1:
I've succeeded in running mode 1 (refer to VHDL code for more info) - essentially mode 1 includes an EXACT copy of the initialization code found on the original and official Power Base Converter. This particular routine sets the Z80 Stack Pointer to $DFFF. http://www.smspower.org/forums/viewtopic.php?t=14084 This solves a number of bugs for the FM Power Base Converter. Firstly, it enables the game R-Type to load immediately without needing a special trick (see video linked below). Second, it prevents Double Dragon from crashing at the first level as seen in my first post's video. Here is the improved FM Power Base Converter in action: http://youtu.be/Cqwwmff4zN4 I have tried my mode 2 code but sadly it doesn't work. The game will boot if I don't press UP, but if I hold up it will freeze on startup. I suspect it is because I haven't disabled interrupts. This is technically my first Z80 program; I really didn't expect it to work on the first try. Here is my mode 2 code below for reference... -- Array containing ROM of db PBCFM init code --;************************************************************* --; Boot section --;************************************************************* -- ld sp, $dff2 ; setup stack pointer to point to DFF0 after reset -- ld b, $00 ; clear b as iteration counter = 256 ---: in a,(IOPortA) ; read joypad -- bit 0,a ; check if up is pressed -- jr nz,+ ; if 1, reset and leave FM sound enabled -- djnz - ; must read 256 times as 0 to disable FM sound -- nop ; nop, hardware will disable the FM chip if this opcode is read --+: rst $00 ; reset, nWR signal will disable this small BIOS and enable the game to boot type dbROM_t is array (0 to 15) of std_logic_vector(7 downto 0); constant dbBootROM : dbROM_t := (x"31",x"f2",x"df",x"06",x"00",x"db",x"dc",x"cb", x"47",x"20",x"03",x"10",x"f8",x"00",x"c7",x"00"); |
|
|
Posted: Sun Mar 02, 2014 12:57 am |
Don't worry, the Z80 disables interrupts when reset. The pad check code looks fine so maybe it's something else? When you look at the bus with the logic analyzer, are all games freezing at the same point, and if so what bus activity is going on at the moment of it freezing? |
|
|
Posted: Sun Mar 02, 2014 1:13 am |
Sadly still waiting for my Logic Analyzer to arrive, I only recently purchased one in anticipation of this project. All I have at my disposal is a 2CH oscilloscope for now... :(
If you say the ASM looks fine I'll re-evaluate my VHDL around it. I didn't use the nWR method (during stack write on RST) to reset my flip-flop controlling the nCE line of the cartridge port (as is done on the Sega PBC). I chose another method because I was unsure if other instructions in my small routine would assert nWR. With the Mostek document I should be able to confirm if any of my chosen instructions assert nWR. Will keep you guys updated on the progress! |
|
|
Posted: Sun Mar 02, 2014 4:19 am |
I've got the FM disable feature working by holding UP on startup; the bug was in the VHDL code. Here's a short description of what was happening for those of you who are so inclined (this is a dev forum after all!)
-By default, FM is enabled on this PBC -This is achieved by a latch which was set by reading boot code address $00 -The FM latch was reset if the opcode at boot code address $0D was read (reading this opcode meant that the user was holding the UP button) -At this point, the Z80 resets to hand over the bus to the cartridge, but for some reason, my FM latch would get re-enabled (meaning boot code address $00 is read again during reset!) -This caused the FM latch to always be enabled regardless To fix it, I set the FM latch by reading boot code address $01 instead. Both Double Dragon and R-Type seem to be happy with that! Also, I change my stack init value from $DFF0 to $DFFF. Again, R-Type would not boot with $DFF0, only worked with $DFFF. Here's a video of the FM disable feature in action! VHDL is attached. http://youtu.be/vIP8IsxIvcY |
|
|
Posted: Sun Mar 02, 2014 7:01 pm |
Have you considered putting out a board that will add FM to the original PBC? This person took that approach and it'd be something I'd be very interested in: http://www.mmcafe.com/nico.html#http://www.nicovideo.jp/watch/sm16957113 | |
|
Posted: Sun Mar 02, 2014 7:32 pm |
While it's obvious that the board shown in the video you linked would be very similar in circuitry to my design; one of my main policies when releasing products for gamers is that I will not release anything that requires modding a console. I would never mod any of my consoles or accessories, and therefore will not encourage others to do.
As a collector I'm 100% against making any sort of modification to my consoles, I want to keep them in original condition as much as possible. I will change connectors, capacitors, and similar components, to lengthen the life of the device, but I won't make any change that would alter the functionality. That being said, I think releasing a stand-alone PBC is better because it makes Master System games accessible to more people, as opposed to providing a mod kit which doesn't really expand the reach of the Master System library (and would only work on model 1 Megadrives, and requires you to own a "relatively" rare piece of hardware to begin with). |
|
|
Posted: Tue Mar 04, 2014 3:18 am |
It would appear that nIORQ is not present on Address line 19 of the Genesis model 2 when, unlike the model 1, when it is in Master System compatibility mode. This has the unfortunate effect of preventing the FM Power Base Converter from functioning on a model 2...
Can anyone else confirm or disprove the lack of nIORQ on a model 2 Genesis / Megadrive? |
|
|
Posted: Tue Mar 04, 2014 8:38 pm |
Sure, I'll see if I can come up with a test for this over the weekend. Is there any kind of up to date list of which Genesis pins are repurposed as SMS pins in compatibility mode? I've seen a lot of conflicting information and incomplete pin listings so far. |
|
|
Posted: Tue Mar 04, 2014 10:36 pm |
Perfect, that would be great!
By coincidence I found another model 2 Genesis in a pawn shop for $30 today. I picked it up to test with just in case my own model 2 is deffective; I know it's unlikely but the engineer in me wants repeatable results across a sample size larger than 1. As for the repurposed pins, there seems to be very little information on the matter. All the info I've ever used came from the SMSPower forums. |
|
|
Posted: Sat Mar 15, 2014 3:24 am |
Interesting find:
The nIORQ signal is in fact present on the Model 2 Genesis, I have confirmed this by finally finding the time to put one under the oscilloscope this evening. Hmmm, this has me baffled at bit. Why would the YM2413 detection work on a model 1 but not a model 2? |
|
|
Posted: Sun Mar 16, 2014 2:44 am |
I've discovered that the #RESET signal on cartridge port pin B27 is stuck to GND in Master System compatibility mode. When in Genesis mode, this pin sends an active-low reset pulse to the cartridge port when the Reset pushbutton is pressed.
Therefore, you can't rely on B27 for reset when in Master System compatibility... |
|
|
Posted: Sun Mar 16, 2014 8:39 pm |
I think this is why the Power Base Converter has that RC reset circuit to compensate. The Mark III console doesn't have a reset signal on the cartridge port either, so the lack of a reset signal in the PBC is weirdly consistent with the Mark III design at least. Though insufficient for the US or JP SMS consoles. I don't know how many Mark III games used mapper chips (not many AFAIK), but at least one of the Mark III/SMS compatible development cartridges has a MB3771 reset generator on it to handle the lack of a system reset signal. |
|
|
Posted: Mon Mar 17, 2014 1:04 am |
Maybe it works that way because pin B27 is the #RESET signal for the MC68000 CPU... And to achieve complete halting/ BUS release of the 68000 for M3 mode, they have to hold it's RESET low ... |
|
|
Posted: Tue Mar 18, 2014 3:51 am |
Yeah that makes a lot of sense. Looks like I'll add a reset generator on version 2 of the FM Power Base Converter. |
|
|
Posted: Mon Mar 31, 2014 10:32 pm |
Sooo you do all this noodling around with hardware and yet you're against modding? Oookay... |
|
|
Posted: Mon Mar 31, 2014 11:54 pm |
Well, I see what he's saying... wouldn't you rather have a cartridge you can plug in to any of your consoles or someone elses and have the extra feature instead of having to rip it apart and solder something?
It also makes it a lot more accessible to someone who is unwilling or lacks the skills to solder the mod. |
|
|
Posted: Tue Apr 01, 2014 3:13 pm |
Yes, and... modding is completely different from hardware design. I did do an S-Video mod to a spare Genesis when I was in college, but that's the only thing I've ever done. Now my TV setup can accept SCART inputs; I no longer need S-Video. It's not so much that I don't/won't mod my system, it's that I want my products to be accessible to everyone - no soldering skills required. Even then, most people who have basic soldering skills wouldn't be able to repair a lifted pad or accidental trace damage which I would classify as necessary skills to perform a mod. |
|
|
Posted: Tue Jul 29, 2014 2:02 am |
Here it is guys! FM Power Base Converter working on both Model 1 and Model 2 Genesis!
http://youtu.be/bgm-sbANHfI Sound clip available on my website's July 2014 Lab Journal Adding compatibility for the Model 2 Genesis seems to have broken the "hold up to disable FM sound" feature. I'm beginning to question whether disabling the FM sound is a necessary feature, I mean, if I'm buying this thing it's because I want to hear the FM sound. What do you guys think? |
|
|
Posted: Tue Jul 29, 2014 3:49 am |
Damn that's sexy.
Didn't you plan to put a physical switch at some point, instead of a software cheat? Maybe it would be easier to implement and bypass your bug altogether? |
|
|
Posted: Tue Jul 29, 2014 10:16 am |
Some (all?) Mega Drive original models have the audio input lines terminated with a 75 ohm resistor to ground. The model 2 doesn't have the resistors (to its detriment, it picks up noise coupled from the digital lines). Can your output circuit can accommodate such a load? |
|
|
Posted: Tue Jul 29, 2014 11:30 am Last edited by db-electronics on Tue Jul 29, 2014 1:17 pm; edited 1 time in total |
Yes I can drive approximately 2.5Vpp into the Genesis without harming my output circuit - I have 75 ohms in series with the output. I do have to reduce the gain a bit on the output opamps because as it stands, even on Model 1, the FM is WAY louder than the console's PSG. |
|
|
Posted: Tue Jul 29, 2014 12:49 pm |
I'd rather get the software to disable the FM module rather than having the added cost of a switch, and added labour of exposing said switch through a cartridge shell; it's worth the extra effort now in order to save on parts and labour down the road. Also, on both my original Power Base Mini and TG-16 converters the #1 failure thus far is broken switches; the fewer switches the better! |
|
|
Posted: Tue Jul 29, 2014 1:29 pm |
I have to agree, even if a switch would be the optimal solution for the final user, mechanical parts are always more prone to failures than electrical parts. | |
|
Posted: Sun Aug 03, 2014 3:11 am |
I only mentioned it because you have what appears to be the circuit diagram in the background of the photo. You have a 10u (X7R maybe?) coupling capacitor on the output which forms a high pass filter. After tempco, tolerance, and ageing, the cap is probably going to look more like 5u. So your cut off frequency is 1/(2*3.14*75*5e-6) = 425 Hz. |
|
|
Posted: Sun Aug 03, 2014 10:07 am |
Well there will already be a switch for the Pause button, I figured having one more wouldn't hurt that much. Plus it seems it's the assumed option when people talk about your PBC. On that subject, is it possible for your PBC to do something similar to the Pause on controller mod? I mean trigger Pause when a specific input is received, like one from the Start button. |
|
|
Posted: Mon Aug 04, 2014 2:09 pm |
Good eye, this is a bad old habit of mine from my first design job where the policy was to not calculate filters at schematic time. We had to rush our boards in order to get them built as soon as possible - just put some reasonable footprints for a filter and deal with it later. I simply haven't updated my schematic file yet. So yes, you're absolutely right about the cutoff frequency. Both Model 1 and Model 2 AC couple the SR1 and SL1 inputs so I'm going to do a few comparisons with no coupling caps at all - the output opamps can handle the load so it's worth a try. I still have to find a happy medium between the 75 ohm Model 1 input and the Model 2's input. There is a considerable volume difference between the 2 as I showed in my demo video. |
|
|
Posted: Tue Aug 05, 2014 2:56 am |
I was getting a bit frustrated with the joypad reading differences between the Model 1 and Model 2 MDs. These are probably not that hard to sort out but not necessarily what I plan on tackling with the limited Z80 opcodes I can fit on a 32 macrocell CPLD. Therefore I applied a stupid simple fix, hold the Pause button on bootup to disable FM sound - seems to work just fine. The NMI is negative edge triggered (pretty sure) so it shouldn't really cause any issues. The CPLD samples the Pause button as soon as the Reset generator releases POR, so basically you can let go of the Pause button as soon as you see something on screen...
Also, I removed the coupling caps from the audio output circuitry. I did have 47uF caps there, but viletim's comments made me realize these weren't necessary since the MD 1 & 2 already AC couple the SL1 and SR1 inputs. This has slightly improved the low-end response in the FM audio. There's still the issue of volume difference between Model 1 and Model 2 - this is due to Model 1's having 75ohm termination of SL1 and SR1 and Model 2's lacking this. This makes the FM audio on Model's 2 louder than the equivalent PSG (when FM is disabled). There isn't really much I can do to address that on the FMPBC sadly. My only advice is get a Model 1! Haha! Edit: I'll share the VHDL as soon as I comment it nicely and clean it up a bit... Edit 2: BTW I reverted the BIOS code back to identical code from the original PBC |
|
|
Posted: Wed Aug 13, 2014 12:12 pm |
Last night I tested with After Burner, Altered Beast, Phantasy Star (SMSPower english translation) and Ys. All worked with the FM PBC...
On the audio quality side, I had been trying for the last week or so the reduce, as much as possible, the noise at the audio output of the FM PBC. A note on this noise; it is very small, barely perceivable (on a Model 1 you need headphones and must set the slider at maximum to detect it). Still, I'm an audiophile musician and this bugs me a bit. Turns out the source of the noise is not my opamp circuit but the YM2413 directly. A look at the YM2413 datasheet does reveal that the typical noise of this chip is -65dB (pretty damn high by today's standards). It would seem as though there isn't much I can do about removing this small barely perceivable noise. While I certainly don't think this small noise is a show-stopper (I have yet to notice it without headphones), I would like to be able to reduce it as much as possible. In order to even notice it you need to use headphones on the Model 1 and set the volume slider to maximum. A simple test of removing the YM2413 from its socket (on my socketed prototype) has confirmed the source to be the YM2413. Oh well... Maybe I should look into running an RTL model of the YM2413 on an FPGA in a future version... |
|
|
Posted: Wed Aug 20, 2014 8:07 am |
Seconded this please. Is it possible to send pause from a key combo in game? Thanks for all of your work on this. |
|
|
Posted: Wed Aug 20, 2014 8:40 am |
What about the compatible chips? Do they have the same typical noise? |
|
|
Posted: Wed Aug 20, 2014 9:12 am |
The PBC can't monitor the Start button without hijacking either the CPU or the bus, which amounts to about the same thing: something that would break some games.
I thought the "compatible" YM2413s were generally pretty shoddy, as seen by the FM board which had some refreshes with better (original) chips? |
|
|
Posted: Wed Aug 20, 2014 12:51 pm |
The YM2413 has a 9bit output DAC, while a noise floor of -65dB is equivalent roughly to an 11th bit.
How good is the YM2413 emulation in MEKA? I wonder if it's feasible to port the YM2413 emulation (assuming it's written in 'C') to a small microcontroller and use that instead. |
|
|
Posted: Wed Aug 20, 2014 2:21 pm |
Meka uses emu2413 which is fairly accurate and can in fact operate at multiple bit depths (for the internal sine table), allowing it to exceed the original chip's capabilities. However, I'm not sure how well a microcontroller could deal with the real-time nature of the output, insofar as the number of CPU cycles taken per emitted sample will vary. In a program you'd have a much faster CPU and you'd use output buffering (with some latency) to avoid jitter. | |
|
Posted: Wed Aug 20, 2014 2:45 pm |
Is the emu2413 source code open source? I'd like to have a look at it to gauge the feasibility.
There are entire families of DSP-oriented microcontrollers which can run at 80 MIPS or greater. At least some of them should be able to handle the YM2413, given that this would be the only code running on the chip. The YM2413 is obsolete and some of the available stock on eBay are fakes which sound horrible. It would be wonderful to be able to produce an emulated version which can run on real silicon! |
|
|
Posted: Wed Aug 20, 2014 4:45 pm |
Then how about this:
http://www.pokipoki.org/dsa/index.php?VM2413 |
|
|
Posted: Wed Aug 20, 2014 4:54 pm |
I found that quite a while back. The license terms in Pokipoki's source code forbid to sell it or to use it in a commercial product. I would have to contact him for persmission but I'm not getting my hopes up since the edit date on that webpage dates to 2007. While it would be nice to use this VHDL implementation, it would be more expensive to use an FPGA than a standard DSP. Also, with a 'C' implementation I could track updates to emu2413 in my port. Either way, I'm sitting on a fairly large stock of YM2413 chips which I need to use up before considering a soft implementation. |
|
|
Posted: Wed Aug 20, 2014 5:39 pm |
Well, emu2413 is by the same guy; the tricky part is finding it, as it was in the MSXPlug sources, but they seem not to be offered any more. It's pretty widespread though - here, for example:
https://github.com/gammy/wiimednafen/tree/master/mednafen/src/hw_sound/ym2413 This seems up to date, plus it seems to have some useful simplifications applied. The licence seems to allow commercial use. Edit: found the canonical emu2413 latest source here: http://dsa.sakura.ne.jp/arc/src/msxplug/latest/ which is no newer than the above. |
|
|
Posted: Thu Aug 28, 2014 6:12 am |
Just uploaded a video to youtube of tests I made today - I tried to round up all of the FM SMS games I could and ran them on my FM Power Base Converter using the Master Everdrive - compatibility seems pretty good!
http://youtu.be/HXkxkov8Db8 If there's a game I missed please let me know, I'd like to build a list of all compatible FM games. |
|
|
Posted: Thu Aug 28, 2014 12:11 pm |
Well you missed the obvious Wonder Boy III the Dragon's Trap, but I guess it's because your Megadrive isn't modded with a region switch to activate FM sound.
In the Homebrews, at least DARC supports FM sound. http://www.smspower.org/Homebrew/DARC-SMS There also quite a few Japanese only games that you can find on this list: http://segaretro.org/FM_Sound_Unit Great Golf Hoshi wo Sagasite Megumi Rescue Nekkyuu Koushien Solomon no Kagi Super Racing Tensai Bakabon Bar from making a Japanese cartridge adapter, you will only be able to play those with an Everdrive mind you. I don't think any of those have a region restriction like Dragon's Trap. |
|
|
Posted: Thu Aug 28, 2014 1:54 pm |
http://www.smspower.org/Tags/FM | |
|
Posted: Thu Aug 28, 2014 9:52 pm |
There's something over here you could test against it. http://krikzz.com/forum/index.php?topic=1097.0 |
|
|
Posted: Tue Sep 23, 2014 1:18 pm |
FYI I finally managed to build a small run of these to put them up for sale.
http://www.ebay.ca/usr/db-elec A lot of technical information required to build and design the FM Power Base Converter came from this site and forum - thank you! |
|
|
Posted: Thu Sep 25, 2014 11:00 am |
Well, they got sold quickly! Hope you will get some feedback from these first five owners. | |
|
Posted: Mon Oct 06, 2014 5:39 am |
That is cool! Does that cartridge slot fit just US/Eur SMS games then? | |
|
Posted: Mon Oct 06, 2014 12:10 pm |
Yes it's a 50 pin edge connector. I haven't been asked yet about supporting the M3 connector so I'm assuming there's not a big demand for that. |
|
|
Posted: Mon Oct 06, 2014 5:24 pm |
Good luck finding edge connectors in its weird size... | |
|
Posted: Mon Oct 06, 2014 5:41 pm |
I don't have an M3 cart on hand, but assuming it's the same pin pitch as SMS then this 44pin edge connector, from the same family of parts as the SMS edge connectors I use, would work: http://www.digikey.ca/product-detail/en/5530843-4/A31717-ND/770543 |
|
|
Posted: Mon Oct 06, 2014 5:43 pm |
http://gamedoctorhk.com/index.php?main_page=product_info&cPath=72_2_97_149&a...
I think there is demand for such a thing, Japanese Power Base converters are pretty expensive. A better solution than creating separate Japanese and Western Power Base Converters would probably be a simple 44 pin to 50 pin adapter which could be used with not only your PBC, but also any existing ones and also Master Gear Converters. It should also work on a standard Master System with games that have a header at least. It should also allow the use of card games via the card catcher, which isn't too uncommon or expensive. |
|
|
Posted: Mon Oct 06, 2014 5:51 pm |
They're different specs (despite less pins Mark III slot is actually wider), if you click on the link I posted above you can see the part specs on the image. Edit, actually the specs are on an image from a different site. |
|
Goto page 1, 2 Next |