1
0
mirror of https://github.com/cc65/cc65.git synced 2025-02-25 16:29:08 +00:00

Moved some code from scratch.s into a new subroutine named writefndiskcmd in

the diskcmd.s module.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3939 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2009-02-22 14:02:52 +00:00
parent 770d230178
commit 30237d3c36
2 changed files with 27 additions and 17 deletions

View File

@ -1,5 +1,5 @@
; ;
; Ullrich von Bassewitz, 17.11.2002 ; Ullrich von Bassewitz, 2002-11-17, 2009-02-22
; ;
; Handle disk command channels ; Handle disk command channels
; ;
@ -9,9 +9,11 @@
.export closecmdchannel .export closecmdchannel
.export readdiskerror .export readdiskerror
.export writediskcmd .export writediskcmd
.export writefndiskcmd
.import SETLFS, SETNAM, OPEN, CLOSE, BSOUT, BASIN .import SETLFS, SETNAM, OPEN, CLOSE, BSOUT, BASIN
.import CHKIN, CKOUT, CLRCH .import CHKIN, CKOUT, CLRCH
.import fncmd, fnlen, fnunit
.importzp tmp1, ptr1 .importzp tmp1, ptr1
.include "cbm.inc" .include "cbm.inc"
@ -164,6 +166,26 @@ readdiskerror:
pla pla
rts rts
;--------------------------------------------------------------------------
; writefndiskcmd: Write the contents of fncmd to the command channel of the
; drive in fnunit. Returns an error code in A, flags are set according to
; the contents of A.
writefndiskcmd:
lda #<fncmd
sta ptr1
lda #>fncmd
sta ptr1+1
ldx fnlen
inx ; Account for command char in fncmd
txa ; Length of name into A
ldx fnunit ; Unit
; Run directly into writediskcmd
; jmp writediskcmd
;-------------------------------------------------------------------------- ;--------------------------------------------------------------------------
; writediskcmd: Gets pointer to data in ptr1, length in A. Writes all data ; writediskcmd: Gets pointer to data in ptr1, length in A. Writes all data
; to the command channel of the given drive. Returns an error code in A, ; to the command channel of the given drive. Returns an error code in A,
@ -205,7 +227,6 @@ writediskcmd:
rts rts
;-------------------------------------------------------------------------- ;--------------------------------------------------------------------------
; Data ; Data

View File

@ -1,13 +1,12 @@
; ;
; Ullrich von Bassewitz, 16.11.2002 ; Ullrich von Bassewitz, 2002-11-16, 2009-02-22
; ;
; Scratch a file on disk ; Scratch a file on disk
; ;
.export scratch .export scratch
.import opencmdchannel, closecmdchannel, writediskcmd .import opencmdchannel, closecmdchannel, writefndiskcmd
.import fnunit, fnlen, fncmd .import fnunit, fncmd
.importzp ptr1
.include "cbm.inc" .include "cbm.inc"
@ -25,17 +24,7 @@
lda #'s' ; Scratch command lda #'s' ; Scratch command
sta fncmd sta fncmd
jsr writefndiskcmd
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 pha
ldx fnunit ldx fnunit