changeset 3017:545a59f51fee

Changed llcocosdc read and write routines to enter and leave command mode.
author tlindner
date Thu, 27 Nov 2014 20:03:48 -0800
parents eb04ba1c507f
children e7ffcda58117
files level1/modules/llcocosdc.asm
diffstat 1 files changed, 32 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/level1/modules/llcocosdc.asm	Wed Oct 29 23:12:52 2014 +0100
+++ b/level1/modules/llcocosdc.asm	Thu Nov 27 20:03:48 2014 -0800
@@ -8,6 +8,8 @@
 * ------------------------------------------------------------------
 *          2004/??/??  Boisy G. Pitre
 * Created.
+*          2014/11/27  tim lindner
+* Changed read and write routines to enter and leave command mode
 
                NAM       llcocosdc
                TTL       CoCo SDC Low-level driver
@@ -61,9 +63,9 @@
 *    B  = error code
 *
 ll_init                  
-               ldy      V.PORT-UOFFSET,u
-               ldb      #$43
-               stb      -$0A,y
+*               ldy      V.PORT-UOFFSET,u
+*               ldb      #$43
+*               stb      -$0A,y
                clrb      
                rts       
 
@@ -132,8 +134,18 @@
 *    sectsize       = sector size (0=256,1=512,2=1024,3=2048)
 *    V.SectCnt      = sectors to read
 *    V.PhysSect = physical sector to start read from
-ll_read                  
-               lda       PD.DRV,y
+ll_read              
+               lda       #$43
+               sta       $ff40
+               ldx       #0
+rdCmMd         lda       $ff48
+               lsra
+               bcc       rdStart
+               leax      -1,x
+               bne       rdCmMd
+               bra       rdFail
+               
+rdStart        lda       PD.DRV,y
                ldb       V.PhysSect,u
                ldx       V.PhysSect+1,u
                ldy       V.PORT-UOFFSET,u
@@ -153,6 +165,7 @@
                leax      -1,x
                bne       rdWait
 rdFail
+               clr       $ff40
                ldb       #E$Read
                coma
                rts
@@ -171,6 +184,7 @@
                deca
                bne       rdChnk
 
+               sta       $ff40
                rts
 
 
@@ -186,7 +200,17 @@
 *    V.SectCnt      = sectors to read
 *    V.PhysSect     = physical sector to start read from
 ll_write                 
-               lda       PD.DRV,y
+               lda       #$43
+               sta       $ff40
+               ldx       #0
+wrCmMd         lda       $ff48
+               lsra
+               bcc       rwStart
+               leax      -1,x
+               bne       wrCmMd
+               bra       wrFail
+
+rwStart        lda       PD.DRV,y
                ldb       V.PhysSect,u
                ldx       V.PhysSect+1,u
                ldy       V.PORT-UOFFSET,u
@@ -206,6 +230,7 @@
                leax      -1,x
                bne       wrWait
 wrFail
+               clr       $ff40
                ldb       #E$Write
                coma
                rts
@@ -225,6 +250,7 @@
                lsra
                bcs       wrComp
 
+               clr       $ff40
                rts
 
                EMOD