- Timestamp:
- Feb 23, 2012, 7:14:06 AM (13 years ago)
- google:author:
- gregli@hotmail.com
- Location:
- trunk
- Files:
-
- 8 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; -
trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrint.asm
r258 r259 23 23 mov bp, sp 24 24 25 call RamVars_IsDriveHandledByThisBIOS 25 call RamVars_IsDriveHandledByThisBIOS_And_FindDPT_ForDriveNumber 26 26 jc .notOurs 27 27 28 call FindDPT_ForDriveNumber ; if it is one of ours, print the string in bootnfo29 28 call BootMenuInfo_ConvertDPTtoBX 30 29 mov si, g_szDriveNumBOOTNFO ; special g_szDriveNum that prints from BDA … … 112 111 mov si, g_szCapacity ; Setup print string now, carries through to print call 113 112 114 xor di, di 115 call RamVars_IsDriveHandledByThisBIOS 116 jc SHORT .notours 117 call FindDPT_ForDriveNumber ; DS:DI to point DPT 118 .notours: 119 113 xor di, di ; Zero DI for checks for our drive later on 114 call RamVars_IsDriveHandledByThisBIOS_And_FindDPT_ForDriveNumber 115 120 116 test dl, dl ; are we a hard disk? 121 js BootMenuPrint_HardDiskRefreshInformation 122 123 test di, di124 jnz .ours 117 js BootMenuPrint_HardDiskRefreshInformation 118 119 test di, di 120 jnz .ours ; Based on CF from RamVars_IsDriveHandledByThisBIOS above 125 121 call FloppyDrive_GetType ; Get Floppy Drive type to BX 126 122 jmp .around … … 187 183 ; BootMenuPrint_HardDiskMenuitemInformation 188 184 ; Parameters: 189 ; DL: Untranslated Hard Disk number190 185 ; DS: RAMVARS segment 191 186 ; Returns: … … 196 191 ALIGN JUMP_ALIGN 197 192 BootMenuPrint_HardDiskRefreshInformation: 198 test di, di193 test di, di 199 194 jz .HardDiskMenuitemInfoForForeignDrive 200 195 201 196 .HardDiskMenuitemInfoForOurDrive: 202 ePUSH_T ax, g_szInformation 203 204 ; Get and push total LBA size 205 call BootMenuInfo_GetTotalSectorCount 197 ePUSH_T ax, g_szInformation ; Add substring for our hard disk information 198 call BootMenuInfo_GetTotalSectorCount ; Get Total LBA Size 206 199 jmp .ConvertSectorCountInBXDXAXtoSizeAndPushForFormat 207 200 -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH0h_HReset.asm
r258 r259 22 22 eMOVZX bx, dl ; Copy requested drive to BL, zero BH to assume no errors 23 23 call ResetFloppyDrivesWithInt40h 24 25 %ifdef MODULE_SERIAL_FLOPPY 26 ; 27 ; "Reset" emulatd serial floppy drives, if any. There is nothing to actually do for this reset, 28 ; but record the proper error return code if one of these floppy drives is the drive requested. 29 ; 30 call RamVars_UnpackFlopCntAndFirstToAL 31 cbw ; Clears AH (there are flop drives) or ffh (there are not) 32 ; Either AH has success code (flop drives are present) 33 ; or it doesn't matter because we won't match drive ffh 34 35 cwd ; clears DX (there are flop drives) or ffffh (there are not) 36 37 adc dl, al ; second drive (CF set) if present 38 ; If no drive is present, this will result in ffh which 39 ; won't match a drive 40 call BackupErrorCodeFromTheRequestedDriveToBH 41 mov dl, al ; We may end up doing the first drive twice (if there is 42 call BackupErrorCodeFromTheRequestedDriveToBH ; only one drive), but doing it again is not harmful. 43 %endif 44 45 test bl, bl ; If we were called with a floppy disk, then we are done, 46 jns SHORT .SkipHardDiskReset ; don't do hard disks. 47 24 48 call ResetForeignHardDisks 25 49 call AH0h_ResetHardDisksHandledByOurBIOS … … 129 153 jb SHORT .DriveResetLoop ; If not, reset next drive 130 154 .AllDrivesReset: 131 %ifdef MODULE_SERIAL_FLOPPY 132 ; 133 ; "Reset" emulatd serial floppy drives, if any. There is nothing to actually do for this reset, 134 ; but record the proper error return code if one of these floppy drives is the drive requested. 135 ; 136 call RamVars_UnpackFlopCntAndFirstToAL 137 138 cbw ; Clears AH (there are flop drives) or ffh (there are not) 139 ; Either AH has success code (flop drives are present) 140 ; or it doesn't matter because we won't match drive ffh 141 142 cwd ; clears DX (there are flop drives) or ffffh (there are not) 143 144 adc dl, al ; second drive (CF set) if present 145 ; If no drive is present, this will result in ffh which 146 ; won't match a drive 147 call BackupErrorCodeFromTheRequestedDriveToBH 148 mov dl, al ; We may end up doing the first drive twice (if there is 149 jmp BackupErrorCodeFromTheRequestedDriveToBH ; only one drive), but doing it again is not harmful. 150 %else 151 ret 152 %endif 153 155 ret 156 157 154 158 ;-------------------------------------------------------------------- 155 159 ; .BackupErrorCodeFromMasterOrSlaveToBH -
trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm
r258 r259 72 72 .StoreDptPointersToIntVectors: 73 73 mov dl, 80h 74 call RamVars_IsDriveHandledByThisBIOS 74 call RamVars_IsDriveHandledByThisBIOS_And_FindDPT_ForDriveNumber ; DPT to DS:DI 75 75 jc SHORT .FindForDrive81h ; Store nothing if not our drive 76 call FindDPT_ForDriveNumber ; DPT to DS:DI77 76 mov [es:HD0_DPT_POINTER_41h*4], di 78 77 mov [es:HD0_DPT_POINTER_41h*4+2], ds 79 78 .FindForDrive81h: 80 79 inc dx 81 call RamVars_IsDriveHandledByThisBIOS 80 call RamVars_IsDriveHandledByThisBIOS_And_FindDPT_ForDriveNumber 82 81 jc SHORT .ResetDetectedDrives 83 call FindDPT_ForDriveNumber84 82 mov [es:HD1_DPT_POINTER_46h*4], di 85 83 mov [es:HD1_DPT_POINTER_46h*4+2], ds -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.asm
r258 r259 23 23 add al, [RAMVARS.xlateVars+XLATEVARS.bFlopCreateCnt] 24 24 %endif 25 xchg ax, dx 26 ; Fall to FindDPT_ForDriveNumber 27 25 xchg ax, dx 26 ; fall-through to FindDPT_ForDriveNumber 28 27 29 28 ;-------------------------------------------------------------------- … … 66 65 xchg di, ax ; Restore AX and put result in DI 67 66 pop dx 68 ret 67 68 ret 69 70 ;-------------------------------------------------------------------- 71 ; Consolidator for checking the result from RamVars_IsDriveHandledByThisBIOS 72 ; and then if it is our drive, getting the DPT with FindDPT_ForDriveNumber 73 ; 74 ; RamVars_IsDriveHandledByThisBIOS_And_FindDPT_ForDriveNumber 75 ; Parameters: 76 ; DL: Drive number 77 ; DS: RAMVARS segment 78 ; Returns: 79 ; DS:DI: Ptr to DPT, if it is our drive 80 ; CF: Set if not our drive, clear if it is our drive 81 ; Corrupts registers: 82 ; Nothing 83 ;-------------------------------------------------------------------- 84 ALIGN JUMP_ALIGN 85 RamVars_IsDriveHandledByThisBIOS_And_FindDPT_ForDriveNumber: 86 call RamVars_IsDriveHandledByThisBIOS 87 jnc FindDPT_ForDriveNumber 88 ret 89 69 90 70 91 ;-------------------------------------------------------------------- … … 212 233 push cx 213 234 214 mov cl, [RAMVARS.bDrvCnt]215 mov ch, 0216 217 235 mov di, RAMVARS_size ; Point DS:DI to first DPT 218 236 219 jcxz .NotFound ; Return if no drives 237 mov cl, [RAMVARS.bDrvCnt] 238 xor ch, ch ; Clears CF 239 240 jcxz .AllDptsIterated ; Return if no drives, CF will be clear from xor above 220 241 221 242 ALIGN JUMP_ALIGN … … 223 244 call si ; Is wanted DPT? 224 245 jc SHORT .AllDptsIterated ; If so, return 225 add di, BYTE LARGEST_DPT_SIZE ; Point to next DPT 246 add di, BYTE LARGEST_DPT_SIZE ; Point to next DPT, clears CF 226 247 loop .LoopWhileDPTsLeft 227 228 .NotFound: 229 clc ; Clear CF since DPT not found 248 249 ; fall-through: DPT was not found, CF is already clear from ADD di inside the loop 230 250 231 251 ALIGN JUMP_ALIGN … … 233 253 pop cx 234 254 ret 255
Note:
See TracChangeset
for help on using the changeset viewer.