-D: Define Label

Group

Input

Scope

Assembly Unit

Syntax
  -D<LabelName>[=<Value>]
  
  
Arguments

<LabelName>: Name of label.

<Value>: Value for label. 0 if not present.

Default

0 for Value.

Description

This option behaves as if a Label: EQU Value is at the start of the main source file. When no explicit value is given, 0 is used as the default.

This option can be used to build different versions with one common source file.

Example

Conditional inclusion of a copyright notice. See the following listings.

Listing: Source code that conditionally includes a copyright notice

YearAsString: MACRO
   DC.B $30+(\1 /1000)%10

   DC.B $30+(\1 / 100)%10

   DC.B $30+(\1 /  10)%10

   DC.B $30+(\1 /   1)%10

ENDM

  ifdef ADD_COPYRIGHT

   ORG $1000

   DC.B "Copyright by "

   DC.B "John Doe"

  ifdef YEAR

   DC.B " 1999-"

   YearAsString YEAR

  endif

   DC.B 0

  endif

When assembled with the option -dADD_COPYRIGHT -dYEAR=2005, the code in the following listing is generated:

Listing: Generated list file

 1   1                     YearAsString:  MACRO
 2   2                         DC.B $30+(\1 /1000)%10

 3   3                         DC.B $30+(\1 / 100)%10

 4   4                         DC.B $30+(\1 /  10)%10

 5   5                         DC.B $30+(\1 /   1)%10

 6   6                     ENDM

 7   7

 8   8          0000 0001  ifdef ADD_COPYRIGHT

 9   9                       ORG $1000

10  10  a001000 436F 7079    DC.B "Copyright by "

         001004 7269 6768

         001008 7420 6279

         00100C 20

11  11  a00100D 4A6F 686E    DC.B "John Doe"

         001011 2044 6F65

12  12          0000 0001    ifdef YEAR

13  13  a001015 2031 3939      DC.B " 1999-"

         001019 392D

14  14                     YearAsString YEAR

15   2m a00101B 32         +   DC.B $30+(YEAR /1000)%10

16   3m a00101C 30         +   DC.B $30+(YEAR / 100)%10

17   4m a00101D 30         +   DC.B $30+(YEAR /  10)%10

18   5m a00101E 31         +   DC.B $30+(YEAR /   1)%10

19  15                     endif

20  16  a00101F 00             DC.B 0

21  17                     endif