[cc65] ca65: .sizeof() doesn't return correct values?

From: Yutaka Amanai <yasai-itame19421jade.plala.or.jp>
Date: 2011-05-08 17:18:09
I'm very new to cc65/ca65, but I think the behavior of .sizeof() is
strange. When I use .sizeof() against labels, it seems to return
different values depending on newlines in source code.

I wrote a tiny test code:

  FOO:  .byte   $00, $01
  BAR:
        .byte   $00
        .byte   $01
  BAZ:
        .byte   $00
        .byte   $01
  .proc myproc
        lda     #.sizeof(FOO)
        lda     #.sizeof(BAR)
        ;lda    BAZ, x
        lda     #.sizeof(BAZ)
  .endproc

I assembled this code with ca65 --listing, and I got this listing (I
extracted only the part of "myproc"):

  000006r 1               .proc myproc
  000006r 1  A9 02              lda     #.sizeof(FOO)
  000008r 1  A9 00              lda     #.sizeof(BAR)
  00000Ar 1                     ;lda    BAZ, x
  00000Ar 1  A9 00              lda     #.sizeof(BAZ)
  00000Cr 1               .endproc

According to this listing, .sizeof(FOO)=2 and .sizeof(BAR)=0. And, if
you uncomment the line "lda BAZ,x", ca65 causes an error: "Size of `BAZ'
is unknown". Is this intended behavior? Or am I making a wrong use of
.sizeof() ?

----------------------------------------------------------------------
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 May 8 17:26:33 2011

This archive was generated by hypermail 2.1.8 : 2011-05-08 17:26:36 CEST