It is currently Wed Nov 22, 2017 12:59 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 24 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Mon Jun 19, 2017 8:39 pm 
Offline
User avatar

Joined: Thu Mar 26, 2015 6:34 pm
Posts: 33
After some extremely crude fun messing around with LSDJ and enabling VIN to play Famicom expansion chips behind LSDJ tracks, I got to talking with B00daW and others to see about making an MBC5-compatible cart with an on-board sound chip that people could actually use. I don't have any hardware prototypes out and probably won't for a bit, mainly because I want to know if it's possible and need help getting it out of my head.

When I first mentioned it in a Discord server, someone mentioned possibly making a special version of their sound driver that was compatible with the new sound chip, the only thing they needed was for it to show up in a predictable memory location. Looking at these wiki'd Pan Docs pages, the area from $6000-7FFF isn't mentioned, so assuming it's not mirrored from $4000-5FFF (I honestly don't know), it could be used. Me being a massive Sunsoft 5B fanboy, I elected to try using the YMZ284 since it's bigger brothers are extremely well-known and documented (also where the tentative "MBC-5B" name comes from. I'm not aware of an actual B-revision of the MBC5 so it's perfect!). Taking from this, I looked at the 5B Audio page on the NESDev Wiki and saw that the 5B uses a space twice as large for its control on the Famicom, namely $C000-DFFF and $E000-FFFF. This is where my problem is.

The YMZ284 is a very straightforward chip to wire up, but for me not being SUPER into hardware, the addressing is a bit tricky. All the data lines are obvious, GB /WR can go to YMZ /WR (reads don't work on the YMZ anyway), /IC to RESET, and all that's left are Vcc/Vdd, OUT, /CS, and A0, the YMZ's sole addressing pin. These last two are my issue.

Image

1. Can the area from $6000-7FFF be used for this with the MBC5?
2. If it can, can the YMZ be controlled with $6000 (SN5B equivalent $C000) for Address Select, and $7000 for Address Write (SN5B equivalent $E000)?
3. How would the wiring for such a scheme be?

In my opinion, VIN is the last "well-known" Cool ThingTM about the GB that I don't think's been taken advantage of enough, or at all really. Implemented and used, yes, but not taken advantage of. Nanoloop 1.5's phase square and Mono's drum synth are cool and all, but not very practical or "useful" in my mind as 1.5's implementation is a simple extension of ONE hardware channel, Mono doesn't let you use the internal sound, and neither one can be used for anything other than their namesake program's purpose, simple 16-step loops. I hope this concept can reach a stage where people can use it to its full potential. Since the aim is to be MBC5-compatible (first by using a real MBC5), it can be used as-is, but if someone wants to make a homebrew program to take advantage of 3 new channels, the option will be there too. Thank you in advance for any help.


Top
 Profile  
 
PostPosted: Mon Jun 19, 2017 9:06 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6448
Location: UK (temporarily)
ImATrackMan wrote:
1. Can the area from $6000-7FFF be used for this with the MBC5?
Don't know. Certainly what documentation we have insinuates writes to that region has no effect...

Quote:
2. If it can, can the YMZ be controlled with $6000 (SN5B equivalent $C000) for Address Select, and $7000 for Address Write (SN5B equivalent $E000)?
Sure? Connect YMZ A0 to DMG A12, in that case.

Quote:
3. How would the wiring for such a scheme be?
You need to decode when /WR is low, and A15,14,13 are '011'. The YMZ284/294 has two separate enables that both have to be low; other parts (e.g. AY-3-8910) do something else.

Regardless, you could use a 74'138 or 74'139 to generate the signals needed for any of these parts.

https://wiki.nesdev.com/w/index.php/74138
(Try gnd74HC138./G2[A,B], +5V74HC138.+G1, A[15,14,13]74HC138.S[2,1,0], 74HC138./Y3YMZ./CS, A12YMZ A0, DMG/WRYMZ /WR. You'll want something different if you're starting with a AY-3-8910.)

You might need extra analog hardware before the VIN pin.

Quote:
In my opinion, VIN is the last "well-known" Cool ThingTM about the GB that I don't think's been taken advantage of enough, or at all really. Implemented and used, yes, but not taken advantage of.
I was under the impression that there was significant model-to-model behavior differences on the VIN pin. I guess there's what he reported himself on the Nanoloop mono. But ... I guess you can still technically get audio out of it, regardless.

(On a wild tangent: I kinda want to know how the Nanoloop Mono's analog synth works, but...)


Top
 Profile  
 
PostPosted: Mon Jun 19, 2017 9:33 pm 
Offline
User avatar

Joined: Thu Mar 26, 2015 6:34 pm
Posts: 33
Quote:
The YMZ284/294 has two separate enables that both have to be low; other parts (e.g. AY-3-8910) do something else.


The other enables are /WR and /CS, both have to remain low. A0 being high selects the register, while it being low writes the data.

Quote:
(Try gnd74HC138./G2[A,B], +5V74HC138.+G1, A[15,14,13]74HC138.S[2,1,0], 74HC138./Y3YMZ./CS, A12YMZ A0, DMG/WRYMZ /WR. You'll want something different if you're starting with a AY-3-8910.)


Will do. AY isn't my starting point, I have 2 294s already. Thank you so much.


Top
 Profile  
 
PostPosted: Tue Jun 20, 2017 12:38 am 
Offline
User avatar

Joined: Fri Jan 24, 2014 9:05 am
Posts: 138
Location: Hungary
If you want easy wiring the SN76489 could also be useful, you only need one register for it (some bits of the data written determine which channel receives the lower bits and whether it's a volume or period register write)


Top
 Profile  
 
PostPosted: Tue Jun 20, 2017 1:03 am 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6448
Location: UK (temporarily)
The SN76494 theoretically requires its inputs be stable for up to 32 cycles (of the 4MHz master clock). Not hard, but it does require an extra latch.


Top
 Profile  
 
PostPosted: Tue Jun 20, 2017 8:22 pm 
Offline
User avatar

Joined: Thu Mar 26, 2015 6:34 pm
Posts: 33
Image

Well, here goes the first proto. This is meant to plug in between the GB itself and a flash cartridge. I don't know if splitting the lines like this and making them this much longer than they need to be will cause any issues.

Also, I have no idea if this will work at all! No way to know what's wrong if the test ROM doesn't do anything.


Top
 Profile  
 
PostPosted: Wed Jun 21, 2017 12:37 pm 
Offline
User avatar

Joined: Tue Jul 03, 2007 1:49 pm
Posts: 969
If CR1 is a resonator, you're grounding out one pin. It won't work that way.


Top
 Profile  
 
PostPosted: Wed Jun 21, 2017 12:46 pm 
Offline
User avatar

Joined: Sat Oct 29, 2005 2:09 am
Posts: 501
Location: Indianapolis
ImATrackMan wrote:
Image

Well, here goes the first proto. This is meant to plug in between the GB itself and a flash cartridge. I don't know if splitting the lines like this and making them this much longer than they need to be will cause any issues.

Also, I have no idea if this will work at all! No way to know what's wrong if the test ROM doesn't do anything.



Not to pop your bubble but you need to make some changes to that to make it work. The chip requires a clock to run. It can probably use the GB's own clock or you can provide an oscillator. The way it's wired now to what I assume is a 3 terminal resonator will not work. The middle terminal is ground, and the outside 2 terminals need to be connected to some kind of amplifier (usually an inverter inside a chip). The sound chip you are using however cannot run that resonator.

A 4 pin crystal oscillator will work, but I suggest using the GB's clock which eliminates the need. It will run a bit slower, around 1MHzish but it will still work. Just run CLK to pin 7. The schematic I saw shows 2MHz, so the GB clock should be fine; this will give you more low end range anyways.

Also, you need bypass capacitors, 0.1uf caps across each chip (though a single one is probably OK).

As for routing, it'd probably be a lot simpler if you ran all the "passthrough" signals on the bottom layer, straight from the cart edge to the socket, then did all the other routing on the top only (or minimal bottom use for vertical connections). It should be relatively easy to do this.

Might wanna bump the size of the power/ground routes up too. Say 20-25 mils for those. Signals can be 6-8 mils depending on the board fab you're using.

The audio might be another issue too. It appears you need a 4.7K resistor to ground to load the audio output, otherwise it will probably be silent or at least very very quiet. A coupling capacitor is needed too. I suggest a 1uf between the output and the GB input for starters.

Hope that helps.

_________________
/* this is a comment */


Top
 Profile  
 
PostPosted: Wed Jun 21, 2017 2:42 pm 
Offline
User avatar

Joined: Thu Mar 26, 2015 6:34 pm
Posts: 33
kevtris wrote:

Not to pop your bubble but you need to make some changes to that to make it work.

Absolutely not popping any bubbles, that's the whole reason for me posting that screenshot, and people popping in and offering their input, you especially, is even more motivation to get this done. I'll make some of those changes tonight when I get home.
kevtris wrote:

A 4 pin crystal oscillator will work, but I suggest using the GB's clock which eliminates the need. It will run a bit slower, around 1MHzish but it will still work. Just run CLK to pin 7. The schematic I saw shows 2MHz, so the GB clock should be fine; this will give you more low end range anyways.


Rationale for the external clock is that the YMZ, like the 5B inspiring this, also has a permanent 1/2 clock divider. Connecting it to CLK would certainly give me more low end, but I think .5 mHz is a little too much. That plus the fact that AY/YM at 1.79 mHz is already familiar to people makes it a good choice in my opinion.


Top
 Profile  
 
PostPosted: Wed Jun 21, 2017 3:08 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6448
Location: UK (temporarily)
Here's two quick-and-dirty crystal drivers I've used. You'll almost certainly get more reliable results from using one of the 4 pin oscillator-in-a-cans, though.
Attachment:
osc-4part-pierce.png
osc-4part-pierce.png [ 390 Bytes | Viewed 999 times ]
Attachment:
osc-4part-colpitts.png
osc-4part-colpitts.png [ 412 Bytes | Viewed 999 times ]


A much sillier option would be to take advantage that the clock on the gameboy's clock edge is a square wave. Then you could use a resonant highpass filter (e.g. inductory and capacitor or crystal and resistor) to extract the 3x harmonic. (Set 1/(2·π·sqrt(L·C)) = 3.072MHz)


In a ridiculous way, I've wanted to add a user-programmable prescaler to the clock input of these old sound ICs. It'd be nice to be able to switch between having a high enough clock frequency to actually use envelope bass ... and then to switch back such that you could get useful bass notes out of the ordinary square wave channels. (Obviously not at the same time)


Top
 Profile  
 
PostPosted: Wed Jun 21, 2017 4:10 pm 
Offline
User avatar

Joined: Sun May 27, 2012 8:43 pm
Posts: 1311
ImATrackMan wrote:
kevtris wrote:

Not to pop your bubble but you need to make some changes to that to make it work.

Absolutely not popping any bubbles, that's the whole reason for me posting that screenshot, and people popping in and offering their input, you especially, is even more motivation to get this done. I'll make some of those changes tonight when I get home.
kevtris wrote:

A 4 pin crystal oscillator will work, but I suggest using the GB's clock which eliminates the need. It will run a bit slower, around 1MHzish but it will still work. Just run CLK to pin 7. The schematic I saw shows 2MHz, so the GB clock should be fine; this will give you more low end range anyways.


Rationale for the external clock is that the YMZ, like the 5B inspiring this, also has a permanent 1/2 clock divider. Connecting it to CLK would certainly give me more low end, but I think .5 mHz is a little too much. That plus the fact that AY/YM at 1.79 mHz is already familiar to people makes it a good choice in my opinion.


The clock being "Familiar" to people is a poor justification IMO. Keeping it in the same clock domain as the GB will make it simpler to program as well, since all these square wave-based sound chips are just period counters.


Top
 Profile  
 
PostPosted: Wed Jun 21, 2017 5:05 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6448
Location: UK (temporarily)
mikejmoffitt wrote:
The clock being "Familiar" to people is a poor justification IMO. Keeping it in the same clock domain as the GB will make it simpler to program as well, since all these square wave-based sound chips are just period counters.
To rephrase, on the off chance that it's insufficiently clear, using the same clock (or a power of two multiple) means that you can use the same pitch table for the YMZ as well as the built-in channels.


Top
 Profile  
 
PostPosted: Wed Jun 21, 2017 6:19 pm 
Offline
User avatar

Joined: Thu Mar 26, 2015 6:34 pm
Posts: 33
A casual reminder that the YMZ will further divide CLK by two, resulting in it running at 1/8th of the internal clock. That, and as far as I'm aware, the GB has 11-bit pitch where the YMZ has 12-bit, so to get it where the pitch tables line up exactly, I have to clock it at half of the gameboy speed, which equates to using the full gameboy clock. For that, I could use the donor crystal from an actual GB, or an increasingly complicated multiplier circuit to make CLK 4 times as fast as it is. In any case, this is really just to see if it works at all, so at this stage, clock speed doesn't matter at all as long as it makes noise.

Edit:The ultimate goal is to put this into a flash cartridge. I'm going for as few parts as possible while maintaining a decent clock speed. Sure a flat 4.00000 is an option but then it'll be too "close enough" while still bring out of tune with the internal GB channels. I honestly think 3.58/1.79 is a good speed, especially when the frequency table is available in the source for arguably the most popular PC chiptune creation software there is, Famitracker, which is, incidentally, where the person who programmed the test ROM got it from.


Top
 Profile  
 
PostPosted: Wed Jun 21, 2017 7:21 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6448
Location: UK (temporarily)
ImATrackMan wrote:
A casual reminder that the YMZ will further divide CLK by two, resulting in it running at 1/8th of the internal clock. That, and as far as I'm aware, the GB has 11-bit pitch where the YMZ has 12-bit, so to get it where the pitch tables line up exactly,
Musically, they don't need to. The reason I mentioned "any power of two" is because musically, each power of two is an octave and easy to compensate for. (After all, the NES's pulse and triangle channels differ by one octave.) Although being off by three octaves is a bit silly, it still gives some remaining headroom.

Admittedly, when the fastest divisor yields 16KiHz and any integer quotient of same, that is pretty cramped.

Ultimately, you can easily get 4 MiHz crystals or osillators, not just exact 4.000MHz ones.


Top
 Profile  
 
PostPosted: Thu Jun 22, 2017 3:03 am 
Offline
User avatar

Joined: Thu Mar 26, 2015 6:34 pm
Posts: 33
[OLDER IMAGE]
Did some of the changes, namely went to an OSC, added the decoupling cap, and the resistor from VIN to ground. I also did a little rewiring but I don't think it made much difference. The width of the power traces was fine since I used .5mm (19.86 mils)
kevtris wrote:
I suggest a 1uf between the output and the GB input for starters.

I forgot to ask if that was before or after the resistor. I assume after.

lidnariq wrote:
Ultimately, you can easily get 4 MiHz crystals or osillators, not just exact 4.000MHz ones.


I found a nice one on Mouser in both 3.58 AND exactly 4.194304. They're non-stock though, so I'll have to wait a bit longer for them.

EDIT: I went ahead and added the cap. I also went and added some jumpers to the top area of the adapter near the cart slot.


Image

Image


Some flash carts use VIN as a /WR signal for the flash rom, and it seems that EMS cartridges are among those. As a result, they pull VIN to 5V, so these are there to accommodate any flash cart someone might be using to play around with this.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 24 posts ]  Go to page 1, 2  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group