Re: [cc65] ca65 .if statement

From: Ullrich von Bassewitz <>
Date: 2004-03-20 18:33:42

On Sat, Mar 20, 2004 at 01:59:39PM +0100, carlos wrote:
> Is this a bug, or did i understand something wrong with the .IF statement? I
> thought, that != and <> is the same.

No, '!=' is an invalid token. The docs say nothing about '!=' being the same
as '<>'. However, there's a problem with the assembler that prevents the
output of an error message in this special case, which is the reason, it
doesn't complain.

What happens is that the != token is handled as two tokens: '!' and '='. The
'!' is not expected in this place, so the expression evaluation for the .IF
ends, and since the first expression is FALSE (zero), so for the assembler,
the .IF is complete, and it starts skipping tokens, until it runs into an
.ELSE or .ENDIF. This is why it won't output a diagnostic.

Your code does also show another problem with the assembler: '<>' is ambigous,
it could mean:

	a <> b
	a < >b		; a < .hibyte(b)

Maybe I should introduce != and drop <> in the long run...

Thanks for the feedback!



Ullrich von Bassewitz                        
To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sat Mar 20 18:33:47 2004

This archive was generated by hypermail 2.1.8 : 2004-03-20 18:33:54 CET