Re: [cc65] absolute and immediate macros

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2003-10-15 13:53:15


Hi!

On Wed, Oct 15, 2003 at 01:04:39PM +0200, MagerValp wrote:
> Is it possible to make a ca65 macro that differentiates between
> absolute and immediate addressing?

Yes. There is an incomplete example in the docs, well hidden in the
description of the .TCOUNT function. Here is a complete version:

        .macro  ldax    arg
                .if (.paramcount <> 1)
                    .error "ldax: invalid macro call"
                .else
                    .if (.match (.left (1, arg), #))
                        ; immediate mode
                        lda     #<(.right (.tcount (arg)-1, arg))
                        ldx     #>(.right (.tcount (arg)-1, arg))
                    .else
                        ; assume absolute or zero page
                        lda     arg
                        ldx     1+(arg)
                    .endif
                .endif
        .endmacro


Regards


        Uz



Off topic P.S.: My current project is running out. Does anybody need an
experienced freelancer specialized in embedded development, C, C++, Unix,
Networking, realtime stuff, ...?

-- 
Ullrich von Bassewitz                                  uz_at_musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2003-10-15 13:53:27 CEST