Is it possible to add the asm() as an alternate to _asm _endasm?
The reason why I am asking is that _asm and _endasm seems to be doing a lot of unnecessary processing that so far causes bugs in my embedded assembly code. I would like to see one that treats the embedded as a string and simply paste it into the assembly file without any processing. Since it doesn't make sense to alter the behavior of existing feature, this would be an alternative.
Bugs I have caught so far for Z80 version:
- assembly comments contains ! causes internal error (resolved)
- ex af,af' - that extra ' is part of a valid operand, but causes an error because the compiler thinks it is an unclosed ' ' quote. I had to use a .db with the right values to trick the compiler into putting the right code.
- multi-line #define macro issues all lumped into the same line. If you are not careful, this can cause serious issues. A simple ; comment can turn every assembly code after it into comments.
The following is taken from ez80 port from freertos project. This makes the assembly listing easier to read instead of a clump of text all squeezed into a single line. Also funny stuff like the ex af,af' won't cause grief and eliminates any potential compiler induced bug cause by its own processing.
#define portSAVE_CONTEXT() \ asm ( "xref _pxCurrentTCB \n\t" \ "di \n\t" \ "push af \n\t" \ "in0 a, (62h) \n\t" \ "push bc \n\t" \ "push de \n\t" \ "push hl \n\t" \ "push iy \n\t" \ "ex af, af' \n\t" \ "exx \n\t" \ "push af \n\t" \ "push bc \n\t" \ "push de \n\t" \ "push hl \n\t" \ "ld ix, 0 \n\t" \ "add ix, sp \n\t" \ "ld hl, (_pxCurrentTCB) \n\t" \ "ld (hl), ix \n\t" \ );