As I dive in and out of the BASIC interpreter and Kernel of the Commodore 64, I thought to shed some light on an error that I was seeing a lot back in the day when I was a teenager: after loading some data file e.g. at $C000-$CFFF and then trying to make any change to the BASIC program in memory I would always get the “?OUT OF MEMORY  ERROR” message.

Out of memory error message

Out of memory error message


Why is that? Well, when in direct mode the LOAD command sets the pointer to the start of variables for the BASIC interpreter to the end address+1 of the file that was just loaded, even when the secondary address is odd.

Out of memory error message

Out of memory error message

Is that correct or not? Well, that depends on whether the LOAD command is understood to only load BASIC programs or also data files without a BASIC program to execute and use such data. From the “Programmer’s reference guide”:

The LOAD statement reads the contents of a program file from tape or disk into memory. […] If LOAD is executed from within a program, the program is RUN. This means that you can use LOAD to “chain” several programs together. None of the variables are cleared during a chain operation.

That should make things clear 🙂

About Luigi Di Fraia

I am a Senior DevOps Engineer so I get to work with the latest technologies and open-source software. However, in my private time I enjoy retro-computing.
This entry was posted in Retrocomputing, Technical and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s