[cc65] A question about .org and the linker

From: Sidney Cadot <cadot1science-and-technology.nl>
Date: 2005-09-05 23:11:00
Hi guys,

Suppose I have the following two-line file "foo.s":

============================== start of: foo.s
         .org    $E000
bar:    jmp     bar
============================== end of: foo.s

--- This assembles nicely of course:

sidney@wopr:~/ossl$ ca65 -l foo.s -o foo.o && cat foo.lst
ca65 V2.10.1 - (C) Copyright 1998-2003 Ullrich von Bassewitz
Main file   : foo.s
Current file: foo.s

000000r 1                       .org    $E000
00E000  1  4C 00 E0     bar:    jmp     bar
00E000  1

--- Now using the following "foo.lnk":

============================== start of: foo.lnk
sidney@wopr:~/ossl$ cat foo.lnk

memory {
   ram: start = $0000, size = $10000, file = %O, fill=yes;
}

segments {
   CODE: load = ram;
}
============================== end of: foo.lnk

--- I do:

sidney@wopr:~/ossl$ ld65 -C foo.lnk foo.o -o foo

--- which yields a 65,536 byte file "foo", as expected. However, when  
I look at the contents:

sidney@wopr:~/ossl$ od -Ax -tx1 foo
000000 4c 00 e0 00 00 00 00 00 00 00 00 00 00 00 00 00
000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
010000

--- it shows that the linker has located the three bytes of code at  
the start of the
--- CODE segment, where I would have expected it at offset $E000  
(being forced there by the .org).

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?

[ 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. ]

Any help would be appreciated.

Cheers, Sidney

----------------------------------------------------------------------
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:11:16 2005

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