Is it possible to do this using GAS

Nick Clifton nickc@redhat.com
Fri Mar 23 14:42:00 GMT 2001


Hi Robert-Margaret,

> .macro	test2 regpair
> 
>     ldi	\regpairL, 0x0a
>     ldi	\regpairH, 0x0a
> .endm
> 
> ; This doesn't work
>     test2	abc
> ; I can't find a way to combine a parameter
> ; without adding whitespace
> ; ie I want \regpairL to end up as
> ; abcL which would be equated to 16.

You need to use nested macros, like this:

  .macro test-sub regpair letter1 letter2
     ldi	\regpair\letter1, 0x0a
     ldi	\regpair\letter2, 0x0a
  .endm

  .macro test2 regpair
    test-sub \regpair L H
  .endm

  test2 abc


Cheers
        Nick



More information about the Binutils mailing list