Treatment of Data Pointer Select when interfacing C and IAR 8051 Assembly



Hello all,

I'm sorry if this topic has been covered, but I've done a lot of
searching and not found any mention of it anywhere. Feel free to
point me to existing resources if I've just missed them in my search.

I'm working with an 8051 and the IAR Embedded Workbench toolset. I
have to write some assembly routines that will be called from C.
Looking at the compiler's assembly listing output, I see that
sometimes the compiler explicitly sets the data pointer select
register (DPS) to data pointer 0 before exiting the function but other
times it does not.

I have looked through the IAR documentation and while they thoroughly
describe which registers must be preserved across function calls there
is no mention of the DPS register and how it must be treated.

Does anyone know if what state the DPS register must be left in and/or
if there are certain circumstances when it can be manipulated freely
and other times when it must be preserved? I have definitely seen
cases of the compiler counting on the called routine to set the DPS
register back to data pointer 0, but I cannot find a magic pattern as
to when this rule applies.

Thanks in advance for your help!!!!

.



Relevant Pages