Code Monkey home page Code Monkey logo

Comments (7)

davidgiven avatar davidgiven commented on June 12, 2024

Um. This bit of vdfs.s isn't particularly encouraging:

\ ------------------------------
\ Filing System Command Routines
\ ------------------------------
.F2toXY
TYA:CLC:ADC &F2:TAX:LDA &F3:ADC #0:TAY:RTS
.access   :RTS
.back     :LDA #&D5:STA PORT_CMD:RTS :\ Pass to host and return
.backup   :RTS
.compact  :RTS
.copy     :RTS
.delete   :RTS
.destroy  :RTS
.dir      :LDA #&D7:STA PORT_CMD:RTS :\ Pass to host and return
.drive    :RTS
.enable   :RTS
.ex       :JSR F2toXY:LDA #&09:JMP CallFSCV
.form     :RTS
.free     :RTS
.info     :JSR F2toXY:LDA #&0A:JMP CallFSCV
.lib      :LDA #&D8:STA PORT_CMD:RTS :\ Pass to host and return
.mount    :RTS
.rename   :JSR F2toXY:LDA #&0C:JMP CallFSCV
.rescan   :LDA #&D9:STA PORT_CMD:RTS :\ Pass to host and return
.wipe     :RTS
.title    :RTS
.verify   :RTS

It looks like jgh's version at http://mdfs.net/Apps/Emulators/BBC/ implements these by using emulator command 0x08 (which seems to be 'execute star command'). I'm not sure that's a good idea, at least for deleting files, as OSFILE 0x06 would need implementing to. (I'm rather surprised not to be able to find a MOS call for renaming files. Was that only ever supported via the * command?)

So I think this may need ROM changes, which I reckon is too much work.

from b-em.

SteveFosdick avatar SteveFosdick commented on June 12, 2024

There is a non-command way to rename a file (on a filing system that implements it) but it involves calling function 12 (&0C) of FSCV. There is no address you can JSR to directly in the same way as the other OS API calls but you can include an indirect jump via the FSCV vector in your own code and then call that. That is exactly what the code in the VDFS ROM is doing for the RENAME command - see the one instruction subroutine CallFSCV. As FSCV function 12 takes the pair of filenames exactly as they appear after the *RENAME part of the command, that is all the ROM needs to do to implement the *RENAME command so the VDFS C code just needs to implement function 12.

The *DELETE case would require a small ROM change because OSFILE takes a control block rather than the address of the filename in XY. It would not be a big change, though, because most of the control block does not appear relevant to deleting a file - only the address of the filename in the first two bytes of the control block. Such a control block could be set up in a handful of instructions and then that would also be a case of needing the VDFS C code to implement the correct OSFILE function.

I will have a go at the necessary assembler change to the ROM and then look at the C changes.

from b-em.

SteveFosdick avatar SteveFosdick commented on June 12, 2024

Ok, so with the assembler in the VDFS ROM for "DELETE" changed to:

.delete :JSR F2toXY:STX &B0:STY &B1:LDX #&B0:LDY #&00:LDA #&06:JMP OSFILE

attempting to delete a file gives this message in b-emlog.txt (with debug messages turned on):

12/11/2017 22:06:43 DEBUG vdfs: osfile unimplemented for a=6, x=176, y=0

likewise attempting to rename a file gives:

12/11/2017 22:10:07 DEBUG vdfs: osfsc unimplemented for a=12, x=6, y=7

so hopefully that's the assembler bit done, just the C code to go now.

from b-em.

SteveFosdick avatar SteveFosdick commented on June 12, 2024

So the new ROM in both source and assembled versions are now on branch issue28.

from b-em.

SteveFosdick avatar SteveFosdick commented on June 12, 2024

Initial implementation of the OSFILE delete in vdfs.c, and therefore *DELETE is now in the Issue28 branch.

from b-em.

SteveFosdick avatar SteveFosdick commented on June 12, 2024

The latest code pushed to the issue#28 branch implement rename too.

from b-em.

SteveFosdick avatar SteveFosdick commented on June 12, 2024

Latest code, now in master, implements delete, rename and *CDIR.

from b-em.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.