RAM disk capacity

For experts to discuss very technical stuff and newbies to ask why the Spectrum they bought off ebay doesn't work.
Post Reply
equinox
Dynamite Dan
Posts: 1052
Joined: Mon Oct 08, 2018 1:57 am
Location: SE England

RAM disk capacity

Post by equinox »

I was surprised to notice recently that the 128k Speccies don't all have the same size of RAM disk. If you try this on a 128 or +2:

Code: Select all

FOR n=0 TO 99: PRINT n: SAVE ! STR$ n CODE 0,1024: NEXT n
it gets up to number 72 before failing with "4 Out of memory". However, running the equivalent on a +2a or +3:

Code: Select all

FOR n=0 TO 99: PRINT n: SAVE "m:"+STR$ n CODE 0,1024: NEXT n
only reaches 29.

Of course the +2a and +3 have a significantly different ROM from the 128 and +2, but it's the same size ROM. I assumed the RAM banks were basically empty when you switched on (other than the screen display, system variables etc.), so why the big difference in capacity?
zup
Manic Miner
Posts: 211
Joined: Wed Jul 08, 2020 8:42 am

Re: RAM disk capacity

Post by zup »

+3 uses 2k of bank 1 as a disk cache, so they are unavailable as RAM disk.
AndyC
Dynamite Dan
Posts: 1409
Joined: Mon Nov 13, 2017 5:12 am

Re: RAM disk capacity

Post by AndyC »

It's not actually the same size ROM, the +2A/+3 has 64K of ROM, where the +2 has just 32K, although I don't think that matters here.

The RAMdisk on the +2 is a very minimal implementation and can use all 5 extra 16K pages on the 128. I'd assume the directory structure is also pretty minimal. The RAMdisk on the +3 is a more fully featured disk emulation as it's provided by +3DOS, but that's limited to only 4 of the banks as +3DOS reserves page 7 for internal use and the second screen, it also reserves some of the RAM for the disk cache (configurable by calling DOS SET 1346)
equinox
Dynamite Dan
Posts: 1052
Joined: Mon Oct 08, 2018 1:57 am
Location: SE England

Re: RAM disk capacity

Post by equinox »

Hmm, so, relatedly: are there any games that work on a 128/+2 but not on a +2/+3 purely because there isn't enough RAM?
AndyC
Dynamite Dan
Posts: 1409
Joined: Mon Nov 13, 2017 5:12 am

Re: RAM disk capacity

Post by AndyC »

equinox wrote: Mon Jan 15, 2024 9:37 am Hmm, so, relatedly: are there any games that work on a 128/+2 but not on a +2/+3 purely because there isn't enough RAM?
I doubt it. The Syntax for using the RAMdisk is entirely incompatible between the two, so that'd break thing in BASIC long before running out of RAM.

In a pure m/code game, you can happily trash all the +3DOS reserved memory, unless you're loading from disk. But if someone's done a disk conversion, they've likely already worked around any +3DOS issues.
User avatar
spider
Dynamite Dan
Posts: 1099
Joined: Wed May 01, 2019 10:59 am
Location: Derby, UK
Contact:

Re: RAM disk capacity

Post by spider »

Ah yes "!" vs "M" if I recall.

As one bank is used by +3DOS , I wonder what happens with that on the +2A/B , if its got anything in it or used, as in for the ram-disk.
User avatar
TMD2003
Rick Dangerous
Posts: 2045
Joined: Fri Apr 10, 2020 9:23 am
Location: Airstrip One
Contact:

Re: RAM disk capacity

Post by TMD2003 »

equinox wrote: Mon Jan 15, 2024 9:37 am Hmm, so, relatedly: are there any games that work on a 128/+2 but not on a +2/+3 purely because there isn't enough RAM?
I spy a challenge on the horizon...
Spectribution: Dr. Jim's Sinclair computing pages.
Features my own programs, modified type-ins, RZXs, character sets & UDGs, and QL type-ins... so far!
AndyC
Dynamite Dan
Posts: 1409
Joined: Mon Nov 13, 2017 5:12 am

Re: RAM disk capacity

Post by AndyC »

spider wrote: Mon Jan 15, 2024 2:08 pm Ah yes "!" vs "M" if I recall.

As one bank is used by +3DOS , I wonder what happens with that on the +2A/B , if its got anything in it or used, as in for the ram-disk.
It's the same. +3DOS still reserves some for a disk cache and keeps the second screen free regardless of whether a disk drive is attached or not.
User avatar
1024MAK
Bugaboo
Posts: 3123
Joined: Wed Nov 15, 2017 2:52 pm
Location: Sunny Somerset in the U.K. in Europe

Re: RAM disk capacity

Post by 1024MAK »

The +2A/+2B/+3/+3B use essentially the same ROM code, hence work the same (more or less) when it comes to common features.

Mark
:!: Standby alert :!:
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :dance
Looking forward to summer later in the year.
equinox
Dynamite Dan
Posts: 1052
Joined: Mon Oct 08, 2018 1:57 am
Location: SE England

Re: RAM disk capacity

Post by equinox »

TMD2003 wrote: Mon Jan 15, 2024 2:34 pm I spy a challenge on the horizon...
Yeah, unfortunately my Rockfall 3 mod may prove to be the first one. So I'm going to have to do a standard +3 multiload version too (in which case I might as well also allow it to work on a 48K or +2a with tape or +D)... zzz...
At least if I can work out that bloody issue in the other thread, else it's all off.

I can remember a very few utilities that worked with the RAM disk, btw. The 128 version of the (Wham!) Music Box was one (and actually used BASIC for the RAM load & save), Superfile was another. Art Studio 128 offers RAM save but there's presumably no BASIC involved there.
Post Reply