CA65 ReadOnlySegments

You need an actual VIC.

Moderator: Moderators

Post Reply
User avatar
beamrider
Vic 20 Scientist
Posts: 1447
Joined: Sun Oct 17, 2010 2:28 pm
Location: UK

CA65 ReadOnlySegments

Post by beamrider »

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
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: CA65 ReadOnlySegments

Post by Mike »

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.
groepaz
Vic 20 Scientist
Posts: 1180
Joined: Wed Aug 25, 2010 5:30 pm

Re: CA65 ReadOnlySegments

Post by groepaz »

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) :)
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
User avatar
beamrider
Vic 20 Scientist
Posts: 1447
Joined: Sun Oct 17, 2010 2:28 pm
Location: UK

Re: CA65 ReadOnlySegments

Post by beamrider »

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
Post Reply