CPU Overclocking?
Moderator: Moderators
CPU Overclocking?
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.
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.
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.
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.
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.
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!
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:
Compared to the overclocked version:
Or would this cause errors because of DPCM IRQ timings? That is the only reason I can see why this wouldn't work.
Code: Select all
float cycles = CPU.Execute();
PPU.Execute(cycles * 3f);
APU.Execute(cycles);
Code: Select all
float cycles = CPU.Execute();
PPU.Execute(cycles);
APU.Execute(cycles / 3f);
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.
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.
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 author
RockNES author
It would of course be an option in emulator. Maybe a slider bar to change the system to certain pre-configured frequencies?tepples wrote:Allowing the CPU to haul ass would break all sorts of raster effects.
How do games like Castlevania, Contra, and Mega Man handle the overclocking?MottZilla wrote:I just remembered Kirby's Adventure shows improvement by being overclocked.
Are you sure the data is actually used ?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.
I remember the PSX verison of Chrono Trigger contains the original ROM, but I don't think it was used at all.
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.How do games like Castlevania, Contra, and Mega Man handle the overclocking?
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.
Useless, lumbering half-wits don't scare us.
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?
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?
-
- Posts: 81
- Joined: Fri Aug 22, 2008 10:04 am