X-Git-Url: http://cloudbase.mooo.com/gitweb/avrcpm.git/blobdiff_plain/09fb1250adc484929f0e0ed9df942ad6560aacdf..18938d0cc783a503ea04cdd0d804a87ebf178d33:/dsk_mgr.asm diff --git a/dsk_mgr.asm b/dsk_mgr.asm index 8086d2f..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,31 +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 #endif + lds temp,ndisks sbr temp,0x80 mgr_pcpe: + + tst temp ret @@ -217,19 +240,29 @@ mgr_pcpe: mgr_prnt_parttbl: ldiw z,hostparttbl -pprl: -; Partitiontype examining + lds yl,ndisks + ldi xh,'A' - ldd xl,z+0 -; Empty slot? - cpi xl,dskType_None - breq mgr_goto_next_part +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 + +; Partitiontype examining + ldd xl,z+0 ; CP/M ? cpi xl,dskType_CPM brne mgr_prtb_nocpm + rcall mgr_prnt_diskname rcall mgr_prnt_table_cpm rjmp mgr_prnt_size @@ -237,12 +270,14 @@ pprl: mgr_prtb_nocpm: cpi xl,dskType_FAT brne mgr_prtb_nofat + rcall mgr_prnt_diskname rcall mgr_prnt_table_fat rjmp mgr_prnt_size ; RAMDISK ? mgr_prtb_nofat: cpi xl,dskType_RAM brne mgr_prnt_err + rcall mgr_prnt_diskname rcall mgr_prnt_table_ram rjmp mgr_prnt_size ; Entry Error @@ -251,14 +286,11 @@ mgr_prnt_err: rjmp mgr_prnt_size mgr_prnop: + rcall mgr_prnt_diskname rcall mgr_prnt_image mgr_prnt_size: - ldd temp ,z+1 ;Get partition start - ldd temp2,z+2 - ldd temp3,z+3 - ldd temp4,z+4 - lcall print_ultoa + call print_ultoa printstring ", size: " ldd temp ,z+5 ;Get partition size @@ -270,15 +302,15 @@ mgr_prnt_size: ror temp3 ror temp2 ror temp - lcall print_ultoa + call print_ultoa printstring "KB." mgr_goto_next_part: adiw z,PARTENTRY_SIZE - ldi temp,high(hostparttbltop) - cpi zl, low (hostparttbltop) - cpc zh,temp - brlo pprl + inc xh + dec yl + tst yl + brne pprl mgr_pppre: ret @@ -298,6 +330,15 @@ mgr_prnt_fatsize: rjmp mgr_goto_next_part +mgr_prnt_diskname: + push temp + mov temp,xh + call uartputc + ldi temp,':' + call uartputc + pop temp + ret + mgr_prnt_table_cpm: printstring "CP/M partition at: " ret