gnupic: Thread: labels in macros?


[<<] [<] Page 1 of 1 [>] [>>]
Subject: labels in macros?
From: Joe Pfeiffer ####@####.####
Date: 8 Jan 2015 03:35:29 -0000
Message-Id: <21677.64249.146466.587673@pfeifferfamily.net>

I suspect I know the answer to this, but...  is there a way to
auto-generate labels in macros?  I'd like to write a macro that
includes a GOTO instruction, and uses that instruction to jump some
instructions within the macro.  If I can avoid either passing the
label in as a parameter or using $+3 it would be good...
-- 
Joe Pfeiffer                                   http://pfeifferfamily.net/
1440 Tierra del Sol Dr                         575.525.2764 (H)
Las Cruces, NM 88007-5548                      575.496.3501 (C)
Subject: Re: labels in macros?
From: Peter Stuge ####@####.####
Date: 8 Jan 2015 06:20:10 -0000
Message-Id: <20150108062004.13647.qmail@stuge.se>

Joe Pfeiffer wrote:
> is there a way to auto-generate labels in macros?

Yes: local labelname, as used in spin2 below.

spin    macro   n
        movlw   n
        addlw   0xff
        btfss   STATUS,Z
        goto    $-2
        endm

spin2   macro   a,b
        local   s2s
        movlw   a
        movwf   spinreg
s2s     spin    b
        decfsz  spinreg,f
        goto    s2s
        endm


//Peter
Subject: Re: labels in macros?
From: Joe Pfeiffer ####@####.####
Date: 8 Jan 2015 16:43:31 -0000
Message-Id: <21678.45999.63782.115524@pfeifferfamily.net>

Peter Stuge writes:
>Joe Pfeiffer wrote:
>> is there a way to auto-generate labels in macros?
>
>Yes: local labelname, as used in spin2 below.
<snip>

Thanks!  I don't know who maintains the gputils user manual, but
adding this information to section 2.3.4 (Macros) might be worth while
(now that I know what the directive is called, I was able to find it).
-- 
Joe Pfeiffer                                   http://pfeifferfamily.net/
1440 Tierra del Sol Dr                         575.525.2764 (H)
Las Cruces, NM 88007-5548                      575.496.3501 (C)
Subject: Re: labels in macros?
From: Peter Stuge ####@####.####
Date: 8 Jan 2015 16:59:01 -0000
Message-Id: <20150108165858.27824.qmail@stuge.se>

Joe Pfeiffer wrote:
> >> is there a way to auto-generate labels in macros?
> >
> >Yes: local labelname, as used in spin2 below.
> 
> Thanks!  I don't know who maintains the gputils user manual, but
> adding this information to section 2.3.4 (Macros) might be worth while

Maybe you can send a patch?


//Peter
Subject: Re: labels in macros?
From: Joe Pfeiffer ####@####.####
Date: 8 Jan 2015 17:25:12 -0000
Message-Id: <21678.48497.259566.839809@pfeifferfamily.net>

A first cut is attached.  I used your example directly.

Peter Stuge writes:
>Joe Pfeiffer wrote:
>> >> is there a way to auto-generate labels in macros?
>> >
>> >Yes: local labelname, as used in spin2 below.
>> 
>> Thanks!  I don't know who maintains the gputils user manual, but
>> adding this information to section 2.3.4 (Macros) might be worth while
>
>Maybe you can send a patch?
-- 
Joe Pfeiffer                                   http://pfeifferfamily.net/
1440 Tierra del Sol Dr                         575.525.2764 (H)
Las Cruces, NM 88007-5548                      575.496.3501 (C)

[Content type application/octet-stream not shown. Download]
Subject: Re: labels in macros?
From: Peter Stuge ####@####.####
Date: 9 Jan 2015 15:00:59 -0000
Message-Id: <20150109150055.29119.qmail@stuge.se>

Joe Pfeiffer wrote:
> A first cut is attached.  I used your example directly.

I'm flattered! :) For completeness maybe spinreg should also be
reserved in udata_shr in the example?

Thanks for this! I hope the patch gets picked up from the mailing list.


//Peter
Subject: Re: labels in macros?
From: Joe Pfeiffer ####@####.####
Date: 9 Jan 2015 15:29:40 -0000
Message-Id: <21679.62432.445351.257331@pfeifferfamily.net>

Peter Stuge writes:
>Joe Pfeiffer wrote:
>> A first cut is attached.  I used your example directly.
>
>I'm flattered! :) For completeness maybe spinreg should also be
>reserved in udata_shr in the example?
>
>Thanks for this! I hope the patch gets picked up from the mailing list.

My first thought is that I prefer an example only cover a single
feature if possible...

We'll see what they think!  The funny thing is once I had it written I
realized I was doing it wrong and I didn't need it after all.  So
another tool goes in the box, which is a good thing!
-- 
Joe Pfeiffer                                   http://pfeifferfamily.net/
1440 Tierra del Sol Dr                         575.525.2764 (H)
Las Cruces, NM 88007-5548                      575.496.3501 (C)
[<<] [<] Page 1 of 1 [>] [>>]


Powered by ezmlm-browse 0.20.