Re: [cc65] .IFDEF, .DEFINED for checking existance of macros?

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2011-11-28 20:57:20
Hi!

On Mon, Nov 28, 2011 at 03:50:50PM +0100, Gábor Lénárt wrote:
> Is there a way to do conditional assembly based on the fact that a macro is
> defined?
[...]
> My goal is to have a single source to have a music player which can play an
> song included (with .INCBIN, I meant) as a quick demo, but also it can be
> compiled with a minor modification (commenting out the .DEFINE) to be able
> to load song from disk: and only then the routines needed for this is
> compiled. Also, I have constants (my_data + ...) which should be correct for
> both cases.
>
> Is it possible somehow? Sorry form my chaotic example, but hopefully my idea
> is understandable at least.

Just use constants instead of the macro. There's also .IFREF, which checks if
the source up to the point where .IFREF was used has any references to a
specific symbol. This can be used to build subroutine libraries that are
assembled only if they have been referenced before.

As a sidenote: It has been a bad decision to use .DEFINE for a special macro
style since many people think they're really C style macros and use them as
such. They're not, and doing so will fail in many places.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Mon Nov 28 20:57:26 2011

This archive was generated by hypermail 2.1.8 : 2011-11-28 20:57:29 CET