News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: SNES Slowdown: FastROM?  (Read 3264 times)

redmagejoe

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
SNES Slowdown: FastROM?
« on: March 18, 2019, 10:36:35 am »
Now that I've finished with hack work for the time being, I'm back to steadily improving my ROM collection through polish patches and the like. That brings me to the whole "fastrom" discussion, and my curiosity about pros and cons.

http://bszelda.zeldalegends.net/stuff/Con/alttp_fastrom.zip

I found this while looking around online, and I'm wondering if anyone might give me insight on how fastrom patches might address infamous slowdown issues in certain games before I just blindly apply it to my ROM and hope for the best. Specifically, if the benefits outweigh the problems. Link to the Past, for instance, has a very few, not flow-breaking moments where slowdown occurs, but I can certainly think of other games that could benefit from being able to handle more sprites/activity/calculations on-screen before it.

I am compiling a list of SNES games infamous for slowdown, for anyone who might give thought down the road to working on a FastROM or optimization patch.
  • The Legend of Zelda: A Link to the Past - Solution
  • Gradius III - WIP
  • 7th Saga - Already FastROM but poorly optimized. Fix possible?
  • Seiken Densetsu 3
  • Super Castlevania 4
  • Super R-Type
« Last Edit: April 01, 2019, 05:26:03 pm by redmagejoe »

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 6893
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: NES & SNES Slowdown: FastROM?
« Reply #1 on: March 18, 2019, 10:46:52 am »
NES does not have "FastROM" to my knowledge.
"My watch says 30 chickens" Google, 2018

redmagejoe

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
Re: NES & SNES Slowdown: FastROM?
« Reply #2 on: March 18, 2019, 10:53:32 am »
NES does not have "FastROM" to my knowledge.

So in the case of NES, "it is what it is" then. :-\

Disch

  • Hero Member
  • *****
  • Posts: 2717
  • NES Junkie
    • View Profile
Re: NES & SNES Slowdown: FastROM?
« Reply #3 on: March 18, 2019, 11:21:20 am »
Slowdown is ultimately caused by a game having too much work to do in a single frame than it has time for.  Hacking a game to use FastRom is one [simple] option that works for SNES.  But another option would be to just go in and optimize the code so it doesn't use as much CPU time.

There are a number of games, particularly on the NES, which infamously do a TON of work during a single frame.  Battletoads is well known for its optimization efforts, and I know nothing about the game code, but Recca on the NES does an INSANE about of splitscreening and spritework every frame with no noticable slowdown.

So while FastROM is a nice crutch to speed up a poorly optimized game, it isn't strictly necessary.  You could just make the game not so poorly optimized.  Of course, that is more difficult because it involves analyzing the code, figuring out what it's doing, and finding a smarter way to do it.

But often, small improvements make a big difference.  Code slowdowns often pile up in looped code.  So shaving 5 cycles off some code that is called 40 times per frame makes the game effectively 1.5 scanlines faster, which MIGHT be enough to make it not miss the next frame and eliminate all in-game slowdown.

redmagejoe

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
Re: NES & SNES Slowdown: FastROM?
« Reply #4 on: March 18, 2019, 02:45:20 pm »
There's quite a few patches in the database that bundle FastROM (and other things) into these omnibus patches, but I'm all for more options. For instance, I'm sure Zelda - Link to the Past DX/Redux/Etc is amazing, but I much more appreciate that some kind souls made individual L/R item switching and Controlled Pegasus Dashing patches I could apply. I was thinking of doing the same for FastROM, but I don't know if the one included in the patch(es) hosted on this site are the same as what I linked above.

How difficult would it be to create a FastROM patch (amount of code modified, tools and time required, etc) for those games that don't already have a FastROM bundle patch (which I could probably just try to diff out and extract into a separate upload), and what are some infamous examples of SNES games that could benefit from this treatment? I'd like to compile such a list here as I may set out to make this my newest project.

Disch

  • Hero Member
  • *****
  • Posts: 2717
  • NES Junkie
    • View Profile
Re: SNES Slowdown: FastROM?
« Reply #5 on: March 18, 2019, 04:36:00 pm »
Quote
How difficult would it be to create a FastROM patch (amount of code modified, tools and time required, etc) for those games that don't already have a FastROM bundle patch

Doing a FastROM hack involves two (3?) basic things:

1)  Enable FastROM some time after game startup (hook into the reset routine and perform a single write to a specific register)
2)  Change all ROM memory accesses to use the FastROM mirror addresses
3?) Change the in cart header to emus recognize that the game uses FastROM  (I don't know if this is actually necessary, but I'd probably do it because whynot)


#2 is really the big step here, as tracking down each and every memory access might be tedious.  Or the game might already be using the appropriate addresses and you won't have to do anything.  It really depends entirely on the game and how it's structured.


Quote
what are some infamous examples of SNES games that could benefit from this treatment?

This isn't really my area, but the one game I remember that had some REALLY annoying and sluggish menus was Seiken Densetsu 3.  It seemed like the equip menus and whatnot were extremely unresponsive.

I kind of doubt that'd be a simple FastROM hack though -- that might take a bit of a closer look to figure out what's actually going on.

redmagejoe

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
Re: SNES Slowdown: FastROM?
« Reply #6 on: March 18, 2019, 04:52:41 pm »
Okay yeah that... I admit that sounds a little beyond my experience level just yet. Still, I am always for the idea of "de-bundling" bundle patches that add several different features into individual option patches. As someone said in my other thread, it's always nice to have options. And now that I'm looking at the Link to the Past DX page, it seems that "Con" is a contributor to it. That's evidence enough for me to believe that the fastrom included is the same one I linked from "Con's stuff", and thus I feel comfortable enough in it to apply it to my ROM.

Seiken Densetsu 3 is another game in my collection, along with Castlevania 4, so if there isn't already a finished/in-progress FastROM project for those (or for Seiken, an analysis as you mentioned), it would be nice to see interest in that. Any other SNES games that anyone can think of with known slowdown issues, please post here. I'm going to compile a list for reference.

Zimgief

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
Re: SNES Slowdown: FastROM?
« Reply #7 on: March 18, 2019, 05:07:56 pm »
Gradius III and Super R-Type would benefit a lot from it.

redmagejoe

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
Re: SNES Slowdown: FastROM?
« Reply #8 on: March 18, 2019, 05:36:46 pm »
Added to the list.

Also I seem to be running into a curious problem. Two, rather. I applied the fastrom patch to both the clean LttP and to my fully patched one. SNES9x does not seem to want to even start the clean fastrom, related perhaps to it still saying LoROM on load, but ZSNES plays it just fine. The second problem is more likely an issue of load order, as catastrophic failure occurs on either emulator (at least S9x loads it though!) once I select a game file in the fully patched ROM. Should I be applying FastROM last or first? Or does it simply not play nicely with other patches when not properly integrated?

It was indeed a load order issue. Be sure to apply FastROM patches to a CLEAN ROM.
« Last Edit: March 18, 2019, 11:22:49 pm by redmagejoe »

Aaendi

  • Jr. Member
  • **
  • Posts: 23
    • View Profile
Re: SNES Slowdown: FastROM?
« Reply #9 on: March 31, 2019, 12:21:53 am »
I wish there was an automatic ROM optimizer.  The hard part is finding every possible jump location though.

slidelljohn

  • Sr. Member
  • ****
  • Posts: 250
    • View Profile
Re: SNES Slowdown: FastROM?
« Reply #10 on: April 01, 2019, 01:43:39 am »
Actually finding the jump addresses, LDA’s, MVP’s, and MVN’s(got to do the LDA’s, MVP’s, and MVN’s as well) is the easy part. The hardest thing to do is sit at your computer for hours at a time. :D
To easily find your addresses that need to be changed use Geiger’s snes debugger and set trace to trace once and go beat the game, then save your file and fill in the blanks by using giegers disassembler. Very very easy to do just time consuming. Now once you get your game fully disassembled you need to convert the addresses to the fast rom locations. Seems like it would take forever, but not with the right tools. I developed a tool where you can take your Geiger’s snes disassembled data upload into my program and it coverts all of the addresses in less than a second. Boom, most of it is done the only other things to do is set your rom at fastrom, make sure your interrupts are correct and it’s a near complete fastrom hack. Now Im not sure but I believe to get it %100 fastrom you also have to get all of your pointers loading in fastrom locations as well but I don’t think those will make much of a difference(if they can even use the fastrom speed) in speeding things up but the asm data definitely adds some noticeable speedup but definitely won’t remove all of the slowdowns. Really the pointers probably don’t even have to be done at all. That’s the only thing that I haven’t done to gradius 3 to complete the fastrom patch so the gradius 3 patch is pretty much as good as it’s going to get but I’m still going to update the pointers just in case. I am currently developing a tool for helping in hacking snes games and my tool for converting disassembled snes data to fastrom locations will be included with it. I have no idea when I will post the tool because I have many interesting things that I am developing for it.

If you would like to see a example of what the disassembled files look like before I run them through my program you can download my uploaded disassembled gradius 3 data. I run those files one at a time and boom, the addresses are instantly converted.
« Last Edit: April 01, 2019, 02:17:41 am by slidelljohn »

Aaendi

  • Jr. Member
  • **
  • Posts: 23
    • View Profile
Re: SNES Slowdown: FastROM?
« Reply #11 on: April 01, 2019, 11:50:03 am »
I meant a program that can automatically make ASM optimizations as well.

redmagejoe

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
Re: SNES Slowdown: FastROM?
« Reply #12 on: April 01, 2019, 02:59:19 pm »
By all means, if you guys make any FastROM patches or know where to find any, or know of any specific games that suffer from slowdown, post them here and I'll update the first post.

slidelljohn

  • Sr. Member
  • ****
  • Posts: 250
    • View Profile
Re: SNES Slowdown: FastROM?
« Reply #13 on: April 01, 2019, 04:45:52 pm »
I know of a specific game that suffers from slow down, 7th saga. It slows down in the menu for items and it slows down when some towns flash red. And guess what, it’s a fastrom game. This game is so poorly programmed it’s just ridiculous. They didn’t even get all of the fastrom stuff right. I think I had fixed the slowdown for the red flashing by using the math registers instead of the loop they had in place. So that part was easy to optimize but what they did with the menu system was just ridiculous. If anyone wants a good laugh go look at whats going on in the oam ram when you are in the item menu in 7th saga when it’s slowing down. Over half of the sprites are being updated and moved to different locations to make the text of one item flash and the arrow down/up flash. As those two things flash they completely remove them from oam ram then move the stuff above them down to to fill in the spot that was removed then vise versa when it reappears. There is no need to move any of those sprites data and the only sprites that need updating are the ones flashing not all of them. Like why reload all those sprites like that? I can optimize the menu so it doesn’t slowdown but I haven’t got to it yet. Fastrom helps a little bit best thing is optimizations and fastrom combined. And if you really want no slowdowns sa-1 is the answer. I actually have a sa-1 gradius 3 that I am working on so maybe oneday if I can finish it and we will have a snes gradius 3 with zero slowdowns. I chose gradius 3 because it’s the smallest game that was worth giving sa-1 to. The gradius 3 sa-1 is just practice for my mmx sa-1 hack that I plan on making.

redmagejoe

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
Re: SNES Slowdown: FastROM?
« Reply #14 on: April 01, 2019, 05:26:10 pm »
List updated.

justin3009

  • Hero Member
  • *****
  • Posts: 1614
  • Welp
    • View Profile
Re: SNES Slowdown: FastROM?
« Reply #15 on: April 01, 2019, 08:54:23 pm »
The fact that 7th Saga uses sprites as a menu is disturbing. Anything like that usually loads another screen or uses BG3 to load text and such since that's a lot less intense. I don't know if there's any reason why it's not BG3 but it would help TREMENDOUSLY if it was converted to that instead.
'We have to find some way to incorporate the general civilians in the plot.'

'We'll kill off children in the Juuban district with an infection where they cough up blood and are found hanging themselves from cherry blossom trees.'

slidelljohn

  • Sr. Member
  • ****
  • Posts: 250
    • View Profile
Re: SNES Slowdown: FastROM?
« Reply #16 on: April 01, 2019, 11:48:46 pm »
Definitely should be bg3 but because of the mode 7 graphics that they use in battle they had to use sprites for the menu. The world map when you travel also uses mode 7 and the menu system could be changed to something similar to final fantasy 6 that uses bg3 for text but that won’t work with the battles. In battles mode 7 needs to be removed to use the bg3 and the world map can still have mode 7 with a new menu like ff6. This is one of the reasons why I want to remove mode 7 from battles. The mode 7 is a neat feature for the battles but it’s just not worth having it. The game can be so much better without it.

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 6893
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: SNES Slowdown: FastROM?
« Reply #17 on: April 02, 2019, 01:33:36 am »
It was kind of a neat effect for the overworld at its time but the fact that all non-overworld battles have the same background is dull, and nearly like a retread to 8-bit RPGs (which I know often had blank backgrounds for technical reasons).
"My watch says 30 chickens" Google, 2018

eyeballkid

  • Jr. Member
  • **
  • Posts: 9
    • View Profile
Re: NES & SNES Slowdown: FastROM?
« Reply #18 on: April 02, 2019, 05:48:15 am »
For instance, I'm sure Zelda - Link to the Past DX/Redux/Etc is amazing, but I much more appreciate that some kind souls made individual L/R item switching and Controlled Pegasus Dashing patches I could apply.

There's at least this:

http://www.zeldix.net/t400-direction-change-while-running-with-pegasus-boots

You can find more single-purpose hacks here:

http://www.zeldix.net/f30-innovative-patches

I didn't see L/R item switching on the list, though.

redmagejoe

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
Re: NES & SNES Slowdown: FastROM?
« Reply #19 on: April 02, 2019, 09:18:58 am »
There's at least this:

http://www.zeldix.net/t400-direction-change-while-running-with-pegasus-boots

You can find more single-purpose hacks here:

http://www.zeldix.net/f30-innovative-patches

I didn't see L/R item switching on the list, though.

Just a reminder that we have those hacks, with the first one even being improved based on Con's own words.

http://www.romhacking.net/hacks/2880/ for AST Dashing in Link to the Past
http://www.romhacking.net/hacks/2879/ for L & R Item Switching

I sent Con a PM asking about uploading some of the other innovative one-off patches that were used in DX/Redux that only showed up on Zeldix, since it would make the hacks more accessible to those who use the site but not the forum here, and would otherwise never find Zeldix.