Re: [cc65] Problems with ORG directive and linker

From: Karri Kaksonen <karri1sipo.fi>
Date: 2011-03-31 07:13:38
On 03/31/2011 07:31 AM, Groepaz wrote:
> On Donnerstag 31 März 2011, you wrote:
>> On 03/30/2011 08:30 PM, Groepaz wrote:
>>> On Mittwoch 30 März 2011, you wrote:
>>>> but due to the unusual ORG semantics, the emitted object
>>>> file is different. It is a bit weird to realize that the addresses as
>>>> emitted in listing files are not to be interpreted as the actual
>>>> addresses where stuff will end up.
>>> its not unusual actually - every toolchain that includes an external
>>> linker works like this :)
>>>
>>> maybe something like ACME is a better idea for this particular project -
>>> it works like you need it.
>> Have you examined the option to replace all these .orgs with labels
>> instead?
>>
>> I mean instead of having
>>     .org $1234
>>
>> ...
>>
>>     jsr $1234
>>
>> You would use
>> org1234:
>> ...
>>
>>     jsr org1234
>>
>> And let the linker assemble the stuff as it sees fit. The things may not
>> end up in the right locations but the code could work.
> as i understood, the code is written in such a way that it relies on
> assembling to the same adress multiple times... like
>
> 	* = $1234
>
>     lda #0
>
> 	<more stuff here>
>
> 	* = $1235
>
> 	.byte 5
>
> probably quite some work to convert something like that. (but imho worth it,
> this is really a bad way to do things)
>

But that is quite trivial to solve. Just change ORG's to SEGMENTS.

.segment "ORG1234_0"
lda #0
...

.segment "ORG1234_1"
.byte 5

In the cfg file you then make all instances of these segments to start 
at $1234

--
Karri

----------------------------------------------------------------------
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 Mar 31 07:13:48 2011

This archive was generated by hypermail 2.1.8 : 2011-03-31 07:13:51 CEST