From: Leo Date: Tue, 12 Oct 2010 10:06:30 +0000 (+0000) Subject: * Added detection of simh AltairZ80 Simulator harddisk format. X-Git-Tag: 2.2^2~9 X-Git-Url: http://cloudbase.mooo.com/gitweb/avrcpm.git/commitdiff_plain/b165699b5d330e3d78b2ad87f1f666d2b05882de?hp=1b1f05727b3a29ce854557d3e799f5c6993b06d7 * Added detection of simh AltairZ80 Simulator harddisk format. git-svn-id: svn://cu.loc/avr-cpm/avrcpm/trunk@150 57430480-672e-4586-8877-bcf8adbbf3b7 --- diff --git a/avr/dsk_fat16.asm b/avr/dsk_fat16.asm index d8b74a2..6a73bc4 100644 --- a/avr/dsk_fat16.asm +++ b/avr/dsk_fat16.asm @@ -619,15 +619,24 @@ fat_look_store: ; Convert Filesize to ammount of sectors ; (calc with 512byte/sector) + ldd _tmp0,z+0x1C ldd xl,z+0x1D ldd xh,z+0x1E ldd zl,z+0x1F ; mov zh,_0 + cpse _tmp0,_0 ;round up + adiw x,1 + adc zl,_0 + lsr zl ror xh ror xl + adc xl,_0 + adc xh,_0 + adc zl,_0 + ; store ammount of sectors in partitiontable tst zl ;file size larger than 65535 sectors? diff --git a/avr/dsk_fsys.asm b/avr/dsk_fsys.asm index 484a0e2..2bf9d80 100644 --- a/avr/dsk_fsys.asm +++ b/avr/dsk_fsys.asm @@ -364,8 +364,6 @@ dpbdat_avrcpm: ;(dpb243) .db 0x10,0x00 ;chk size .db 0x02,0x00 ;offset - - dpbdat_myz80: ; .db 0x02,0x80 ;sector offset, low(spt) .db 0x00,0x05 ;high (spt), block shift @@ -376,6 +374,16 @@ dpbdat_myz80: ; .db 0x00,0x01 ;chk size .db 0x00,0x00 ;offset +dpbdat_simhd: ; + .db 0x00,0x20 ;sector offset, low(spt) + .db 0x00,0x05 ;high (spt), block shift + .db 0x1F,0x01 ;bock mask, extent mask + .db 0xF9,0x07 ;disk size - 1, + .db 0xFF,0x03 ;dir max + .db 0xFF,0x00 ;alloc0, alloc1 + .db 0x00,0x01 ;chk size + .db 0x06,0x00 ;offset + #if 0 ;rd1016 .db 0x20,0x00 ;spt @@ -611,18 +619,16 @@ dsk_tyze_not: ; ; -------------------------------------------------------------------- ; Description: Test, if first 2 Sectors are filled with 0xE5, -; and Size = 8192 KB. +; and Size = 8192KB + 256Bytes. ; ==================================================================== dsk_tst_myz80: mov zl,temp3 rcall dsk_getpartentry ;get partition entry ldd temp,z+PTAB_SIZE - ldd temp2,z+PTAB_SIZE+1 ;check, if (rounded) size is 8192KB - lsr temp2 - ror temp - cpi temp,low(8192) - ldi temp,high(8192) + ldd temp2,z+PTAB_SIZE+1 ;check, if size is 16385 phys. sectors + cpi temp,low(16385) + ldi temp,high(16385) cpc temp2,temp brne dsk_tmyz80_not ;wrong size @@ -643,6 +649,50 @@ dsk_tmyz80_not: ori temp,0xff ;Not a MyZ80 hard disk image. ret +; ==================================================================== +; Function: Test disk format: simhd, simh altair 8800 hard disk format +; ==================================================================== +; Parameters +; -------------------------------------------------------------------- +; Registers : temp drive # +; +; -------------------------------------------------------------------- +; Description: Test, if first 6 tracks are filled with 0xE5, +; and Size = 8192 KB. +; Actually, only the first phys. sector is tested, since +; the other 47 sectors are not in memory at this time. +; ==================================================================== +dsk_tst_simhd: + + mov zl,temp3 + rcall dsk_getpartentry ;get partition entry + ldd temp,z+PTAB_SIZE + ldd temp2,z+PTAB_SIZE+1 ;check, if size is 16384 phys. sectors + cpi temp,low(16384) + ldi temp,high(16384) + cpc temp2,temp + brne dsk_tsimhd_not ;wrong size + + ldiw z,hostbuf + ldi temp2,high(512) + clr _tmp0 ;low(512) + +dsk_tsimhd_loop: + ld temp,z+ + cpi temp,0xE5 + brne dsk_tsimhd_not + dec _tmp0 + brne dsk_tsimhd_loop + dec temp2 + brne dsk_tsimhd_loop + + clr temp + ret + +dsk_tsimhd_not: + ori temp,0xff ;Not a simhd hard disk image. + ret + ; ==================================================================== ; Function: ; ==================================================================== @@ -680,6 +730,12 @@ dsk_img_type: rcall dsk_tst_yaze breq dsk_img_prep +; Test for simhd format. + + rcall dsk_tst_simhd + ldiw z,dpbdat_simhd*2 + breq dsk_img_fix + ; Test for MyZ80 format. rcall dsk_tst_myz80