From 30237d3c3688d13db67d4128ca36d69a3d44b359 Mon Sep 17 00:00:00 2001 From: uz Date: Sun, 22 Feb 2009 14:02:52 +0000 Subject: [PATCH] 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 --- libsrc/cbm/diskcmd.s | 25 +++++++++++++++++++++++-- libsrc/cbm/scratch.s | 19 ++++--------------- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/libsrc/cbm/diskcmd.s b/libsrc/cbm/diskcmd.s index c6f04e9fe..16914d837 100644 --- a/libsrc/cbm/diskcmd.s +++ b/libsrc/cbm/diskcmd.s @@ -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,6 +166,26 @@ 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+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, @@ -205,7 +227,6 @@ writediskcmd: rts - ;-------------------------------------------------------------------------- ; Data diff --git a/libsrc/cbm/scratch.s b/libsrc/cbm/scratch.s index 6fd617308..e1665e5a6 100644 --- a/libsrc/cbm/scratch.s +++ b/libsrc/cbm/scratch.s @@ -1,13 +1,12 @@ ; -; Ullrich von Bassewitz, 16.11.2002 +; Ullrich von Bassewitz, 2002-11-16, 2009-02-22 ; ; Scratch a file on disk ; .export scratch - .import opencmdchannel, closecmdchannel, writediskcmd - .import fnunit, fnlen, fncmd - .importzp ptr1 + .import opencmdchannel, closecmdchannel, writefndiskcmd + .import fnunit, fncmd .include "cbm.inc" @@ -25,17 +24,7 @@ lda #'s' ; Scratch command sta fncmd - - lda #fncmd - sta ptr1+1 - - ldx fnlen - inx ; Account for "S" - txa ; Length of name into A - ldx fnunit ; Unit - jsr writediskcmd + jsr writefndiskcmd pha ldx fnunit