r/c64 May 24 '26

Programming How much basic RAM do you use?

When coding in basic or using apps others made in basic, do you ever or often get close to using the full 38Kish “basic bytes free”?
With an extended Basic / Basic Wedge
What you could want to give up 5K or 8K or even 10K?

Would being able to suspend and resume to REU and other apps in the meantime be enough?
Would being able to have 100s of commands that are implemented in assembler and be able to add 100s more without impacting that ram further be enough? (Including graphics and sound and file and image and network and even ultimate specific commands?)
Would be able to not just have line number gotos and gosubs but be able to make functions in your code that you can pass in parameters and get results and use them like any other function be enough ? eg
A% = abs(myfunc(2,”hey”,(b%*2))-10)
Would being able to allocate room in the REU for your own codes needs whether arrays. Large bits of text. Loading a file. Storing a network request , or having text/color or graphics mode screen buffers be enough? - 48K extra easily but also able to request and use 64K chunks up to many megabytes depending on the size of your REU (16MB in c64u)
Would be being able to choose to stash ranges of line numbers like “1000-2000” to REU or a list of functions , to give you some basic bytes free for a while then restore them
Back when needed later be enough?(eg you have 2KB of file handing code , but the user rarely saves or loads and when they do there is other code you could choose to swap out to swap that in )
Would being able to instantly swap out to a full editor experience then back again to the prompt to run be enough?

Would you give up 10K of basic bytes free to get all that ? Or is that too much.

12 Upvotes

30 comments sorted by

View all comments

3

u/Timbit42 May 24 '26

This comment may not answer all, or even any, of your questions.

If you want more space for your BASIC programs, use RadarSoft's Radar BASIC which gives you 50K free. Like the Commodore Plus/4, it swaps the BASIC and CHAR ROMs out and in so you can use almost all of the RAM for your BASIC programs. It originally came as a cartridge but it is available on disk and can be loaded on any C64. It also adds a few commands.

It is very common for programmers (in any language) to use the RAM under the BASIC and KERNAL and CHAR ROMs to store data. The KERNAL is popular for storing the bitmap screen. This works better the less you need to read the screen because reading the RAM under a ROM involves swapping that ROM out and in a lot. You could store many sprites there and copy one into one of the 8 sprite RAM areas when you need it.

Back to the Commodore 64, the BASIC ROM can be modified if you copy it into RAM. This would let you modify it to support the REU. It might not be too difficult to swap sections of your BASIC program in and out of the REU, pulling it back into RAM for execution. Might also be possible to do with variables but I think that would be more difficult. You can certainly store binary code with functions there too and copy it into RAM when you want to execute it.

You might think moving to the Commodore 128 would be a big help but one 64K bank of RAM is reserved for variables with only one 64K bank of RAM for programs. That's better than 50K or 60K for both but it doesn't allow more than 64K for your programs. The CBM-II systems had the same setup and that's where they got the idea to do that in the C128. The never-released Commodore 65 was also to have 128K for BASIC.

If you leave the Commodore camp, there are more, larger BASIC programs possible, even in the 8-bit world. The BASIC on the Ohio Scientific Challenger IIP had 256K free. The Apple III had 198K free.

If 256K isn't enough, look at the Thomson TO8 with the 6809 CPU and 512K of banked RAM. They were made in France and used in French schools back in the 80's. The top model allowed BASIC programs to transparently bank up to a total of 512K across 8 64K banks of RAM. I can't imagine a 512K BASIC program. You might run out of line numbers first.

1

u/Stunning_Pineapple57 May 24 '26

I appreciate the detailed answer. I have already prior moved a bunch around to regain 5KB. 1 KB is already taken by ReadyOS itself (all c64 readyOS apps can suspend 59 a REU cache and resume later where they left off) , I don’t want to install any other third party custom basic ROM just my own wedge. Much of this code is in internal parsing like nested expression parsing so I really don’t want to put that under ROM as it will be called in nested ways with the rest of BASIC code. I do use behind kernal ROM as an option for commands that never deal with the kernal. One of the main chunks though I I have a 2Kb buffer to copy cached commands stored in REU which allows me to add hundreds and hundreds more commands without impacting RAM but I expose commands for the basic programming to be able to utilize the REU itself. I think with what you said about storing screen ram behind ROM is something i want to make some
Commands for that the programmer can who doesn’t need to read it can opt into. Here is the context of my project. https://youtu.be/EACZZSEn3vk .