]> cloudbase.mooo.com Git - avrcpm.git/commitdiff
git-svn-id: svn://cu.loc/avr-cpm/trunk/avrcpm/avr@116 57430480-672e-4586-8877-bcf8adb...
authorFrank Zoll <fzoll@web.de>
Tue, 5 Oct 2010 11:42:36 +0000 (11:42 +0000)
committerFrank Zoll <fzoll@web.de>
Tue, 5 Oct 2010 11:42:36 +0000 (11:42 +0000)
dsk_fat16.asm

index 0a7510a7a9fb0242a7f07968633976e2fc876230..4d2683d7b247e057f8cdd9a27c9b83508154d88c 100644 (file)
        .dseg
 
 fat_partfound:   .byte   1     ; (partition: 0= no found 1=found )
-fat_parttbl:    .byte   8      ; first fat16 partition entry \r
-                               ; (start sector, sector count)
-;fat_sectorsize:  .byte   2    ; size of sector in bytes
+fat_parttbl:    .byte   4      ; first fat16 partition entry \r
+                               ; only startsector is needed
 fat_clustersize: .byte   1     ; sectors per cluster
-fat_ressectors:  .byte   2     ; number of reserved sectors
-fat_secperfat:   .byte   2     ; number of sectors per fat
-fat_numfatcp:    .byte   1     ; number of FAT Copies
 fat_numdirentrys:.byte   2     ; Max. num. of entrys within Rootdirektory
 fat_ptr2fat:     .byte   4     ; pointer to the first fat sector
-fat_ptr2dir:     .byte   4     ; pointer to the first root directory sector
 fat_ptr2dat:     .byte   4     ; pointer to the first data sector
 
 /*These variables define a cache that holds the last Cluster and Sector\r
@@ -177,15 +172,16 @@ fat_add_partition:
        st      y+,temp
        ldd     temp,z+PART_START+3
        st      y+,temp
-       
-       ldd     temp,z+PART_SIZE
-       st      y+,temp
-       ldd     temp,z+PART_SIZE+1
-       st      y+,temp
-       ldd     temp,z+PART_SIZE+2
-       st      y+,temp
-       ldd     temp,z+PART_SIZE+3
-       st      y+,temp
+\r
+; Don't need the Size of the Partition for use with Imagefiles
+;      ldd     temp,z+PART_SIZE
+;      st      y+,temp
+;      ldd     temp,z+PART_SIZE+1
+;      st      y+,temp
+;      ldd     temp,z+PART_SIZE+2
+;      st      y+,temp
+;      ldd     temp,z+PART_SIZE+3
+;      st      y+,temp
 
 
 ;   reload variables from stack
@@ -256,21 +252,6 @@ fat_bootblock_check:
        printnewline
 .endif
 
-; Not needed / used by now because size of Sectors fixed at 512 Bytes
-;   Get ammount of Bytes per Sector
-;      ldiw    z,hostbuf+FAT16_BSO_SECSIZE
-;      ldiw    y,fat_sectorsize
-;      ld          temp,z
-;      st      y+, temp
-;      ldd         temp2,z+1
-;      st      y , temp2
-;
-;.if FAT16_DEBUG > 0
-;      printstring "Bytes per Sector ",0
-;      rcall printhexw
-;      printnewline
-;.endif
-
 ;      get sectors per cluster from bootblock
        ldiw    z,hostbuf+FAT16_BSO_CLUSTSZ
        ld      temp,z
@@ -282,36 +263,10 @@ fat_bootblock_check:
        printnewline
 .endif
 
-;      get num of reseved sectors from bootblock
-       ldiw    z,hostbuf+FAT16_BSO_RESSECT
-       ld      temp,z+
-       sts     fat_ressectors,temp             ; low byte
-       ld      temp2,z
-       sts     fat_ressectors+1,temp2          ; high byte
-
-.if FAT16_DEBUG > 0
-       printstring "Reserved Sectors__: ",0
-       rcall printhexw
-       printnewline
-.endif
-
-;      get num of sectors per FAT-Table from bootblock
-       ldiw    z,hostbuf+FAT16_BSO_SECPERFAT
-       ld      temp,z+
-       sts     fat_secperfat,temp              ; low byte
-       ld      temp2,z
-       sts     fat_secperfat+1,temp2           ; high byte
-
-.if FAT16_DEBUG > 0
-       printstring "Sectors per FAT__: ",0
-       rcall printhexw
-       printnewline
-.endif
-
 ;      get num of FAT Tables from bootblock
        ldiw    z,hostbuf+FAT16_BSO_NUMFATCP
        ld      temp,z
-       sts     fat_numfatcp,temp               ; low byte
+       sts     fat_last_dsk,temp               ; low byte
 
 .if FAT16_DEBUG > 0
        printstring "Ammount of FAT copies: ",0
@@ -350,11 +305,26 @@ fat_bootblock_check:
        rcall   printhexw
        printnewline
 .endif
+\r
+;      get num of sectors per FAT-Table from bootblock
+       ldiw    z,hostbuf+FAT16_BSO_SECPERFAT
+       ld      temp,z+
+       sts     fat_log_clust,temp              ; low byte
+       ld      temp2,z
+       sts     fat_log_clust+1,temp2           ; high byte
 
+.if FAT16_DEBUG > 0
+       printstring "Sectors per FAT__: ",0
+       rcall printhexw
+       printnewline
+.endif\r
+\r
+;      get num of reseved sectors from bootblock
+       ldiw    z,hostbuf+FAT16_BSO_RESSECT
+       ld      temp,z+
+       ld      temp2,z
+\r
 ;      Calculate begin of FAT within the Volume
-       lds     temp ,fat_ressectors
-       lds     temp2,fat_ressectors+1
-
        ldiw    z,fat_parttbl   
        ldd     xl,z+0          
        ldd     xh,z+1
@@ -389,9 +359,9 @@ fat_bootblock_check:
        ldd     yl,z+2
        ldd     yh,z+3
 
-       lds     temp ,fat_secperfat
-       lds     temp2,fat_secperfat+1
-       lds     temp3,fat_numfatcp
+       lds     temp ,fat_log_clust
+       lds     temp2,fat_log_clust+1
+       lds     temp3,fat_last_dsk
 
 fat_calc_dp_loop:
        cp      temp3,_0
@@ -407,10 +377,10 @@ fat_calc_dp_loop:
        jmp     fat_calc_dp_loop
 fat_calc_dp_lend:
 
-       sts     fat_ptr2dir  ,xl
-       sts     fat_ptr2dir+1,xh
-       sts     fat_ptr2dir+2,yl
-       sts     fat_ptr2dir+3,yh
+       sts     fat_clust_ptr  ,xl
+       sts     fat_clust_ptr+1,xh
+       sts     fat_clust_ptr+2,yl
+       sts     fat_clust_ptr+3,yh
 
 
 .if FAT16_DEBUG > 1
@@ -442,10 +412,10 @@ fat_calc_dp_lend:
        lsr     zh
        ror     zl
 
-       lds     xl,fat_ptr2dir
-       lds     xh,fat_ptr2dir+1
-       lds     yl,fat_ptr2dir+2
-       lds     yh,fat_ptr2dir+3
+       lds     xl,fat_clust_ptr
+       lds     xh,fat_clust_ptr+1
+       lds     yl,fat_clust_ptr+2
+       lds     yh,fat_clust_ptr+3
 
        add     xl,zl
        adc     xh,zh
@@ -489,10 +459,10 @@ fat_scan_for_next_image:
 \r
 fat_next_sector_loop:\r
 ;   Get a Pointer to the first Directory sector\r
-       lds     xl,fat_ptr2dir
-       lds     xh,fat_ptr2dir+1
-       lds     yl,fat_ptr2dir+2
-       lds     yh,fat_ptr2dir+3
+       lds     xl,fat_clust_ptr
+       lds     xh,fat_clust_ptr+1
+       lds     yl,fat_clust_ptr+2
+       lds     yh,fat_clust_ptr+3
 
 ;      Add actual offset\r
        lds     temp,fat_clust_offset\r