beebasm icon indicating copy to clipboard operation
beebasm copied to clipboard

Add directive to test for symbol definition

Open chriskillpack opened this issue 2 years ago • 0 comments

Quoting from https://stardot.org.uk/forums/viewtopic.php?p=370117#p370117

I've been playing around with MACROs in RC2. Is there a way to do an IF on something being defined? An EXISTS or DEFINED keyword? What I want to do is...

MACRO testdefined label
	foo = label+"_suffix"
	IF DEFINED(EVAL(foo))
		PRINT foo," exists"
	ELSE
		PRINT foo," doesn't exist"
	ENDIF
ENDMACRO

bar_suffix = 10

testdefined bar
testdefined baz

chriskillpack avatar Sep 16 '22 21:09 chriskillpack