Re: [cc65] Macro/asm problem

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2004-05-28 00:41:32
Hi!

On Thu, May 27, 2004 at 09:09:18AM -0700, Shawn Jefferson wrote:
> When I compile a program with this macro in it, it
> complains about an Identifier expected on the "bmi"
> line.

The inline assembler doesn't support the full ca65 syntax. In this case, it
means that you will have to use a label for the branch:

        #define WAITSUZY        \
            asm ("L1:");        \
            asm ("bit $fc92");  \
            asm ("bmi L1")

One problem is that you will run into trouble when using this macro twice
within one function, since the label is redefined. A solution would be to pass
the label number as a macro argument.

>  When looking at the .s file, the bmi has been
> changed to "jmi", which I assume is normal?

Inline assembler statements run through the optimizer and may be changed or
even removed when the optimizer thinks that it is necessary. This does also
mean that branches may get transformed into the long form. In your case, the
reason is that the label is invalid, so the optimizer thinks it is no near
label.

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 May 28 00:41:37 2004

This archive was generated by hypermail 2.1.8 : 2004-05-28 00:41:45 CEST