Page 1 of 1

Merlin 64 Macros

Posted: Tue Jan 25, 2022 11:39 am
by A0CBM
I am new to Merlin and would like to use it to modify Jamaica Mon. I ran into something I don't see in the manual and was looking for help. Here's a snippet of code from the PEEK+POKE+WAIT that I don't understand.

Code: Select all

* Init IEVAL vector

         LDA $F7E5
         CMP #$91         ;Check for PPP
         BNE :SKIP
         LDA $030A        ;Old IEVAL
         STA $0334
         LDA $030B
         STA $0335
:SKIP    
         >>> per,HEXEVAL
         PLA
         STA $030A
         PLA
         STA $030B
In the macro call there's a per,HEXEVAL. My question is what is "per"? I believe the HEXEVAL is the name of the macro, which is found later in the code, and if so, isn't the macro supposed to be defined before it is used? Or is that what "per" is for?

Re: Merlin 64 Macros

Posted: Tue Jan 25, 2022 2:17 pm
by Dr Jefyll
"Jamaica Mon" -- is that something for the 65816? The '816 has an instruction called PER. Maybe the author of the code is trying to do something similar...? I admit I'm guessing, but maybe the suggestion will be helpful. I don't understand what the >>> is supposed to do. It's not a comment delimiter, is it??

Code: Select all

>>> per,HEXEVAL
-- Jeff

Re: Merlin 64 Macros

Posted: Tue Jan 25, 2022 3:02 pm
by teamtempest
Quote:
>>> per,HEXEVAL
The '>>>' is one way to invoke a macro in Merlin assemblers.

I don't know what this is trying to do, but IIRC the name of the macro is 'per' and 'HEXVAL' is a parameter which replaces every ']1' in the macro definition when it is expanded.

If I'm right, then 'HEXVAL' isn't a macro itself but a constant value. It doesn't matter that it's defined after the macro is invoked. The assembler will note the value is undefined when first encountered and fix it up on a later pass, after the value is known.

Re: Merlin 64 Macros

Posted: Thu Feb 17, 2022 5:20 pm
by A0CBM
Thanks for the explanation.