From: Wolfgang R. <wol...@ra...> - 2001-04-19 18:12:27
|
"Gernot.Fink" schrieb: > > Hallo > > I found a problem using prototypes for functions > > The following code generates a movx-instruchtion where a mov shold be: > My Compiler is SDCC : mcs51/gbz80/z80/avr/ds390 2.2.1 ` (UNIX) > Tha commandline is sdcc t.c > > Thanks > Gernot > > ----------------- > 433 ; ----------------------------------------- > 434 ; function lcd_init > 435 ; ---------------------------------------- > 0040 436 _lcd_init: > 437 ; t.c 26 > 0040 C2 00 438 clr _lcddata > 439 ; t.c 27 > 0042 90 00 30 440 mov dptr,#_lcd_putm_PARM_2 > 0045 74 07 441 mov a,#0x07 > 0047 F0 442 movx @dptr,a > ---- This only happens whenn I use a > prototype > > 443 ; Peephole 182 used 16 bit load of dptr > 444 ; Peephole 210 simplified expression > 0048 90 00 7D 445 mov dptr,#_lcdinitstring > 004B 12 00 51 446 lcall _lcd_putm > 447 ; t.c 28 > 004E D2 00 448 setb _lcddata > 0050 449 00101$: > 0050 450 C$t.c$29$1$1 ==. > 0050 451 XG$lcd_init$0$0 ==. > 0050 22 452 ret > @ > ---------------- > > ----------------------- > #include <at89S8252.h> > > void lcd_init(void); > void lcd_putm(unsigned char code *c,data unsigned char l); > > main() > { > lcd_init(); > } > > bit lcddata; > > void lcd_out(unsigned char c) > { > P0=c; /dummy > } > > code unsigned char lcdinitstring[]={0x28,0x28,0x28,12,6,1}; > > void lcd_init(void) > { > lcddata=0; > lcd_putm(lcdinitstring,6); > lcddata=1; > } > > void lcd_putm(code unsigned char *c,unsigned char l) > { > while (l--) > { > lcd_out(*(c++)); > } > } This problem is known. Please try traditional C prototype void lcd_putm(unsigned char code *,data unsigned char) Bye Wolfgang |