Hi all,
this seemingly simple inline instruction won't compile:
char c;char d;void foobar(void){ __asm movb c , d : 1 ; // access byte behind d}
It generates an error C12089: ',' expected before next element
Version with '+' or reversed order yield the same result. It seems that the assembler can't generate the necessary offset calculation to produce the desired access. The reason I want to have this is a C array which I want to access with indices which carry an offset:
#define OFS -4char x[8];char get(char c) // c ranges from 4 .. 11{ return x[OFS + c];}
Of course on can always do the offset calculation at runtime, at the cost of extra bytes and cycles:
#define OFS -4char x[8];char get(char c) // c ranges from 4 .. 11{ c += OFS; return x[c];}
But this negates the whole purpose of using inline assembly IMO.
Is there a solution to this?
regards,
Mark