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

What's wrong with my struct *

I'm using 80c390 in 24-bit mode (a TINI board). If I define the following:

struct rtc
{
unsigned char seconds;
unsigned char minutes;
unsigned char hours;
}

struct rtc *p_time;

I have a pointer (p_time), which is located somewhere in XDATA ( > 0x100080) and it points to address I:0x00 and there messes up with register bank0.

If I declare the pointer as

struct rtc * xdata p_time;

it points to X:0x000000.

What am I doing wrong?

Val

Parents

  • Even worse: that all-zeros pointer will trash your registers.

    In hindsight, I'd wish for a different mapping for that tag byte. (Say 0-7fh is xdata, without having to subtract one to get the bank; high values can map to code and idata/data.) But changing now would introduce a fairly major incompatibility with existing code, and annoy everyone that wrote assembler routines that have an interface with a C pointer involved.

Reply

  • Even worse: that all-zeros pointer will trash your registers.

    In hindsight, I'd wish for a different mapping for that tag byte. (Say 0-7fh is xdata, without having to subtract one to get the bank; high values can map to code and idata/data.) But changing now would introduce a fairly major incompatibility with existing code, and annoy everyone that wrote assembler routines that have an interface with a C pointer involved.

Children
No data