Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > how to delete a file with rom routines?
2006-07-19 19:08
Trifox
Account closed

Registered: Mar 2006
Posts: 108
how to delete a file with rom routines?

hi all, how to delete a file with rom routines?
2006-07-19 19:24
TNT
Account closed

Registered: Oct 2004
Posts: 189
        lda     #15
        ldx     $ba
        tay
        jsr     $ffba

        lda     #CMDLEN
        ldx     #<CMD
        ldy     #>CMD
        jsr     $ffbd

        jsr     $ffc0
        lda     #15
        jsr     $ffc3
	...

CMD     dc.b    "S0:"
FNAME   dc.b    "filename"

CMDLEN  = *-CMD


That should be close what you want, assuming that device you are using is somewhat compatible with 1541.
2006-07-19 20:44
Graham
Account closed

Registered: Dec 2002
Posts: 990
A bit of error handling would be nice, else you might get wicked crashes.
2006-07-19 21:06
TNT
Account closed

Registered: Oct 2004
Posts: 189
Only calls sending anything to IEC (or some other) bus in above routine are OPEN ($ffc0) and CLOSE ($ffc3), and you need to close any opened files on C64 side even if open wasn't succesful at device end. I see no crash opportunity.

Adding code to read drive status after delete is easy, just
        ldx     #15
        jsr     $ffc6   ; chkin
.loop   jsr     $ffcf   ; chrin
        jsr     $ffd2   ; chrout, store in memory if you wish
        lda     $90     ; use "jsr READST" if you wish
        beq     .loop
        jsr     $ffcc   ; clrchn

after call to $ffc0.
2006-07-19 21:43
Graham
Account closed

Registered: Dec 2002
Posts: 990
Not quite correct. Some of the possible errors do not OPEN anything and executing a CLOSE would be a problem then. CHKIN/CHRIN is definitely a problem with unopened file, I had lots of crashes with those.
2006-07-19 22:27
TNT
Account closed

Registered: Oct 2004
Posts: 189
If he's sloppy with his opened files, then yes. Only errors not affecting kernal open file table are opening logical file #0, opening already open file, or opening more than 10 files. Attempting to open file on IEC device which doesn't exist returns error, but table is already updated.

Kernal CLOSE is no-operation if file isn't opened. CHKIN/CHRIN aren't a problem unless you use them, and my original code doesn't. CHKIN itself isn't a problem, but one should check for carry after calling it to see if file was OPENed.
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Exploding Fi../Techn..
Didi/Laxity
Sentinel/Excess/TREX
Flex/Artline Designs
A3/AFL
jmin
Guests online: 98
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 Memento Mori  (9.6)
10 Bromance  (9.5)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Onscreen 5k  (9.5)
8 Wafer Demo  (9.5)
9 Dawnfall V1.1  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Logo Graphicians
1 Sander  (10)
2 Facet  (9.7)
3 Mermaid  (9.4)
4 Pal  (9.4)
5 Shine  (9.3)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.033 sec.