MPASM: Any "local" labels like with Gnu as?

I can't find any references to local labels in the MPASM User's Guide. Am I missing them or don't they exists? In Gnu as I can do this:

func_one: lwz r4,(r3)

1: addi r4,r4,1 cmpi r4,1000 bne 1b mr r3,r4 blr

func_two: lwz r4,(r3)

1: addi r4,r4,-1 cmpi r4,0 bne 1b mr r3,r4 blr

In this example, '1' is the local label and the branch to 1b means jump backwards to the first '1' label encountered. This is quite convenient since I don't need to keep coming up with unique label names for simple loop points.

Thanks.

--
- Mark ->
--
Reply to
Mark A. Odell
Loading thread data ...

The LOCAL pseudo-op does this for macros for the PIC MPASM. The MPASM manual can be downloaded from

formatting link
picmicro/code/mpasm/33014g.pdf

Thad

Reply to
Thad Smith

Thad Smith wrote in news: snipped-for-privacy@acm.org:

I saw that, but I'm writing functions (non-repeated code), not macros.

I've read that already. I guess the answer is "no".

Thanks,

--
- Mark ->
--
Reply to
Mark A. Odell

Simply write your functions as macro and invoke them only once.

myfunc_m macro local bla,blub

bla: blub: endm

my_func: myfunc_m rts

--
42Bastian
Do not email to bastian42@yahoo.com, it's a spam-only account :-)
 Click to see the full signature
Reply to
42Bastian Schick

I think this link should help you:

formatting link

While these are no "local" labels, they are compound delimiters with anonymous label names behind them. You can write

_begin_ btfsc __C goto _end _begin_ ;some simple loop here btfsc __C goto _begin _end_ movlw 0ffh addf some_mem goto _else nop goto _end _else_ _begin_ ; etc _else_ ; etc _end_ _end_

You can also nest them (I think) 4 levels deep. I found the quick-typing-without-figuring-out-another-pesky-label-name actually made my coding less buggy and more productive. The source was more readable also, although someone may think that the absence of the information that was once in the label names would make it harder to understand. It was quite the contrary because without the pressure to find an original and talking name you had time to write a senseful comment above the loops. BTW, in this posting you will find a semi-intelligent "switch-case" construct also.

HTH Mark

-- Mark Piffer MCU and DSP programming & software design

Reply to
Mark Piffer

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.