SupercardGBASlowdowns
From PHWiki
Due to the design of the Supercard, many people experience slowdowns when playing GBA games. There are three main reasons for this:
- Slow SDRAM on the Supercard.
- 'Restart' patch problems.
- Lack of prefetch when not using the restart patch.
More information is below.
Contents |
Slow SDRAM
The GBA starts up with its ROM interface set to a wait state of 4/2 cycles: it will wait 4 cycles for the first 16-bit word of a transfer and 2 cycles for each additional 16-bit word. Official GBA Game Paks are capable of a wait state of 3/1 cycles, and one of the first thing that an official game will usually do is reprogram the GBA's ROM interface to work at 3/1 wait state. However, the 32 MB RAM in the SuperCard does not work at 3/1; to allow games to work, the SuperCard patcher prevents the game from reprogramming the ROM interface. (If you have a DS, a SuperCard, and a SuperKey or other NoPass card, you can demonstrate this using memtestARM: the RAM tests will fail for any speed faster than 4/2.)
The GBA CPU runs 280,896 cycles in each frame. Some games are designed to use all the cycles in a frame at 3/1 wait state, and 4/2 just makes each read from ROM take more cycles, possibly causing computation to spill over to the next frame. There's not much that you can do about this, short of taking your Supercard apart and putting in a faster SDRAM module (*) Some games that require this include
- Doom, Doom 2, Duke Nukem Advance, and other games that use a software 3D engine
- Mario Kart Super Circuit
But for most other games, you don't need to go that far.
(*) This is not a very feasible option. See the following quote by a user named rarefluid [1]:
The SDRAM chip is a Hynix HY57V561620CT-H (133MHz) http://www.chipcatalog.com/Hynix/HY57V561620CT.htm As you can see here http://www.kurobox.com/downloads/Hardware/kurosdram.pdf you could use a Hynix HY57V561620CT-6 (166MHz), which is faster. It has different cycle times etc. though, so you wouldn't be able to use it without a changed firmware, which you probably won't get...
Also the Supercard seems to have a 50MHz clock generator, so I presume the CPLD (Lattice LC4128V 75T100, 7.5ns tPD (propagation delay)) and the SDRAM are running at that speed too. So to get a faster system I'd say you'd first have to replace the CPLD. There are versions with 2.7 and 5ns tPD, but they are pricey: ~40/30$ (http://www.mouser.com/catalog/624/188.pdf).
Maybe there are some more hardware specialist around that can clarify things... As much as I'd love to do this myself: It is stupid, expensive and probably won't work out because of missing firmware. So we'd better leave this alone altogether :/
'Restart' patch problems
The 'restart' patch in the Supercard software enables the use of shortcut keys to jump back to the Supercard screen - this makes saving and exiting a game easier.
This patch works by hooking into the DS's "vertical blanking" interrupt, which is (usually) called as soon as the screen finishes displaying one frame of animation, which happens at 60 times per second. If games push the limits of what can be done in vblank, there won't be enough time left for the restart patch to check keystrokes, and thus slowdown occurs.
There are two options available. One is to disable the 'restart' patch. This can make saving cumbersome (see QPC saving), and it also disables prefetching (see the next section).
The alternative is to use Bubble2k's fastrestart patch, which attempts to optimise the restart patch. It's a good idea to try this first as saving will be easier, but it may not be as effective as the solutions below.
Lack of prefetching
Another thing the GBA ROM controller can do is fetch more instructions from ROM while the program is reading or writing data in the GBA's internal RAM. This "Fetching" can result in significant speedups in some games, as the CPU doesn't have to wait as long for the next instruction to come in (giving an effective 4/1 wait state), with an approximate 10% hit in battery life.
A program called 'pfpatch' (again by Bubble2k) solves this problem by enabling prefetching on ROMs patched without the 'restart' patch. QPC saving can be cumbersome, but if you're still experiencing slowdowns, this method is the best.
Instructions
fastrestart
- Make sure you have a backup copy of the ROMs you want to use.
- Select some files and drag them onto fastrestart.exe, or from the commandline, type 'fastrestart nameOfRom.gba'
- Process the ROMs with the Supercard software. Make sure 'saver' and 'restart' patching are enabled. You only need 'saver', not 'save'. Reports have come in that the "restart" patch is not needed and causes issues when using fastrestart. Try using ONLY "enable saver patch" for best results.
- Copy the .sav file fastrestart generated, and the output from the Supercard software to your Supercard.
pfpatch
- Make sure you have a backup copy of the ROMs you want to use.
- Load the roms into Supercard. Enable 'saver' and 'save', and make sure 'restart' is disabled.
- Run pfpatch on each generated ROM in turn. Unlike fastrestart, you need to drag files onto pfpatch one at a time. From the commandline, run 'pfpatch nameOfRom.gba'
- Copy the updated ROMs and .sav files to your Supercard.
To save, use the QPC method (see Supercard).
External links
Old mirrors (broken as of April 2007):
- Fast restart (SD): http://l33t.spod.org/ratx/DS/SC/misc/fastrestart-v0.1.zip
- Fast restart (CF): http://l33t.spod.org/ratx/DS/SC/misc/fastrestart-cf-v0.1.zip
- Prefetch: http://l33t.spod.org/ratx/DS/SC/misc/pfpatch.zip
DanTheMan's mirrors:
- Fast restart (SD): http://dannysied.googlepages.com/fastrestart-v0.1.zip
- Fast restart (CF): http://dannysied.googlepages.com/fastrestart-cf-v0.1.zip
- Prefetch: http://dannysied.googlepages.com/Prefetch_patcher.zip
