Hello,
I want to check if there is an equivalent instruction of the MOVX at the C language.
I tried doing in-line assembly with no luck.
Any assistance is appreciated
a very good reason to be hacking with absolute addresses
One of the most common good reasons is if you have hardware memory-mapped into the external data space. So, to write to a particular address, you must write to a particular xdata address.
In this case, you could use the _at_ directive to locate a variable. Or, you could use a C pointer.
volatile U8 xdata myReg _at_ 0xF000;
#define XdataReg(addr) (*((volatile xdata U8*)(addr))) #define myReg XdataReg(0xF000)
myReg = 0; myReg |= 1;
"One of the most common good reasons is if you have hardware memory-mapped into the external data space."
Of course.
XBYTE is effectively just a "magic number" address - hence I prefer using _at_.
Using _at_ automatically informs the tools that there is something at the specified location; using "magic number" addresses - whether via XBYTE or a pointer - hides this from the tools, so they have no reason to know that the address is "reserved"!