Re: [cc65] Passing variables from asm to c and vice versa

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2008-08-05 21:21:14
Hi!

On Tue, Aug 05, 2008 at 10:56:45AM +0200, Stefan wrote:
> But if i calculate the difference of two constant pointers they are for some
> reason not recognized as constants (A difference of constants is again
> constant, or?).
> The same i get, when i define a label _colortable_size in the assembler
> program.
> This is again not recognized as contant in the c code even with the
> ampersand before.

No compiler known to me does what you want, so you have to find other
solutions. Compiling the following code

    int main (void)
    {
        extern unsigned char colortable[];
        extern unsigned char colortable_end[];

        static unsigned char colorindex = colortable_end-colortable-1;
        return 0;
    }

this is what cc65 says:

    uz@trixie:~$ cc65 test.c
    test.c(6): Error: Constant expression expected

this is what gcc says:

    uz@trixie:~$ gcc  test.c
    test.c: In function ‘main’:
    test.c:6: error: initializer element is not computable at load time

and finally this is what Watcom C says:

    uz@trixie:~$ wine wcc386 -oneatx -zq test.c
    test.c(6): Error! E1054: Expression must be constant

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 Tue Aug 5 21:21:26 2008

This archive was generated by hypermail 2.1.8 : 2008-08-05 21:21:28 CEST