]> cloudbase.mooo.com Git - avrcpm.git/blobdiff - avr/dsk_cpm.asm
* FAT buffer on ATmega328
[avrcpm.git] / avr / dsk_cpm.asm
index 0999b7928989e1b61cd2af1810d6b3b837ad293d..91cd434d2fe7075e503b7013094dc3e17f64c2fc 100644 (file)
 ;    $Id$
 ;
 
-#ifndef CPMDSK_SUPPORT
-       #define CPMDSK_SUPPORT 1        
-#endif
-
 #if CPMDSK_SUPPORT
 
 
-;----------------------------------------------- Start of Code Segment
        .cseg
 
-; ====================================================================
-; Function: Does a Disk write operation
-; ====================================================================
-; Parameters
-; --------------------------------------------------------------------
-; Registers  : none
-; Variables  : [r] seekdsk             Number of Disk to Read
-;                         [r] seeksec          Sector to read
-;              [r] seektrk             Track  to read
-; hostdsk = host disk #,  (partition #)
-; hostlba = host block #, relative to partition start 
-; Read/Write "hostsize" bytes to/from hostbuf
-; --------------------------------------------------------------------
-; Description:
-; ==================================================================== 
-
-cpm_hostparam:
-       lds     zl,hostdsk
-
-.if HOSTRW_DEBUG
-       mov     temp,zl
-       subi    temp,-('A')
-       lcall   uartputc
-       printstring ": "
-.endif
-
-       rcall dsk_getpartentry          ; get partition entry
-
-       lds     temp,hostlba            ; get sector to access
-       lds     temp2,hostlba+1
-;      lds     temp3,hostlba+2
-
-.if HOSTRW_DEBUG
-       printstring "lba: "
-       clr     temp4
-       lcall   print_ultoa
-.endif
-
-       ldd     xl,z+5                  ; get disksize
-       ldd     xh,z+6
-;      ldd     yl,z+7
-       
-       cp      temp,xl                 ; check given sector against disksize
-       cpc     temp2,xh
-;      cpc     temp3,yl
-       brcs    cpm_hp1
-       
-.if HOSTRW_DEBUG
-       printstring ", max: "
-       push    temp4
-       push    temp3
-       push    temp2
-       push    temp
-       movw    temp,x
-;      mov     temp3,yl
-       clr     temp3
-       clr     temp4
-       lcall   print_ultoa
-       pop     temp
-       pop     temp2
-       pop     temp3
-       pop     temp4
-       printstring " "
-.endif
-       
-       clr     temp
-       ret
-
-cpm_hp1:
-       ldd     xl,z+1                  ; get startsector of partition
-       ldd     xh,z+2
-       ldd     yl,z+3
-       ldd     yh,z+4
+cpm_lba_to_phys:
+       ldd     temp ,z+PTAB_START+0    ; get startsector of partition
+       ldd     temp2,z+PTAB_START+1
+       ldd     yl,z+PTAB_START+2
+       ldd     yh,z+PTAB_START+3
 
        add     xl,temp                 ; add offset to startsector
        adc     xh,temp2
-;      adc     yl,temp3
        adc     yl,_0
        adc     yh,_0
 
-.if HOSTRW_DEBUG
-       printstring ", abs:"
-       push    temp4
-       push    temp3
-       push    temp2
-       push    temp
-       movw    temp,x
-       movw    temp3,y
-       lcall   print_ultoa
-       pop     temp
-       pop     temp2
-       pop     temp3
-       pop     temp4
-       printstring " "
-.endif
-
-       ori     temp,255
-cpm_hpex:
        ret
 
-; ====================================================================
-; Function: Does a Disk write operation
-; ====================================================================
-; Parameters
-; --------------------------------------------------------------------
-; Registers  : none
-; Variables  : [r] seekdsk             Number of Disk to Read
-;                         [r] seeksec          Sector to read
-;              [r] seektrk             Track  to read
-; --------------------------------------------------------------------
-; Description:
-; ====================================================================
-
-cpm_writehost:
-.if HOSTRW_DEBUG
-       printnewline
-       printstring "host write "
-.endif
-       rcall   cpm_hostparam
-       breq    cpm_rdwr_err
-       
-       rcall   mmcWriteSect
-       tst     temp
-       brne    cpm_rdwr_err
-       
-       rjmp    cpm_rdwr_ok
-       
-
-; ====================================================================
-; Function: Does a Disk read operation
-; ====================================================================
-; Parameters
-; --------------------------------------------------------------------
-; Registers  : none
-; Variables  : [r] seekdsk             Number of Disk to Read
-;             [r] seeksec              Sector to read
-;              [r] seektrk             Track  to read
-; --------------------------------------------------------------------
-; Description:
-; ====================================================================
-cpm_readhost:
-.if HOSTRW_DEBUG
-       printnewline
-       printstring "host read  "
-.endif
-
-       rcall   cpm_hostparam
-       breq    cpm_rdwr_err
-       
-       rcall   mmcReadSect
-       tst     temp
-       brne    cpm_rdwr_err
-
-cpm_rdwr_ok:
-       sts     erflag,_0
-       ret
-
-cpm_rdwr_err:
-       sts     erflag,_255
-       ret
-
-
 ; ====================================================================
 ; Function: Add's a CP/M Partition to the Partition table
 ; ====================================================================
@@ -236,7 +82,7 @@ cpm_add_prune:
 cpm_add_e:
        ret
                
-#endif
+#endif /* CPMDSK_SUPPORT */
 
 ; vim:set ts=8 noet nowrap