+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  Making a FastROM patch
Pages: [1]
Author Topic: Making a FastROM patch  (Read 643 times)
smkd
Guest
« on: July 29, 2007, 01:56:13 am »

Gradius 3 is the worst offender I know when it comes to slowdown and I'd like to make a fastrom patch to ease some of it.  I've tried all the measures I know of when it comes to making one and it doesn't seem to have any effect.

-I set $420D to 01 at reset and removed the instructions that clear it otherwise
-NMI which normally points to $008000 now leads to a JMP $808000.  All the game logic runs inside the NMI and it only returns when it's finished the frame.
-Every JSL I've found I've found I have pointed to the equivalent in the banks from $80 onwards.  It's all done in JSL's regardless if the target is in the same bank.  I logged scenes from scenes that suffer the most and searched for all the JSL's in it.

It hasn't had any effect though.  I recorded a movie from what I think is the worst effected part of the game, just to see if it's only a subtle change.  The part of stage 3 where you have to shoot through the sand.  There is no difference at all.  It starts and ends in the exact same way. 

I changed 7FD5 in ROM to 30 if it matters.  3.58Mhz mode 20 it says in the dev manual.

Is there something I'm forgetting about FastROM?
byuu
Guest
« Reply #1 on: July 31, 2007, 12:33:40 pm »

Let me guess, you're using ZSNES, right? ZSNES doesn't emulate FastROM properly. I don't recall the specifics, but suffice to say, that 008000 lda $c00000 will take the same number of cycles regardless of FastROM setting -- actual memory fetches aren't timed. I believe it just shortens the length of the opcode if it is executing in $800000 or higher. It also counts in cycles instead of clocks, which complicates things even more. Plus the tendency to make up for missing accuracy by speeding up emulation doesn't help. The game is most likely already running faster than it should be.

But suffice to say, I don't think you'd see a big difference with a FastROM patch even in SNES9x, which does emulate FastROM properly. There's lots of reasons the game could be slow. For one example, you tried making the NMI routine run in FastROM, but that won't make a huge difference because the game was designed so that NMI would never run out of vblank time. Meaning it's probably hardcoded to only do so much per frame. It's unlikely the NMI routine even realizes it has more time available to do a bit more processing now, so your game probably just sleeps a lot more now.

With ZSNES, you might have more luck screwing with the CPU execution ratios. Won't be a "real" speedup, but it should feel a little faster. Worth a try, anyway. You'll probably run into the same problems above with that approach, though.
Kitsune Sniper
Guest
« Reply #2 on: July 31, 2007, 05:30:03 pm »

The game had slowdowns while playing on a real SNES, if I recall correctly. I think it was just poor programming.
Shadowsithe
Guest
« Reply #3 on: July 31, 2007, 07:04:20 pm »

It was a godsend.
MathOnNapkins
Guest
« Reply #4 on: July 31, 2007, 10:28:04 pm »

byuu, am I incorrect in saying that an NMI running in FastROM isn't really much better than its counter part (SlowRom)? For example, if it consisted of 8 different DMA transfers of a large number of bytes each, that would mean the CPU is halted for most of NMI and the DMA transfers run on the master clock anyway, right?

I think the only advantage FastRom gives is it gives you more time to do the proper setup outside of NMI in order to use the V-blank time more efficiently.

As for speeding up the game, it could be lagging for reasons other than lack of CPU time, as Kitsune Sniper said. Perhaps it is inefficient loops that take too long to search. Perhaps it purposely does a lot of stuff for each sprite it might not have to. maybe it does expensive calculations that could be sped up with a look up table?
byuu
Guest
« Reply #5 on: July 31, 2007, 11:04:06 pm »

MathOnNapkins, it's true that DMA always transfers at SlowROM speeds (I imagine trying to strobe the XSlow controller ports with it would either return open bus, or incomplete reads -- nobody's tried it, because it's psychotic), and that NMIs perform lots of DMA transfers. They also usually have some long loops talking to the S-SMP.

But once again, I believe that even if the NMI routine is sped up, it'll just complete sooner (it was designed to finish before vblank ran out before, so it won't change its' design just because it's faster now), and then the non-NMI code will just finish faster and lock itself in a loop waiting on NMI to trigger again. So while the code is technically executing faster, it's all mostly just being transferred to idle wait loops.

If you really want to find out, download bsnes' source code, edit src/memory/memory.h : MemBus::speed() to always return 6 (FastROM speed). If the game doesn't speed up, then a FastROM hack is pointless.
Kyrael Seraphine
Guest
« Reply #6 on: August 01, 2007, 12:56:58 am »

A lot of shmups had intentional slowdown, by the way.

Specifically later gen stuff-- in particular, Cave games did this-- used to use slow-down to give you breathing space in intense situations. I doubt it's something that Gradius does, though. Heh. It's not exactly bullet-hell.
smkd
Guest
« Reply #7 on: August 01, 2007, 04:29:32 am »

I only mention the NMI handler because nothing related to the game action happens outside of it.  I kept logging frames and changing the JSL pointers until there were only pointers to the FastROM region.  First it'll do all the PPU stuff and then take action for the next frame.  I wanted to do a FastROM patch so it will have frames where instead of spilling past the NMI point for the next frame, it would finish earlier than that.  The patch didn't seem to do much at all, so I think I'll just drop it. 

byuu, what do you mean by the 'S-SMP'?
creaothceann
Guest
« Reply #8 on: August 01, 2007, 05:18:34 am »

The APU part, I think. :huh:

EDIT: Specifically, the SPC700.
« Last Edit: August 01, 2007, 05:25:12 am by creaothceann »
Piotyr
Guest
« Reply #9 on: August 01, 2007, 09:51:28 am »

Wait theres a way to remove slowdown on games? Cause a slowdown removing patch for megaman 7 and a few other games would be AWESOME! Screw accuracy if it means I can play my game at a constent fps.
MathOnNapkins
Guest
« Reply #10 on: August 01, 2007, 04:24:58 pm »

Yeah.... well nobody said that doing so would be easy or even feasible all of the time.
byuu
Guest
« Reply #11 on: August 01, 2007, 05:34:25 pm »

Quote
Wait theres a way to remove slowdown on games? Cause a slowdown removing patch for megaman 7 and a few other games would be AWESOME!

Only one way to find out. Download my sources and get to compiling! :beer: Or do I have to make you slackers a special version of bsnes that reads its' bus access timings from a text file for you guys? Lowering those values would be like unlocking a special UltraFastROM mode, unlike the cheap way of just bumping the frame counter up. Though I can't guarantee the games would still work right, of course. They should.
Pages: [1]  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC