Re: [cc65] ASM to C help a n00b

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2010-05-27 22:47:47
On Thu, May 27, 2010 at 09:28:26PM +0100, S M wrote:
> I would like to put the lower nibble of the addresses of several array into
> an array how can I do that?

You cannot do that in a C source, at least not at compile time. The C compiler
does not consider such an expression a constant, and only constant expressions
can be used as initializers.

What you can do is to place the data into an assembly file, because the
assembler is much more flexible in this respect.

> I tried:
>
>  unsigned char *pCharsLo [] = {(char0 & 0xf0)};
>
>  unsigned char *pCharsLo [] = {((unsigned char*) (char0 & 0xf0))};

Are you really sure you want to initialize a pointer with a 4-bit value? I
cannot really imagine that this is actually useful. Maybe the problem is more
a conceptual one?

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 Thu May 27 22:47:53 2010

This archive was generated by hypermail 2.1.8 : 2010-05-27 22:47:56 CEST