Re: [cc65-devel] Binary loads of overlays on various targets
cc65 - a freeware C compiler for 6502 based systems
Brought to you by:
gpz
|
From: Oliver S. <ol...@we...> - 2013-05-26 12:19:29
|
Hi, > I'm writing a large project that uses overlays and also targets multiple > platforms (C64, C128, A2, Atari). Cool, I like cross-target stuff :-) > I already know that the best way to load > the overlays on the two Commodores is through the CBM_LOAD command which > will allow fast-loaders to load the files. What is the best way to > accomplish this on the Apple and Atari platforms? Maybe someone else comments on the Atari but for the Apple I can say that it doesn't get any better (which is pretty fast/good) than done in the in my overlay demo at https://github.com/oliverschmidt/cc65/blob/master/samples/overlaydemo.c > I know I could fread the > data to memory, but I'm not sure if that's the right thing to do. In general you should start to consider when to use fopen() and friends vs. open() and friends. The former have primarily three features: - text line oriented i/o - buffering - one byte push back I'm pretty sure that you don't need any of those features here so open() and friends are the right choice. They make your program smaller and (somewhat) faster. > As an aside, I have a question concerning overlay files on the Apple and > Atari platforms. Do I need to include a load address at the beginning of > the files? I'm assuming I do, but don't want to go off the reservation to > exclude them unless necessary. Your question shows a quite CBM-biased point of view. If you want to do something cross-target I suggest to start out with cross-target code like my overlay demo mentioned above and then put in target-specific optimizations where you consider them necessary. BTW: You might want to check out my multi demo at https://github.com/oliverschmidt/cc65/blob/master/samples/multidemo.c which loads overlays into RAM extensions (where present) in an target-independent way which means that (of course only with RAM extensions present) disk performance is way less of an issue. Regards, Oliver |