[cc65] ca65

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2002-11-26 14:03:05

On Tue, Nov 26, 2002 at 05:40:19AM -0500, Keates, Mark wrote:
> Many of the developers on AtariAge
> (http://www.atariage.com/forums/index.php)
> seem to prefer XASM or TASM, probably because the CC65 suite is not
> out-of-the-box
> ready for the Atari consoles. I've not tried these myself to make a fair
> comparison
> but from what I see in their source listings they are close to MAC/65 which
> was
> a favourite of A8 developers.

Please don't take my comments too serious. I just wanted to point out, that
ca65 is playing in the top league when it comes to features. Most people don't
realize this , because they know ca65 as "the assembler that comes with the
cc65 compiler".

There are of course a lot more reasons for using an assembler: Some people are
using an assembler because it's their own, others are used to a specific
syntax, some are using the assembler they have used 20 years ago and like the
retro feeling, and again others have lots of code that is written for even
another assembler. For most people, the reasons for using an assembler have
nothing to do with its features, and this is ok. It's all about having fun,
isn't it? :-)

> For me, CA65 is the choice as I prefer the modular approach to developing,
> i.e. .s or .c to .o and then link, with makefiles controling the building
> of that which has changed.

You can also use C like header files:

; Exported functions
.global         _close
.global         _open
; File mode constants
O_RDONLY	= $01
O_WRONLY	= $02
O_RDWR		= $03
O_CREAT		= $10
.include        "fcntl.inc"

.proc           _open   ; Will get exported because of the .global in fcntl.h
.include        "fcntl.inc"
        lda     #<O_RDONLY      ; from fcntl.h
        ldx     #>O_RDONLY
        jsr     _open   ; Will get imported because of the .global in fcntl.h

Using ".global" (or ".globalzp") is like the "extern" directive in C: If such
a symbol is encountered, it is exported, otherwise it is declared and marked
as an import. So using .inc files (or whatever they are named) may be used to
describe an interface to a module or a library, similar like a .h file does
the same for C code.

Another feature I do really like is the capability to store complete
expression trees in the object file. For example, the startup code for the
VIC20 generates the BASIC header like this:

        .word   Head            ; Load address
Head:   .word   @Next
        .word   1000            ; Line number
        .byte   $9E             ; SYS token
        .byte   <(((@Start / 1000) .mod 10) + $30)
        .byte   <(((@Start /  100) .mod 10) + $30)
        .byte   <(((@Start /   10) .mod 10) + $30)
        .byte   <(((@Start /    1) .mod 10) + $30)
        .byte   $00             ; End of BASIC line
@Next:  .word   0               ; BASIC end marker

The actual address of the SYS call embedded in this BASIC header (the four
complex expression lines) is calculated by the linker(!) depending on the
start address of the module (which comes from the linker configuration).



Ullrich von Bassewitz                                  uz_at_musoftware.de
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.

Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2002-11-26 14:03:10 CET