stardot / beebasm

A portable 6502 assembler with BBC Micro style syntax
http://www.retrosoftware.co.uk/wiki/index.php/BeebAsm
GNU General Public License v3.0
83 stars 26 forks source link

Add directive to test for symbol definition #88

Open chriskillpack opened 1 year ago

chriskillpack commented 1 year ago

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