Re: [cc65] Macro/asm problem

From: Shawn Jefferson <jefferson_shawn_a8bit1yahoo.com>
Date: 2004-05-28 15:41:42
--- Ullrich von Bassewitz <uz@musoftware.de> wrote:
> The inline assembler doesn't support the full ca65
> syntax.

Well, it does work with optimizations turned off.

>         #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.

That would definitely be a problem, since this macro
could very well be used multiple times in one
function.  I could do something like:

while ($fc92 & 0x80);

but that compiles to something like lda $fc92, and
#$80, beq *-7.  I think the bit/bmi is cheaper.
 
Your suggestion about adding a label number to the
macro might work, but a little ugly.  Any other
suggestions?

Hmmm, my best bet might be to use the while loop from
above, and just let the programmer worry about using
the bit/bmi form if they need to shave a few cycles
out of a loop.

--
Shawn Jefferson



	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 
----------------------------------------------------------------------
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 15:41:46 2004

This archive was generated by hypermail 2.1.8 : 2004-05-28 15:41:54 CEST