I used the SM89516A, the cpu have 512 byte ram, but how can i define a variable at 0x100 to 0x2FF? I try to define a variable as idata but it will be located at 0x80 to 0xFF. then I try to define a variable as xdata, but it seem like the variable locate at the off chip ram. so, how can i do?
Most chip data sheets are poorly written on this point. But most chips operate exactly as Andy says. The chip designer often will put a single physical RAM block on the chip, say 1KB or 2KB. RAMs have overhead on the chip, and it's generally cheaper in die area to put in one larger RAM area than to split it into two little ones. But those 8192 bits are used both for (typically) 256 bytes of data/idata space for the 8051 core, and then the rest of the physical memory (768 bytes) is decoded as xdata memory from the point of view of the 8051 core. The data sheet, however, will usually list a bullet point along the lines of "2KB of internal RAM", by which they mean internal to the whole chip; that is, not outside the chip package. This is not the same thing as the internal data space of the 8051 processor core. There are some 8051 variants where they actually modify the implementation of the processor core itself to address more memory space, but these designs are more rare.