]> cloudbase.mooo.com Git - avrcpm.git/blobdiff - avr/dsk_fat16.asm
* avr/config.inc
[avrcpm.git] / avr / dsk_fat16.asm
index d8b74a2fb16962ff57430aef9af317d231de05a0..5139346cec57d8478a8271d67af535bc7d948127 100644 (file)
 #define FAT16_BSO_NUMFATCP     0x10    ; Offset to Ammount of FAT Copys
 #define FAT16_BSO_NUMDIRENT    0x11    ; Offset to Max. Root Dir. Entrys
 #define        FAT16_FIRST_IMAGENAME   'A'     ; First letter of filename to search 
+#define FAT16_LAST_IMAGENAME    'Z'    ; Last letter of filename to 
+/*
 #define FAT16_LAST_IMAGENAME    'A'+MAXDISKS-1 ; Last letter of filename to 
                                                ; search 
+*/
 
 ; ############################################################################ 
 ;                              Start of Data Segment
@@ -582,7 +585,7 @@ fat_store_new_entry:
 
 ;   Found a valid image
 .if FAT16_DEBUG > 1
-       printstring "Found a valid Image ! Z="
+       printstring "Found a valid Image! Z="
        mov     temp ,zl
        mov     temp2,zh
        rcall   printhexw
@@ -590,14 +593,14 @@ fat_store_new_entry:
 .endif
 
        ldiw    y,hostparttbl
-       lds     temp,ndisks
+       lds     temp3,ndisks
 
 fat_look_store_loop:
-       cp      temp,_0
+       tst     temp3
        breq    fat_look_store
 
        adiw    y,PARTENTRY_SIZE
-       dec     temp
+       dec     temp3
        rjmp    fat_look_store_loop
 
 fat_look_store:
@@ -619,15 +622,24 @@ fat_look_store:
 
 ;   Convert Filesize to ammount of sectors
 ;   (calc with 512byte/sector)
+       ldd     _tmp0,z+0x1C
        ldd     xl,z+0x1D
        ldd     xh,z+0x1E
        ldd     zl,z+0x1F
 ;      mov     zh,_0
 
+       cpse    _tmp0,_0                ;round up
+       adiw    x,1
+       adc     zl,_0
+
        lsr     zl
        ror     xh
        ror     xl
 
+       adc     xl,_0
+       adc     xh,_0
+       adc     zl,_0
+
 ;   store ammount of sectors in partitiontable 
 
        tst     zl                      ;file size larger than 65535 sectors?
@@ -872,7 +884,7 @@ fat_hostparam:
 fat_hostlend:
        lds     temp ,hostlba
        lds     temp2,hostlba+1
-       lds     temp3,hostlba+2
+;      lds     temp3,hostlba+2
 
 
        ldd     xl,z+5                  ; get size of disk in sectors
@@ -1119,3 +1131,5 @@ fat_readhost:
 
 #endif
 
+; vim:set ts=8 noet nowrap
+