]> cloudbase.mooo.com Git - avrcpm.git/blobdiff - avr/dsk_mgr.asm
* FAT buffer on ATmega328
[avrcpm.git] / avr / dsk_mgr.asm
index f378da4246e98a01de79fed4e25b1517d2d3dcd4..c9ff9e02ad701adaff2a662bade374f11f3591c2 100644 (file)
@@ -81,6 +81,7 @@ mgr_picl:
 ;Load first sector from MMC (boot sector)
        ldiw    y,0                     ; Sector 0
        movw    x,y
+       ldiw    z,hostbuf
        lcall   mmcReadSect
        tst     temp
        breq    mgr_check_bootsektor
@@ -105,6 +106,8 @@ mgr_check_bootsektor:
 
 ;No MBR, no partition table ...
 
+#if CPMDSK_SUPPORT
+
        inc     temp3                   ;pretend we have one.
        sts     ndisks,temp3
        ldi     temp,high((1<<16) * 128/512)
@@ -120,10 +123,15 @@ mgr_check_bootsektor:
        ldi     temp3,0
        rcall   dpb_imgdata_get
 
+#endif /* CPMDSK_SUPPORT */
+
        rjmp    mgr_pend
 
-; Search for valid Partitions and ImageFiles 
 mgr_search:
+
+#if CPMDSK_SUPPORT
+
+; Search for valid Partitions and ImageFiles 
        ldiw    z,hostbuf+510-64        ;Point to  first byte of partition table
 
 mgr_ploop:
@@ -146,6 +154,7 @@ mgr_nextp:
        adiw    z,16
        cpi     zl,low(hostbuf+510)     ;End of partition table reached?
        brne    mgr_ploop
+#endif /* CPMDSK_SUPPORT */
 
 #if FAT16_SUPPORT
 
@@ -174,7 +183,7 @@ mgr_nextp2:
        adiw    zl,16
        cpi     zl,low(hostbuf+510)
        brne    mgr_ploop2
-#endif
+#endif /* FAT16_SUPPORT */
 
 mgr_pend:
        clr     temp3
@@ -205,12 +214,16 @@ mgr_pend2:
 ; ====================================================================
 
 mgr_prnt_parttbl:
+       lds     yl,ndisks
+       tst     yl
+       brne    ppr_doit
+       ret
+
+ppr_doit:
        push    r15
        push    r14
        ldiw    z,hostparttbl
-       lds     yl,ndisks
        ldi     xh,'A'
-
 pprl:
        printnewline
 
@@ -219,23 +232,33 @@ pprl:
        ldd     r14,z+3
        ldd     r15,z+4
 
+; Partitiontype examining
+
+       ldd     xl,z+0
+       andi    xl,dskType_MASK
+
+#if CPMDSK_SUPPORT
+
        cp      temp,_0                 ;If zero ...
        cpc     temp2,_0
        cpc     r14,_0
        cpc     r15,_0
-       breq    mgr_prnop               ;... no partition table at 0
+       brne    mgr_prchkcpm            ;... no partition table at 0
 
-; Partitiontype examining
-       ldd     xl,z+0
-       andi    xl,dskType_MASK
+       rcall   mgr_prnt_diskname
+       rcall   mgr_prnt_image
+       rjmp    mgr_prnt_size
+
+mgr_prchkcpm:
 ; CP/M ?
        cpi     xl,dskType_CPM
        brne    mgr_prtb_nocpm
        rcall   mgr_prnt_diskname
        rcall   mgr_prnt_table_cpm
        rjmp    mgr_prnt_size
-
 mgr_prtb_nocpm:
+#endif
+
 #if FAT16_SUPPORT
 ; FAT16 ?
        cpi     xl,dskType_FAT
@@ -245,22 +268,21 @@ mgr_prtb_nocpm:
        rjmp    mgr_prnt_size
 mgr_prtb_nofat:
 #endif
+
 #if 0                                  /* RAMDISK is not on SD card */
+#if RAMDISKCNT
 ; RAMDISK ?
        cpi     xl,dskType_RAM
-       brne    mgr_prnt_err
+       brne    mgr_prnt_noramdisk
        rcall   mgr_prnt_diskname
        rcall   mgr_prnt_table_ram
        rjmp    mgr_prnt_size
+mgr_prnt_noramdisk:    
+#endif
 #endif
-mgr_prnt_err:  
+
 ; Entry Error
        rcall   mgr_prnt_table_err
-       rjmp    mgr_prnt_size
-
-mgr_prnop:
-       rcall   mgr_prnt_diskname
-       rcall   mgr_prnt_image
 
 mgr_prnt_size:
        lcall   print_ultoa
@@ -295,10 +317,17 @@ mgr_prnt_diskname:
        pop     temp
        ret
 
+#if CPMDSK_SUPPORT
 mgr_prnt_table_cpm:
        printstring "CP/M partition at: "
        ret
 
+mgr_prnt_image:
+       printstring "Assuming CP/M image at: "
+       ret
+#endif
+
+#if FAT16_SUPPORT
 mgr_prnt_table_fat:
        printstring "FAT16 File-Image '"
        push    temp
@@ -308,17 +337,16 @@ mgr_prnt_table_fat:
        pop     temp
        printstring "' at: "
        ret
+#endif
 
+#if RAMDISKCNT
 mgr_prnt_table_ram:
        printstring "Ramdisk at: "
        ret
+#endif
 
 mgr_prnt_table_err:
        printstring "Unknown Entry at: "
        ret
 
-mgr_prnt_image:
-       printstring "Assuming CP/M image at: "
-       ret
-