This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Looking for efficiency

I am using small memory model and I need to write data to an absolute memory location (0xC002), so I'm using the MVAR macro:
#define DISPLAY_DATA MVAR(unsigned char, 0xC002)

void main(void)
{
DISPLAY_DATA = '*';
}

And I'm getting:

MOVB RL4, #0x2A
EXTP #3, #1
MOVB DPP0:2, RL4

The thing is, one of the DPP registers already contains '3' since the near memory is located in 0xD000-0xE7FF, so the EXTP instruction is unnecessary.
Doesn't the linker/locator perform this sort of optimization to eliminate inefficiencies like this one? Is there a way to make use of 'near' addressing mechanism for accessing absolute memory locations without having to know which DPP contains which value?

0