Philipp Klaus Krause schreef op 2022-07-14 21:34:
Am 14.07.22 um 14:46 schrieb Maarten Brock:
Hi Philipp,

Philipp Klaus Krause schreef op 2022-07-14 12:58:
SDCC currently supports two forms of inline assembler:

1:
__asm
asm code here
__endasm;

and

2:
__asm("asm code here");

Does (or will) this second form also support multiple asm instructions? AFAIK it doesn't.

void f(void)
{
        __asm__("nop\nnop");
}

and

void f(void)
{
        __asm__("nop\n"
                "nop");
}

both work.

Personally I do not like having to add \n to every line.


Since people like form 1, I'd now think we should keep it, but drop
#pragma sdcc_hash. That looks like a better way forward and also
solves the issues.

When this pragma is dropped does that mean it is no longer possible to use the # for an immediate operand? Or will it be limited to use outside of a macro? I wouldn't even know how to escape the #.

Benedikt Freisen schreef op 2022-07-14 18:46:
Another option would be to rely on a mechanism similar to C++11-style
raw string literals (i.e. R""), because they may contain newlines.

This could be a very nice solution to this problem, I guess. With that I think it would be possible to do almost everything we can currently do in __asm __endasm with __asm__(""), though I suspect that using macros will still be cumbersome.

Maarten


_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to