[Coco] BASIC: order of operations query, and PRINT MEM

Allen Huffman alsplace at pobox.com
Fri Jul 8 11:13:15 EDT 2022


On Jul 8, 2022, at 1:58 AM, William Astle via Coco <coco at maltedmedia.com> wrote:
> 
> That extra 26 bytes is the stack and several bytes that mark an empty program. The variable table takes zero space unless you actually define a variable. Note that there's also a slop factor used in the calculation for OM errors that MEM doesn't take into account so the maximum usable memory is about 30 bytes less than what MEM says.

I just started digging in to this, looking at BOTSTK which is used for the ?OM ERROR. It takes the current stack pointer, and adds BOTSTK to it.

It says BOTSTK is 58 bytes. I am looking through Unraveled to see how this stack is used. It appears to be located in upper memory before string space. In my test program, BOTSTK is 32573 and string storage starts at 32566 - which is your "about 30 bytes less."

If that’s the case, then FRETOP (start of string storage) - BOTSTK (bottom of stack at last check) would be the actual memory available.

 




More information about the Coco mailing list