If I'm using the compact memory model, which implicitly sticks variables in xdata, but also declare a variable (in this case a char[]) to go in xdata, it appears to use the wrong pointer type. Thus, I get the lower 8 bits if the address, NOT the data. Not explicitly declaring the variable as xdata yields the correct result. Is it me or the compiler?
Sorry, my bad. Thanks Andrew. Looks like my problem lies in using xdata then. Not sure how I'm supposed to set that up. I'm using an Atmel T89C51CC01, so I have 32k to play with, if I know how. Anybody got any hints? Thanks for your time.
Do Not use Compact Model. Always try to use Small and then explicitly place structs/arrays and seldom used vars in xdata. pdata saves little code by using the movx A,@Rn but depends on P2 address lines ALWAYS being the correct value. Keil sets P2 to the PDATA area assigned in startup but never updates later. If you mess with P2 you can screw up pdata area big time.
Taken on board, will try that out tomorrow, as it's just gone 3am here... Thanks...