As much memory as possible

GFA, ASM, STOS, ...

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

Post Reply
Samoteph
Atariator
Atariator
Posts: 22
Joined: Tue Jun 28, 2022 2:37 pm

As much memory as possible

Post by Samoteph »

Hello Atari devs!

I'm developing a game for Atari 520 ST and I need as much memory as possible.
The game uses GemDos to access files.
When the game start it is not mandatory for me to return to the desktop.

On Atari ST, The RAM seems to start at $5B4 but a part of this memory is used by TOS (end of TOS RAM at $4FA).
I've heard that some developpers copy their code in $5B4 to save memory. But how to stop TOS to use this part of memory?
Is it possible to use GemDos in this condition?
mikro
Hardware Guru
Hardware Guru
Posts: 2997
Joined: Sat Sep 10, 2005 11:11 am
Location: Kosice, Slovakia
Contact:

Re: As much memory as possible

Post by mikro »

I'm not an expert in this area but I'd say you have to choose one: compatibility or purging the OS. :)

There is a few open source projects which offer an OS-independent way of managing files, assets, memory etc. Amiga Demo 2 by Leonard comes into my mind: http://leonard.oxg.free.fr/download/Ami ... ersion.zip.
The user space is from $5000 to $80000 for 512Kb machine
So that gives you about 492 KB of RAM (out of 512, not bad!).

Loading files seems to be pretty straighforward:

Code: Select all

	lea		$5000.w,a0		; user space to load the file
	moveq	#2,d0
	jsr		$1000.w			; $1000 is Kernel adress
	jmp		$5000.w			; jump in the file
It should be fairly easy to replace the demo with your game and use the underlying manager for loading files.
User avatar
sporniket
Captain Atari
Captain Atari
Posts: 203
Joined: Fri Feb 16, 2018 5:39 pm

Re: As much memory as possible

Post by sporniket »

https://freemint.github.io/tos.hyp/en/t ... ctors.html
Bus errors arise when one attempts to access regions of memory to which access is not permitted. In supervisor mode this really can be only nonexistent memory areas. In user mode this can also happen in attempting to access hardware registers or regions below $800.
User avatar
Eero Tamminen
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2834
Joined: Sun Jul 31, 2011 1:11 pm

Re: As much memory as possible

Post by Eero Tamminen »

Some instructive reading on how not to do things: https://raw.githubusercontent.com/emuto ... atible.txt
Samoteph
Atariator
Atariator
Posts: 22
Joined: Tue Jun 28, 2022 2:37 pm

Re: As much memory as possible

Post by Samoteph »

Thank you for this information. Finally, I use a packer and a compression algorithm to minimize my memory footprint while respecting the OS :)
elliot
Captain Atari
Captain Atari
Posts: 215
Joined: Tue Mar 17, 2009 2:00 pm

Re: As much memory as possible

Post by elliot »

Does your game actually use GEM? Can you open files with TOS? I am not sure but I think you may have a little more memory if your game boots from disk (auto folder) before GEM loads. I may be wrong about this. Well it is def true if the user has ACCs and other "on boot" apps.

4Mb is a easy max memory you will get. You can also have "fast RAM" or "TT RAM" but I have no idea how one uses that. Is it STE or F?
Falcon with CT60 in rack mountable case. Two STFMs, one upgraded lots. My original STE from when I was a teen with Switchable TOS, 1.44Mb drive, 4MB RAM, Supra Hard Drive and very very yellow case. Mega STE with (currently none working) Crazy Dots 2. Atari 2600 and a Jag. And a mountain of commercial software and lots of hardware addons.
ThorstenOtto
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2367
Joined: Sun Aug 03, 2014 5:54 pm

Re: As much memory as possible

Post by ThorstenOtto »

Samoteph wrote: Sun Nov 20, 2022 8:48 am On Atari ST, The RAM seems to start at $5B4 but a part of this memory is used by TOS (end of TOS RAM at $4FA).
Don't know where you got those values from, but TOS uses much more memory. In TOS 1.04 for example usable memory starts at $A84E. The _membot system variable tells you the exact address.
mikro wrote: Sun Nov 20, 2022 10:28 am It should be fairly easy to replace the demo with your game and use the underlying manager for loading files.
I would say that this doesn't save memory at all. You would then maybe be able to start at a lower address, at the cost of additional code for the filesystem routines instead of using GEMDOS. GEMDOS of tos 1.4 takes about 24k of code.
User avatar
metalages
Captain Atari
Captain Atari
Posts: 306
Joined: Thu Jun 06, 2013 5:14 pm
Location: France
Contact:

Re: As much memory as possible

Post by metalages »

I have made the choice to get rid of the os and loads at $1000. The framework is a mix of asm and c without any standard lib. There is a tool to generate a floppy image with a resource management easy to use from the application. When loading from hd the application needs more memory. It preloads the disk image into additional memory and then the framework transparently copy from memory instead of loading at each load request. I don't think the loading code implementation takes more than 24kb as the whole demo code fits in less than 100kb (code + statics) and everything runs in 1mb.

https://github.com/jhubrt/demOS
Post Reply

Return to “Coding”