It is currently Tue Oct 17, 2017 6:34 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: CPU Overclocking?
PostPosted: Sun Aug 28, 2011 9:06 pm 
Offline

Joined: Wed Mar 31, 2010 12:40 pm
Posts: 207
Is it possible to emulate an overclocked CPU, to allow games to run more smoothly under stress? Or would the PPU keep sync on it, and therefor limit it?

I just tried this with Mega Man 3, having the PPU running at 1/3 it's normal speed and it seemed to have a very positive effect! Just wondering if most games would benefit from something like this, cause if they do I would definitely make it an option in my emulator.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 28, 2011 9:23 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10046
Location: Rio de Janeiro - Brazil
Sure it is, even Nesticle allowed you to adjust the number of CPU cycles per frame (or scanline, I don't remember). It's also been done on hardware, but the audio gets screwed up because the note frequencies are derived from the CPU clock.

Some games will benefit from it, but others will glitch to various degrees, because a lot of games rely on timed code for visual effects.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 28, 2011 11:37 pm 
Offline
User avatar

Joined: Fri Nov 19, 2004 7:35 pm
Posts: 3941
I think the best approach is to simulate how the Dendy did it.
You know how there's one final scanline (before NMI) which is a blanking line? The Dendy instead runs 51 blanking scanlines at that point. So games which rely on timed code still work, and the CPU runs faster with no side effects. If you want to run 300 extra scanlines at that point, you could even do that, and most games would still synchronize correctly. Some wouldn't, because they turn the screen off early and assume that vblank starts very shortly from that point, so they start waiting for a Sprite 0 hit before vblank has ended.
Of course, this will also break every game which attempts to detect the region.

But Dendy was a 50 FPS PAL system. You need to speed up the system to 60 FPS. And if you're doing cycle-accurate sound emulation, you would need to correct the sound pitches for all channels for this new "overclocked NTSC" mode. Software played PCM will play back faster, but you can fix the other sound channels.

_________________
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 29, 2011 8:45 am 
Offline

Joined: Wed Mar 31, 2010 12:40 pm
Posts: 207
Couldn't I also just keep the APU running at the same clock? That would keep all the tones accurate, while still allowing the CPU to haul ass. Take the following pseudo-code:

Code:
float cycles = CPU.Execute();

PPU.Execute(cycles * 3f);
APU.Execute(cycles);


Compared to the overclocked version:

Code:
float cycles = CPU.Execute();

PPU.Execute(cycles);
APU.Execute(cycles / 3f);


Or would this cause errors because of DPCM IRQ timings? That is the only reason I can see why this wouldn't work.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 29, 2011 8:56 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19085
Location: NE Indiana, USA (NTSC)
Allowing the CPU to haul ass would break all sorts of raster effects.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 29, 2011 9:04 am 
Offline
User avatar

Joined: Wed Dec 06, 2006 8:18 pm
Posts: 2799
In emulation, overclocking the CPU can be done just fine. I did it in my emulator by just changing the ratio of CPU clocks to PPU clocks. Obviously games with timed code for raster effects break. But some games benefit and work just fine, for example Teenage Mutant Ninja Turtles the first game has slowdown and often causes the status bar/background to flicker since its sprite hit zero based and too much slowdown causes this to be missed normally. But if the CPU runs faster then it never gets bogged down enough to miss.

There are other games that benefit too. I think there was a bugs bunny game that had quite a change. Games that use CPU based IRQs need adjustment so their still trigger at the right time, PPU based do not. As previously mentioned any games like the RARE developed ones such as Battletoads will break due to precise timed code but I don't know that these games would benefit from overclocking anyway. I just remembered Kirby's Adventure shows improvement by being overclocked.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 29, 2011 9:12 am 
Offline
Formerly Fx3
User avatar

Joined: Fri Nov 12, 2004 4:59 pm
Posts: 3064
Location: Brazil
I'm giving an example: Rockman Complete Works, for PSX. There's absolutely no slowdown or sprite flickering. The 6502 PRG data is intact, only the graphics were ported to the PSX format.

_________________
Zepper
RockNES developer


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 29, 2011 9:16 am 
Offline

Joined: Wed Mar 31, 2010 12:40 pm
Posts: 207
tepples wrote:
Allowing the CPU to haul ass would break all sorts of raster effects.


It would of course be an option in emulator. Maybe a slider bar to change the system to certain pre-configured frequencies?

MottZilla wrote:
I just remembered Kirby's Adventure shows improvement by being overclocked.


How do games like Castlevania, Contra, and Mega Man handle the overclocking?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 29, 2011 1:52 pm 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7224
Location: Chexbres, VD, Switzerland
Quote:
I'm giving an example: Rockman Complete Works, for PSX. There's absolutely no slowdown or sprite flickering. The 6502 PRG data is intact, only the graphics were ported to the PSX format.

Are you sure the data is actually used ?
I remember the PSX verison of Chrono Trigger contains the original ROM, but I don't think it was used at all.

Quote:
How do games like Castlevania, Contra, and Mega Man handle the overclocking?

Contra and Mega Man would handle it fine I guess. Castlevania would have problems with the status bar, as it has a time-out on it's wait-for-sprite-zero-hit loop. If you hack it to remove the timeout it will work fine.

Games like Rad Racer might end up completely broken, however, this won't be true if you do it like Dwedit says. In fact his method will only break several rare games that starts forced VBlank early and expect the NMI to come just after that or something in the like. It might be the better way to go. However such overclocking is not feasible on hardware.

_________________
Life is complex: it has both real and imaginary components.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 29, 2011 1:54 pm 
Offline
User avatar

Joined: Fri Nov 19, 2004 7:35 pm
Posts: 3941
I had tested out a few games, and Jaws is broken on a Dendy or PAL system.

_________________
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 29, 2011 3:01 pm 
Offline
User avatar

Joined: Sat Apr 18, 2009 4:36 am
Posts: 257
Location: Russia
Sorry, offtop.

HardWareMan can donate some UMC UA6527P and UA6538 dendy chips to nesdev community for analysis or decapsulation.
Who is interested in it? Who want to take these chips, maybe Quietust?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 29, 2011 8:04 pm 
Offline

Joined: Wed Mar 31, 2010 12:40 pm
Posts: 207
I guess I'll give it a try soon once I overhaul a few things to allow for this sort of modification. I'll report back with my findings.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 29, 2011 5:41 pm 
Offline

Joined: Fri Aug 22, 2008 10:04 am
Posts: 81
i oc'd one of mine a few years ago, music is higher in pitch and you can't push them too far. Castlevania II is extra annoying (night/day happens much faster :) )


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: Yahoo [Bot] and 5 guests


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