Hello Arne,

Of course ".-2" is more cumbersome than a local label like 2$. But as you
realized a local label is not always possible in a macro.

What you're asking for is a way to say that some local labels are more
local than others ;)

Maybe you can do something with a parameter to the macro.

You could also check if the upstream asxxxx has more options or request
them there. Our focus is mainly on the compiler, not the assembler.

Maarten

>  Hi Maarten!
>
> ".-2" is a good idea...I tried "-5" (without the dot), which resulted in
> a weird linker error...
> but ".-2" compiles and links fine and produces good code...
>
> "2$" cannot work, if u have to wait twice within a macro, that uses this
> USBp macro (e. g. when u want to poll before a read).
>
> a label that is only valid within the macro would be nice to have, because
> counting the bytes of instructions is error prone... :)
> Thx.
> Bye
> Arne
>
> Am Samstag, 17. März 2018, 12:54:48 UTC hat Maarten Brock
> <sourceforge.br...@dse.nl> Folgendes geschrieben:
>
>  Hello Arne,
>
> I believe you can use a relative offset like this:
>     mov A,(USB0ADR)
>     jb (ACC+USBBUSY), .-2  ; . = address of this instruction
>
> Or you can use reusable symbols below 100 (SDCC uses above 100)
> 2$: mov A,(USB0ADR)
>     jb (ACC+USBBUSY), 2$  ; . = address of this instruction
>
> Have look in the amslnk.txt documentation 1.3.3 and 1.3.4.
>
> Maarten
>
>> Hi!
>> How can I jump within a macro in sdas8051?
>>
>> I do it like this now:
>> .macro USBp
>>  mov A, (USB0ADR)
>>  .byte 0x20 , 0xE7 , 0xFB ; jb (ACC+USBBUSY), {to start of macro}
>> .endm
>>
>> but it feels like there should be a different notation... :)
>>
>> Thx.
>>
>> Bye
>> Arne
>
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Sdcc-user mailing list
> Sdcc-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sdcc-user
>   
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org!
> http://sdm.link/slashdot_______________________________________________
> Sdcc-user mailing list
> Sdcc-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sdcc-user
>



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to