Replacing Parts of Strings in C64 Basic
Posted3 months agoActive3 months ago
retrogamecoders.comTechstory
calmpositive
Debate
0/100
C64RetrocomputingBasic Programming
Key topics
C64
Retrocomputing
Basic Programming
The article discusses techniques for replacing parts of strings in C64 BASIC, a topic of interest for retrocomputing enthusiasts, with the single comment providing additional context and personal experience.
Snapshot generated from the HN discussion
Discussion Activity
Light discussionFirst comment
3d
Peak period
1
72-78h
Avg / period
1
Key moments
- 01Story posted
Oct 18, 2025 at 7:35 PM EDT
3 months ago
Step 01 - 02First comment
Oct 21, 2025 at 8:12 PM EDT
3d after posting
Step 02 - 03Peak activity
1 comments in 72-78h
Hottest window of the conversation
Step 03 - 04Latest activity
Oct 21, 2025 at 8:12 PM EDT
3 months ago
Step 04
Generating AI Summary...
Analyzing up to 500 comments to identify key contributors and discussion patterns
ID: 45631124Type: storyLast synced: 11/17/2025, 9:04:46 AM
Want the full context?
Jump to the original sources
Read the primary article or dive into the live Hacker News thread when you're ready.
Actually, integer arrays use just 2 bytes per entry (contrary to simple integer variables). And integers are really all what's needed here.
Therefore, using `DIM %R(RC,6)` should come with less overhead.
As for calculating overheads: String variables use 5 byte and the memory required for the actual string (one byte per character). Arrays use 2 bytes for the name and then 2 bytes for a length offset and 1 byte for the width/length per dimension, plus the space required for the individual entries (for integers 2 bytes per entry, for floating point 5 bytes and for strings 3 bytes). So a 2D array uses 2 + (2 + 1) + (2 + 1) = 8 bytes for the header plus the space for the entries.
Regarding performance, mind that arrays come after simple variables in memory and must be relocated (moved) each time, a new simple variable is defined (or used for the first time). So make sure to define simple variables before DIM-ing arrays. (As a lesser known feature, you can define simple variables by DIM as a list at once, where no dimensions parameters are provided, which should make this easier. E.g., `DIM A$, I%, X, Y`. Mind that this also defines the lookup order, so define often used variables before infrequently used ones. Add your array-DIMs after this.)