Anyone Interested in a Combined NES + Gameboy Cart?

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

Moderator: Moderators

tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Anyone Interested in a Combined NES + Gameboy Cart?

Post by tepples »

mikejmoffitt wrote:I am assuming the refresh rate of the Game Boy would be locked to the updating of the CHR data the NES is displaying so there isn't tearing / lag.
When I was programming the Game Boy Advance, the number 280896 cycles per frame was drilled into me, and the best guess for its crystal was 2^24 Hz = 16.7772 MHz. The Game Boy runs at one-fourth the clock speed (4.1943 MHz) but has one-fourth the cycles per frame: 70224. This means the frame rate is 4194304/70224 = 59.7275 Hz for both systems.

The NTSC NES and Super NES run slightly faster, based on a 945/44 = 21.4773 MHz master clock. (This is six times 315/88 = 3.57955 MHz, the NTSC color burst frequency.) The frame is 1364*262-2 = 357366 master clocks long for a 60.0988 Hz frame rate.

Super Game Boy clocks the Game Boy hardware at 1/5 of the Super NES master clock rate, or 189/44 = 4.29545 MHz, which is 2.42% faster than the standard Game Boy clock. The video circuit ends up producing 61.1679 frames per second, causing the SGB to skip frames. This is also why the original Super Game Boy lacks a a link port, as the speed difference from a standard Game Boy is enough to cause games to desync. The rare SGB 2, released to support Pocket Monsters, has its own crystal to produce a more accurate clock signal.

The only external clock signal on the Famicom cart edge is M2, which is master divided by 12. The NES additionally provides master, but 72 to 60 pin adapters don't. It's possible to use a PLL to multiply M2 by some factor to produce a clock signal for the FPGA. But then we run into a problem: do we want correct game speed, audio pitch, and link cable speed, or do we want to align NES vblank to Game Boy vblank without skipping or repeating frames? The speed factor differs for the two approaches.

EDIT: correction to Game Boy mono calculation
User avatar
mikejmoffitt
Posts: 1353
Joined: Sun May 27, 2012 8:43 pm

Re: Anyone Interested in a Combined NES + Gameboy Cart?

Post by mikejmoffitt »

tepples wrote:
mikejmoffitt wrote:I am assuming the refresh rate of the Game Boy would be locked to the updating of the CHR data the NES is displaying so there isn't tearing / lag.
When I was programming the Game Boy Advance, the number 280896 cycles per frame was drilled into me, and the best guess for its crystal was 2^24 Hz = 16.7772 MHz. The Game Boy runs at one-fourth the clock speed (4.1943 MHz) but has one-fourth the dots per frame: 70224. This means the frame rate is 4194304/70224 = 59.7275 Hz for both systems.
I believe you mean one-fourth the cycles per frame here.
tepples wrote:The only external clock signal on the Famicom cart edge is M2, which is master divided by 12. The NES additionally provides master, but 72 to 60 pin adapters don't. It's possible to use a PLL to multiply M2 by some factor to produce a clock signal for the FPGA. But then we run into a problem: do we want correct game speed, audio pitch, and link cable speed, or do we want to align NES vblank to Game Boy vblank without skipping or repeating frames? The speed factor differs for the two approaches.
The ideal approach for me would be as follows:
Using a PLL on M2 as you've mentioned, run the FPGA-GB at a speed that has the GB Vsync and the NES Vsync in lockstep - genlock them. The game might be *slightly* too fast or too slow, but people did not get upset with this in the Super Game Boy. Frameskips and tearing are very interruptive to the already limited graphical experience, and since the appeal here is looking at a Game Boy on the television, the graphical presentation is a high priority. We can do better than the SGB by having optional sound pitch correction, since this gives us control over the audio generation hardware. For those who are concerned with the link port speed matching other devices, an option to de-sync the systems might be an okay idea.
Last edited by mikejmoffitt on Tue Aug 18, 2015 11:34 am, edited 1 time in total.
xeorix
Posts: 6
Joined: Tue Aug 18, 2015 11:09 am

Re: Anyone Interested in a Combined NES + Gameboy Cart?

Post by xeorix »

I would be interested. And will follow this thread
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: Anyone Interested in a Combined NES + Gameboy Cart?

Post by lidnariq »

mikejmoffitt wrote:Using a PLL on M2 as you've mentioned, run the FPGA-GB at a speed that has the GB Vsync and the NES Vsync in lockstep - genlock them.
Unfortunately, the PLL ratio needed there is the fairly obnoxious 140448 ÷ 59561, or approximately 2.358

(Showing my work: 3 (pixels/M2 cycle) ÷ (178683÷2 pixels/source frame) × 70224 (pixels/target frame))
User avatar
mikejmoffitt
Posts: 1353
Joined: Sun May 27, 2012 8:43 pm

Re: Anyone Interested in a Combined NES + Gameboy Cart?

Post by mikejmoffitt »

lidnariq wrote:
mikejmoffitt wrote:Using a PLL on M2 as you've mentioned, run the FPGA-GB at a speed that has the GB Vsync and the NES Vsync in lockstep - genlock them.
Unfortunately, the PLL ratio needed there is the fairly obnoxious 140448 ÷ 59561, or approximately 2.358

(Showing my work: 3 (pixels/M2 cycle) ÷ (178683÷2 pixels/source frame) × 70224 (pixels/target frame))
Hm, that's pretty bad. Perhaps a clock on the cart can target the solved speed, and can either correct itself to match, or just have to skip the occasional frame. I would prefer a consistent occasional frameskip over tearing, though.
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Anyone Interested in a Combined NES + Gameboy Cart?

Post by tepples »

It's also something that a PLL multiplier followed by a DDA clock divider can probably handle.
tsu
Posts: 29
Joined: Fri Feb 15, 2013 12:00 am

Re: Anyone Interested in a Combined NES + Gameboy Cart?

Post by tsu »

I would buy this cart. Would a game manuals viewer in the menu be possible?
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Anyone Interested in a Combined NES + Gameboy Cart?

Post by tepples »

A game manual viewer might not even be needed if enough people bribe me to make an e-book reader for NES, as then you'd just have e.g. "Dr. Mario.nes" and "Dr. Mario manual.nes".
Great Hierophant
Posts: 780
Joined: Tue Nov 23, 2004 9:35 pm

Re: Anyone Interested in a Combined NES + Gameboy Cart?

Post by Great Hierophant »

tepples wrote:A game manual viewer might not even be needed if enough people bribe me to make an e-book reader for NES, as then you'd just have e.g. "Dr. Mario.nes" and "Dr. Mario manual.nes".
What about a Playchoice-10 instructions viewer program? Wouldn't cover all the games, but it should be sufficient for the 52 that did find their way to a PCB.
User avatar
kevtris
Posts: 504
Joined: Sat Oct 29, 2005 2:09 am
Location: Indianapolis
Contact:

Re: Anyone Interested in a Combined NES + Gameboy Cart?

Post by kevtris »

re: how to get systems to run at the proper speed, I have the PLLs on the FPGA and my own oscillator. If I wish to frame-lock I can also do a more complex method with a phase accumulator to generate the system clock and dial in any clock speed desired.

I will not use the NES' clock to time anything.
/* this is a comment */
User avatar
Orbit
Posts: 3
Joined: Thu Aug 20, 2015 2:43 pm

Re: Anyone Interested in a Combined NES + Gameboy Cart?

Post by Orbit »

Even though I have a N8, I would definitely get one of your carts. GB support and better compability would be awesome.
User avatar
Myask
Posts: 965
Joined: Sat Jul 12, 2014 3:04 pm

Re: Anyone Interested in a Combined NES + Gameboy Cart?

Post by Myask »

kevtris wrote:Mappers would not be user-updateable
That's a feature I would want in a devcart.
User avatar
nintendo2600
Posts: 367
Joined: Mon Mar 30, 2009 4:40 pm

Re: Anyone Interested in a Combined NES + Gameboy Cart?

Post by nintendo2600 »

I will buy one for sure.
Last edited by nintendo2600 on Thu Aug 27, 2015 6:06 pm, edited 1 time in total.
Lyjal
Posts: 18
Joined: Wed Aug 06, 2014 3:45 pm

Re: Anyone Interested in a Combined NES + Gameboy Cart?

Post by Lyjal »

What about the pirate mappers for the pokemon games and the ff7 demake? Will those be supported as well?
muckyfingers
Posts: 41
Joined: Sun Jan 06, 2013 9:56 pm

Re: Anyone Interested in a Combined NES + Gameboy Cart?

Post by muckyfingers »

I'd definitely order one, and a Famicom version as well if you were to make one.
Post Reply