[cc65] Possible bug?

From: Shawn Jefferson <jefferson_shawn_a8bit1yahoo.com>
Date: 2004-06-09 21:48:21
I don't know if this would be a bug or not, but if I
have the following code:

#define disable_irq(n)        \
  asm("lda #$80");            \
  asm("trb $fd01+"#n"*4") 

and in my C code I do:

if (JOYSTICK == BUTTON_INNER)
  disable_irq(0);

I get the following listing (with -OSir):

;
00019Br 1               ; if (JOYSTICK ==
BUTTON_INNER)
00019Br 1               ;
00019Br 1  AD B0 FC     L0047:	lda     $FCB0
00019Er 1  C9 02        	cmp     #$02
0001A0r 1  D0 02        	bne     L0061
0001A2r 1               ;
0001A2r 1               ; disable_irq(0);
0001A2r 1               ;
0001A2r 1  A9 80        	lda     #$80
0001A4r 1  1C 01 FD     L0061:	trb     $fd01+0*4

It works if I put the disable_irq(0) in { } brackets. 
I guess the compiler doesn't know the inline assembly
is going to be more than one line's worth?

--
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 Wed Jun 9 23:05:10 2004

This archive was generated by hypermail 2.1.8 : 2004-06-09 23:05:19 CEST