;
-; Ullrich von Bassewitz, 16.11.2002
+; Ullrich von Bassewitz, 2002-11-16, 2009-02-22
;
; Scratch a file on disk
;
.export scratch
- .import readdiskerror
- .import fnunit, fnlen, fncmd
+ .import opencmdchannel, closecmdchannel, writefndiskcmd
+ .import fnunit, fncmd
.include "cbm.inc"
.proc scratch
- lda #15 ; Command channel
- ldx fnunit ; Unit
- tay ; Secondary address
- jsr SETLFS
+ ldx fnunit
+ jsr opencmdchannel
+ bne done
lda #'s' ; Scratch command
sta fncmd
- ldx fnlen
- inx ; Account for "S"
- txa ; Length of name into A
- ldx #<fncmd
- ldy #>fncmd
- jsr SETNAM
-
- jsr OPEN
- bcs done
-
- jsr readdiskerror ; Read the command channel
+ jsr writefndiskcmd
pha
- lda #15
- jsr CLOSE
+ ldx fnunit
+ jsr closecmdchannel
pla
done: rts