• Welcome to SCdev.org. Please log in.

Welcome to the new SCdev forums!

Story of a misunderstanding about slowdown (sadly)

Started by Ishan, March 01, 2005, 02:35:29 PM

Previous topic - Next topic

Ishan

Story of a misunderstanding :

even with no patch at all some games are slow.
It reminds me problems I had with my old visoly flash cart 64Mbits: the ram chip wasn't fast enough for certain "Game Pak Waitstate Control" settings, wich is a register used to set at wich rate the gba must access the gamepak (the ROM) and the games crashed. So to avoid that problem many peoples used to patch the game code the set the register to the lowest possible speed.

I was toying around with the SC sofware, just to see what nasty things it does to the roms. I tried passing a rom through it with all options disabled, no save patch, nothing, to see what was modified by SCsoft to make it run on the SC. And i found it overwrite 0x04020004 (little endian) at several location in the code with 0x00000000 and tadaaaa the game run on the cart.

this value is the famous "Game Pak Waitstate Control" register I was talking about earlier. So I guess Romman is removing any access to this register and set it permanently to 0x0000 wich correspond to the slowest speed settings (edit: with a few problems, see posts below).
I don't know why he does that but i guess it's because the logic/dram/whatever in the cart isn't fast enough to handles higher reading speeds.

(Note : setting the values to 0x00000000 is just a way to discard any write to 0x04020004 by sending bytes to a ROM space (ie the bios) wich isn't writable)

Well after some research, using the visualboy advance debugger and a good gba hardware doc I was thinking I found the problem about slowdown.

VBA allowed me to monitor/control the content of the WAITCNT register wich is that 0x04020004 thing.
I tried to run some of the problematic games and found something very interesting : Those games write a value, setting rom access speed according to their needs (even if some don't need all that speed :) ) so I just forced the register to 0x0000 (the value I believe Romman is using) and guess what? I got the same slowdown than on the SC :) (at that time I was working on rom without the enable restart option, so the good value wasn't writen)

I found out the bit causing the slowdown (I was thinking), it's called : "bit 14 - Game Pak Prefetch Buffer (Pipe)"

the description of what it does is as follow :
When prefetch buffer is enabled, the GBA attempts to read opcodes from Game Pak ROM during periods when the CPU is not using the bus (if any). Memory access is then performed with 0 Waits if the CPU requests data which is already stored in the buffer.


It's a bit like a cache mecanism, reading opcodes ahead to keep up with the CPU demand. I don't know if it's really clear for normal people but it is to me  :wink:

So my conclusion is, a more correct value for this would be 0x4000 (big endian) wich just set the bit 14 to 1.
Even more, a safer value would be 0x4003 wich also set a slower access speed for the SRAM (save) part.

Then I found out what killed the hope :( :

The code added to the game when enabling "enable restart" permanently set the register to 0x4002, so my guess Romman was using 0x0000 wasn't a good guess. It's only true when you disable the realtime save/enable restart option wich is the case for us user of the QPC saving method.

Thousands excuses to Romman :)

But now we have a way to get full speed without the realtime save, so my patchs can be usefull for some of the problematic games like Metroid - Zeo Mission or Street Fighter II but not all games. The memory chip in the SC isn't fast enough to handle the faster games and it's a hardware problem so no luck.

Sorry about all this, I'll release some patch for games that get a little faster without "enable restart".

edit: tried on Street Fighter II, it boosted the game slightly, having a bit less instruction to execute.
And Metroid gots smoother.
This is going to work mostly on games with a slight slowdown, so if you want me to do some, ask.

Conclusion : This is a hardware problem and it'll never be solved. We'll have to wait for a better version of the SC card with faster memory chips and why not SD Card support :)

plz NTolerance delete all posts belo, thx (you can delete the files too)

NT

Wow, nice detective work there.   8)

I wonder if this method can be applied to some of the well-known slow ROMs such as Yoshi's Island.  The reason I say this is because Romman claims that  he tested that game and some others and found no slowdown, which just isn't the case.

NT

Wow, nice work again.  I'm not a software developer, so you'll have to bear with me on this.  If I understand you correctly, can we do a find and replace hex edit of problematic ROMs to try and get them working better via your method?   :D

seam

Quote from: "Ishan"If u can get in touch with Romman, just tel him to write 0x4003 in the 0x04000204 register instead of his value and it'll resolve nearly everything I guess :)

(edit for Romman to read if you can get him to :
Just tried on the very problematic Mario Kart Advance and setting the bit 14 to 1 resolve most of the problem. There's just some slight slow down due to the fact the memory access is still set too low.
The next best thing would be some settings in the options menu to set the speed (there's 4 speeds setting : 2,3,4 and 8 and 8 is the slowest) , the bit 14 can be safely always set to 1)

yes someone please attempt to contact roman. i wish roman would work on the supercard more... im still upset he hasnt got the newest movie player firmware to work yet. have you read about the crystal engine firmware????

http://forum.lik-sang.com/showthread.php?t=2062

if that comes out and we are still on this old firmware, im going to be upset... :(

NT

Excellent demonstration.  Hopefully Romman will look at this and make the necessary changes.  As I've said before, slowdown in games is the single biggest problem with the Supercard and this change would be great for everyone.

seam

Quote from: "Ishan"I got Metroid - Zero Mission to run at full speed with every patch enabled !!
I've just restored back one of the register access and set the value the code load to 0x4003 wich is the slowest safe value and it actually works like a charm!!

If you know how to apply an IPS patch, I can send one. u'll have to put it on the 1370 offline release and it's associated files (.sci and .sav)

the only drawback is I have to patch the rom after it comes out of the SC software so no compression for now :|

do yoshis island and mario kart!!!!!! hehe. if possible. im glad SOMEONE is finally working on solving the slowdown of roms with SC. since roman apparently never is.

NT

Quote from: "seam"
Quote from: "Ishan"I got Metroid - Zero Mission to run at full speed with every patch enabled !!
I've just restored back one of the register access and set the value the code load to 0x4003 wich is the slowest safe value and it actually works like a charm!!

If you know how to apply an IPS patch, I can send one. u'll have to put it on the 1370 offline release and it's associated files (.sci and .sav)

the only drawback is I have to patch the rom after it comes out of the SC software so no compression for now :|

do yoshis island and mario kart!!!!!! hehe. if possible. im glad SOMEONE is finally working on solving the slowdown of roms with SC. since roman apparently never is.

The (U) versions would be my preference.   :D

NT

Quote from: "Ishan"
@NTolerance> could you mirror the avi files and patchs for me? i'll be forced to remove those soon form the server I'm using.

done

SyNTaXer

absolutely perfect, nothing more to say.  all my respect goes to you Ishan. and thank you very much for finding, let's call it "bug" in SC development. nothing against SC, it's nice but not perfect, but i love it.  bye SyNTaXer

seam

Quote from: "Ishan"Story of a misunderstanding :

even with no patch at all some games are slow.
It reminds me problems I had with my old visoly flash cart 64Mbits: the ram chip wasn't fast enough for certain "Game Pak Waitstate Control" settings, wich is a register used to set at wich rate the gba must access the gamepak (the ROM) and the games crashed. So to avoid that problem many peoples used to patch the game code the set the register to the lowest possible speed.

I was toying around with the SC sofware, just to see what nasty things it does to the roms. I tried passing a rom through it with all options disabled, no save patch, nothing, to see what was modified by SCsoft to make it run on the SC. And i found it overwrite 0x04020004 (little endian) at several location in the code with 0x00000000 and tadaaaa the game run on the cart.

this value is the famous "Game Pak Waitstate Control" register I was talking about earlier. So I guess Romman is removing any access to this register and set it permanently to 0x0000 wich correspond to the slowest speed settings (edit: with a few problems, see posts below).
I don't know why he does that but i guess it's because the logic/dram/whatever in the cart isn't fast enough to handles higher reading speeds.

(Note : setting the values to 0x00000000 is just a way to discard any write to 0x04020004 by sending bytes to a ROM space (ie the bios) wich isn't writable)

Well after some research, using the visualboy advance debugger and a good gba hardware doc I was thinking I found the problem about slowdown.

VBA allowed me to monitor/control the content of the WAITCNT register wich is that 0x04020004 thing.
I tried to run some of the problematic games and found something very interesting : Those games write a value, setting rom access speed according to their needs (even if some don't need all that speed :) ) so I just forced the register to 0x0000 (the value I believe Romman is using) and guess what? I got the same slowdown than on the SC :) (at that time I was working on rom without the enable restart option, so the good value wasn't writen)

I found out the bit causing the slowdown (I was thinking), it's called : "bit 14 - Game Pak Prefetch Buffer (Pipe)"

the description of what it does is as follow :
When prefetch buffer is enabled, the GBA attempts to read opcodes from Game Pak ROM during periods when the CPU is not using the bus (if any). Memory access is then performed with 0 Waits if the CPU requests data which is already stored in the buffer.


It's a bit like a cache mecanism, reading opcodes ahead to keep up with the CPU demand. I don't know if it's really clear for normal people but it is to me  :wink:

So my conclusion is, a more correct value for this would be 0x4000 (big endian) wich just set the bit 14 to 1.
Even more, a safer value would be 0x4003 wich also set a slower access speed for the SRAM (save) part.

Then I found out what killed the hope :( :

The code added to the game when enabling "enable restart" permanently set the register to 0x4002, so my guess Romman was using 0x0000 wasn't a good guess. It's only true when you disable the realtime save/enable restart option wich is the case for us user of the QPC saving method.

Thousands excuses to Romman :)

But now we have a way to get full speed without the realtime save, so my patchs can be usefull for some of the problematic games like Metroid - Zeo Mission or Street Fighter II but not all games. The memory chip in the SC isn't fast enough to handle the faster games and it's a hardware problem so no luck.

Sorry about all this, I'll release some patch for games that get a little faster without "enable restart".

edit: tried on Street Fighter II, it boosted the game slightly, having a bit less instruction to execute.
And Metroid gots smoother.
This is going to work mostly on games with a slight slowdown, so if you want me to do some, ask.

Conclusion : This is a hardware problem and it'll never be solved. We'll have to wait for a better version of the SC card with faster memory chips and why not SD Card support :)

plz NTolerance delete all posts belo, thx (you can delete the files too)

so your patches dont work???? or what... i dont understand...

Ishan

those patchs works only for games patched for QPC use. Some games have heavy slowdown when you don't enable "enable restart" option, like Metroid - Zero Mission.
Most of the very problematic games like mario kart or yoshi's island are never going to run at full speed due to hardware limitation (the ram chip inside the SC is too slow)

I got Super Mario Advance 2 running better than with the "enable restart" option and made the patch available if you want to try it.
I'll put some more patchs online for QPC users during the WE.