Re: [cc65] Linker config for assembler users (was: ca65 for stand-alone asm projects)

From: Ullrich von Bassewitz <>
Date: 2010-11-14 12:42:02
Thanks for any responses, they're quite helpful. Before adding my comments, I
have one more question:

Is it desirable to have the SYS header start code at arbitrary addresses, or
is it enough if it jumps to the address following the header? Currently, it's
always the latter (init code starts after the header). If I'm going for the
former, we need to agree on a symbol that marks the start of the program. It
would also mean that a 5 digit address following the SYS token is necessary
(currently, it's 4 digits).

As I see it, using an extra symbol for the program start just adds complexity
which is not necessary in most cases. Anybody who wants to use this can easily
supply a changed header module. But I'm open for arguments.

Apart from this, I will now use $801 as a default start address (overridable
by command line), allocate the whole remaining memory space and make all
segments optional. So no error checking - assembler programmers hopefully know
what they're doing:-)

On Sat, Nov 13, 2010 at 11:58:06AM -0800, Stefan Wessels wrote:
>    After a compile, with VICE, I type start myapp.prg on the command line
>    which starts VICE and also does a load and run.  To have the program have
>    the basic stub and start at $0801 is very effective.  On Power64 which I
>    use on OS X, it's almost the same.  I still have to type RUN which is
>    shorter than any SYS xxxx command.  I very much prefer this ease of use as
>    a default.

This won't be the default for two reasons: First, I do assume that most people
coming from other assembler don't expect an automatically added SYS header.
Second, the new linker features allow easy adding such a header by command
line, but not removing it.

>    Is it possible to do this "smart" and have it, if no --start-addr is
>    given target $0801 with a basic stub or otherwise target the specified
>    address with no stub, and lastly have the option forcing the stub off (so
>    you can target $0801 with no stub)?

No. Which means: yes, that would be technically possible, but it is against
the spirit in which ca65 was written, so I'm not going to do it.

My current concept will always supply the load address. It allows the SYS
header but does not add it. Assembler programs can be created by using

    cl65 -o myprog -t c64 -C c64-asm.cfg myprog.s

This will create a binary that includes the load address and loads to $801. If
you want another start address, use

    cl65 -o myprog --start-addr $C000 -t c64 -C c64-asm.cfg myprog.s

If you want to have a SYS header, use

    cl65 -o myprog -u __EXEHDR__ -t c64 -C c64-asm.cfg myprog.s

(another start address would be possible but doesn't make sense)

I hope this is acceptable. Docs will go to the machine specific doc files.



Ullrich von Bassewitz                        
To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sun Nov 14 12:42:12 2010

This archive was generated by hypermail 2.1.8 : 2010-11-14 12:42:15 CET