X-Git-Url: http://cloudbase.mooo.com/gitweb/avrcpm.git/blobdiff_plain/6421790873fa5bdb8e1d525cac42764faf0f0af3..18938d0cc783a503ea04cdd0d804a87ebf178d33:/dsk_mgr.asm diff --git a/dsk_mgr.asm b/dsk_mgr.asm index 38901cd..e48052c 100644 --- a/dsk_mgr.asm +++ b/dsk_mgr.asm @@ -22,13 +22,16 @@ ; -; ------------------------- Defines for the disk management Structures +;-------------------------- Defines for the disk management Structures ;----------------------------------------------- Start of Data Segment .dseg +; Partition table offsets: +tmp_tbl: + .byte PARTENTRY_SIZE*MAXDISKS ; ------------------------------- Start of Code Segment .cseg @@ -38,10 +41,10 @@ ; ==================================================================== ; Parameters ; -------------------------------------------------------------------- -; Registers : none -; Variables : [w] temp Status of Operation -; (0x80 - Operation Failure ) -; (others - Operation Suceded) +; +; Registers : [w] temp Number of disk images (raw and fat16) found. +; + 0x80 if sd card changes. (not used, doesn't work) +; SREG : Z according to temp ; -------------------------------------------------------------------- ; Description: ; This Function scans an SD-Cards Boot-Sector for valid Partitions. @@ -147,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) @@ -164,8 +174,15 @@ mgr_nextp2: mgr_pend: +#if 0 /* ToDo: ramdisks are not in sd-card partitions */ ; Initialize RAM-Disks rcall rdsk_add_partition +#endif + +; 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. @@ -175,32 +192,37 @@ 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 + mov temp,temp3 + sts ndisks,temp + brtc mgr_pcpe - tst temp - breq mgr_pcpe +; SD card changed. -; SD card not changed. + 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 sbr temp,0x80 mgr_pcpe: + + tst temp ret @@ -221,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 @@ -268,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 @@ -280,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 @@ -310,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