[cc65] segment address arithmetic

From: Shawn Jefferson <sjefferson1shaw.ca>
Date: 2008-09-21 02:45:38
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__;

 

void main(void) {

  cprintf("%X", &_DATA_LOAD__+1024);

 

  return;

}

 

The compiler produces:

 

000003r 1               .segment     "CODE"

000000r 1               

000000r 1               .proc            _main: near

000000r 1               

000000r 1               .segment     "CODE"

000000r 1               

000000r 1               ;

000000r 1               ; cprintf("%X", &_DATA_LOAD__+1024);

000000r 1               ;

000000r 1  A9 rr             lda     #<(L0001)

000002r 1  A2 rr             ldx     #>(L0001)

000004r 1  20 rr rr          jsr     pushax

000007r 1  A9 rr             lda     #<(__DATA_LOAD__+2048)

000009r 1  A2 rr             ldx     #>(__DATA_LOAD__+2048)

00000Br 1  20 rr rr          jsr     pushax

00000Er 1  A0 04           ldy     #$04

000010r 1  4C rr rr          jmp     _cprintf

000013r 1               

000013r 1               .endproc

000013r 1               

000013r 1               

 

What am I doing wrong here?

 

Thanks,

Shawn



----------------------------------------------------------------------
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 02:45:49 2008

This archive was generated by hypermail 2.1.8 : 2008-09-21 02:45:51 CEST