Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

You are in a maze of UUCP connections, all alike.


devel / comp.sys.apple2.programmer / Re: cc65: file I/O on external drive?

SubjectAuthor
* cc65: file I/O on external drive?Colin Leroy-Mira
`* Re: cc65: file I/O on external drive?mmphosis
 `* Re: cc65: file I/O on external drive?Colin Leroy-Mira
  `* Re: cc65: file I/O on external drive?Colin Leroy-Mira
   `* Re: cc65: file I/O on external drive?Oliver Schmidt
    `* Re: cc65: file I/O on external drive?Colin Leroy-Mira
     `- Re: cc65: file I/O on external drive?Oliver Schmidt

1
cc65: file I/O on external drive?

<20230810153128.037b45e2@laptop-sigfox>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=328&group=comp.sys.apple2.programmer#328

  copy link   Newsgroups: comp.sys.apple2.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED.93.8.31.152!not-for-mail
From: colin@colino.net (Colin Leroy-Mira)
Newsgroups: comp.sys.apple2.programmer
Subject: cc65: file I/O on external drive?
Date: Thu, 10 Aug 2023 15:31:28 +0200
Organization: A noiseless patient Spider
Message-ID: <20230810153128.037b45e2@laptop-sigfox>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable
Injection-Info: dont-email.me; posting-host="93.8.31.152";
logging-data="394498"; mail-complaints-to="abuse@eternal-september.org"
X-Newsreader: Claws Mail 3.19.1git30 (GTK+ 2.24.33; x86_64-pc-linux-gnu)
 by: Colin Leroy-Mira - Thu, 10 Aug 2023 13:31 UTC

Hi there,

I've - finally - found an external disk drive for my Apple //c! And I'd
like to make use of it on my own cc65-based projects.

From what I see, there's no helper in place to select a device before
fopen, opendir or anything. Could someone point me in the right
direction?

Thanks!
--
Colin
https://www.colino.net/

Re: cc65: file I/O on external drive?

<mmphosis-1691679708@macgui.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=329&group=comp.sys.apple2.programmer#329

  copy link   Newsgroups: comp.sys.apple2.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mmphosis@macgui.com (mmphosis)
Newsgroups: comp.sys.apple2.programmer
Subject: Re: cc65: file I/O on external drive?
Date: Thu, 10 Aug 2023 15:01:50 -0000 (UTC)
Organization: Mac GUI
Lines: 14
Message-ID: <mmphosis-1691679708@macgui.com>
References: <20230810153128.037b45e2@laptop-sigfox>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 10 Aug 2023 15:01:50 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="77d75fb7db9af9501750f2eb0dfea9c2";
logging-data="441937"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18dxbEos0O361bjoZ/5tU7P"
User-Agent: Mac GUI Usenet
Cancel-Lock: sha1:M+Z0/PHGJ32Xq+PfHyRT+tl2ptg=
In-Reply-To: <20230810153128.037b45e2@laptop-sigfox>
 by: mmphosis - Thu, 10 Aug 2023 15:01 UTC

I thought that the slot and drive would be specified in the pathname. For
example: FILE,S6,D1 but maybe not. There is a low level DEV_NUM and I found
these device.h helper functions...

https://cc65.github.io/doc/funcref.html#ss2.20

unsigned char getfirstdevice (void);
unsigned char __fastcall__ getnextdevice (unsigned char device);
unsigned char getcurrentdevice (void);

Re: cc65: file I/O on external drive?

<20230810180315.19b34c79@laptop-sigfox>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=330&group=comp.sys.apple2.programmer#330

  copy link   Newsgroups: comp.sys.apple2.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED.93.8.31.152!not-for-mail
From: colin@colino.net (Colin Leroy-Mira)
Newsgroups: comp.sys.apple2.programmer
Subject: Re: cc65: file I/O on external drive?
Date: Thu, 10 Aug 2023 18:03:15 +0200
Organization: A noiseless patient Spider
Message-ID: <20230810180315.19b34c79@laptop-sigfox>
References: <20230810153128.037b45e2@laptop-sigfox>
<mmphosis-1691679708@macgui.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="93.8.31.152";
logging-data="394498"; mail-complaints-to="abuse@eternal-september.org"
X-Newsreader: Claws Mail 3.19.1git30 (GTK+ 2.24.33; x86_64-pc-linux-gnu)
 by: Colin Leroy-Mira - Thu, 10 Aug 2023 16:03 UTC

Hi,

>I thought that the slot and drive would be specified in the pathname.
>For example: FILE,S6,D1 but maybe not. There is a low level DEV_NUM
>and I found these device.h helper functions...
>
>https://cc65.github.io/doc/funcref.html#ss2.20
>
>unsigned char getfirstdevice (void);
>unsigned char __fastcall__ getnextdevice (unsigned char device);
>unsigned char getcurrentdevice (void);

Thanks, I had missed those! This is really helpful.

--
Colin
https://www.colino.net/

Re: cc65: file I/O on external drive?

<20230810182225.7571b259@laptop-sigfox>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=331&group=comp.sys.apple2.programmer#331

  copy link   Newsgroups: comp.sys.apple2.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED.93.8.31.152!not-for-mail
From: colin@colino.net (Colin Leroy-Mira)
Newsgroups: comp.sys.apple2.programmer
Subject: Re: cc65: file I/O on external drive?
Date: Thu, 10 Aug 2023 18:22:25 +0200
Organization: A noiseless patient Spider
Message-ID: <20230810182225.7571b259@laptop-sigfox>
References: <20230810153128.037b45e2@laptop-sigfox>
<mmphosis-1691679708@macgui.com>
<20230810180315.19b34c79@laptop-sigfox>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="93.8.31.152";
logging-data="394498"; mail-complaints-to="abuse@eternal-september.org"
X-Newsreader: Claws Mail 3.19.1git30 (GTK+ 2.24.33; x86_64-pc-linux-gnu)
 by: Colin Leroy-Mira - Thu, 10 Aug 2023 16:22 UTC

Hi,

>>I thought that the slot and drive would be specified in the pathname.
>>For example: FILE,S6,D1 but maybe not. There is a low level DEV_NUM
>>and I found these device.h helper functions...
>>
>>https://cc65.github.io/doc/funcref.html#ss2.20
>>
>>unsigned char getfirstdevice (void);
>>unsigned char __fastcall__ getnextdevice (unsigned char device);
>>unsigned char getcurrentdevice (void);

This is in fact extremely easy: you just fopen("/PREFIX/FILENAME") and
it finds the correct drive all by itself :)
--
Colin
https://www.colino.net/

Re: cc65: file I/O on external drive?

<ub3g31$cajg$1@solani.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=332&group=comp.sys.apple2.programmer#332

  copy link   Newsgroups: comp.sys.apple2.programmer
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: ol.sc@web.de (Oliver Schmidt)
Newsgroups: comp.sys.apple2.programmer
Subject: Re: cc65: file I/O on external drive?
Date: Thu, 10 Aug 2023 20:08:01 GMT
Message-ID: <ub3g31$cajg$1@solani.org>
References: <20230810153128.037b45e2@laptop-sigfox> <mmphosis-1691679708@macgui.com> <20230810180315.19b34c79@laptop-sigfox> <20230810182225.7571b259@laptop-sigfox>
Injection-Date: Thu, 10 Aug 2023 20:08:01 -0000 (UTC)
Injection-Info: solani.org;
logging-data="404080"; mail-complaints-to="abuse@news.solani.org"
Cancel-Lock: sha1:SFMAEAW7qtsXazawiCxE1sVQG8w=
X-Newsreader: Forte Free Agent 1.21/32.243
X-User-ID: eJwFwYERADAEBLCVqvq8cXDsP0ITqIm1P4M9LNar4Js6iD5Ur94cn8wlw3iLEkTM6biY0g8v1xGC
 by: Oliver Schmidt - Thu, 10 Aug 2023 20:08 UTC

Hi Colin,

>This is in fact extremely easy: you just fopen("/PREFIX/FILENAME") and
>it finds the correct drive all by itself :)

Yes, ProDOS is about volumes and paths, not about slots and drives.

However, if you have to access a certain drive then the way to do it
is this:

1. Calculate the device number according to the formula
device = slot + (drive - 1) * 8
(https://cc65.github.io/doc/apple2.html#ss9)

2. Call getdevicedir() with the device from 1.
(https://cc65.github.io/doc/funcref.html#ss3.135)

3. Construct an absolute path from 2. or call chdir() with 2.

If you want to return where you've been before calling chdir(), you
can call getcwd() before chdir().

In general, you might want to have a look at
https://github.com/cc65/cc65/blob/master/samples/enumdevdir.c

Regards,
Oliver

Re: cc65: file I/O on external drive?

<20230811120718.59781fd0@laptop-sigfox>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=333&group=comp.sys.apple2.programmer#333

  copy link   Newsgroups: comp.sys.apple2.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED.93.8.31.152!not-for-mail
From: colin@colino.net (Colin Leroy-Mira)
Newsgroups: comp.sys.apple2.programmer
Subject: Re: cc65: file I/O on external drive?
Date: Fri, 11 Aug 2023 12:07:18 +0200
Organization: A noiseless patient Spider
Message-ID: <20230811120718.59781fd0@laptop-sigfox>
References: <20230810153128.037b45e2@laptop-sigfox>
<mmphosis-1691679708@macgui.com>
<20230810180315.19b34c79@laptop-sigfox>
<20230810182225.7571b259@laptop-sigfox>
<ub3g31$cajg$1@solani.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="93.8.31.152";
logging-data="394498"; mail-complaints-to="abuse@eternal-september.org"
X-Newsreader: Claws Mail 3.19.1git30 (GTK+ 2.24.33; x86_64-pc-linux-gnu)
 by: Colin Leroy-Mira - Fri, 11 Aug 2023 10:07 UTC

Hi Oliver,

>Yes, ProDOS is about volumes and paths, not about slots and drives.
> [...]
>In general, you might want to have a look at
>https://github.com/cc65/cc65/blob/master/samples/enumdevdir.c

Thanks! Grepping from mmphosis' pointed me to this file, and it helped
a lot. I now have a functional multi-device file selector :

https://piaille.fr/@colin_mcmillen/110870419691108842

--
Colin
https://www.colino.net/

Re: cc65: file I/O on external drive?

<ub566n$6hbm$1@solani.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=334&group=comp.sys.apple2.programmer#334

  copy link   Newsgroups: comp.sys.apple2.programmer
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: ol.sc@web.de (Oliver Schmidt)
Newsgroups: comp.sys.apple2.programmer
Subject: Re: cc65: file I/O on external drive?
Date: Fri, 11 Aug 2023 11:31:35 -0000 (UTC)
Message-ID: <ub566n$6hbm$1@solani.org>
References: <20230810153128.037b45e2@laptop-sigfox>
<mmphosis-1691679708@macgui.com>
<20230810180315.19b34c79@laptop-sigfox>
<20230810182225.7571b259@laptop-sigfox>
<ub3g31$cajg$1@solani.org>
<20230811120718.59781fd0@laptop-sigfox>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 11 Aug 2023 11:31:35 -0000 (UTC)
Injection-Info: solani.org;
logging-data="214390"; mail-complaints-to="abuse@news.solani.org"
User-Agent: NewsTap/5.5 (iPhone/iPod Touch)
Cancel-Lock: sha1:6eQru2m1lhsS8v3+P4vf4ajZ+uU= sha1:iaNRClJ1rHKZoweLS5ry04MckYM=
X-User-ID: eJwFwQkBwEAIAzBLMGjBDs/wL+ESGJUTTtBxuMzqgLauC/9eETuwxyZ3BO7T8ZlUFq+T8gAePREd
 by: Oliver Schmidt - Fri, 11 Aug 2023 11:31 UTC

Hi Colin,

>> https://github.com/cc65/cc65/blob/master/samples/enumdevdir.c
>
> Thanks! Grepping from mmphosis' pointed me to this file, and it helped
> a lot. I now have a functional multi-device file selector

Yes, an interactive file selector was more less the use case I had in mind
when developing the functionality (and the sample) :-)

Regards,
Oliver

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor