Page 1 of 1
SA-1 patched Roms work fine in MiSTer
Posted: Mon Jan 04, 2021 6:47 pm
by Chris23235
Maybe this is old news to most of you, but I just stumbled over this project:
https://github.com/VitorVilela7/SA1-Root/releases
Vitor Vilela patched the code of several SNES Roms that were plagued by slowdowns so that they make use of the SA-1 chip that was in fact a second CPU that ran much faster than the CPU in the SNES. SA-1 was by far the most often used special chip it was used in 34 different games. The patched roms (Contra III, Gradius III, Super R-Type, Super Mario World) run much more smooth now and as the SNES core supports the SA-1 chip they all work fine in MiSTer.
Re: SA-1 patched Roms work fine in MiSTer
Posted: Mon Jan 04, 2021 10:19 pm
by SwedishGojira
You can get pretty much the same results with any game in the SNES core by just toggling the turbo setting in the OSD so I find these patches not necessary on the MiSTer.
Re: SA-1 patched Roms work fine in MiSTer
Posted: Tue Jan 05, 2021 6:37 am
by Chris23235
The turbo function isn't working flawless in all games, e.g. Contra III doesn't load and Super Mario World shows graphical corruption. Gradius III has a higher speed with the SA-1 hack in general.
In all these cases the SA-1 versions are the better choice. The advantage of the SA-1 versions over the turbo button is that the gamecode is altered to prevent issues and to take full use of the better CPU.
Re: SA-1 patched Roms work fine in MiSTer
Posted: Tue Jan 05, 2021 10:19 am
by 12characters
I was aware of Vilela's work but had missed the recent hack of Super R-Type. Thanks for sharing.
Concerning SA-1 hacks versus using the turbo option, there is some nice documentation on the core's GitHub page:
https://github.com/MiSTer-devel/SNES_Mi ... S_Turbo.md
Re: SA-1 patched Roms work fine in MiSTer
Posted: Tue Jan 05, 2021 8:36 pm
by Alkadian
Chris23235 wrote: ↑Mon Jan 04, 2021 6:47 pm
Maybe this is old news to most of you, but I just stumbled over this project:
https://github.com/VitorVilela7/SA1-Root/releases
Vitor Vilela patched the code of several SNES Roms that were plagued by slowdowns so that they make use of the SA-1 chip that was in fact a second CPU that ran much faster than the CPU in the SNES. SA-1 was by far the most often used special chip it was used in 34 different games. The patched roms (Contra III, Gradius III, Super R-Type, Super Mario World) run much more smooth now and as the SNES core supports the SA-1 chip they all work fine in MiSTer.
Thanks for sharing that. I have just tried all three patches and they look great to me!
Re: SA-1 patched Roms work fine in MiSTer
Posted: Wed Jan 06, 2021 1:19 am
by PikWik
this is great news for SMW rom hack players (like myself)
mind you, most SMW rom hacks dont make use of the SA-1 mod in Lunar Magic (the SMW level/game editor which enables SA-1)
but its good to know when SA-1 rom hacks get developed, they will run on the mister !
Re: SA-1 patched Roms work fine in MiSTer
Posted: Wed Jan 06, 2021 3:15 pm
by grizzly
Vitor Vilela have been working on another project similar to this.
Called FastROM
https://www.youtube.com/watch?v=9QCD0KvHQpI&t=23s
Which also can help slowdowns/etc.
Re: SA-1 patched Roms work fine in MiSTer
Posted: Wed Jan 06, 2021 11:23 pm
by 12characters
Interesting. Out of curiosity, I used uCON64 to check whether my library of 184 SNES games use FastROM or SlowROM. It appears that ~60% have FastROM. Those are typically later releases. For example, Actraiser, Super R-Type, Top Gear and Super Turrican use SlowROM whereas their sequels Actraiser 2, R-Type 3, Top Gear 2 and Super Turrican 2 use FastROM.
Although I suspect that there are other more important factors behind the slowdown found in early releases for the system, there might be some potential for improvement if one could convert the SlowROM games to FastROM.
Re: SA-1 patched Roms work fine in MiSTer
Posted: Thu Jan 07, 2021 9:41 am
by Chris23235
FastROM can speed up games significantly, because alongside to the faster ROM access the CPU clocks 30% higher on the SNES.
Re: SA-1 patched Roms work fine in MiSTer
Posted: Fri Jan 08, 2021 12:01 am
by ExCyber
Chris23235 wrote: ↑Thu Jan 07, 2021 9:41 am
FastROM can speed up games significantly, because alongside to the faster ROM access the CPU clocks 30% higher on the SNES.
It's not really "alongside"; running the CPU clock faster is how the faster ROM access is achieved, and it's sped up specifically for cartridge access by the CPU. Cycles that access non-cartridge hardware are the same speed regardless of the Fast/SlowROM setting, as are DMA transfers.
Re: SA-1 patched Roms work fine in MiSTer
Posted: Fri Jan 08, 2021 6:42 am
by Chris23235
Thanks for the explanation. As SloROM access is keeping the CPU at the normal speed it is not as good as I first thought.
Re: SA-1 patched Roms work fine in MiSTer
Posted: Sun Jan 10, 2021 1:56 am
by MottZilla
I'm not sure how the Turbo function on the MiSTer works exactly but the idea of converting SlowROM games to FastROM isn't new at all. But the gains from doing so are probably going to be pretty small. The SNES CPU takes a different number of master cycles each CPU cycle depending on the memory being accessed. SlowROM accesses take 8 master cycles. FastROM accesses take 6 master cycles. But that's just the CPU reading from ROM. Cycles that are reading or writing WorkRAM or internal registers won't be any faster. And DMA from ROM is not faster from FastROM so no benefit there.
If a game is just *barely* missing its window to complete the calculations for each frame in time then maybe FastROM would be enough to make a difference. It'd be easiest to use an emulator that was modified to try to find this out. You'd want an option you could toggle to make all SlowROM accesses take only 6 master cycles instead of 8 master cycles. Otherwise to find out if it would make a significant difference you're going to have to do significant patching to the game to make sure the code execution and data accesses are happening through the ROM banks that FastROM access will occur.
If anyone here knows how MiSTer's Turbo mode works I'd like to hear about it. It's not clear if it's overclocking the CPU, changing CPU instruction timing, removing DRAM refresh delays, making all memory accesses run at FastROM speed.
Re: SA-1 patched Roms work fine in MiSTer
Posted: Sun Jan 10, 2021 3:08 am
by ExCyber
MottZilla wrote: ↑Sun Jan 10, 2021 1:56 amIf anyone here knows how MiSTer's Turbo mode works I'd like to hear about it. It's not clear if it's overclocking the CPU, changing CPU instruction timing, removing DRAM refresh delays, making all memory accesses run at FastROM speed.
I'm not totally sure, but at first glance my best guess is that Turbo means "making all non-interrupt-context memory [not MMIO] accesses run at 20% faster than FastROM speed". I guess this might correspond to setting the CPU clock duty cycle to 50% instead of the canonical SNES behavior that can apparently be summarized as "wait, what? CPU clock duty cycle? are you the datasheet police?".
Code: Select all
process( SPEED, MEMSEL, REFRESHED, CPU_ACTIVEr, TURBO, P65_CLK_CNT, P65_ACCESSED_PERIPHERAL_CNT)
begin
-- Turbo should only occur when the cpu is ONLY accessing ram/rom, in otherwords during the main game loop
if TURBO = '1' and P65_ACCESSED_PERIPHERAL_CNT = x"0" then
CPU_LAST_CLOCK <= x"4";
elsif REFRESHED = '1' and CPU_ACTIVEr = '1' then
CPU_LAST_CLOCK <= x"7";
elsif SPEED = FAST or (SPEED = SLOWFAST and MEMSEL = '1') then
CPU_LAST_CLOCK <= x"5";
elsif SPEED = SLOW or (SPEED = SLOWFAST and MEMSEL = '0') then
CPU_LAST_CLOCK <= x"7";
else
CPU_LAST_CLOCK <= x"B";
end if;
[...]
if DMA_ACTIVE = '1' or NMI_EN = '0' or NMI_FLAG = '1' or VBLANK = '1' or HBLANK = '1' or ((P65_A_HIGH > x"1F" and P65_A_HIGH < x"80") and (P65_BANK < x"40" or (P65_BANK > x"7F" and P65_BANK < x"C0"))) then
P65_ACCESSED_PERIPHERAL_CNT <= x"3F";