(Atari) ST-RAM boost WIP

68030 + SDRAM + IDE

Moderators: terriblefire, Terriblefire Moderator

User avatar
agranlund
Posts: 777
Joined: Sun Aug 18, 2019 10:43 pm
Location: Sweden
Contact:

(Atari) ST-RAM boost WIP

Post by agranlund »

Here's a bit of proof-of-concept speeding up stuff that normally cannot run from fastram (Ie; most games).
I'm thinking this feature should be disabled by default and switched on by running a small utility application.

It does steal 4MB fastram but with 64/128 available that might not matter too much?
(yeah it's pretty much just a simple 4MB ST-RAM shadow located in fastram. Writes to ST-RAM cost the same as before but reads end up being super fast)

And the drawbacks at the moment:
- It wont be happy if the blitter is used - but you probably don't need this feature for those types of games anyway.
- It wont be happy if you're loading from floppy or HDD connected to the ACSI port. An IDE port is fine though.
I'm not overly concerned about the Blitter but solving it for non IDE drives feels quite important - I'm planning on investigating if I got all relevant signals available for snooping those DMA writes.
Failing that I believe I may be able to fix it in software, at least for games that are using TOS for file i/o..


CPU scroll Giana Sisters with "ST-RAM boost":


And with stock TF536 firmware


Driller with ST-RAM boost:


And stock firmware:
User avatar
exxos
Site Admin
Site Admin
Posts: 23498
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: (Atari) ST-RAM boost WIP

Post by exxos »

We need GB6 ;)

I did consider such a thing ages ago, might have talked about it in here as well. It was basically to use fast ram as a fast catch to ST ram.'so same thing really ? I knew the glitter was a issue.. But I envisioned a issue which would prevent it from working right, but can't remember what it was now :roll: probably DMA related issues as you say ..

In any case, that is super cool :dualthumbup:
https://www.exxosforum.co.uk/atari/ All my hardware guides - mods - games - STOS
https://www.exxosforum.co.uk/atari/store2/ - All my hardware mods for sale - Please help support by making a purchase.
viewtopic.php?f=17&t=1585 Have you done the Mandatory Fixes ?
Just because a lot of people agree on something, doesn't make it a fact. ~exxos ~
People should find solutions to problems, not find problems with solutions.
User avatar
stephen_usher
Posts: 5580
Joined: Mon Nov 13, 2017 7:19 pm
Location: Oxford, UK.
Contact:

Re: (Atari) ST-RAM boost WIP

Post by stephen_usher »

I must admit that Maprom 1.7 allows *MORE* of PP's converted games to run on the TT (and TF) when the ST RAM remapping is in place than otherwise, which is quite interesting. Once the mapping is turned off the games don't start. Do you map the memory both for the user and supervisor translation tables? I'm wondering if games are fiddling with addresses that they shouldn't be touching and the mapping moves that away from something sensitive and into TT-RAM.

Oh, and I've had no DMA issues (floppy or ACSI) on the TT with the remapping and almost none with the TF.
Intro retro computers since before they were retro...
ZX81->Spectrum->Memotech MTX->Sinclair QL->520STM->BBC Micro->TT030->PCs & Sun Workstations.
Added code to the MiNT kernel (still there the last time I checked) + put together MiNTOS.
Collection now with added Macs, Amigas, Suns and Acorns.
User avatar
agranlund
Posts: 777
Joined: Sun Aug 18, 2019 10:43 pm
Location: Sweden
Contact:

Re: (Atari) ST-RAM boost WIP

Post by agranlund »

exxos wrote: Tue Dec 08, 2020 1:20 am We need GB6 ;)

I did consider such a thing ages ago, might have talked about it in here as well. It was basically to use fast ram as a fast catch to ST ram.'so same thing really ? I knew the glitter was a issue.. But I envisioned a issue which would prevent it from working right, but can't remember what it was now :roll: probably DMA related issues as you say ..

In any case, that is super cool :dualthumbup:
Yep sounds pretty much the same as what you considered! :)

The problem with using the "run from altram" flag on most games is that their video buffer ends up in fastram, so while the games do run nothing is being displayed on the screen.
On and off, I've been thinking about an approach where one could dynamically update the MMU table when needed to remap screen memory to ST-RAM (also copying the data for brand new memory pages).
The screen pointer detection code could either live in Timer-C or better yet, have the TF536 firmware generate an interrupt when that register is updated. There are plenty of unused interrupt lines on the ST.

Then as I was toying with some different approaches for adding hardware assisted STE DMA sound emulation, one of which involved shadowing ST-RAM, it occurred to me I could test that approach for generally speeding up games running from ST-RAM.
It's simple, brute-force and not nearly as elegant as juggling the MMU table. But since there is tons of ram available maybe simple is better..

I still like to try the MMU approach at some point though.. I think it would be quite an interesting exercise in general :)


With a lot of OS stuff already being able to run from fastram it doesn't do a super big difference to Gem or Gembench but here's what it looks like in EmuTOS without NVDI.
It's more of an improvement for the worst case such as games running code from ST-RAM.

Before:
stb0.jpg
stb0.jpg (46.96 KiB) Viewed 3739 times
After:
stb1.jpg
stb1.jpg (46.81 KiB) Viewed 3739 times
memspeed:
IMG_0048.jpg
IMG_0048.jpg (29.5 KiB) Viewed 3739 times
User avatar
agranlund
Posts: 777
Joined: Sun Aug 18, 2019 10:43 pm
Location: Sweden
Contact:

Re: (Atari) ST-RAM boost WIP

Post by agranlund »

stephen_usher wrote: Tue Dec 08, 2020 8:42 am I must admit that Maprom 1.7 allows *MORE* of PP's converted games to run on the TT (and TF) when the ST RAM remapping is in place than otherwise, which is quite interesting. Once the mapping is turned off the games don't start. Do you map the memory both for the user and supervisor translation tables? I'm wondering if games are fiddling with addresses that they shouldn't be touching and the mapping moves that away from something sensitive and into TT-RAM.
Yep it uses the same table for both user and super. Interesting observation and I don't really know why that is but I think your theory is probably correct :)

Depending on the game, these HDD+TOS2.06 fixed versions do a lot of insanely clever stuff. Some of the PP conversions moves the current TOS and temporarily inserts a custom TOS1.04 in its place and runs the game under that.. restoring the whole thing at exit.
These would definitely overwrite the low st-ram region..
But even the games that aren't entirely replacing TOS do a lot of moving memory about to make older games work.
In some fixed games I believe it even reloads his own HDD driver instead of whatever one you are current running but I'm not 100% sure about that.
User avatar
exxos
Site Admin
Site Admin
Posts: 23498
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: (Atari) ST-RAM boost WIP

Post by exxos »

@agranlund RAM access is the key, I mean it jumps to 200%, so games will run twice as quick easily! Pretty cool in anycase!

I guess one option would be to try to just move the shifter databus over to the CPU bus. Then use the MMU's shifter control to basically multiplex RAM between CPU and SHIFTER as it would anyway.. Though may need more buffers to isolate the CPU from the shifter bus..

Overall its why myself and @Icky are looking at a FPGA MMU. Then just run the whole RAM at 32MHz or whatever.. Easier said than done though as always :)
https://www.exxosforum.co.uk/atari/ All my hardware guides - mods - games - STOS
https://www.exxosforum.co.uk/atari/store2/ - All my hardware mods for sale - Please help support by making a purchase.
viewtopic.php?f=17&t=1585 Have you done the Mandatory Fixes ?
Just because a lot of people agree on something, doesn't make it a fact. ~exxos ~
People should find solutions to problems, not find problems with solutions.
User avatar
stephen_usher
Posts: 5580
Joined: Mon Nov 13, 2017 7:19 pm
Location: Oxford, UK.
Contact:

Re: (Atari) ST-RAM boost WIP

Post by stephen_usher »

I s'pose you could catch access to the hardware when the program tries to change the video memory address, discover the address and then map that into ST-RAM in the translation tables. Similarly for DMA set-up. In that way programs would not know that they're in TT-RAM as holes would be punched through for the memory regions that need to be in ST-RAM.

Of course, the most foolproof way would be to catch any access to supervisor mode and run the instructions in user mode but then catching and simulating any instructions which require supervisor access or access memory which isn't available in user mode. Effectively it would be a hypervisor running the game in a VM.
Intro retro computers since before they were retro...
ZX81->Spectrum->Memotech MTX->Sinclair QL->520STM->BBC Micro->TT030->PCs & Sun Workstations.
Added code to the MiNT kernel (still there the last time I checked) + put together MiNTOS.
Collection now with added Macs, Amigas, Suns and Acorns.
User avatar
agranlund
Posts: 777
Joined: Sun Aug 18, 2019 10:43 pm
Location: Sweden
Contact:

Re: (Atari) ST-RAM boost WIP

Post by agranlund »

stephen_usher wrote: Tue Dec 08, 2020 11:46 am I s'pose you could catch access to the hardware when the program tries to change the video memory address, discover the address and then map that into ST-RAM in the translation tables. Similarly for DMA set-up. In that way programs would not know that they're in TT-RAM as holes would be punched through for the memory regions that need to be in ST-RAM.
Yes that would be the more elegant way of doing it and I'm still tempted in giving that a go at some point for the sake of curiosity. Not sure if this would be faster or not but it's interesting none the less.
You would basically be trading fast reads from screen memory to instead get fast writes to work memory so I guess it's a matter of where the bottleneck lies in each particular game. Updating the screen usually involves a ton of read-modify-writes so it's a bit of a guess really.

How much any of this really matters in the end is another question but it's quite interesting and fun stuff :)
Newer stuff, like Frontier, is fastram aware anyway and old games probably only need a minor bump in performance if any.
I haven't tried very many but I'm guessing there's a high risk most(?) of them will just run to run too fast since they're from a time when you developed against a fixed hardware (like that Driller game for example)
And a bunch are probably capping to whatever target framerate they had when they developed/ported it for the ST.

Giana Sisters with PPeras CPU based smooth scrolling patch does benefit a lot from it though and it actually brings it up to par with how the Blitter-assisted version runs on stock 68000 :)

stephen_usher wrote: Tue Dec 08, 2020 11:46 am Of course, the most foolproof way would be to catch any access to supervisor mode and run the instructions in user mode but then catching and simulating any instructions which require supervisor access or access memory which isn't available in user mode. Effectively it would be a hypervisor running the game in a VM.
That is quite close to what the shapeshifter/basilisk2 Macintosh emulator for Amiga is doing. With the exception that it patches MacOS at load time so the emulator doesn't have to spend time verifying and rerouting hardware access.
(A port of either of these to accelerated Ataris would be awesome :))
User avatar
stephen_usher
Posts: 5580
Joined: Mon Nov 13, 2017 7:19 pm
Location: Oxford, UK.
Contact:

Re: (Atari) ST-RAM boost WIP

Post by stephen_usher »

Of course the biggest difference between the Mac and Atari is that Apple forced developers to play by the rules and only use documented system calls. On the Atari it was always a free for all mess. :-)
Intro retro computers since before they were retro...
ZX81->Spectrum->Memotech MTX->Sinclair QL->520STM->BBC Micro->TT030->PCs & Sun Workstations.
Added code to the MiNT kernel (still there the last time I checked) + put together MiNTOS.
Collection now with added Macs, Amigas, Suns and Acorns.
Steve
Posts: 2570
Joined: Fri Sep 15, 2017 11:49 am

Re: (Atari) ST-RAM boost WIP

Post by Steve »

More work of genius from the great @agranlund :D Whatever will he do next? World peace? Free energy?
Post Reply

Return to “TF536”