Path: utzoo!utgpu!water!watmath!watcgl!bphollander From: bphollander@watcgl.waterloo.edu (Brian Hollander) Newsgroups: comp.sys.cbm Subject: Re: C Language for Commodore 64/128 Keywords: Looking for C compiler Message-ID: <6135@watcgl.waterloo.edu> Date: 4 Oct 88 02:20:07 GMT References: <1520@nunki.usc.edu> <1825@uokmax.UUCP> Reply-To: bphollander@watcgl.waterloo.edu (Brian Hollander) Organization: U. of Waterloo, Ontario Lines: 84 About the two C compilers, Super C and Power C, I would like to ask about size of object files and execution speed. It is my understanding that Super C is an interpeted C which includes all the libraries every time you link. This would produce compact code plus a constant amount from the libraries. Power C produces machine code (much larger) but links only parts of the libraries that are used. The difference in speed should make Power C much faster than Super C. Since I'm a user of Power C only, could someone post some specific info on the differences in code generation and runtime execution of the two compilers. As for the long awaited bug list this is my contribution to the list. Power C places the first 32 bytes of local variables in zero page memory. When a new function is invoked it clears out however many bytes of zero page it needs by pushing the old stuff to the C stack, not the CPU stack. If you pass the address of a zero page stored variable to one of YOUR functions (library routines do not clear out that part of zero page) and that function uses enough zero page variables to push the old one to the stack, then the address is no longer valid. It still points to the zero page address where it used to be. This example should demonstrate the problem. main() { int value; value = 5; foo(&value); printf("value = %d\n",value); } foo(value) int *value; { int var1,var2,var3; /* a bunch of locals only one is needed here */ *value = 20; } When this is run value should be 20 but it will be 5. I have not tested this specific example but others that are similar. This means that this example will work fine on someone else's computer because: 1 - They are using a version where this bug has been fixed. 2 - My C64 was having a bad day (occurs very often) 3 - I'm seeing things. My system is: A C64 (OLD one), 1541 Tape (I mean disk) drive (older than the C64), 1764 RAM expansion, 1541 Express (holding the disk together) and the 1581 DISK DRIVE. I'm using Spinnaker's version of Power C (C Power) with a self modified shell to use the RAM expansion as a third drive. It is possible that this bug does not appear on the 128. I have also noted that there are two useful function not documented: kernel(0 or 1) - banks kernel out or in. (useful to have in). device(device number) - sets default device for fopen, ferror... good to know if you have more than 1 drive. If anyone else comes across useful information (undocumented functions, hard to find bugs) PLEASE post it to the net. It may save me some long sleepless nights! Brian. -- uucp : ...!watmath!watcgl!bphollander internet: bphollander@watcgl.waterloo.edu