Re: [cc65] Zeropage Addressing?

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2009-11-13 14:31:56
On Fri, Nov 13, 2009 at 10:57:08AM +0100, silverdr@wfmh.org.pl wrote:
> > Warning: Didn't use zeropage addressing for `dli'
[...]
> It is not THAT new. I was bugging Uz about it (and he introduced it) quite
> some time ago already ;-) To eliminate it, either don't use forward references
> or don't use zeropage.

There's also a third way: In cases where the assembler cannot deduce the
addressing mode from the instruction, you can add an address size override
prefix.

-----------------------------------------------------------------------------
sym1    = $1234

; Following this declaration, sym1 is known, sym2 and sym3 are unknown

        lda     sym1    ; Assemble as absolute, since sym1 is known
        lda     sym2    ; Assemble as absolute, since sym2 is unknown. May
                        ; also be zero page, but don't know so act safely

        lda     z:sym2  ; Assemble as zero page
        lda     z:sym1  ; (1) Range error
        lda     a:sym2  ; Assemble as absolute even if zero page possible
        lda     z:sym3  ; (2) Range error
        lda     (sym2),y; (3) Assemble as zeropage caused by addressing mode
        lda     (sym3),y; (4) Error

sym2    := $02
sym3    := $4321
-----------------------------------------------------------------------------

Please note the difference between (1) and (2): The first one can be decided
by the assembler when it encounters the instruction, for the second, the
assembler makes an assumption and checks this assumption at the end of
assembly. Similar for (4). (3) is also checked at the end of assembly, but
found correct.

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 Fri Nov 13 14:32:01 2009

This archive was generated by hypermail 2.1.8 : 2009-11-13 14:32:03 CET