1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-23 04:30:10 +00:00
cc65/libsrc/cbm/scratch.s
cuz 544ff5b900 Working on the CBM file functions
git-svn-id: svn://svn.cc65.org/cc65/trunk@1533 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-11-17 22:45:55 +00:00

50 lines
1.1 KiB
ArmAsm

;
; Ullrich von Bassewitz, 16.11.2002
;
; Scratch a file on disk
;
.export scratch
.import opencmdchannel, closecmdchannel, writediskcmd
.import fnunit, fnlen, fncmd
.importzp ptr1
.include "cbm.inc"
;--------------------------------------------------------------------------
; scratch: Scratch a file on disk. Expects the name of the file to be already
; parsed. Returns an error code in A, which may either be the code read from
; the command channel, or another error when accessing the command channel
; failed.
.proc scratch
ldx fnunit
jsr opencmdchannel
bne done
lda #'s' ; Scratch command
sta fncmd
lda #<fncmd
sta ptr1
lda #>fncmd
sta ptr1+1
ldx fnlen
inx ; Account for "S"
txa ; Length of name into A
ldx fnunit ; Unit
jsr writediskcmd
pha
ldx fnunit
jsr closecmdchannel
pla
done: rts
.endproc