Re: [cc65] New .IDENT function

From: 42Bastian Schick <bastian421monlynx.de>
Date: 2005-05-10 08:16:14
Ullrich

> I've added a new pseudo function named .ident. Its purpose is to make an
> identifier from a string. Example:
>
>         .macro  makelabel       arg1, arg2
>                 .ident (.concat (arg1, arg2)):
>         .endmacro
>
>                 makelabel       "foo", "bar"
>
>                 .word           foobar          ; Valid label
>
> If the argument of .ident starts with the current .localchar, it is 
> converted
> into a cheap local identifer.

Nice new feature.

Actually it would be interessing if following works (using .set as 
variable :-)

nesting .set 0
elseuse .set 0
	.macro IFEQ arg
nesting .set nesting + 1
	cmp	#arg
	bne	.ident(.concat("_else",.STRING(nesting)))
	.endmacro

	.macro ELSE
elseuse .set elseuse + 1
	bra	.indent(.concat("_endif",.STRING(nesting)))
.indent("_else",.STRING(nesting)):
	.endmacro


	.macro ENDIF
   .if elseuse == nesting
elseuse .set elseuse - 1
   .else
.indent("_else",.STRING(nesting))
   .endif
.indent("_endif",.STRING(nesting)):
nesting .set nesting - 1
	.endmacro

Now:
	IFEQ 10
	lda test
	ELSE
	lda game
	ENDIF

would be possible.

But it seems it is not possible to build a string out of a number...



-- 
42Bastian Schick
----------------------------------------------------------------------
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 May 10 08:16:22 2005

This archive was generated by hypermail 2.1.8 : 2005-05-10 08:16:25 CEST