SDCC 4.2.0 #13081 (MINGW64)
sdcc -mpdk14 test.c
__sfr __at(0x10) _pa;
#define PA _pa
volatile char foo;
void main() {
for(;;) {
__asm;
sr _foo
swapc.io __pa, #0
__endasm;
if (PA&1) foo ^= 0x8e; //lfsr
}
}
got "test.asm:111: Error: machine specific addressing or addressing mode error"
can someone reproduce/confirm the bug ?
I can reproduce the issue using sdcc from current svn on my amd64 Debian GNU/Linux testing system. I suspect this could be fixed in the assembler relatively easily, by what is different for swapc vs. other instructions that have an .io variant. But I don't know, and I'm not that familiar with the assemblers. Patches are welcome.
looks like the assembler emit function for swapc was called with plain op (without the extra options) and therefore the mandatory falg "PDK_OPCODE_ADR_IO" was not present.
patch for pdk14 and pdk15 (pdk13 does not have swapc and pdk16 implementation is missing it):
Thanks. the patch looks good to me (though I am not an assembler expert), and regression tests pass (but they don't use swapc anyway).
I've applied the patch in [r13768].
It would be good if someone finishes the pdk16 assembler and linker. Nikolas, who did most of the work on pdk assemblers and linkers AFAIK isn't around anymore.
Related
Commit: [r13768]
Please check if the fix in [r13768] works for you.
Related
Commit: [r13768]
thanks, it works