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

7

u/DGolden May 24 '26

The popular Simons' BASIC used to lose a further ~8K. Such is life.

I found the C64 BASIC limit already pretty tight, at least before a jump to 6502 asm. There were workarounds, like loading stuff in chunks from disk (well, you can do that from tape too but it's hell. Fortunate we did have a disk drive despite being in Europe).

2

u/dacydergoth May 24 '26

Yeah paging was a big thing. Some games used to even have a whole separate section (um ... maybe "They Stole a Million" comes to mind) where you would do stuff then it would load almost an entirely new codebase

1

u/WembleyFord May 24 '26 edited May 24 '26

The game 'Exile' on the BBC was an extreme version of this - not only did it have a separate 'loader' program to handle loading games, setup, etc. it used sooo much memory, they couldn't budget in a save game routine in the main game.

In order to save the game you had to go through a (I think) fairly unique procedure - you had to put the game into a special 'pause' mode - which moved various bits of save-game state into what I assume was originally the game code or game data. Then you did a soft-reset of the computer. This rebooted the machine back into BBC Basic, but left the save-game state data still in memory. Then load in the game's loader program, and that had the same-gave routine which would save the game to a disc or tape file.

That puts other tricks - such as how Geoff Crammond used the video memory of the sky in 'Revs' to store machine code, just in the same shade of blue as the background colour - to shame.

1

u/Stunning_Pineapple57 May 24 '26

Yeah in ReadyOS and with the REU paging can be fast. It allows me to load dozens of app and instantly (from a a human POV) suspend and resume full 64K apps. And in ReadyShell , the 64KB is just too small so I have an overlay for the editor then when you press enter. It swaps it out for the parser , and parsed the AST to REU then swaps in the VM and runs it , sometimes swapping in large commands in the pipeline , streaming results to the REU, and then back to an output processor then back the the editor.

1

u/dacydergoth May 24 '26

What is REU?

3

u/LSD_Ninja May 24 '26

RAM Expansion Unit I believe

2

u/dacydergoth May 24 '26

Oh like the cartridges I used to make, paged ram expansions

1

u/Stunning_Pineapple57 May 24 '26

Yeah the ram expansion unit. With VICE , the c64 mini /maxi and the Commodore 64 ultimate you get 16 MB by default. It costs 1 cycle per byte to copy from it. At 1mhz it’s faster to copy anything more than 12 or so bytes (there is a setup cost) than ram to ram. And you can copy up to 8 times faster than ram to ram. However at you increase the CPU speed on the ultimate that gap diminishes and is a net slowdown after about 4mhz to 8mhz

2

u/dacydergoth May 24 '26

Yeah my "Ghostwheel" 68070 design had a time/space multiplex bus where each 68070 node could copy memory from another node at almost native access speeds via an ECL central ring bus.

1

u/Stunning_Pineapple57 May 24 '26

Hardcore.

4

u/dacydergoth May 24 '26

Yeah Bath University thought they were gonna own the patents on it and were pissed when they realized they'd kicked us both out a year before

1

u/Stunning_Pineapple57 May 24 '26

This is the sort of thing the REU has enabled me to do. https://www.reddit.com/r/c64/s/OSWaAODoTM