From: groepaz (groepaz_at_gmx.net)
Date: 2002-07-13 19:53:18
Hello Ullrich, UvB> There are many command line tools out there that process the command line from UvB> left to right. [snip] UvB> I hope this explains why things are as they are :-) oh yeah, well... i understood that before i think :=P i still it'd be better to make this act somewhat "smarter".... i understand that it makes sence for certain switches to be used more than once on the command line (and thus affecting a number of files only, depending on their order) but IMHO for some others its pretty uncommon atleast. for eg one could assume only few ppl use cl65 for compiling to multiple output files, or multiple targets....well i dont know :o) atleast for cc65 and ca65 (when called manually) it would be nice if they would work that way... however, no matter what, it would be smart to be able to be warned about this possible problem ;) >> ok, for the -Oi bug its your turn now i guess :o) UvB> The base routine for printf() contains a UvB> jmp (ind) UvB> command. The linker should warn if the argument address crosses a page UvB> boundary, but it does not. Your code seems to trigger that bug. Please try to UvB> reorder the array program (move the f() and g() functions before main() in the UvB> source) and recompile it with the command line switches that were not working. UvB> If the program works now, it is the bug described above. I have already fixed UvB> the problem in the development version (using jmp (ind) is never a good idea, UvB> even with a linker extension, because there are output formats - o65 for UvB> example - where the final address is not known). mh wouldnt that be fixed as easy as .align 2 ind: .word $beaf ? :o) however, i have rebuilt the compiler and the libs from yesterdays snapshot.... looks like that cured some more problems :o) anyway, theres one thing that really bothered me last nite (until i have found a workaround ;=D), which is appearently broken variable argument lists in C-funktions...... to be more precise, referring to the parameters before the variable list by name does not work as expected. (i am compiling with no optimizations at again by now... until i have eliminated all compiler-caused problems that is ;=P) this code wont work: void chk0(char *format,...){ va_list ap; static char string[0x100]; va_start(ap,format); vsprintf(string,format,ap); printf("format:%s,string:%s\n",_format,string); va_end(ap); } and this is my current workaround: void chk0(char *format,...){ __asm__ ("pha"); // save argument size { //va_list ap; char *ap; char *_format; static char string[0x100]; // va_start(ap,format); __asm__ ("pla"); // restore argument size __asm__ ("ldx #$00"); // clear hibyte of AX ap=__AX__; ap+=(char*)&format; // adress of format incorrectly // equals the adress of the last // parameter in the variable list // get value of format ap-=2; _format=*((char**)ap); // vsprintf(string,format,ap); vsprintf(&string[0],_format,ap); printf("format:%s,string:%s\n",_format,string); // va_end(ap); } } tjam... soo :o) i got most of the .c code i made for/with 2.7.1 working again now, i am gonna take a closer look at the filestuff atm and also rechecking (and possibly removing) some workarounds that were previously needed. after all that is done i am going to create a little textfile that documents some of that stuff and which references to the programs that can be used to trigger the specific bug (or, which need workarounds).... and finally upload a new snapshot then :o) after that, i'd like to check out that loadable modules stuff, and your gfx interface. (btw does there exist a little testprogram or sth that shows how to use these loadable modules?) ... maybe i can contribute most of the gfx-related stuff i have done so far. -- Best regards, groepaz mailto:groepaz_at_gmx.net ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo_at_musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.
This archive was generated by hypermail 2.1.3 : 2002-07-13 19:53:59 CEST