Re: [cc65] Uniform mass storage device discovery and file locations

From: Oliver Schmidt <ol.sc1web.de>
Date: 2012-08-16 12:47:14
Hi,

I'll try to align your code snippet with my ideas in order to see if
this works out for you...

> if (getActiveDrives() & DRIVE_EEPROM) {

Here you presume that all drives can be represented as bits in a
bitmask. Looking at the CBMs, the Atari and the Apple this doesn't
seem to be the case. So this would rather be a list of bytes than a
bitmask.

The list of bytes I have in mind lists the devices present. However at
least the Apple needs get from the device number to the volume name
for further access. My suggestion is something like

  char *rootdir(unsigned char device);

On targets using device numbers for file access the implementation of
rootdir() might just add '0' to the parameter converting i.e. 8 to "8"
- and check at this point if a disk/tape/... is actually present in
the device if necessary.

As the string in question is something the user might see - or even be
asked to enter as location for a file you might consider calling this
root directory "EEPROM".

>    // EEPROM exists
>    char currentDrive = getCurrentDrive();

This would rather be a getcwd().

>    setCurrentDrive(EEPROM);

This would be a chdir().

>    fd = open("0", O_RDWR);
>    read(fd, &highscoreTable, sizeof(highscoreTable));
>    // close(fd);
>    setCurrentDrive(currentDrive);

This would again be a chdir().

> }

Regards,
Oliver
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Thu Aug 16 12:47:54 2012

This archive was generated by hypermail 2.1.8 : 2012-08-16 12:47:57 CEST