; Defines for FAT16 Structures
; ############################################################################
-#define PARTID_FAT16 0x0E
+#define PARTID1_FAT16 0x0E
+#define PARTID2_FAT16 0x06
/*These are the Offsets to the Variables within the Bootsector of a FAT16
Partition.
#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 search
+#define FAT16_LAST_IMAGENAME 'A'+MAXDISKS-1 ; Last letter of filename to
+ ; search
; ############################################################################
; Start of Data Segment
fat_last_dsk: .byte 1 ; number of disk with entry in cache
fat_log_clust: .byte 2 ; last searched logical cluster
fat_clust_offset: .byte 1 ; offset within the cluster
-fat_clust_ptr: .byte 4; ; sector of last real cluster
+fat_clust_ptr: .byte 4 ; sector of last real cluster
+/* This Variable is only needed within the scanning of the directory
+for tempoary variable storage.. todo: optimize away :-) */
+fat_temp: .byte 3 ; for tempoary use
; ############################################################################
; Start of Code Segment
fat_add_partition:
.if FAT16_DEBUG > 0
- printstring "fat16 part found",0
+ printstring "fat16 part found"
printnewline
.endif
fat_scan_partition:
.if FAT16_DEBUG > 0
- printstring "fat16 scanning",0
+ printstring "fat16 scanning"
printnewline
.endif
.if FAT16_DEBUG > 0
- printstring "free entrys in ptable ?",0
+ printstring "free entrys in ptable ?"
printnewline
.endif
breq fat_scan_error
.if FAT16_DEBUG > 0
- printstring "read fat bootblock.",0
+ printstring "read fat bootblock."
printnewline
.endif
fat_bootblock_check:
.if FAT16_DEBUG > 0
- printstring "fat16 bootblock check",0
+ printstring "fat16 bootblock check"
printnewline
.endif
sts fat_clustersize,temp
.if FAT16_DEBUG > 0
- printstring "Sectors per Cluster ",0
+ printstring "Sectors per Cluster "
rcall printhex
printnewline
.endif
sts fat_last_dsk,temp ; low byte
.if FAT16_DEBUG > 0
- printstring "Ammount of FAT copies: ",0
+ printstring "Ammount of FAT copies: "
rcall printhex
printnewline
.endif
sts fat_numdirentrys+1,temp2 ; high byte
.if FAT16_DEBUG > 0
- printstring "Max. entrys in Rootdir.: ",0
+ printstring "Max. entrys in Rootdir.: "
rcall printhexw
printnewline
.endif
ldd yl,z+2
ldd yh,z+3
- printstring "Begin of Volume at: ",0
+ printstring "Begin of Volume at: "
mov temp ,yl
mov temp2,yh
rcall printhexw
sts fat_log_clust+1,temp2 ; high byte
.if FAT16_DEBUG > 0
- printstring "Sectors per FAT__: ",0
+ printstring "Sectors per FAT__: "
rcall printhexw
printnewline
.endif
sts fat_ptr2fat+3,yh
.if FAT16_DEBUG > 1
- printstring "Begin of FAT at___: ",0
+ printstring "Begin of FAT at___: "
mov temp ,yl
mov temp2,yh
rcall printhexw
.if FAT16_DEBUG > 1
- printstring "Begin of DIR at___: ",0
+ printstring "Begin of DIR at___: "
mov temp ,yl
mov temp2,yh
rcall printhexw
sts fat_ptr2dat+3,yh
.if FAT16_DEBUG > 1
- printstring "Begin of Data at__: ",0
+ printstring "Begin of Data at__: "
mov temp ,yl
mov temp2,yh
rcall printhexw
cpi temp,'G'
brne fat_look_not_ok
- sts fat_clust_ptr ,zl
- sts fat_clust_ptr+1,zh
- sts fat_clust_ptr+2,temp2
+ sts fat_temp ,zl
+ sts fat_temp+1,zh
+ sts fat_temp+2,temp2
rjmp fat_store_new_entry
fat_scan_for_more:
- lds zl ,fat_clust_ptr
- lds zh ,fat_clust_ptr+1
- lds temp2,fat_clust_ptr+2
+ lds zl ,fat_temp
+ lds zh ,fat_temp+1
+ lds temp2,fat_temp+2
fat_look_not_ok:
adiw z,32
; Found a valid image
.if FAT16_DEBUG > 1
- printstring "Found a valid Image ! Z=",0
+ printstring "Found a valid Image ! Z="
mov temp ,zl
mov temp2,zh
rcall printhexw
rcall fat_gethostsec
- printstring "Begin of Image at: ",0
+ printstring "Begin of Image at: "
mov temp ,yl
mov temp2,yh
rcall printhexw
ldd yh,z+2
.if FAT16_DBG_FAT > 0
- printstring "Search log. Cluster ",0
+ printstring "Search log. Cluster "
mov temp,xl
mov temp2,xh
lcall printhexw
printnewline
- printstring "Search phys. Cluster ",0
+ printstring "Search phys. Cluster "
mov temp ,yl
mov temp2,yh
lcall printhexw
fat_found_phsy_clust:
.if FAT16_DBG_FAT > 0
- printstring "Found phys. Cluster at:",0
+ printstring "Found phys. Cluster at:"
mov temp,yl
mov temp2,yh
lcall printhexw
; Found the physical sector
.if FAT16_DBG_FAT > 0
- printstring "Found phys. Sector at:",0
+ printstring "Found phys. Sector at:"
mov temp,yl
mov temp2,yh
lcall printhexw
; Found the physical sector
.if FAT16_DBG_FAT > 0
- printstring "Sector with Offset at:",0
+ printstring "Sector with Offset at:"
mov temp,yl
mov temp2,yh
lcall printhexw