Re: [cc65] bug?

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2000-12-09 13:48:49


Hi!

On Sat, Dec 09, 2000 at 01:50:31AM +0100, Groepaz wrote:
> lda (foo)+bar,y
>
> would incorrectly give an 'illegal adressmode' error, were

Yes, this is a known problem, and there may even be a comment in the docs
about it. The parser works with one token lookahead, so the decision about the
addressing mode is made by the first token of the operand.

There are other assemblers that use brackets instead of parenthesis to avoid
this problem. Another way would be to use more lookahead tokens. I don't like
any of these solutions, so I just ignored the problem:-) I don't think there
is an urgent need to fix this, since the problem happens very rarely (you are
the first one complaining:-), and there is an easy workaround. Anyway, I will
put it on the todo list, maybe I find a third and cleaner solution.

> #define AREA(x) =COUNT;COUNT+=x;
[...]
> so far i couldnt reproduce this behaviour in ca65, and it looks to me like
> allowing multiple lines in c-style macros would be the way to go ;)

The syntax itself may be reproduced with "old fashioned" macros and some V2.6
features:

	.macro	AREA	Arg

	  	.if .not .match (.left (1, Arg), ()
	  	.error "Argument needs parens"
	  	.endif

	  	...
	.endmacro

The bigger problem is that you are not allowed to modify constants, which
means that COUNT+=x will not work. So, even having line terminators as part of
a C style macro does not help here.

Maybe you can tell me somewhat more detailed what the author of the code is
trying to do, so I can decide if there is a way to do this with ca65, or (if
there is no such way, and the feature seems reasonable), I can add something
to make it work.

Regards
	  

	Uz


--
Ullrich von Bassewitz                                  uz_at_musoftware.de



---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo_at_musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2001-12-14 22:05:37 CET