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

From: Yutaka Amanai <yasai-itame19421jade.plala.or.jp>
Date: 2011-05-08 20:58:35
2011/05/09 3:00 Yutaka Amanai wrote:
> But if this behavior is valid, I think it is troublesome to write data
> on a line if the data is large. And, your "#BAR-FOO" method certainly
> works, but generally "FOO" is not always relevant to "BAR", so it is
> annoying that I have to be concerned with "BAR" when I want only to get
> the size of "FOO". Is there a good way to get the size of large data
> written on multiple lines?

Probably I found a solution by myself. For .proc labels, .sizeof() seems 
to return the size of the whole content (until .endproc). So, I can 
define large data on multiple lines enclosing it with .proc and 
.endproc. It is data, not "procedure", but the method seems ok for my 
purpose.

But still there is a strange behavior. I wrote a test code:

   STR:    .byte   "str"
   .proc   myproc
           lda     STR,x
           lda     #.sizeof(STR)
   .endproc

Giving ca65 this code, it causes error: "Size of `STR' is unknown". If 
you comment out the line "lda STR,x", ca65 doesn't cause any error and 
.sizeof() returns 3. And, it seems that there are some ways to suppress 
this error:
   * removing the lines ".proc" and ".endproc"
   * explicitly specify STR as "::STR" (global label)
Is it related to scope?
----------------------------------------------------------------------
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 20:59:00 2011

This archive was generated by hypermail 2.1.8 : 2011-05-08 20:59:03 CEST