On Tue, Feb 17, 2009 at 12:21:42PM -0800, Lawrence Leung wrote: > I have been ghosting this list for a little while and I've noticed that > there have been conflicting reports on whether or not the atmos.lib file is > needed to compile certain .nes files. I know for that the simple "hello > world" needs the atmos.lib file to be compiled correctly but the sample > "controllertest" from the cc65 website does not. Could somebody clear up the > function of this library? atmos.lib is a library for the Oric Atmos (see http://en.wikipedia.org/wiki/Oric_Atmos ). It has *nothing* to do with the NES despite the fact that it also uses the 6502 CPU and has some support by cc65. It is not only unnecessary to link against this library when writing programs for the NES, it is even an error that can cause all sorts of problems. I can only image that someone got linker errors for functions not available for the NES, linked against a randomly choosen library that did also come with cc65 and noticed that the linker errors vanished. If you get errors compiling a "hello world" program, this is probably caused by missing file I/O support in the NES library. The NES does not have files or disks, so the I/O functions on which printf is based are missing. This could be resolved by writing "hacked" functions that at least support stdin/stdout and stderr - or simpler by ressorting to cprintf instead of printf. This program: ----------------------------------------------------------------------------- #include <conio.h> #include <stdlib.h> int main (void) { cprintf ("Hello, world\n"); return EXIT_SUCCESS; } ----------------------------------------------------------------------------- compiles without problems for the NES (*without* linking against foreign libraries). This program: ----------------------------------------------------------------------------- #include <stdio.h> #include <stdlib.h> int main (void) { printf ("Hello, world\n"); return EXIT_SUCCESS; } ----------------------------------------------------------------------------- gives: ----------------------------------------------------------------------------- Unresolved external `_write' referenced in: fwrite.s(10) ld65: Error: 1 unresolved external(s) found - cannot create output file ----------------------------------------------------------------------------- Linking against any of the other libraries that come with cc65 will make it compile (because most systems implement write()), but it won't work, because the write() routine supplied by the other library is not written for the NES and will therefore not work (or may even crash the system). Regards Uz -- Ullrich von Bassewitz uz@musoftware.de ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo@musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.Received on Tue Feb 17 23:09:49 2009
This archive was generated by hypermail 2.1.8 : 2009-02-17 23:09:52 CET