API for renaming files?

discussion of beeb/electron applications, languages, utils and educational s/w
User avatar
hjalfi
Posts: 74
Joined: Sat May 13, 2017 10:17 pm
Location: Zürich, Switzelrand
Contact:

API for renaming files?

Postby hjalfi » Sun Nov 05, 2017 3:25 pm

Silly question, but...

I can't find any API way of renaming files on the MOS. I'd expect it to be in OSFILE somewhere next to 0x06 (delete file), 0x08 (create directory) etc. But there's nothing.

Does one exist, or is it only implemented via *RENAME?

crj
Posts: 320
Joined: Thu May 02, 2013 4:58 pm

Re: API for renaming files?

Postby crj » Sun Nov 05, 2017 8:08 pm

I'm pretty sure there isn't an API.

You can use OSCLI, of course...

User avatar
jgharston
Posts: 2756
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield

Re: API for renaming files?

Postby jgharston » Sun Nov 05, 2017 9:45 pm

hjalfi wrote:I can't find any API way of renaming files on the MOS. I'd expect it to be in OSFILE somewhere next to 0x06 (delete file), 0x08 (create directory) etc. But there's nothing.

It woudn't be OSFILE even if it was in the API, OSFILE is for operating on whole files, not on files' names.

The only way to do it is via OSCLI. Some systems translate a *RENAME command into an FSC call, but FSC is not a user-visible API, it's the method that the MOS uses to call the filing system that the filing system responds to, just as the user doesn't call FSC to read EOF, the user calls EOF to read EOF, which the MOS passes on to the filing system as a FSC call.

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

crj
Posts: 320
Joined: Thu May 02, 2013 4:58 pm

Re: API for renaming files?

Postby crj » Mon Nov 06, 2017 4:13 pm

jgharston wrote:Some systems translate a *RENAME command into an FSC call


That arrived in 32-bit land, didn't it? I don't think FSC 25 ever existed in 8-bit OSes.

FSC is not a user-visible API

CALL !&21E from BASIC or JMP (&21E) from 6502 code has always worked fine for me. (-8 (Besides, its' what BASIC and all the other languages use internally. So much so that for the Master they had to bodge the vector for backwards compatability. I've often wondered why there wasn't an OSFSC entry point to go with all the others.)

User avatar
jgharston
Posts: 2756
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield

Re: API for renaming files?

Postby jgharston » Mon Nov 06, 2017 9:24 pm

crj wrote:
FSC is not a user-visible API
CALL !&21E from BASIC or JMP (&21E) from 6502 code has always worked fine for me.
Only if you're executing on the 6502 I/O processor.

crj wrote:Besides, its' what BASIC and all the other languages use internally.
No they don't and they MUSTN'T because it's ***NOT*** an API call, it's a filing system internal entry point. They ***MUST*** ***ONLY**** call &FFxx.

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

crj
Posts: 320
Joined: Thu May 02, 2013 4:58 pm

Re: API for renaming files?

Postby crj » Tue Nov 07, 2017 3:36 am

Gosh. I'd not noticed that FSCV wasn't forwarded from the 6502 Second Processor to the host. If FSCV forwarding isn't supported, I wonder how the ARM Evaluation Board supported OS_FSControl.

Meanwhile, even if not officially supported, indirection through FSCV from non-OS code is/was clearly a widespread practice. Hence the necessity of bodging FSCV in the Master as part of supporting ur-FileSwitch. And there are useful things there, such as obtaining *INFO/*EX output, which are fiddly to achieve otherwise.

User avatar
hjalfi
Posts: 74
Joined: Sat May 13, 2017 10:17 pm
Location: Zürich, Switzelrand
Contact:

Re: API for renaming files?

Postby hjalfi » Thu Nov 09, 2017 11:10 am

The Advanced User's Guide doesn't mention anything above OSFSC 8.

This is in the context of b-em's copy of VDFS, which doesn't implement features like deleteing or renaming files (most of them just silently do nothing, causing my build scripts to fail in hilarious fashions).

It seems like a very odd omission. Surely even back in nineteen eighty-mumble people were aware that file renaming needed to be a first-class operation?


Return to “software: other”

Who is online

Users browsing this forum: No registered users and 3 guests