Re: [cc65] A question about .org and the linker

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2005-09-05 23:18:58
Hi!

On Mon, Sep 05, 2005 at 11:11:00PM +0200, Sidney Cadot wrote:
> Now I know how to get this fixed by juggling a linker file, but I
> would like to be able to nail a piece of code really at a certain
> address using .ORG only. Is there a way to do this (without using to
> the linker config?). Is the current behavior intentional?

Yes it is. The behaviour is explained here in more detail:

        http://www.cc65.org/faq.php#ORG

In short it reads like this: Code placement is done by the linker, not the
assembler. Using .org will assemble the code to run at a fixed address, but
you will also need to tell the linker to place it there (or use another
method, like copying).

> [ You may ask why I would want this. The reason is that I have
> scanned/OCRed/corrected 128 pages of Atari OS source code, and I
> would like to get this to work with ca65 with minimal changes. I
> really wouldn't like to put extra ".segment" directives in the code,
> for example. ]

If you have just one big input file (maybe separated into several includes),
you can use .res to fill up the space, so a piece of code will end up at a
certain address. But even this depends on knowledge about the linker config
used. If you know that your code is located at $2000 by the linker, you can
for example do

        .res    $E000-$2000             ; Emit $C000 bytes

        ; The following data/code will go to $E000

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Mon Sep 5 23:19:10 2005

This archive was generated by hypermail 2.1.8 : 2005-09-05 23:19:12 CEST