Re: Sv: [cc65] Back on Track

Date view Thread view Subject view

From: Spiro Trikaliotis (Spiro.Trikaliotis_at_gmx.de)
Date: 2000-01-21 23:43:20


Hi Groepaz,

>yes... actually my 'kernal-disc' driver will read through the sector chain
>when you open() a file and buffer the link-list somewhere. this way real
>'random' access a'la relative files (even performing better IMHO) is quite
>easy to implement. Ofcoz seeks will still be slow...(well, if the r/w head
>must NOT move tracks, it should be fairly acceptable) but compared to the
>brute force method above it'll be lightening fast =P

Why will seeks remain slow? Every seek will require at most reading one
sector from disc.

Even the already mentioned "while(1) fseek(-1)" - example could be made
fast if you would always buffer a whole (physical) sector on the host,
so you would not need to read the sector from disc with every seek.

Another fine way would be to 'detach' the seeking and the reading:
The seek could issue the command to the floppy to find the sector
and return immediately; then, you only would have to wait for the
seek being performed when you read some bytes (which could possibly be
some time afterwards). This would also have the advantage that seeks
w/o reading anything (like the loop above) would be really fast, because
we would never have to wait for the floppy.



Another think to think about is to read the links only when they 
are needed or when they are provided anyway. I believe it's too
much overhead at opening to get the link list for a file occupiing
the whole disc, when there will never be any seek on it.


>... subsequent calls to open() will return handles 3,4,5,... for easier
>internal handling (this should be perfectly standard compliant, is it?!)

Yes, it is.


>... at run time, the user could redefine stdin/sdtout/stderr by the following
>procedure:
>
> close(FILENO_STDIN);
> close(FILENO_STDOUT);
> close(FILENO_STDERR);

> // the ORDER of these is important!!!
>        fd=open("a:/myinfile");          // returns fd=0
>        fd=open("b:/myoutfile");         // returns fd=1
>        fd=open("c:/myerrfile");         // returns fd=2

Well, now I'm not sure, but I believe you should only close() _one_
pre-defined file handle at a time and re-open it immediately.


The rest seems good to me.

>> Andre Fachat has a very good description on his home page. Unfortunately,
>> his homepage location changed lately and I don't have the new URL handy.

>mmmh, too bad =(

http://www.6502.org/users/andre does not work anymore?


Good luck,
   Spiro.

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2001-12-14 22:05:35 CET