On Sun, May 02, 2010 at 10:22:12AM +0200, Maarten Brock wrote:
> Peter,
>
> > Can someone suggest how to avoid the allocation in DSEG (which is
> > overfull) in the following code snippet?
> >
> > ...
> > void lcd_puts (char xdata *str)
> > {
> > uint8 xdata i;
> >
> > for (i=0; str[i] != '\0'; i++) {
> > lcd_datas (str[i]);
> > }
> > }
>
> To put the pointer in xdata you must add the memory type
> behind the * as explained in the manual. Furthermore you
> can get rid of i and expensive indexing if use the
> pointer itself.
>
> void lcd_puts (char xdata * xdata str)
> {
> while (*str != '\0') {
> lcd_datas (*str++);
> }
> }
>
> Maarten
>
Thanks, I thought I had to be missing something. I stopped reading
the manual when it got past near and far defines in variables and on to bit
and sfr functions with pointers being just after that of course :-) .
As to the code I'm porting some from Keil and some of it is as you
note poor quality :-). Once (or in some cases as) I get it to compile I'll
try cleaning it up a bit.
Peter Van Epp
------------------------------------------------------------------------------
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user