Overclocking: Difference between revisions

From NeoGeo Development Wiki
Jump to navigation Jump to search
(Created page with "This page is a draft :) The principle of overclocking is to make electronic chips (not only CPUs) run at a clock frequency higher than usual. =Why overclock ?= Fanatics...")
 
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
This page is a draft :)
The principle of overclocking is to make electronic chips (not only CPUs) run at a [[clock]] frequency higher than intended.
 
The principle of overclocking is to make electronic chips (not only CPUs) run at a [[clock]] frequency higher than usual.


=Why overclock ?=
=Why overclock ?=


Fanatics may not want to read this, but the NeoGeo can have slowdowns. Games known for lagging are:
Fanatics may not want to read this, but the NeoGeo can have [[slowdown]]s.
*[[Aero Fighters]]
*[[Blazing Star]]
*[[Metal_Slug_2_-_Super_Vehicle-001/II|Metal Slug 2]]
*[[Shock Troopers]]...
*[[Twinkle Star Sprites]]


As the [[GPU]] runs in real time and has no frame buffer, slowdowns on most 2D consoles are CPU slowdowns. This means that they are caused by long calculations and not graphical complexity (we're not talking about polygons !). For example: 20 animated sprites could cause slowdowns, but 300 static sprites won't.
As the [[GPU]] runs in real time, slowdowns on most 2D consoles can only caused by the [[68k|CPU]] because of long calculations (and not graphical complexity). For example, 20 moving sprites could cause slowdowns, but 200 static sprites won't.


=Slowdowns=
=Overclocking which chip ?=
 
Slowdowns are perceived during gameplay as slow picture updates (frameskip), this is only caused by the CPU not being able to update [[VRAM]] often enough to animate sprites smoothly.
 
If a game wants to run at a constant 60 FPS (no frameskip), the calculations for a frame need to last less than 1/60 = 16.7ms. For 30 FPS (1/2 frameskip), they need to last less than 1/30 = 33.3ms.


If calculations are too long and "overflow" to the next frame, it will be skipped. For example, if calculations last 16.8ms, a whole frame will be skipped (16.7ms) because the CPU was 0.1ms late.
* Overclocking the {{Chipname|68k}} makes it execute instructions (game code) faster.
* Overclocking the {{Chipname|Z80}} is pointless, as it only takes care of [[Sound driver|music]] and has plenty of time for that.
* Overclocking the GPU is also pointless: as mentioned above, it can't cause slowdowns.


In the following graphs:
In short, only the 68k CPU deserves overclocking.
*The vertical lines are frame ticks given by the GPU, they always occur every 16.7ms (60Hz)
**Black lines are updated frames (different from the last one)
**<span style="color:#7F0000">'''Red lines'''</span> are skipped frames (same as the last one)
*<span style="color:#007F7F">'''Cyan areas'''</span> are the vblank periods, during which the CPU updates VRAM
*<span style="color:#007F00">'''Green zones'''</span> are CPU calculations not causing frameskip
*<span style="color:#7F7F00">'''Yellow zones'''</span> are CPU calculations causing unwanted frameskip


==60 FPS engine==
=Stability=


===No slowdown===
==CPU==
[[File:Lag60.png]]
The stock 68000-12 CPU can often work up to 14MHz (17% overclock) without crashing, but don't expect going above safely. Crashes are due to gate delays ? Crippling ?


If CPU calculations are always shorter than 16.7ms, each and every frame is updated.
Some people from the Atari and Amiga community showed that the high-end 68000-16 can work way beyond 16MHz. Reports of stable operation at 30MHz (150% overclock from 12MHz) can be found.


===Slowdowns===
Heat is not an issue.
[[File:Lag60fs.png]]
 
If CPU calculations are longer than 16.7ms, the next frame is skipped. Multiple consecutive frames can be skipped (see [[overclocking#perceived slowdown|Perceived slowdown]]).
 
==30 FPS engine==
 
The game's engine voluntarily updates one frame out of two, making the game run at 30 FPS at best. Note that the GPU '''always''' runs at 60.
 
Has the advantage of giving a more consistent framerate if the game tends to often exceed the 16.7ms limit, at the expense of more pronounced slowdown if it occurs.
 
===No slowdown===
[[File:Lag30.png]]
 
If CPU calculations are always shorter than 33.3ms, one frame out of two is updated.
 
===Slowdowns===
[[File:Lag30fs.png]]
 
If CPU calculations are longer than 33.3ms, one or two frames are skipped. Multiple groups of frames can be skipped (see [[overclocking#perceived slowdown|Perceived slowdown]]).
 
Some game engines might be smart enough to "resync" and skip only one frame if they detect one was already accidentally skipped (doesn't rely on the LSB of a frame counter).
 
==Perceived slowdown==
[[File:Laghigh.png]]
 
Skipping one or two frames from time to time isn't often seen or felt by the player. The worst slowdowns are when the video practilly stalls for fractions of a second.
 
Perception of slowdowns depend on the spreading of updates:
 
* #-#-#-#-#-#-#-#- is 30 FPS, acceptable.
* ########-------- is also 30 FPS, but very bothering.
 
==Crappy engines==
[[File:Lagstoopid.png]]
 
Are there game engines stupid enough to try catching up on each and every frame, instead of skipping some ? Poor CPU, poor player :(
 
=Overclocking which chip ?=


Overclocking the {{Chipname|68k}} makes it execute instructions faster.
==Memory==


Overclocking the {{Chipname|Z80}} is completly useless, as it only takes care of music.
Overclocking might not be safe for all [[memory speed|RAM access]] on the NeoGeo. For example, [[68k user RAM]] is 100ns (166ns at 12MHz, would need <83ns at 24MHz). Max would be 19.8MHz ? [[Palette RAM]] is even slower: 120ns. Max would be 16.6MHz ?


Multiple forum discussions (links ?).
The cartridge ROMs might also be too slow in some cases. [[Wait cycle]]s could be artificially inserted to slow down acces, but overlocking would be way less efficient.


The stock 68000-12 can often work up to 14MHz (16% overclock) without crashing, but don't expect going above safely. Crashes are due to gate delays ? Crippling ?
==Video glitches==


Some in the Atari or Amiga community know that the high-end 68000-16 can work way beyond 16MHz. Reports of steady operation at 30MHz (150% overclock) can be found.
[[File:tssglitch.gif|thumb|[[Twinkle Star Sprites]] runs a lot better at 20MHz (67% overclock) but glitches heavily.]]


24MHz (100% overclock) seems safe for all memory access ?
When increasing the CPU clock only over 13.5MHz (13 %), some games start having video glitches. Games which have shorter access delays to the [[VRAM]] will glitch first.


=Video glitches=
The problem arises from the fact that the overclocked CPU inherently talks to the GPU faster, but the GPU still runs at 12MHz. This makes it skip writes or reads, making a mess in VRAM.


When increasing the CPU clock over only 13.5MHz, some games start exhibiting video glitches. This is because they alreayd have tight write timings to the GPU.
So why not also overclock the GPU ?


The problem arises from the fact that the CPU talks to the GPU faster, but the GPU still runs at 12MHz. This makes it skip writes or reads, making a mess in VRAM.
Simply because the GPU generates the video sync and [[68k interrupts|vertical blank interrupt]]. If it is overclocked, the [[framerate]] will rise accordingly. This will not only make the snake bite its own tail, but also make the video signal go out of range for most TVs and monitors (14MHz would give [[framerate|69 frames/s]]).


So why not overclock the GPU also ?
That's why most modification write-ups describe a way to keep the GPU at 12MHz and switch the CPU between 12MHz and 14MHz+ manually.


Simply because the GPU generates the video signal. If it is overclocked, the framerate will rise accordingly. This will not only make the snake bite its own tail, but also make the video signal go out of range for most TVs and monitors (14MHz would give 69Hz).
=Oscillator swap mod=


That's why the most popular mods describe a way to switch between 12Mhz and 14MHz+ manually.
Cut clock input just before the 68k (lift pin if possible, don't cut the PCB). Wire a ~14MHz oscillator's output to it. Can use a SPDT switch to chose between the oscillator's output and the original {{Sig|12M|12M}} signal. Switching mid-game will certainly crash the CPU.


How about 120Hz TVs ? Do they have 120Hz analog inputs ?
Warning: use an '''oscillator''' (usually 4 pins), not a quartz crystal (2 pins). Quartz crystals can't provide a clock signal all alone.


=Gearbox mod=
=Gearbox mod=

Latest revision as of 17:16, 13 March 2017

The principle of overclocking is to make electronic chips (not only CPUs) run at a clock frequency higher than intended.

Why overclock ?

Fanatics may not want to read this, but the NeoGeo can have slowdowns.

As the GPU runs in real time, slowdowns on most 2D consoles can only caused by the CPU because of long calculations (and not graphical complexity). For example, 20 moving sprites could cause slowdowns, but 200 static sprites won't.

Overclocking which chip ?

  • Overclocking the 68k makes it execute instructions (game code) faster.
  • Overclocking the Z80 is pointless, as it only takes care of music and has plenty of time for that.
  • Overclocking the GPU is also pointless: as mentioned above, it can't cause slowdowns.

In short, only the 68k CPU deserves overclocking.

Stability

CPU

The stock 68000-12 CPU can often work up to 14MHz (17% overclock) without crashing, but don't expect going above safely. Crashes are due to gate delays ? Crippling ?

Some people from the Atari and Amiga community showed that the high-end 68000-16 can work way beyond 16MHz. Reports of stable operation at 30MHz (150% overclock from 12MHz) can be found.

Heat is not an issue.

Memory

Overclocking might not be safe for all RAM access on the NeoGeo. For example, 68k user RAM is 100ns (166ns at 12MHz, would need <83ns at 24MHz). Max would be 19.8MHz ? Palette RAM is even slower: 120ns. Max would be 16.6MHz ?

The cartridge ROMs might also be too slow in some cases. Wait cycles could be artificially inserted to slow down acces, but overlocking would be way less efficient.

Video glitches

Twinkle Star Sprites runs a lot better at 20MHz (67% overclock) but glitches heavily.

When increasing the CPU clock only over 13.5MHz (13 %), some games start having video glitches. Games which have shorter access delays to the VRAM will glitch first.

The problem arises from the fact that the overclocked CPU inherently talks to the GPU faster, but the GPU still runs at 12MHz. This makes it skip writes or reads, making a mess in VRAM.

So why not also overclock the GPU ?

Simply because the GPU generates the video sync and vertical blank interrupt. If it is overclocked, the framerate will rise accordingly. This will not only make the snake bite its own tail, but also make the video signal go out of range for most TVs and monitors (14MHz would give 69 frames/s).

That's why most modification write-ups describe a way to keep the GPU at 12MHz and switch the CPU between 12MHz and 14MHz+ manually.

Oscillator swap mod

Cut clock input just before the 68k (lift pin if possible, don't cut the PCB). Wire a ~14MHz oscillator's output to it. Can use a SPDT switch to chose between the oscillator's output and the original 12M signal. Switching mid-game will certainly crash the CPU.

Warning: use an oscillator (usually 4 pins), not a quartz crystal (2 pins). Quartz crystals can't provide a clock signal all alone.

Gearbox mod

To do :)