nesdev.com
https://forums.nesdev.com/

Anyone Interested in a Combined NES + Gameboy Cart?
https://forums.nesdev.com/viewtopic.php?f=9&t=13042
Page 4 of 7

Author:  tepples [ Mon Aug 17, 2015 3:41 pm ]
Post subject:  Re: Anyone Interested in a Combined NES + Gameboy Cart?

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

Author:  mikejmoffitt [ Tue Aug 18, 2015 10:21 am ]
Post subject:  Re: Anyone Interested in a Combined NES + Gameboy Cart?

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.

Author:  xeorix [ Tue Aug 18, 2015 11:31 am ]
Post subject:  Re: Anyone Interested in a Combined NES + Gameboy Cart?

I would be interested. And will follow this thread

Author:  lidnariq [ Tue Aug 18, 2015 11:41 am ]
Post subject:  Re: Anyone Interested in a Combined NES + Gameboy Cart?

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))

Author:  mikejmoffitt [ Tue Aug 18, 2015 11:54 am ]
Post subject:  Re: Anyone Interested in a Combined NES + Gameboy Cart?

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.

Author:  tepples [ Tue Aug 18, 2015 12:12 pm ]
Post subject:  Re: Anyone Interested in a Combined NES + Gameboy Cart?

It's also something that a PLL multiplier followed by a DDA clock divider can probably handle.

Author:  tsu [ Wed Aug 19, 2015 10:03 am ]
Post subject:  Re: Anyone Interested in a Combined NES + Gameboy Cart?

I would buy this cart. Would a game manuals viewer in the menu be possible?

Author:  tepples [ Wed Aug 19, 2015 11:55 am ]
Post subject:  Re: Anyone Interested in a Combined NES + Gameboy Cart?

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".

Author:  Great Hierophant [ Wed Aug 19, 2015 8:19 pm ]
Post subject:  Re: Anyone Interested in a Combined NES + Gameboy Cart?

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.

Author:  kevtris [ Thu Aug 20, 2015 8:45 pm ]
Post subject:  Re: Anyone Interested in a Combined NES + Gameboy Cart?

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.

Author:  Orbit [ Fri Aug 21, 2015 12:56 am ]
Post subject:  Re: Anyone Interested in a Combined NES + Gameboy Cart?

Even though I have a N8, I would definitely get one of your carts. GB support and better compability would be awesome.

Author:  Myask [ Fri Aug 21, 2015 10:34 am ]
Post subject:  Re: Anyone Interested in a Combined NES + Gameboy Cart?

kevtris wrote:
Mappers would not be user-updateable

That's a feature I would want in a devcart.

Author:  nintendo2600 [ Tue Aug 25, 2015 1:37 pm ]
Post subject:  Re: Anyone Interested in a Combined NES + Gameboy Cart?

I will buy one for sure.

Author:  Lyjal [ Tue Aug 25, 2015 6:24 pm ]
Post subject:  Re: Anyone Interested in a Combined NES + Gameboy Cart?

What about the pirate mappers for the pokemon games and the ff7 demake? Will those be supported as well?

Author:  muckyfingers [ Tue Aug 25, 2015 9:01 pm ]
Post subject:  Re: Anyone Interested in a Combined NES + Gameboy Cart?

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

Page 4 of 7 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/