From: Frank Zoll Date: Thu, 7 Oct 2010 18:01:58 +0000 (+0000) Subject: git-svn-id: svn://cu.loc/avr-cpm/branches/fat16-test@132 57430480-672e-4586-8877... X-Git-Tag: 2.0-fat16-1~2 X-Git-Url: http://cloudbase.mooo.com/gitweb/avrcpm.git/commitdiff_plain/18938d0cc783a503ea04cdd0d804a87ebf178d33 git-svn-id: svn://cu.loc/avr-cpm/branches/fat16-test@132 57430480-672e-4586-8877-bcf8adbbf3b7 --- diff --git a/dsk_fat16.asm b/dsk_fat16.asm index 42c3ae0..b0e9be1 100644 --- a/dsk_fat16.asm +++ b/dsk_fat16.asm @@ -36,7 +36,8 @@ ; 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. @@ -49,7 +50,8 @@ #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 diff --git a/dsk_mgr.asm b/dsk_mgr.asm index 4b108a3..e48052c 100644 --- a/dsk_mgr.asm +++ b/dsk_mgr.asm @@ -150,14 +150,21 @@ mgr_ploop2: ; Get Partitiontype ldd temp,z+PART_TYPE -; Test for FAT Partition - cpi temp,PARTID_FAT16 +; Test for FAT Partition Type 1 + cpi temp,PARTID1_FAT16 + brne mgr_nextp1 + + rcall fat_add_partition + rjmp mgr_pend + +; Test for FAT Partition Type 2 +mgr_nextp1: + cpi temp,PARTID2_FAT16 brne mgr_nextp2 - rcall fat_add_partition + rcall fat_add_partition + rjmp mgr_pend - rjmp mgr_pend - mgr_nextp2: adiw zl,16 cpi zl,low(hostbuf+510) @@ -172,11 +179,10 @@ mgr_pend: rcall rdsk_add_partition #endif -/* - Don't use change info. It doesn't word reliably with partitions, - and it doesn't work at all with fat images: -*/ -#define CHANGEINFO 0 +; Save ammount of found CP/M Partitions + sts ndisks,temp3 + tst temp3 + breq mgr_fat ;Store new partitions and check if the SD card has been changed. @@ -186,36 +192,36 @@ mgr_pend: clt mgr_pcpl: - ld temp,y+ - ld temp2,z - st z+,temp + ld temp,y+ + ld temp2,z + st z+,temp cpse temp,temp2 set - dec temp4 + dec temp4 brne mgr_pcpl - mov temp,temp3 - sts ndisks,temp -#if CHANGEINFO + mov temp,temp3 + sts ndisks,temp + brtc mgr_pcpe ; SD card changed. -#endif - tst temp - breq mgr_pcpe + tst temp + breq mgr_pcpe +mgr_fat: #if FAT16_SUPPORT rcall fat_scan_partition - rcall fat_reset_cache + rcall fat_reset_cache #endif + lds temp,ndisks -#if CHANGEINFO sbr temp,0x80 -#endif mgr_pcpe: + tst temp ret @@ -237,19 +243,19 @@ mgr_prnt_parttbl: lds yl,ndisks ldi xh,'A' -pprl: - ldd temp ,z+1 ;Get partition start - ldd temp2,z+2 - ldd temp3,z+3 - ldd temp4,z+4 +pprl: + ldd temp ,z+1 ;Get partition start + ldd temp2,z+2 + ldd temp3,z+3 + ldd temp4,z+4 printnewline - cp temp,_0 ;If zero ... - cpc temp2,_0 - cpc temp3,_0 - cpc temp4,_0 - breq mgr_prnop ;... no partition table at 0 + cp temp,_0 ;If zero ... + cpc temp2,_0 + cpc temp3,_0 + cpc temp4,_0 + breq mgr_prnop ;... no partition table at 0 ; Partitiontype examining ldd xl,z+0 @@ -284,7 +290,7 @@ mgr_prnop: rcall mgr_prnt_image mgr_prnt_size: - call print_ultoa + call print_ultoa printstring ", size: " ldd temp ,z+5 ;Get partition size @@ -296,15 +302,15 @@ mgr_prnt_size: ror temp3 ror temp2 ror temp - call print_ultoa + call print_ultoa printstring "KB." mgr_goto_next_part: adiw z,PARTENTRY_SIZE - inc xh + inc xh dec yl tst yl - brne pprl + brne pprl mgr_pppre: ret @@ -326,9 +332,9 @@ mgr_prnt_fatsize: mgr_prnt_diskname: push temp - mov temp,xh + mov temp,xh call uartputc - ldi temp,':' + ldi temp,':' call uartputc pop temp ret diff --git a/init.asm b/init.asm index de576a8..4ffff96 100644 --- a/init.asm +++ b/init.asm @@ -227,11 +227,21 @@ boot_ipl2: ; Read first sector of first CP/M partition (ipl) - lds xl,hostparttbl+1 - lds xh,hostparttbl+2 - lds yl,hostparttbl+3 - lds yh,hostparttbl+4 - rcall mmcReadSect +; lds xl,hostparttbl+1 +; lds xh,hostparttbl+2 +; lds yl,hostparttbl+3 +; lds yh,hostparttbl+4 +; rcall mmcReadSect + +; Disk 0 + sts seekdsk,_0 +; Track 0 + sts seektrk,_0 + sts seektrk+1,_0 +; Sector 0 + sts seeksec,_0 + + rcall dsk_read ; rcall dsk_cboot ;init (de)blocking buffer