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

From: Per Olofsson <magervalp1gmail.com>
Date: 2010-11-14 14:21:56
On Sat, Nov 13, 2010 at 7:09 PM, Ullrich von Bassewitz <uz@musoftware.de> wrote:
>
> 1. What is a reasonable default start address for a config targeted to
>   assembler programmers? $801? $C000? $4000?

$0801.

> 2. How about the usable RAM area? Should it be limited to $A000 by default?
>   My current version uses $FFFF, which means that any errors will go
>   undetected.

$cfff. I/O and kernal are still used implicitly by all apps as IRQs
are enabled, so $d000-$ffff isn't usable unless you set up memory
yourself.

> 3. Is it desirable to have an optional BASIC SYS header, or is this used so
>   rarely that people are better served with a less complex linker config?

Instead of making the linker create it, why not offer a project
template with basic startup and hello world?

  yourproject/
  yourproject/Makefile
  yourproject/build.bat
  yourproject/init.s
  yourproject/main.s
  yourproject/c64-asm.cfg

init.s:

         .import main

         .segment "STARTUP"

        .word basicstub         ; load address

basicstub:
        .word @nextline
        .word 1970 + (.time / 31557600)
        .byte $9e
        .byte <(((init / 1000) .mod 10) + $30)
        .byte <(((init / 100 ) .mod 10) + $30)
        .byte <(((init / 10  ) .mod 10) + $30)
        .byte <(((init       ) .mod 10) + $30)
        .byte 0
@nextline:
        .word 0

init:
        jmp main

main.s:
        .export main

       .code
main:
        ldx #0
:       lda hello,x
        beq @done
        jsr $ffd2
        inx
        bne :-
@done:
        rts

        .rodata
hello:   .asciiz "hello, world!"

This has the advantage of demonstrating several ca/cl65 concepts, like
segments, exporting and importing labels, pseudo functions, anonymous
labels, local labels, and so on.

> 4. How about the SYS token, is it the same on all existing 65xx Commodore
>   machines? In other words: Is a BASIC SYS header module portable across
>   all CBM machines? I do think so, but I'm not 100% sure.

It's the same on C64, C128, +4, and PET. Unsure about CBM2 and C65.
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sun Nov 14 14:22:04 2010

This archive was generated by hypermail 2.1.8 : 2010-11-14 14:22:07 CET