Hi! On Wed, Jun 09, 2004 at 12:48:21PM -0700, Shawn Jefferson wrote: > I don't know if this would be a bug or not, but if I > have the following code: It's a bug in your code. If you replace the macro by it's expansion, you get: if (JOYSTICK == BUTTON_INNER) asm("lda #$80"); asm("trb $fd01+"#n"*4"); Since there are no curly braces, the second asm statement is not controlled by the if. What you need is if (JOYSTICK == BUTTON_INNER) { asm("lda #$80"); asm("trb $fd01+"#n"*4"); } To achieve the goal, you have to rewrite the macro. There are several ways to do that: 1. Use the comma operator: #define disable_irq(n) (asm ("lda #$80"), asm ("trb $fd01+"#n"*4")) 2. Use one asm statement: #define disable_irq(n) asm ("lda #$80\ntrb $fd01+"#n"*4") 3. Use a do loop: #define disable_irq(n) \ do { asm ("lda #$80"); asm ("trb $fd01+"#n"*4"); } while (0) ... and maybe even some more. 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 Wed Jun 9 23:29:35 2004
This archive was generated by hypermail 2.1.8 : 2004-06-09 23:30:13 CEST