Changeset 259 in xtideuniversalbios for trunk/Serial_Server
- Timestamp:
- Feb 23, 2012, 7:14:06 AM (13 years ago)
- google:author:
- gregli@hotmail.com
- Location:
- trunk/Serial_Server
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Serial_Server/library/FlatImage.h
r225 r259 24 24 double sizef; 25 25 FileAccess cf; 26 char sizeChar; 26 27 27 28 size = (unsigned long) p_cyl * (unsigned long) p_sect * (unsigned long) p_head; … … 29 30 log( -1, "'%s', can't create flat file with size greater than %lu 512-byte sectors", name, cf.MaxSectors ); 30 31 sizef = size / 2048.0; // 512 byte sectors -> MB 32 sizeChar = 'M'; 33 if( sizef < 1 ) 34 { 35 sizef *= 1024; 36 sizeChar = 'K'; 37 } 31 38 32 39 if( cf.Create( name ) ) … … 37 44 38 45 if( p_cyl > 1024 ) 39 log( 0, "Created file '%s', size %. 1lf MB", name, sizef);46 log( 0, "Created file '%s', size %.2lf %cB", name, sizef, sizeChar ); 40 47 else 41 log( 0, "Created file '%s', geometry %u:%u:%u, size %. 1lf MB", name, p_cyl, p_sect, p_head, sizef);48 log( 0, "Created file '%s', geometry %u:%u:%u, size %.2lf %cB", name, p_cyl, p_head, p_sect, sizef, sizeChar ); 42 49 cf.Close(); 43 50 } -
trunk/Serial_Server/library/Image.cpp
r258 r259 12 12 #include <stdio.h> 13 13 14 struct floppyInfo { 15 unsigned long size; 16 unsigned char type; 17 unsigned char cylinders; 18 unsigned char heads; 19 unsigned char sectors; 20 } floppyInfos[] = 21 { 22 { 2949120 / 512, 6, 80, 2, 36 }, // 2.88MB 3.5" 23 { 1474560 / 512, 4, 80, 2, 18 }, // 1.44MB 3.5" 24 { 1228800 / 512, 2, 80, 2, 15 }, // 1.2MB 5.25" 25 { 737280 / 512, 3, 80, 1, 18 }, // 720KB 3.5" 26 { 368640 / 512, 1, 40, 2, 9 }, // 360KB 5.25" 27 { 327680 / 512, 0, 40, 2, 8 }, // 320KB 5.25" 28 { 184320 / 512, 0, 40, 1, 9 }, // 180KB 5.25" single sided 29 { 163840 / 512, 0, 40, 1, 8 }, // 160KB 5.25" single sided 30 { 0, 0, 0, 0, 0 } 14 struct floppyInfo floppyInfos[] = 15 { 16 { 1, 2949120 / 512, 6, 80, 2, 36 }, // 2.88MB 3.5" 17 { 0, 2867200 / 512, 6, 80, 2, 36 }, // 2.88MB 3.5" (alternate spelling with 2.8) 18 { 0, 2969600 / 512, 6, 80, 2, 36 }, // 2.88MB 3.5" (alternate spelling with 2.9) 19 { 1, 1474560 / 512, 4, 80, 2, 18 }, // 1.44MB 3.5" 20 { 0, 1433600 / 512, 4, 80, 2, 18 }, // 1.44MB 3.5" (alternate spelling with 1.4) 21 { 1, 1228800 / 512, 2, 80, 2, 15 }, // 1.2MB 5.25" 22 { 1, 737280 / 512, 3, 80, 1, 18 }, // 720KB 3.5" 23 { 1, 368640 / 512, 1, 40, 2, 9 }, // 360KB 5.25" 24 { 1, 327680 / 512, 0, 40, 2, 8 }, // 320KB 5.25" 25 { 1, 184320 / 512, 0, 40, 1, 9 }, // 180KB 5.25" single sided 26 { 1, 163840 / 512, 0, 40, 1, 8 }, // 160KB 5.25" single sided 27 { 0, 0, 0, 0, 0, 0 } 31 28 }; 29 30 struct floppyInfo *FindFloppyInfoBySize( double size ) 31 { 32 struct floppyInfo *fi; 33 34 for( fi = floppyInfos; fi->size != 0 && !(size+5 > fi->size && size-5 < fi->size); fi++ ) ; 35 36 if( fi->size == 0 ) 37 fi = NULL; 38 39 return( fi ); 40 } 32 41 33 42 Image::Image( char *name, int p_readOnly, int p_drive ) … … 69 78 70 79 floppy = 0; 71 for( f = floppyInfos; f->size && f->size != totallba; f++ ) ;80 for( f = floppyInfos; f->size && !(f->size == totallba && f->real); f++ ) ; 72 81 if( f->size ) 73 82 { … … 78 87 p_head = f->heads; 79 88 p_sect = f->sectors; 89 totallba = p_cyl * p_head * p_sect; 80 90 } 81 91 -
trunk/Serial_Server/library/Library.h
r258 r259 15 15 16 16 unsigned short checksum( unsigned short *wbuff, int wlen ); 17 18 struct floppyInfo { 19 unsigned char real; 20 unsigned long size; 21 unsigned char type; 22 unsigned char cylinders; 23 unsigned char heads; 24 unsigned char sectors; 25 }; 26 27 struct floppyInfo *FindFloppyInfoBySize( double size ); 17 28 18 29 class Image -
trunk/Serial_Server/win32/Win32.cpp
r258 r259 30 30 " -n [megabytes] Create new disk with given size or use -g geometry", 31 31 " Maximum size is " USAGE_MAXSECTORS, 32 " Floppy images can also be created, such as \"360K\"", 32 33 " (default is a 32 MB disk, with CHS geometry 65:16:63)", 33 34 "", … … 160 161 if( atol(argv[t+1]) != 0 ) 161 162 { 162 unsigned long size = atol(argv[++t]); 163 sect = 63; 164 head = 16; 165 cyl = (size*1024*2) / (16*63); 163 double size = atof(argv[++t]); 164 struct floppyInfo *fi; 165 char *c; 166 167 size *= 2; 168 for( c = argv[t]; *c && *c != 'k' && *c != 'K'; c++ ) ; 169 if( !(*c) ) 170 size *= 1000; 171 172 if( (fi = FindFloppyInfoBySize( size )) ) 173 { 174 sect = fi->sectors; 175 head = fi->heads; 176 cyl = fi->cylinders; 177 } 178 else 179 { 180 sect = 63; 181 head = 16; 182 cyl = size / (16*63); 183 } 166 184 } 167 185 break;
Note:
See TracChangeset
for help on using the changeset viewer.