Changeset 521 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src
- Timestamp:
- Mar 10, 2013, 3:46:59 PM (12 years ago)
- google:author:
- aitotat@gmail.com
- Location:
- trunk/XTIDE_Universal_BIOS/Src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH0h_HReset.asm
r520 r521 119 119 jz SHORT .ErrorCodeNotUsed 120 120 mov bl, [di+DPT.bIdevarsOffset] ; replace drive number with Idevars pointer for cmp with dl 121 .ErrorCodeNotUsed: 122 123 mov si, ControllerResetForDPTinDSDI 124 call .CallSIforEveryController ; Reset all drives to power on settings 125 mov si, ControllerInitForMasterOrSingleDPTinDSDI 126 ; Fall to .CallSIforEveryController ; Initialize all controllers (Master and Slave drives) 127 128 .CallSIforEveryController: ; BH will be garbage on exit if this entry point is used, 121 .ErrorCodeNotUsed: ; BH will be garbage on exit if this entry point is used, 129 122 ; but reset of all drives will still happen 130 131 123 mov dl, ROMVARS.ideVars0 ; starting Idevars offset 132 124 … … 139 131 140 132 .loop: 141 push si 142 call FindDPT_ForIdevarsOffsetInDL ; look for the first drive on this controller, if any 143 pop si 144 jc SHORT .notFound 133 call FindDPT_MasterOrSingleForIdevarsOffsetInDL 134 jc SHORT .ControllerNotAvailable 145 135 146 push bx 136 ; Reset controller (both Master and Slave Drive). We ignore error codes 137 ; here since initialization is the one that matters. 147 138 push cx 148 139 push dx 149 call si ; Reset Master AND Slave or initialize Master OR Slave drive 140 push bx 141 %ifdef MODULE_IRQ 142 call Interrupts_UnmaskInterruptControllerForDriveInDSDI 143 %endif 144 call Device_ResetMasterAndSlaveController 145 %ifdef MODULE_ADVANCED_ATA 146 call AdvAtaInit_InitializeControllerForDPTinDSDI 147 %endif 148 pop bx 150 149 pop dx 150 151 ; Initialize Master Drive 152 call AH9h_InitializeDriveForUse ; Initialize Master drive 153 call BackupErrorCodeFromTheRequestedDriveToBH 154 155 ; Initialize Slave Drive 156 call FindDPT_SlaveForIdevarsOffsetInDL 157 jc SHORT .SlaveDriveNotAvailable 158 call AH9h_InitializeDriveForUse 159 ; Here we have a small problem. Since DL now has offset to IDEVARS, it will be the same 160 ; for both Master and Slave Drive. We simply ignore error from slave drive reset since most 161 ; systems do not have slave drives at all and it is unlikely that AH=00h would be called for 162 ; specific drive anyway. AH=Dh is for that. 163 164 .SlaveDriveNotAvailable: 151 165 pop cx 152 pop bx 153 call BackupErrorCodeFromTheRequestedDriveToBH ; save error code if same controller as drive from entry 154 155 .notFound: 166 .ControllerNotAvailable: 156 167 add dl, IDEVARS_size ; move Idevars pointer forward 157 168 loop .loop 158 169 ret 159 160 161 ;--------------------------------------------------------------------162 ; ControllerResetForDPTinDSDI163 ; Parameters:164 ; DS:DI: Ptr to DPT for drive to reset (resets both Master and Slave drive)165 ; SS:BP: Ptr to IDEPACK166 ; Returns:167 ; AH: Int 13h return status168 ; Corrupts registers:169 ; AL, BX, CX, DX170 ;--------------------------------------------------------------------171 ControllerResetForDPTinDSDI:172 %ifdef MODULE_IRQ173 call Interrupts_UnmaskInterruptControllerForDriveInDSDI174 %endif175 %ifdef MODULE_ADVANCED_ATA176 call Device_ResetMasterAndSlaveController177 jmp AdvAtaInit_InitializeControllerForDPTinDSDI178 %else179 jmp Device_ResetMasterAndSlaveController180 %endif181 182 183 ;--------------------------------------------------------------------184 ; ControllerInitForMasterOrSingleDPTinDSDI185 ; Parameters:186 ; DS:DI: Ptr to DPT for Master or Single Drive (initializes both Master and Slave drive)187 ; SS:BP: Ptr to IDEPACK188 ; Returns:189 ; AH: Int 13h return status190 ; Corrupts registers:191 ; AL, BX, CX, DX192 ;--------------------------------------------------------------------193 ControllerInitForMasterOrSingleDPTinDSDI:194 call AH9h_InitializeDriveForUse ; Init Master or Single drive195 push ax ; Store error code196 197 eMOVZX ax, BYTE [di+DPT.bIdevarsOffset] ; Clear AH198 add di, BYTE LARGEST_DPT_SIZE ; Slave drive or next controller199 cmp [di+DPT.bIdevarsOffset], al200 jne SHORT .NoSlaveDrivePresent201 202 call AH9h_InitializeDriveForUse ; Init Slave drive203 .NoSlaveDrivePresent:204 pop bx205 MAX_U ah, bh ; Return error code from either drive206 ret -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm
r505 r521 73 73 ; CF: 0 if successful, 1 if error 74 74 ; Corrupts registers: 75 ; AL, BX, CX, DX75 ; AL, CX 76 76 ;-------------------------------------------------------------------- 77 77 AH9h_InitializeDriveForUse: … … 93 93 push es 94 94 push si 95 push dx 96 push bx 95 97 96 98 … … 232 234 %endif 233 235 236 pop bx 237 pop dx 234 238 pop si 235 239 pop es -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm
r520 r521 161 161 %endif 162 162 clc 163 ;; fall through to JumpToBootSector_or_RomBoot164 165 ;-------------------------------------------------------------------- 166 ; JumpToBootSector_or_RomBoot163 ;; fall through to Int19_JumpToBootSectorOrRomBoot 164 165 ;-------------------------------------------------------------------- 166 ; Int19_JumpToBootSectorOrRomBoot 167 167 ; 168 168 ; Switches back to the POST stack, clears the DS and ES registers, … … 179 179 ; Never returns 180 180 ;-------------------------------------------------------------------- 181 JumpToBootSector_or_RomBoot:181 Int19_JumpToBootSectorOrRomBoot: 182 182 mov cx, es ; Preserve MBR segment (can't push because of stack change) 183 183 mov ax, 0 ; NOTE: can't use XOR (LOAD_BDA_SEGMENT_TO) as it impacts CF -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h/BootSector.asm
r505 r521 36 36 call DetectPrint_TryToBootFromDL 37 37 call LoadFirstSectorFromDriveDL 38 %ifndef USE_386 39 jc SHORT .FailedToLoadFirstSector 38 jnc SHORT .FirstSectorLoadedToESBX 39 40 ; Do not display timeout error (80h) for floppy drives since 41 ; it most likely mean no diskette in drive. This way we do not 42 ; display error code every time user intends to boot from hard disk 43 ; when A then C boot order is used. 44 js SHORT .PrintFailedToLoadErrorCode ; Hard Drive 45 cmp ah, RET_HD_TIMEOUT 46 je SHORT .ReturnWithCFclearSinceFailedToLoadBootSector 47 cmp ah, RET_HD_NOMEDIA 48 je SHORT .ReturnWithCFclearSinceFailedToLoadBootSector 49 .PrintFailedToLoadErrorCode: 50 %ifdef USE_186 51 push .ReturnWithCFclearSinceFailedToLoadBootSector 52 jmp DetectPrint_FailedToLoadFirstSector 40 53 %else 41 jc DetectPrint_FailedToLoadFirstSector 54 call DetectPrint_FailedToLoadFirstSector 55 jmp .ReturnWithCFclearSinceFailedToLoadBootSector 42 56 %endif 43 57 58 59 .FirstSectorLoadedToESBX: 44 60 test dl, dl 45 61 jns SHORT .AlwaysBootFromFloppyDriveForBooterGames … … 47 63 jne SHORT .FirstHardDiskSectorNotBootable 48 64 .AlwaysBootFromFloppyDriveForBooterGames: 49 stc 50 jmp SHORT JumpToBootSector_or_RomBoot 51 52 %ifndef USE_386 53 .FailedToLoadFirstSector: 54 jmp DetectPrint_FailedToLoadFirstSector 55 %endif 65 stc ; Boot Sector loaded succesfully 66 jmp SHORT Int19_JumpToBootSectorOrRomBoot 56 67 57 68 .FirstHardDiskSectorNotBootable: 58 69 mov si, g_szBootSectorNotFound 59 jmp DetectPrint_NullTerminatedStringFromCSSIandSetCF 70 call DetectPrint_NullTerminatedStringFromCSSI 71 .ReturnWithCFclearSinceFailedToLoadBootSector: 72 clc 73 ret 60 74 61 75 %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS -
trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm
r505 r521 200 200 ; AH: INT 13h error code 201 201 ; Returns: 202 ; Nothing202 ; CF: Set 203 203 ; Corrupts registers: 204 204 ; AX, CX, SI, DI … … 210 210 push cx ; Push INT 13h error code 211 211 mov si, g_szReadError 212 jmp SHORT DetectPrint_FormatCSSIfromParamsInSSBP 212 jmp SHORT DetectPrint_FormatCSSIfromParamsInSSBP ; Sets CF 213 213 214 214 … … 261 261 262 262 ;-------------------------------------------------------------------- 263 ; DetectPrint_NullTerminatedStringFromCSSI 263 264 ; DetectPrint_NullTerminatedStringFromCSSIandSetCF 264 265 ; Parameters: … … 269 270 ; AX, DI 270 271 ;-------------------------------------------------------------------- 272 DetectPrint_NullTerminatedStringFromCSSI: 271 273 DetectPrint_NullTerminatedStringFromCSSIandSetCF: 272 274 ; -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.asm
r489 r521 136 136 137 137 ;-------------------------------------------------------------------- 138 ; FindDPT_ ForIdevarsOffsetInDL138 ; FindDPT_MasterOrSingleForIdevarsOffsetInDL 139 139 ; Parameters: 140 140 ; DL: Offset to IDEVARS to search for … … 147 147 ; SI 148 148 ;-------------------------------------------------------------------- 149 FindDPT_ ForIdevarsOffsetInDL:149 FindDPT_MasterOrSingleForIdevarsOffsetInDL: 150 150 mov si, IterateFindFirstDPTforIdevars ; iteration routine (see below) 151 151 jmp SHORT FindDPT_IterateAllDPTs ; look for the first drive on this controller, if any 152 152 153 153 ;-------------------------------------------------------------------- 154 ; Iteration routine for FindDPT_ForIdevarsOffsetInDL, 155 ; for use with IterateAllDPTs 154 ; FindDPT_SlaveForIdevarsOffsetInDL 155 ; Parameters: 156 ; DL: Offset to IDEVARS to search for 157 ; DS: RAMVARS segment 158 ; Returns: 159 ; DS:DI: Ptr to second DPT with same IDEVARS as in DL 160 ; CF: Clear if wanted DPT found 161 ; Set if DPT not found, or no DPTs present 162 ; Corrupts registers: 163 ; SI 164 ;-------------------------------------------------------------------- 165 FindDPT_SlaveForIdevarsOffsetInDL: 166 mov si, IterateFindSecondDPTforIdevars ; iteration routine (see below) 167 jmp SHORT FindDPT_IterateAllDPTs ; look for the second drive on this controller, if any 168 169 ;-------------------------------------------------------------------- 170 ; Iteration routines for FindDPT_MasterOrSingleForIdevarsOffsetInDL and 171 ; FindDPT_SlaveForIdevarsOffsetInDL, for use with IterateAllDPTs 156 172 ; 157 173 ; Returns when DPT is found on the controller with Idevars offset in DL 158 174 ; 175 ; IterateFindSecondDPTforIdevars 159 176 ; IterateFindFirstDPTforIdevars 160 177 ; DL: Offset to IDEVARS to search from DPTs … … 164 181 ; Set if wrong DPT 165 182 ;-------------------------------------------------------------------- 183 IterateFindSecondDPTforIdevars: 184 call IterateFindFirstDPTforIdevars 185 jc SHORT IterateFindFirstDPTforIdevars.done ; Wrong controller 186 187 ; We have found DPT for Master Drive, 188 ; next DPT is for slave drive or master for another controller 189 add di, BYTE LARGEST_DPT_SIZE 190 ; Fall to IterateFindFirstDPTforIdevars 191 166 192 IterateFindFirstDPTforIdevars: 167 193 cmp dl, [di+DPT.bIdevarsOffset] ; Clears CF if matched … … 293 319 pop cx 294 320 ret 295
Note:
See TracChangeset
for help on using the changeset viewer.