This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Is it possible to do this using GAS


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]