sdcc is mangling a string constant defined in inlined asm. The culprit seems to be the colon character.
extern int puts(const char *s); int main() { puts("Contact: xyz@da"); __asm .ascii "Contact: xyz@dd" __endasm; }
sdcc -v
3.5.5 #9501 (MINGW64)
sdcc -mz80 -S --no-peep test.c
generates:
_main:: ;zz.c:6: puts("Contact: xyz@da"); ld hl,#___str_0 push hl call _puts pop af ;zz.c:9: __endasm; .ascii "Contact: xyz@dd" 00101$: ret ___str_0: .ascii "Contact: xyz@da" .db 0x00
As you can see, the inlined .ascii directive has a linefeed inserted after the colon. The puts string argument, however, is correctly declared by sdcc. It looks like the lexer is interpretting characters appearing between the asm and endasm; pair.
fixed in revision [r9512].
Last edit: Maarten Brock 2016-03-05
This fix was not yet complete.
What happens if there is a semi-colon ( ; ) inside a string? (Oh, already fixed in [r9513], nice!)
The assembler accepts strings without closing quotes (originally the only option).
And what about a character literal ( .db ':' ) ?
And (a little off-topic) why is this extensive condition in the default clause instead of in its own case ':' clause in the first place?
Further improved in [r9514]