[cc65] Atari file i/o functions

Date view Thread view Subject view

From: Shawn Jefferson (sjefferson_at_sd62.bc.ca)
Date: 2002-04-23 22:08:28


I was doing some programming on the Atari with the C file i/o functions and I noticed that fseek and ftell, and fopen with append are not implemented.

I took a look at the source for the atari library and I figured that fseek and ftell could be implemented for SpartaDOS fairly easily, since SpartaDOS implements a sane NOTE and POINT functions in the FMS.  POINT is XIO#37 and NOTE is XIO #38.  AtariDOS is another story since it doesn't use an offset from the beginning of the file like SpartaDOS... it uses sector and byte!  Ugh!

Unfortunately, my grasp of assembler is weak.  I've attempted to code the ftell function (only implementing seeking from the beginning of the file at the moment) but haven't tested it as I don't even know if I can build the Atari lib myself or not.

Also... looking at the way the functions are layed out.. fseek calls lseek in the atari library... and ftell calls lseek as well.  That doesn't seem like the best way to do it, since you will want to call lseek with different offsets depending on what whence is (SEEK_SET, SEEK_CUR, SEEK_END) and ftell would/should just call the CIO with command 38 to get the current file position.

How tied is the system to calling lseek in this manner for these functions?  I imagine other platforms are implementing their own versions of lseek and changing this might break them.



----------------------------------------------------------------------
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 : 2002-04-23 22:09:57 CEST