Jump to content
IGNORED

Testing Ram with Basic


doctorclu

Recommended Posts

Does anyone know any good basic programs from their bags of tricks that can test the size of available ram? Need to know methods that use pokes and peeks and those that do not.

 

The reason for the lack of pokes and peeks is want to test ram on a non-Atari system. So basically looking for a good basic routine, and trying to understand how it works.

 

Thanks!

Link to comment
Share on other sites

The FRE(0) can give a rough indication but can vary wildly depending on if a DOS is present and what screen mode you're in and of course if a Basic program is in memory.

 

There's not really a cure-all that'll work e.g. on Atari, C64, Plus 4, Apple etc.

All those listed can do Ram switching/banking and all do it differently, even Atari has multiple ways and not much software out there will cover all the bases.

 

Even then, most Basics except for Basic XE, and the Basic built into the Plus 4 will only use the contiguous block of RAM that is available before the ROM in a default configuration machine.

Which equates to about 38,911 bytes for the C64, 37,902 for a >= 40K Atari machine without any DOS.

 

So, POKE/PEEK becomes necessary to test "hidden" RAM and even then you can't necessarily do it from BASIC because the ROM needs to be present for BASIC and you can't just switch out the OS without providing a replacement first.

Although on C64 writes to ROM will go through and hit the underlying RAM, so it is possible to copy the ROMs and switch them out.

 

I guess a universal BASIC program might be possible - all the machines I've listed and most 80s machines that use BASIC have pretty much the same syntax for the common statements and functions.

The thing is, it'd be unnecessarily big becuase it'd need to have checks and dedicated blocks of code to work out what machine it's running on.

Link to comment
Share on other sites

Atari RAM management in Basic works a little like:

 

0000-00FF Page zero
0100-01FF 6502 Stack
0200-05FF OS work variables and buffers
0600-06FF Page 6 free, although buffer can overrun up to 057F
0700      Start of free RAM
xxxx      Top of free RAM
yyyy      Top of available RAM
$700 is where DOS will usually load but if no Dos in use then Basic will start using there for your program.

xxxx Top of free RAM will depend how much RAM is installed and what graphics mode in use.

yyyy Top of available RAM will depend how much RAM installed and what cartridge or ROM is inserted. With Basic that is $9FFF on any machine with >=40K RAM.

 

Basic puts the program then the variables and arrays then stuff like the runtime stack which keeps track of FOR/NEXT loops and GOSUB/RETURN locations.

 

So, free RAM at any given time in Basic is the top of the Basic work area up to the base of the Display List.

 

Since Basic keeps track of it's memory use constantly, it's a pretty easy calculation.

Edited by Rybags
Link to comment
Share on other sites

Does anyone know any good basic programs from their bags of tricks that can test the size of available ram? Need to know methods that use pokes and peeks and those that do not.

 

The reason for the lack of pokes and peeks is want to test ram on a non-Atari system. So basically looking for a good basic routine, and trying to understand how it works.

 

Thanks!

Available RAM isn't easy to detect. 'SHORTEST.COM' by Jager is the only one I know that will test base and extended RAM.

SHORTEST.zip

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...