Merlin 64 Macros

Programming the 6502 microprocessor and its relatives in assembly and other languages.
Post Reply
A0CBM
Posts: 51
Joined: 04 Nov 2015

Merlin 64 Macros

Post 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?
User avatar
Dr Jefyll
Posts: 3526
Joined: 11 Dec 2009
Location: Ontario, Canada
Contact:

Re: Merlin 64 Macros

Post 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
Attachments
PER.png
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
teamtempest
Posts: 443
Joined: 08 Nov 2009
Location: Minnesota
Contact:

Re: Merlin 64 Macros

Post 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.
A0CBM
Posts: 51
Joined: 04 Nov 2015

Re: Merlin 64 Macros

Post by A0CBM »

Thanks for the explanation.
Post Reply