Hi! On Mon, Jul 04, 2011 at 06:45:54PM -0700, Agent Friday wrote: > I've been getting the "constant expression expected" error where I > don't think I should be. I isolated the issue to the conditional > assembly directive being inside a .proc scope vs. being in global > scope. Thanks for reminding me. This should definitely go into the FAQ, I'm answering this (or similar issues) at least once per months. The reason why this happens is that there may be a later symbol definition in local scope: USE_JOYPORT = 1 .PROC test_irq .IF USE_JOYPORT ; code here .ENDIF USE_JOYPORT = 0 ; Symbol in local scope with identical name! .ENDPROC You would expect the assembler to use the local symbol, wouldn't you? But when the definition is reached, the .IF condition has already been decided. This is the reason why you need to tell the assembler which symbol you want. There are cases where it doesn't matter, because evaluation can be delayed: USE_JOYPORT = 1 .PROC test_irq lda #USE_JOYPORT USE_JOYPORT = 0 ; Symbol in local scope with identical name! .ENDPROC Since the later symbol doesn't change the size of the code, the assembler can delay expression evaluation until the end of the local scope is reached. But this is not the case with .IF. 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 Tue Jul 5 10:43:13 2011
This archive was generated by hypermail 2.1.8 : 2011-07-05 10:43:17 CEST