Hi,
> Program displays just T[glyph/rand char][glyph/rand char][glyph/rand
> char] [glyph/rand char].
>
> Why is this happening and how can I prevent it? Thanks.
You perform pointer arithmetics on generic pointers (*(s+1)), and thus
triggered a compiler bug which assigned only the lower 2 byte (of the
3 byte generic pointer) to the (temporary) result. The subsequent
dereference of course evaluated all three bytes of the pointer -- but
as the MSB was uninitialized, we accessed random memory locations,
causing your program to display [glyph/rand char] for s+1, s+2, and s+3.
You can prevent it by (a) updating to sdcc 2.9.4, >= r5568 (either using
a snapshot or the svn head) or (b) by avoiding generic pointers,
replacing them with __data pointers:
unsigned char text[10];
void LCD_String(__data unsigned char *s)
{
LCD_Char(*s);
LCD_Char(*(s+1));
LCD_Char(*(s+2));
LCD_Char(*(s+3));
}
Thank you for reporting this bug.
Raphael
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user