HI
I'm a bit confused about what marking either memory or segments as RO (type = ro) is doing in the CA65 .cfg file.. The documentation is a little lacking and just says that it marks the segment as read-only, but what exactly does that mean in practice?
There's nothing stopping you from writing to a read-only segment at runtime?
Adrian
CA65 ReadOnlySegments
Moderator: Moderators
- Mike
- Herr VC
- Posts: 5134
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Re: CA65 ReadOnlySegments
They're mainly there to designate a memory range for const strings and init data for static variables of C in cc65.
Of course a pure assembly program can't be stopped from writing to a RO-Segment, but holding symbols of C there allows for static checks.
@mods: That being said, this thread should be moved to the 'Emulators & Cross-Development' section. Thanks.
Of course a pure assembly program can't be stopped from writing to a RO-Segment, but holding symbols of C there allows for static checks.
@mods: That being said, this thread should be moved to the 'Emulators & Cross-Development' section. Thanks.
Re: CA65 ReadOnlySegments
its not very relevant unless you are writing code that goes to ROM (like a cartridge) - then you can put the rodata section into rom.
for handwritten assembler programs that will be loaded into RAM, dont bother and use .code and .data only (if even that)
for handwritten assembler programs that will be loaded into RAM, dont bother and use .code and .data only (if even that)

I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
Re: CA65 ReadOnlySegments
Thanks, for the replies.
After RTFM I found that RAM areas marked as "Read Only" can only contain segments also marked as "Read only", so it's just a function of the linker and not applicable at runtime at all as you both say.
I did find a good use for it before though by putting all the code and static data into Read Only segments and loading this into VICE as detailed here
After RTFM I found that RAM areas marked as "Read Only" can only contain segments also marked as "Read only", so it's just a function of the linker and not applicable at runtime at all as you both say.
I did find a good use for it before though by putting all the code and static data into Read Only segments and loading this into VICE as detailed here