Re: [cc65] ca65, 65816 and far label pointers

From: Ullrich von Bassewitz <>
Date: 2013-01-09 10:18:18

On Tue, Jan 08, 2013 at 03:49:21PM -0500, Vince Weaver wrote:
> I'm trying to use the "LDA" instruction with the Absolute Long Indexed, X
> addressing mode.  I can't seem to get it to work.  It would look something
> like this:
>           lda     logo_begin,x
> where logo_begin was forced to be a 24-bit value.

How did you force it to be a 24-bit value?

The ca65 assembler has the notation of address sizes. A segment does have an
address size and labels inherit it from the segment they're in. The assembler
will then choose the instruction size from the address size of the label.

Look at the following example. You may use "ca65 -l test.lst test.s" to
translate it generating a listing and look at the listing to view the 

        .setcpu "65816"         ; Does also enable far segments

.segment        "FAR" : far

foo:    lda     foo             ; far, because of segment default
        lda     .LOWORD(foo)    ; abs, because of truncation

.segment        "NEAR" : absolute

bar:    lda     bar             ; abs, because of segment default
        lda     f:foo           ; far, because of override

In the first case, there is no override for near addressing, since the value
would be truncated. You will have to use one of the truncation operators to
use absolute/near addressing.



Ullrich von Bassewitz                        
To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Wed Jan 9 10:18:25 2013

This archive was generated by hypermail 2.1.8 : 2013-01-09 10:18:29 CET