I am writing code that requires a fair amount of pointer arithmetic and manipulation. The C51 compiler appears to generate lots of generic pointers (much too my dismay). Is there any way to use the built in dual DPTR's to reduce the massive overhead associated with generic pointers significantly? The C51 derivative I'm using (MCS12XX) does have dual data pointers as far as I can tell.
I've attempted judicious use of the
#pragma modp2
directive with no visible change in the code output from the compiler. Specifically I am generating graphic information that is sent to a memory mapped graphic LCD. It works just fine that's not the problem. The problem is code space and the overhead that the generic pointers have are going to make things difficult to complete as wished. So is there a way to get around this?
Stephen
I, usually, do not take the time to do so, but I got curious to see how valid a 'rule' I put on myself years ago (NEVER a generic pointer) actually was.
I found it even more valid than I remembered.
Erik
PS the above refer to Keil C51 nothing else, it may and may not be valid for others.
I should have mentioned that LCALL ?C?CLDPTR is the real 'overhead generator' in the example I gave.
First thanks for explaining what was going on with the generic pointers. I guess I didn't tweak on the compiler enough to find out the internal pointer abuse going on. I plan to abuse xdata pointers more.
Indeed Erik that is what I discovered (amongst other surprises). So if I use an explicit pointer in this case it will reduce overhead. The generic pointers have been a killer (sigh) so I plan on doing something like
#define LPTR xdata
and putting that in front of anything that's suffering from generic data pointers horribly. That way if the code goes to a different processor I just redefine that to an empty define and it becomes normal.