Re: [cc65] Hello and ca65 questions

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2005-05-09 14:57:14
Hi!

On Mon, May 09, 2005 at 02:18:41PM +0200, Spiro Trikaliotis wrote:
> Would it make sense to introduce two types of LABELs, one which has to
> remain static, and one which can be changed?

Yes, but that wouldn't solve the problem with forward references.

> The labels which can be changed could be as follow: It gets the value
> that was defined when the assembler entered that statement.

That "solution" ignores forward references completely. What if a symbol used
is not defined when the assembler "enters" the variable statement?
   
What is the value of foo at point (1)/(2)?

        foo     = bar + 10              ; (1)
        .word   foo                     ; (2)
        bar     = 3

A only solution that avoids any problems is to require constant expressions in
variable definitions. That would rule out things like

        .import         bar

        foo     = bar + 10
                .word   foo
        foo     = baz + foo + 10
                .word   foo
        baz     = 3

which is not as bad as it looks on the first glance, since most expressions
can be split into a variable part (that must be constant at the time of
evaluation), and second part that may contain external and forward references.
The example above would then read

        .import         bar

        foo     = 10
                .word   bar + foo
        foo     = foo + 10
                .word   baz + foo
        baz     = 3

Would that be acceptable?

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Mon May 9 14:57:23 2005

This archive was generated by hypermail 2.1.8 : 2005-05-09 14:57:25 CEST