We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I'm pretty sure I know the answer to my question, but I like verification.
Say I have an array in xdata:
unsigned char xdata foo[32];
I have a function which accepts a pointer and does stuff with it:
void doSomething(unsigned char *ptr, ...) {}
Now, if I pass a pointer to foo to my function:
doSomething(foo, ...);
will accesses to/from ptr in the function use MOVX or will the whole thing blow up?
Or do I need to be explicit about how I write the doSomething function header:
void doSomething(unsigned char xdata *ptr, ...)
I suppose I could make foo[] a global, but I'm trying to keep this generic.
-a
The rules of how the compiler copes with conversions between generic and memory-specific pointers are described in the Manual
Either format will work. Pass an xdata pointer to a generic pointer, and the compiler adds the tag byte. Pass a generic to an xdata, and the tag byte gets removed. There are differences between register usage and efficiency which are explained in the manual.