Re: [cc65] segment address arithmetic

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2008-09-21 13:23:01
On Sat, Sep 20, 2008 at 05:45:38PM -0700, Shawn Jefferson wrote:
> I'm trying to take the address of one of my segments (or memory areas) and
> add 1024 to that address.  When I do that using the following code:
>
> extern char *_DATA_LOAD__;

__DATA_LOAD__ is an address. What you're doing here is to say that there is a
char* located at this address, which is wrong. What you want to to is to use
this address as is. For pointer arithmetics it is easiest to work with char
pointers, so

    extern char _DATA_LOAD__;
    #define DATA_LOAD       (&_DATA_LOAD__)

    int main (void)
    {
        printf ("%p\n", DATA_LOAD + 1024)
        return 0;
    }

is what you want.

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 Sun Sep 21 13:24:31 2008

This archive was generated by hypermail 2.1.8 : 2008-09-21 13:24:33 CEST