Forums

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

Started by Keith May 24, 2007
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!!!!

On May 24, 4:35 pm, Keith <keithd...@yahoo.com> wrote:
> 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.
I'm reasonably sure that the 8051 has only one DPTR and no such thing as a DPS. Could it be that you IAR compiler is generating code for a new-fangled Dallas/Philips/Cygnal/etc. 8051 version? Viktor
On May 24, 12:00 pm, Viktor <vkes...@gmail.com> wrote:
> On May 24, 4:35 pm, Keith <keithd...@yahoo.com> wrote: > > > > > 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. > > I'm reasonably sure that the 8051 has only one DPTR and no such thing > as a DPS. > Could it be that you IAR compiler is generating code for a new-fangled > Dallas/Philips/Cygnal/etc. 8051 version? > > Viktor
Sorry I should have provided a little more detail. We are using an 8051 derivative that has two data pointers. The IAR compiler can be configured to use multiple data pointers. Thanks!!!!