Re: [cc65] File I/O on C64

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2002-11-13 22:56:19


On Wed, Nov 13, 2002 at 02:42:42PM -0600, Brian Bagnall wrote:
> I'm pretty new to C but since Marc already supplied the necessary functions
> in cbm.h then it should be as easy as making a wrapper only. I kind of
> wonder if there are technical reasons why Marc didn't implement stdio
> himself.

While I wouldn't say it is really complex, it is definitely more work than
just adding a wrapper. Possible problems are:

  * You cannot use the handles of the CBM kernal, so you have to use an
    additional translation between kernal handles and C handles.

  * The behaviour specified by the C standard and the implementation of file
    I/O in the commodore drives are sometimes highly incompatible. For
    example, it is impossible to open a file for reading and writing.

  * You need to talk to the device over the command channel to find out about
    disk errors.

> I looked at fctrl.h and it looks like only about 6 functions need to be
> defined. Two of them can't be defined (mkdir, rmdir), since the 1541 has no
> ability to make directories. How should it deal with this problem?

The easiest way would be not to implement these functions. Programs using them
would not link successfully (which is better to have an executable that is not
working correctly).

> Also, there were 1571 drives, and even hard drives released for the c64. Is
> there a strategy to program this so it would not close the door on people
> using other types of drives?

When using standard kernal calls, supporting the 1571 or even CMD hardware
should not be a problem.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz_at_musoftware.de
----------------------------------------------------------------------
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-11-13 22:56:24 CET