Hi Rodrigo,
> void main(void)
> {
> unsigned char c = 0x34;
> unsigned char *p;
>
> p = &c;
> *p = 0x12;
}
> Any help appreciated.
The above code snippet compiles fine with SDCC 2.6.4, r4570.
_main_c_1_1 (alias c) ends up at 0x80, p=&c makes p=(0x80, 0x00, 0x80),
the first 0x80 (MSB) being the pointer type (0x80 --> __data), and
0x0080 being the address of c in data memory.
*p=0x12 assigns 0x12 to memory location 0x80 (alias c), which seems to
be perfectly fine. Tested with gpsim. Even reading back *p (glo = *p;
with a global `char glo;' declared before main()) works nicely.
Could you give more information? How did you `test *p' after the last
line of code? What did you perceive?
--
Regards,
Raphael Neider
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user