Re: [cc65] C64 fast-loader suggestion?

From: Gábor Lénárt <>
Date: 2011-12-14 14:13:44

On Mon, Dec 12, 2011 at 04:29:26PM +0100, Ullrich von Bassewitz wrote:
> On Mon, Dec 12, 2011 at 02:46:43PM +0100, Oliver Schmidt wrote:
> > Obviously the next naive question is why the C library then doesn't
> > use LOAD to implement read().
> Because LOAD reads whole files and nothing else. This is the reason why it is
> a nice target for fast loaders.

I am just coding a directory reading routine. I thought it's faster and
easier to use kernal's LOAD function to load the directory to a buffer and
then parse it myself. I also thought that it's better since:

1. LOAD is faster than "iterating" with CHRIN on bytes
2. fastloaders usually accelerates LOAD not CHRIN (however I can be wrong
   here: as 'file' $ is not a real one, but created by the drive as a
   "virtual" file containing the directory as a BASIC-like program, maybe
   fastloaders can't accelerate the loading of $: am I wrong here?)

However after I've checked cc65's directory handling with opendir
(cbm_dir.c), I found that cc65 uses the CHRIN method to read the directory.

Still, using LOAD seems to be more logical for me: no need to check for
errors etc during each byte transfer, only a single point of error check is
needed (carry bit after LOAD). I guess cc65 may not use the LOAD method only
because you should have a buffer then, which can be eliminated by reading
byte by byte instead. Is my idea correct about cc65's implementation?

Sorry, it's BASIN not CHRIN, btw :)


- Gábor
To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Wed Dec 14 14:13:52 2011

This archive was generated by hypermail 2.1.8 : 2011-12-14 14:13:56 CET