NRTDRV MAN EN SYNTAX COMPILERMACROS

From MSX MUSIC WIKI
Jump to: navigation, search

Compiler Macros

$<str> YOURMML

This is macro function which compiler has. It is previously expanded in compiler and then compiled. .

l, v, V, VOP, o, < and > commands and MML tracks are effected vice versa. Repeat and loop are available as well.

Parameters can be written after macro name + colon(or space character).

<str> is macro name. Max 255 characters of alphabets and numbers can be used. It is case sensitive and different name between capital and small character are treated as other macros.

Error occurs when undefined macro is used.

[sample]
   $X c8de
   A $X:2         ;Same as "c8de2"
   A $X 4.        ;Same as "c8de4."
   $Y l8 ga
   A l4 ef $Y b>c ;Same as "l4 ef l8 gab>c"

Using macros effects data size directly, so it grows bigger than driver macros. Switch both of them appropriately. When you want to save size use to driver macro, when you clear appearance or increase utility use compiler macros.

If you want to write multiple lines of MML, enclose with "{" and "}". Line feeding is available in area from "{" to "}" .

[sample]
   $hoge { v15 l8
        o4 cdefgab>c^1
   }

Strings just before character which cannot be used in macro names are recognized as a macro name. Some times error occurs when macro name and MML are convined. Insert separate signs like space, tab or colon to avoid such error.

[sample]
       A $hogea1&a2   ;NG: Macro name is recognized as "$hogea1". It might cause error.

       A $hoge:a1&a2  ;OK: Macro name is recognized as "$hoge". Colon is treated as same as space.

There is difference from driver macro that compiler macro analyzes syntax after concatenate into one line. So even though error occurs line number cannot be displayed.

[sample]
    $TEST{
         cdef
         gXab>c
 }
    A $TEST
Syntax error occurs at 2nd line and 3rd character, but error is displayed as "10th character in macro2 of $TEST"