I am calling an assembly function from C. The prototype explicitly declares a xdata pointer parameter, foo(unsigned char xdata *buffer). Likewise the definition explicitly declares xdata pointer parameter. However, when it is compiled, the pointer is passed as a generic pointer. This is a problem because memory-specific pointer is passed in registers R6/R7 while generic is passed in R1/R2/R3.
Has anybody heard of this happening before.
My C Compiler is C51.exe V8.12
Oh, it is really odd. With your declaration it should arrange R6/R7 for memory-specific pointer. Sorry for me recklessness. I've test with a small program and it does occupy R6/R7 for this xdata pointer. In C program (main.c):
... extern void testasm(unsigned char xdata* pEBI); ... testasm((unsigned char xdata*)0x4321); ...
The assembler code (testasm.a51):
?PR?TESTASM?MAIN SEGMENT CODE PUBLIC _testasm RSEG ?PR?TESTASM?MAIN _TESTASM: MOV A, R6 MOV B, R7 MUL AB RET END