Re: [cc65] String Literal Segment in C code

From: Agent Friday <64subnet1gmail.com>
Date: 2010-11-30 01:09:42
On Sun, Nov 28, 2010 at 2:14 PM,  <Maspethrose7@aol.com> wrote:
> The config. file:
>    .   .   .
>

OK, haven't studied this for very long, but I see at least one
thing amiss.

Since you used #pragma rodataseg("HIDECONST") before defining
strovr, it SHOULD be in the HIDECONST segment, which you've
assigned to RAM2, which should be contained in data.seq.  Look at
the generated data.seq to see if it's in there.  If not, it COULD be
a bug, unless I misinterpreted the config file.  You are correct to
load the overlay file yourself, however, there are 2 problems:

  1. Your filenames don't match.  "data.seq", vs. "data,prg".  I'm
    not sure if maybe extension handling (are you testing in VICE?)
    might hide those differences, tho.
  2. You aren't providing a load address for your "data" output
    file.  The RAM section does this with a "trick" of sorts, faking
    the actual start of the RAM area as $7FF instead of $801, so
    that the first two bytes of the STARTUP segment can sneak in the
    load address (although those first two bytes never really get
    loaded at $7FF).  If you've downloaded the source code, you can
    look at source/libsrc/c64/crt0.s to see how it's done.  You
    need to do the same...  or better, define the start and size for
    RAM2 as their actual values and just stick your own LOADADDR2
    segment, containing __RAM2_LOAD__ as two bytes of data, before
    HIDECONST.  Appropriate lines shown below.

config::memory:
    RAM2:  start=$5000, file="data.seq", define=yes;

config::segments:
    LOADADDR2:  load=RAM2, type=ro;
    HIDECONST:  load=RAM2 . . . .   #MUST appear after LOADADDR2...

loadaddr2.s:
    .export __LOADADDR2__ : absolute = 1;
    .segment "LOADADDR2"
    .word   start
    start:

I'm guessing a bit on the .export __LOADADDR2__ line...  crt0.s uses
this method to force the segment to be linked, otherwise the linker
may "optimize" it out.  What makes it work is that __STARTUP__ is
implicitly referenced by the linker, I think.  You may have to do
something like reference __LOADADDR2__ somewhere to get it to link,
but someone will have to back me up on this.  That part's a bit
sketchy...

Sorry I don't have time for a better answer.  I'll have more time
over the next day or so.  Just wanted to get some answer to you.
I am NOT a very experienced cc64 user, just so you know.  ;-)

// Agent Friday
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Tue Nov 30 01:09:50 2010

This archive was generated by hypermail 2.1.8 : 2010-11-30 01:09:53 CET