]> git.sur5r.net Git - cc65/blobdiff - libsrc/cbm/diskcmd.s
no TGI_ERR_NO_MEM or TGI_ERR_NO_IOCB anymore: replaced by TGI_ERR_NO_RES
[cc65] / libsrc / cbm / diskcmd.s
index c6f04e9fe9acde1861368943e1cc9522a8fd2894..d090afe14e5d474f83c6c3904e167623940c11ba 100644 (file)
@@ -1,5 +1,5 @@
 ;
-; Ullrich von Bassewitz, 17.11.2002
+; Ullrich von Bassewitz, 2002-11-17, 2009-02-22
 ;
 ; Handle disk command channels
 ;
@@ -9,9 +9,11 @@
         .export         closecmdchannel
         .export         readdiskerror
         .export         writediskcmd
+        .export         writefndiskcmd
 
         .import         SETLFS, SETNAM, OPEN, CLOSE, BSOUT, BASIN
         .import         CHKIN, CKOUT, CLRCH
+        .import         fncmd, fnlen, fnunit
         .importzp       tmp1, ptr1
 
         .include        "cbm.inc"
@@ -164,15 +166,35 @@ readdiskerror:
         pla
         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
-; to the command channel of the given drive. Returns an error code in A,
+; to the command channel of the drive in X. Returns an error code in A,
 ; flags are set according to the contents of A.
 
 writediskcmd:
 
         jsr     isdisk
-        bcs     success
+        bcs     success         ; No disk - already done
 
 ; Remember the length
 
@@ -205,7 +227,6 @@ writediskcmd:
         rts
 
 
-
 ;--------------------------------------------------------------------------
 ; Data