Re: [cc65] Emitting data into segments defined in an interleaved way, while maintaining addresses?

From: David Schmidt <david1attglobal.net>
Date: 2012-08-23 23:30:41
On 8/23/2012 5:10 PM, Ullrich von Bassewitz wrote:
>
> On Thu, Aug 23, 2012 at 04:38:22PM -0400, David Schmidt wrote:
>> I see that the linker does in fact re-pack the various segments
>> together as expected - effectively un-interleaving them.  But the
>> addresses in MSGTABLE after File1.asm are incorrect.  The addresses
>> in the output from File2.asm are actually relative to the file when
>> it got assembled (vs. linked), which are different at link time once
>> the re-packing occurred.
>
> I'm almost sure that this is an error in your sources. There's a lot of code
> out there that relies on the linker to relocate the arguments of .addr
> correctly.
>
> Unfortunately your code does not assemble, so my assumption is that you did
> not use exactly this example for your test.

I do have a macro that does some work on the string for Apples, that I 
did not include for the sake of brevity - here is that macro:

; Define an ASCII string with no attributes
.macro  asc Arg
         .repeat .strlen(Arg), I
         .byte   .strat(Arg, I) | $80
         .endrep
.endmacro

> What I would look for is a .ORG statement somewhere. This would explain what
> you're seeing.

I do also have an .org that helps the listing be more useable/readable, 
but it is not required and I can try without it.

> Some additional tips:
>
>    * You can make your life easier by using the .sizeof() function. Instead
>      of
>
>          .segment "MESSAGES"
>          M11:     .byte      "1A"
>                  M11_END =*
>          .segment "MSGLEN"
>                  .byte M11_END-M11
>
>      you can use
>
>          .segment "MESSAGES"
>          M11:    .byte      "1A"
>          .segment "MSGLEN"
>                  .byte   .sizeof (M11)
>
>      which is somewhat simpler.

I like that - but of course this has to mesh with the Apple-ification of 
the string, too. ;-)

>> Aside from custom file
>> processing to generate a single file out of several at build time,
>> is there a way I can convince the toolchain to do what I want with
>> separate files like this?
>
> As said above, the problem is not the toolchain.

I certainly believe that.  I'll look into my macro usage and the .org as 
suspects.

- David
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Thu Aug 23 23:30:55 2012

This archive was generated by hypermail 2.1.8 : 2012-08-23 23:30:58 CEST