Hello Markus, If your MCU has an MPAGE then just declare it as _XPAGE in any of your source files and you should be fine. You should check your datasheet if it exists and lives at address 0x92. __sfr __at(0x92) _XPAGE;
If there is no MPAGE/XPAGE/EMI0CN equivalent then MOVX @Ri cannot access anything but the first 256 bytes. In these cases there usually is a second DPTR which can be used. Copy crtxinit.asm to your project directory, modify it to set DUAL_DPTR and assemble it with sdas. The resulting crtxinit.rel should be linked just like your other sources. sdas -plosgffw crtxinit.asm sdcc main.c crtxinit.rel Maarten > Hi everybody. > > I am currently working on an project where I want to store a sine wave > lookup table > within the 2048 bytes of ERAM of the AT89C51AC3. Thus before my code > enters the main() > it initializes this array like that: > > __xdata unsigned char > dac_values[128]={128,134,140,146,152,158,165,170,176,182,188,193,198,203,208,213,218,222,226,230,234, > 237,240,243,245,248,250,251,253,254,254,255,255,255,254,254,253,251,250,248,245,243, > 240,237,234,230,226,222,218,213,208,203,198,193,188,182,176,170,165,158,152,146,140, > 134,128,121,115,109,103,97,90,85,79,73,67,62,57,52,47,42,37,33,29,25,21,18,15,12,10, > 7,5,4,2,1,1,0,0,0,1,1,2,4,5,7,10,12,15,18,21,25,29,33,37,42,47,52,57,62,67,73,79,85, > 90,97,103,109,115,121}; > > Curiously the data in that array gets corrupted. For testing purposes I > let the µC send the contents of the array via UART > to my computer. What I get looks like this: > > 128 134 140 146 152 158 165 170 176 182 188 193 198 203 208 213 218 222 > 226 230 234 237 240 243 245 248 250 251 253 254 254 > 255 255 255 254 254 253 251 250 248 245 243 240 237 234 230 226 222 218 > 213 208 203 198 193 188 182 176 170 165 158 152 146 > 140 134 128 121 115 109 103 97 90 85 79 73 67 62 57 52 47 42 37 33 29 25 > 21 18 15 12 10 7 5 0 0 4 96 8 0 16 16 8 0 16 0 1 2 > 0 2 0 0 0 0 0 0 66 0 0 17 0 0 0 32 0 80 4 2 132 20 0 > > As you can see the last few elements starting at 12, 10, 7, 5, ..... are > corrupted. > > Now...I read something in the sdcc manual about startup code and MPAGE > SFR at 0x92 or in case of an µC with dual data pointers > (as the AT89C51AC3) reassembling the crtxinit.asm with DUAL_DPTR = 1. > > Do you guys think my problem cam be solved by one of the last mentioned > things? > If so...I would be very thankful if you could give me some advice in > solving my problem. Like how to reassemble crtxinit.asm. > Sure...giving it to an assembler....but where to put the resulting > output file? > > Hope you can help me on this problems. > > Markus ------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user