[90] | 1 | ; Project name : XTIDE Universal BIOS |
---|
[3] | 2 | ; Description : Int 13h BIOS functions (Floppy and Hard disk). |
---|
| 3 | |
---|
[376] | 4 | ; |
---|
[445] | 5 | ; XTIDE Universal BIOS and Associated Tools |
---|
[526] | 6 | ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team. |
---|
[376] | 7 | ; |
---|
| 8 | ; This program is free software; you can redistribute it and/or modify |
---|
| 9 | ; it under the terms of the GNU General Public License as published by |
---|
| 10 | ; the Free Software Foundation; either version 2 of the License, or |
---|
| 11 | ; (at your option) any later version. |
---|
[445] | 12 | ; |
---|
[376] | 13 | ; This program is distributed in the hope that it will be useful, |
---|
| 14 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
[445] | 16 | ; GNU General Public License for more details. |
---|
[376] | 17 | ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
[445] | 18 | ; |
---|
[376] | 19 | |
---|
[3] | 20 | ; Section containing code |
---|
| 21 | SECTION .text |
---|
| 22 | |
---|
| 23 | ;-------------------------------------------------------------------- |
---|
| 24 | ; Int 13h software interrupt handler. |
---|
[417] | 25 | ; This handler changes stack to top of stolen conventional memory |
---|
| 26 | ; and then calls the actual INT 13h handler (Int13h_DiskFunctionsHandler). |
---|
| 27 | ; |
---|
| 28 | ; Int13h_DiskFunctionsHandlerWithStackChange |
---|
| 29 | ; Parameters: |
---|
| 30 | ; AH: Bios function |
---|
| 31 | ; DL: Drive number |
---|
| 32 | ; Other: Depends on function |
---|
| 33 | ; Returns: |
---|
| 34 | ; Depends on function |
---|
| 35 | ;-------------------------------------------------------------------- |
---|
| 36 | %ifdef RELOCATE_INT13H_STACK |
---|
| 37 | ALIGN JUMP_ALIGN |
---|
| 38 | Int13h_DiskFunctionsHandlerWithStackChange: |
---|
[525] | 39 | sti ; Enable interrupts |
---|
| 40 | ; TODO: Maybe we need to save Flags (DF) as well? |
---|
| 41 | push ds ; Save DS:DI on the original stack |
---|
[417] | 42 | push di |
---|
| 43 | call RamVars_GetSegmentToDS |
---|
| 44 | |
---|
| 45 | ; Store entry registers to RAMVARS |
---|
[525] | 46 | %ifdef USE_386 |
---|
| 47 | pop DWORD [RAMVARS.dwStackChangeDSDI] |
---|
| 48 | %else |
---|
| 49 | pop WORD [RAMVARS.wStackChangeDI] ; Pop DS:DI to the top of what |
---|
| 50 | pop WORD [RAMVARS.wStackChangeDS] ; is to become the new stack |
---|
| 51 | %endif |
---|
[417] | 52 | mov [RAMVARS.fpInt13hEntryStack], sp |
---|
| 53 | mov [RAMVARS.fpInt13hEntryStack+2], ss |
---|
| 54 | |
---|
| 55 | ; Load new stack and restore DS and DI |
---|
[525] | 56 | mov di, ds ; We can save 2 bytes by using PUSH/POP but it's slower |
---|
| 57 | mov ss, di ; No need to wrap with CLI/STI since this is for AT only (286+) |
---|
| 58 | mov sp, RAMVARS.rgbTopOfStack-4 |
---|
| 59 | pop di ; DI before stack change |
---|
| 60 | pop ds ; DS before stack change |
---|
[417] | 61 | |
---|
| 62 | ; Call INT 13h |
---|
| 63 | pushf |
---|
| 64 | push cs |
---|
| 65 | call Int13h_DiskFunctionsHandler |
---|
| 66 | |
---|
| 67 | ; Restore stack (we must not corrupt FLAGS!) |
---|
| 68 | %ifdef USE_386 |
---|
| 69 | lss sp, [ss:RAMVARS.fpInt13hEntryStack] |
---|
| 70 | %else |
---|
[525] | 71 | cli |
---|
[417] | 72 | mov sp, [ss:RAMVARS.fpInt13hEntryStack] |
---|
| 73 | mov ss, [ss:RAMVARS.fpInt13hEntryStack+2] |
---|
[525] | 74 | sti |
---|
[417] | 75 | %endif |
---|
| 76 | retf 2 ; Skip FLAGS from stack |
---|
| 77 | %endif ; RELOCATE_INT13H_STACK |
---|
| 78 | |
---|
| 79 | |
---|
| 80 | ;-------------------------------------------------------------------- |
---|
| 81 | ; Int 13h software interrupt handler. |
---|
[3] | 82 | ; Jumps to specific function defined in AH. |
---|
| 83 | ; |
---|
[148] | 84 | ; Note to developers: Do not make recursive INT 13h calls! |
---|
| 85 | ; |
---|
| 86 | ; Int13h_DiskFunctionsHandler |
---|
[3] | 87 | ; Parameters: |
---|
| 88 | ; AH: Bios function |
---|
| 89 | ; DL: Drive number |
---|
[148] | 90 | ; Other: Depends on function |
---|
[3] | 91 | ; Returns: |
---|
| 92 | ; Depends on function |
---|
| 93 | ;-------------------------------------------------------------------- |
---|
| 94 | ALIGN JUMP_ALIGN |
---|
[148] | 95 | Int13h_DiskFunctionsHandler: |
---|
[525] | 96 | %ifndef RELOCATE_INT13H_STACK |
---|
[3] | 97 | sti ; Enable interrupts |
---|
[556] | 98 | %endif |
---|
[592] | 99 | %ifdef CLD_NEEDED |
---|
[150] | 100 | cld ; String instructions to increment pointers |
---|
[592] | 101 | %endif |
---|
[589] | 102 | ePUSHA |
---|
| 103 | push ds |
---|
| 104 | push es |
---|
| 105 | %ifdef USE_386 |
---|
| 106 | ; push fs |
---|
| 107 | ; push gs |
---|
| 108 | %endif |
---|
| 109 | sub sp, BYTE SIZE_OF_IDEPACK_WITHOUT_INTPACK |
---|
| 110 | mov bp, sp |
---|
[3] | 111 | call RamVars_GetSegmentToDS |
---|
[294] | 112 | |
---|
[493] | 113 | %ifdef MODULE_DRIVEXLATE |
---|
[148] | 114 | call DriveXlate_ToOrBack |
---|
[395] | 115 | %endif |
---|
[322] | 116 | call FindDPT_ForDriveNumberInDL ; DS:DI points to our DPT, or NULL if not our drive |
---|
| 117 | jc SHORT .NotOurDrive ; DPT not found so this is not one of our drives |
---|
[258] | 118 | |
---|
[294] | 119 | .OurFunction: |
---|
[3] | 120 | ; Jump to correct BIOS function |
---|
[148] | 121 | eMOVZX bx, ah |
---|
[445] | 122 | eSHL_IM bx, 1 |
---|
[165] | 123 | cmp ah, 25h ; Possible EBIOS function? |
---|
[417] | 124 | %ifndef MODULE_EBIOS |
---|
| 125 | ja SHORT UnsupportedFunction |
---|
| 126 | jmp [cs:bx+g_rgw13hFuncJump] ; Jump to BIOS function |
---|
| 127 | |
---|
| 128 | %else ; If using MODULE_EBIOS |
---|
[165] | 129 | ja SHORT .JumpToEbiosFunction |
---|
[148] | 130 | jmp [cs:bx+g_rgw13hFuncJump] ; Jump to BIOS function |
---|
[3] | 131 | |
---|
[165] | 132 | ALIGN JUMP_ALIGN |
---|
| 133 | .JumpToEbiosFunction: |
---|
[542] | 134 | test BYTE [di+DPT.bFlagsLow], FLGL_DPT_LBA |
---|
[417] | 135 | jz SHORT UnsupportedFunction ; No eINT 13h for CHS drives |
---|
[322] | 136 | sub bl, 41h<<1 ; BX = Offset to eINT 13h jump table |
---|
[417] | 137 | jb SHORT UnsupportedFunction |
---|
[167] | 138 | cmp ah, 48h |
---|
[417] | 139 | ja SHORT UnsupportedFunction |
---|
[165] | 140 | jmp [cs:bx+g_rgwEbiosFunctionJumpTable] |
---|
[417] | 141 | %endif ; MODULE_EBIOS |
---|
[3] | 142 | |
---|
[417] | 143 | |
---|
[322] | 144 | ALIGN JUMP_ALIGN |
---|
| 145 | .NotOurDrive: |
---|
| 146 | test ah, ah |
---|
| 147 | jz SHORT .OurFunction ; We handle all function 0h requests (resets) |
---|
[260] | 148 | |
---|
[556] | 149 | %ifndef MODULE_SERIAL_FLOPPY |
---|
| 150 | ; Without floppy support, we handle only hard disk traffic for function 08h. |
---|
| 151 | test dl, dl |
---|
| 152 | jns SHORT Int13h_DirectCallToAnotherBios |
---|
| 153 | %endif |
---|
| 154 | ; With floppy support, we handle all traffic for function 08h, as we need to wrap both hard disk and floppy drive counts. |
---|
| 155 | cmp ah, GET_DRIVE_PARAMETERS |
---|
[322] | 156 | je SHORT .OurFunction |
---|
| 157 | ; Fall to Int13h_DirectCallToAnotherBios |
---|
| 158 | |
---|
[417] | 159 | |
---|
[3] | 160 | ;-------------------------------------------------------------------- |
---|
[417] | 161 | ; UnsupportedFunction |
---|
[3] | 162 | ; Int13h_DirectCallToAnotherBios |
---|
| 163 | ; Parameters: |
---|
[148] | 164 | ; DL: Translated drive number |
---|
[3] | 165 | ; DS: RAMVARS segment |
---|
[150] | 166 | ; SS:BP: Ptr to IDEPACK |
---|
[148] | 167 | ; BX, DI: Corrupted on Int13h_DiskFunctionsHandler |
---|
[161] | 168 | ; Other: Function specific INT 13h parameters |
---|
[3] | 169 | ; Returns: |
---|
| 170 | ; Depends on function |
---|
| 171 | ; Corrupts registers: |
---|
| 172 | ; Flags |
---|
| 173 | ;-------------------------------------------------------------------- |
---|
| 174 | ALIGN JUMP_ALIGN |
---|
[417] | 175 | UnsupportedFunction: |
---|
[3] | 176 | Int13h_DirectCallToAnotherBios: |
---|
[557] | 177 | %ifdef MODULE_DRIVEXLATE |
---|
| 178 | ; Disable drive number translations in case of recursive INT 13h calls |
---|
| 179 | mov [RAMVARS.xlateVars+XLATEVARS.bXlatedDrv], dl |
---|
| 180 | push WORD [RAMVARS.xlateVars+XLATEVARS.wFDandHDswap] |
---|
[558] | 181 | call DriveXlate_Reset ; No translation |
---|
[557] | 182 | %endif |
---|
| 183 | |
---|
| 184 | push bp ; Store offset to IDEPACK (SS:SP now points it) |
---|
| 185 | |
---|
| 186 | ; Simulate INT by pushing flags and return address |
---|
| 187 | push WORD [bp+IDEPACK.intpack+INTPACK.flags] |
---|
[561] | 188 | %if 0 |
---|
| 189 | ; No standard INT 13h function uses FLAGS as parameters so no need to restore them |
---|
[557] | 190 | popf |
---|
[561] | 191 | pushf |
---|
| 192 | %endif |
---|
[557] | 193 | push cs |
---|
| 194 | ePUSH_T di, .ReturnFromAnotherBios ; Can not corrupt flags |
---|
| 195 | |
---|
| 196 | ; Push old INT 13h handler and restore registers |
---|
[592] | 197 | %ifdef USE_386 |
---|
| 198 | push DWORD [RAMVARS.fpOldI13h] |
---|
| 199 | %else |
---|
[557] | 200 | push WORD [RAMVARS.fpOldI13h+2] |
---|
| 201 | push WORD [RAMVARS.fpOldI13h] |
---|
[592] | 202 | %endif |
---|
[150] | 203 | mov bx, [bp+IDEPACK.intpack+INTPACK.bx] |
---|
| 204 | mov di, [bp+IDEPACK.intpack+INTPACK.di] |
---|
| 205 | mov ds, [bp+IDEPACK.intpack+INTPACK.ds] |
---|
| 206 | mov bp, [bp+IDEPACK.intpack+INTPACK.bp] |
---|
[557] | 207 | retf ; "Return" to old INT 13h |
---|
| 208 | .ReturnFromAnotherBios: |
---|
[3] | 209 | |
---|
[557] | 210 | %if 0 |
---|
| 211 | ; We need to restore our pointer to IDEPACK but we cannot corrupt any register |
---|
| 212 | push ax ; Dummy WORD |
---|
| 213 | cli |
---|
| 214 | xchg bp, sp |
---|
| 215 | mov [bp], sp ; Replace dummy WORD with returned BP |
---|
| 216 | mov sp, [bp+2] ; Load offset to IDEPACK |
---|
| 217 | xchg sp, bp |
---|
| 218 | sti ; We would have set IF anyway when exiting INT 13h |
---|
| 219 | pop WORD [bp+IDEPACK.intpack+INTPACK.bp] |
---|
| 220 | %endif |
---|
| 221 | ; Actually we can corrupt BP since no standard INT 13h function uses it as return |
---|
| 222 | ; register. Above code is kept here just in case if there is some non-standard function. |
---|
| 223 | ; POP BP below also belongs to the above code. |
---|
| 224 | pop bp ; Clean IDEPACK offset from stack |
---|
[556] | 225 | |
---|
[557] | 226 | ; Store remaining returned values to INTPACK |
---|
[148] | 227 | %ifdef USE_386 |
---|
[557] | 228 | ; We do not use GS or FS at the moment |
---|
[322] | 229 | ; mov [bp+IDEPACK.intpack+INTPACK.gs], gs |
---|
| 230 | ; mov [bp+IDEPACK.intpack+INTPACK.fs], fs |
---|
[148] | 231 | %endif |
---|
[150] | 232 | mov [bp+IDEPACK.intpack+INTPACK.es], es |
---|
| 233 | mov [bp+IDEPACK.intpack+INTPACK.ds], ds |
---|
| 234 | mov [bp+IDEPACK.intpack+INTPACK.di], di |
---|
| 235 | mov [bp+IDEPACK.intpack+INTPACK.si], si |
---|
| 236 | mov [bp+IDEPACK.intpack+INTPACK.bx], bx |
---|
[493] | 237 | %ifdef MODULE_DRIVEXLATE |
---|
[150] | 238 | mov [bp+IDEPACK.intpack+INTPACK.dh], dh |
---|
[414] | 239 | %else |
---|
| 240 | mov [bp+IDEPACK.intpack+INTPACK.dx], dx |
---|
| 241 | %endif |
---|
[150] | 242 | mov [bp+IDEPACK.intpack+INTPACK.cx], cx |
---|
| 243 | mov [bp+IDEPACK.intpack+INTPACK.ax], ax |
---|
[148] | 244 | pushf |
---|
[150] | 245 | pop WORD [bp+IDEPACK.intpack+INTPACK.flags] |
---|
[148] | 246 | call RamVars_GetSegmentToDS |
---|
[414] | 247 | |
---|
[493] | 248 | %ifdef MODULE_DRIVEXLATE |
---|
[557] | 249 | ; Restore drive number translation back to what it was |
---|
| 250 | pop WORD [RAMVARS.xlateVars+XLATEVARS.wFDandHDswap] |
---|
[414] | 251 | cmp dl, [RAMVARS.xlateVars+XLATEVARS.bXlatedDrv] ; DL is still drive number? |
---|
[618] | 252 | je SHORT Int13h_ReturnFromHandlerWithoutStoringErrorCode |
---|
[414] | 253 | mov [bp+IDEPACK.intpack+INTPACK.dl], dl ; Something is returned in DL |
---|
| 254 | %endif |
---|
[618] | 255 | jmp SHORT Int13h_ReturnFromHandlerWithoutStoringErrorCode |
---|
| 256 | ; We cannot return via Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH! |
---|
| 257 | ; 1. If the other BIOS returns something in DL then that is assumed to be a drive number |
---|
| 258 | ; (if MODULE_SERIAL_FLOPPY is included) even though it could be anything. |
---|
| 259 | ; 2. Any non-zero value in AH will cause the CF to be set on return from the handler. |
---|
| 260 | ; This breaks INT 13h/AH=15h for drives handled by the other BIOS. |
---|
[3] | 261 | |
---|
[417] | 262 | |
---|
[260] | 263 | %ifdef MODULE_SERIAL_FLOPPY |
---|
| 264 | ;-------------------------------------------------------------------- |
---|
| 265 | ; Int13h_ReturnSuccessForFloppy |
---|
| 266 | ; |
---|
| 267 | ; Some operations, such as format of a floppy disk track, should just |
---|
| 268 | ; return success, while for hard disks it should be treated as unsupported. |
---|
| 269 | ;-------------------------------------------------------------------- |
---|
| 270 | ALIGN JUMP_ALIGN |
---|
| 271 | Int13h_ReturnSuccessForFloppy: |
---|
| 272 | test dl, dl |
---|
[417] | 273 | js SHORT UnsupportedFunction |
---|
[294] | 274 | xor ah, ah |
---|
[417] | 275 | jmp SHORT Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH |
---|
[260] | 276 | %endif |
---|
[3] | 277 | |
---|
[417] | 278 | |
---|
[3] | 279 | ;-------------------------------------------------------------------- |
---|
[249] | 280 | ; Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAHandTransferredSectorsFromCL |
---|
| 281 | ; Parameters: |
---|
| 282 | ; AH: BIOS Error code |
---|
| 283 | ; CL: Number of sectors actually transferred |
---|
| 284 | ; SS:BP: Ptr to IDEPACK |
---|
| 285 | ; Returns: |
---|
| 286 | ; All registers are loaded from INTPACK |
---|
| 287 | ;-------------------------------------------------------------------- |
---|
| 288 | ALIGN JUMP_ALIGN |
---|
| 289 | Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAHandTransferredSectorsFromCL: |
---|
| 290 | mov [bp+IDEPACK.intpack+INTPACK.al], cl |
---|
| 291 | ; Fall to Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH |
---|
| 292 | |
---|
[417] | 293 | |
---|
[249] | 294 | ;-------------------------------------------------------------------- |
---|
[148] | 295 | ; Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH |
---|
| 296 | ; Int13h_ReturnFromHandlerWithoutStoringErrorCode |
---|
[32] | 297 | ; Parameters: |
---|
[148] | 298 | ; AH: BIOS Error code |
---|
[150] | 299 | ; SS:BP: Ptr to IDEPACK |
---|
[32] | 300 | ; Returns: |
---|
[148] | 301 | ; All registers are loaded from INTPACK |
---|
[32] | 302 | ;-------------------------------------------------------------------- |
---|
| 303 | ALIGN JUMP_ALIGN |
---|
[148] | 304 | Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH: |
---|
[258] | 305 | %ifdef MODULE_SERIAL_FLOPPY |
---|
| 306 | mov al, [bp+IDEPACK.intpack+INTPACK.dl] |
---|
[294] | 307 | Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH_ALHasDriveNumber: |
---|
[258] | 308 | call Int13h_SetErrorCodeToBdaAndToIntpackInSSBPfromAH_ALHasDriveNumber |
---|
[414] | 309 | |
---|
[258] | 310 | %else |
---|
[150] | 311 | call Int13h_SetErrorCodeToBdaAndToIntpackInSSBPfromAH |
---|
[258] | 312 | %endif |
---|
[414] | 313 | |
---|
[148] | 314 | Int13h_ReturnFromHandlerWithoutStoringErrorCode: |
---|
[417] | 315 | ; Always return with interrupts enabled since there are programs that rely |
---|
| 316 | ; on INT 13h to enable interrupts. |
---|
| 317 | or BYTE [bp+IDEPACK.intpack+INTPACK.flags+1], (FLG_FLAGS_IF>>8) |
---|
[32] | 318 | |
---|
[589] | 319 | lea sp, [bp+SIZE_OF_IDEPACK_WITHOUT_INTPACK] |
---|
| 320 | %ifdef USE_386 |
---|
| 321 | ; pop gs |
---|
| 322 | ; pop fs |
---|
| 323 | %endif |
---|
| 324 | pop es |
---|
| 325 | pop ds |
---|
| 326 | ePOPA |
---|
| 327 | iret |
---|
[32] | 328 | |
---|
[589] | 329 | |
---|
[32] | 330 | ;-------------------------------------------------------------------- |
---|
[148] | 331 | ; Int13h_CallPreviousInt13hHandler |
---|
[3] | 332 | ; Parameters: |
---|
[148] | 333 | ; AH: INT 13h function to call |
---|
| 334 | ; DL: Drive number |
---|
| 335 | ; DS: RAMVARS segment |
---|
[3] | 336 | ; Returns: |
---|
| 337 | ; Depends on function |
---|
[567] | 338 | ; NOTE: ES:DI needs to be returned from the previous interrupt |
---|
| 339 | ; handler, for floppy DPT in function 08h |
---|
[3] | 340 | ; Corrupts registers: |
---|
[258] | 341 | ; None |
---|
[3] | 342 | ;-------------------------------------------------------------------- |
---|
| 343 | ALIGN JUMP_ALIGN |
---|
[148] | 344 | Int13h_CallPreviousInt13hHandler: |
---|
[557] | 345 | pushf ; Simulate INT by pushing flags |
---|
[596] | 346 | call FAR [RAMVARS.fpOldI13h] |
---|
[148] | 347 | ret |
---|
[28] | 348 | |
---|
[35] | 349 | |
---|
[150] | 350 | ;-------------------------------------------------------------------- |
---|
[568] | 351 | ; Int13h_SetErrorCodeToBdaAndToIntpackInSSBPfromAH_ALHasDriveNumber |
---|
[150] | 352 | ; Int13h_SetErrorCodeToBdaAndToIntpackInSSBPfromAH |
---|
| 353 | ; Int13h_SetErrorCodeToIntpackInSSBPfromAH |
---|
| 354 | ; Parameters: |
---|
| 355 | ; AH: BIOS error code (00h = no error) |
---|
| 356 | ; SS:BP: Ptr to IDEPACK |
---|
| 357 | ; Returns: |
---|
| 358 | ; SS:BP: Ptr to IDEPACK with error condition set |
---|
| 359 | ; Corrupts registers: |
---|
[568] | 360 | ; DS, BX, DI |
---|
[150] | 361 | ;-------------------------------------------------------------------- |
---|
| 362 | ALIGN JUMP_ALIGN |
---|
[258] | 363 | %ifdef MODULE_SERIAL_FLOPPY |
---|
| 364 | Int13h_SetErrorCodeToBdaAndToIntpackInSSBPfromAH_ALHasDriveNumber: |
---|
| 365 | ; Store error code to BDA |
---|
| 366 | mov bx, BDA.bHDLastSt |
---|
| 367 | test al, al |
---|
[414] | 368 | js SHORT .HardDisk |
---|
[258] | 369 | mov bl, BDA.bFDRetST & 0xff |
---|
| 370 | .HardDisk: |
---|
| 371 | LOAD_BDA_SEGMENT_TO ds, di |
---|
[294] | 372 | mov [bx], ah |
---|
[417] | 373 | ; Fall to Int13h_SetErrorCodeToIntpackInSSBPfromAH |
---|
| 374 | |
---|
[258] | 375 | %else |
---|
[150] | 376 | Int13h_SetErrorCodeToBdaAndToIntpackInSSBPfromAH: |
---|
| 377 | ; Store error code to BDA |
---|
[294] | 378 | LOAD_BDA_SEGMENT_TO ds, di |
---|
[150] | 379 | mov [BDA.bHDLastSt], ah |
---|
[417] | 380 | ; Fall to Int13h_SetErrorCodeToIntpackInSSBPfromAH |
---|
[258] | 381 | %endif |
---|
[35] | 382 | |
---|
[150] | 383 | ; Store error code to INTPACK |
---|
| 384 | Int13h_SetErrorCodeToIntpackInSSBPfromAH: |
---|
| 385 | mov [bp+IDEPACK.intpack+INTPACK.ah], ah |
---|
| 386 | test ah, ah |
---|
| 387 | jnz SHORT .SetCFtoIntpack |
---|
| 388 | and BYTE [bp+IDEPACK.intpack+INTPACK.flags], ~FLG_FLAGS_CF |
---|
| 389 | ret |
---|
| 390 | .SetCFtoIntpack: |
---|
| 391 | or BYTE [bp+IDEPACK.intpack+INTPACK.flags], FLG_FLAGS_CF |
---|
| 392 | ret |
---|
| 393 | |
---|
| 394 | |
---|
[3] | 395 | ; Jump table for correct BIOS function |
---|
| 396 | ALIGN WORD_ALIGN |
---|
| 397 | g_rgw13hFuncJump: |
---|
[417] | 398 | dw AH0h_HandlerForDiskControllerReset ; 00h, Disk Controller Reset (All) |
---|
| 399 | dw AH1h_HandlerForReadDiskStatus ; 01h, Read Disk Status (All) |
---|
| 400 | dw AH2h_HandlerForReadDiskSectors ; 02h, Read Disk Sectors (All) |
---|
| 401 | dw AH3h_HandlerForWriteDiskSectors ; 03h, Write Disk Sectors (All) |
---|
| 402 | dw AH4h_HandlerForVerifyDiskSectors ; 04h, Verify Disk Sectors (All) |
---|
[260] | 403 | %ifdef MODULE_SERIAL_FLOPPY |
---|
[417] | 404 | dw Int13h_ReturnSuccessForFloppy ; 05h, Format Disk Track (XT, AT, EISA) |
---|
[260] | 405 | %else |
---|
[417] | 406 | dw UnsupportedFunction ; 05h, Format Disk Track (XT, AT, EISA) |
---|
[260] | 407 | %endif |
---|
[417] | 408 | dw UnsupportedFunction ; 06h, Format Disk Track with Bad Sectors (XT) |
---|
| 409 | dw UnsupportedFunction ; 07h, Format Multiple Cylinders (XT) |
---|
| 410 | dw AH8h_HandlerForReadDiskDriveParameters ; 08h, Read Disk Drive Parameters (All) |
---|
| 411 | dw AH9h_HandlerForInitializeDriveParameters ; 09h, Initialize Drive Parameters (All) |
---|
| 412 | dw UnsupportedFunction ; 0Ah, Read Disk Sectors with ECC (XT, AT, EISA) |
---|
| 413 | dw UnsupportedFunction ; 0Bh, Write Disk Sectors with ECC (XT, AT, EISA) |
---|
| 414 | dw AHCh_HandlerForSeek ; 0Ch, Seek (All) |
---|
[507] | 415 | dw AH9h_HandlerForInitializeDriveParameters ; 0Dh, Alternate Disk Reset (All) |
---|
[417] | 416 | dw UnsupportedFunction ; 0Eh, Read Sector Buffer (XT, PS/1), ESDI Undocumented Diagnostic (PS/2) |
---|
| 417 | dw UnsupportedFunction ; 0Fh, Write Sector Buffer (XT, PS/1), ESDI Undocumented Diagnostic (PS/2) |
---|
| 418 | dw AH10h_HandlerForCheckDriveReady ; 10h, Check Drive Ready (All) |
---|
| 419 | dw AH11h_HandlerForRecalibrate ; 11h, Recalibrate (All) |
---|
| 420 | dw UnsupportedFunction ; 12h, Controller RAM Diagnostic (XT) |
---|
| 421 | dw UnsupportedFunction ; 13h, Drive Diagnostic (XT) |
---|
[540] | 422 | dw AH10h_HandlerForCheckDriveReady ; 14h, Controller Internal Diagnostic (All) |
---|
[417] | 423 | dw AH15h_HandlerForReadDiskDriveSize ; 15h, Read Disk Drive Size (AT+) |
---|
| 424 | dw UnsupportedFunction ; 16h, |
---|
| 425 | dw UnsupportedFunction ; 17h, |
---|
| 426 | dw UnsupportedFunction ; 18h, |
---|
| 427 | dw UnsupportedFunction ; 19h, Park Heads (PS/2) |
---|
| 428 | dw UnsupportedFunction ; 1Ah, Format ESDI Drive (PS/2) |
---|
| 429 | dw UnsupportedFunction ; 1Bh, Get ESDI Manufacturing Header (PS/2) |
---|
| 430 | dw UnsupportedFunction ; 1Ch, ESDI Special Functions (PS/2) |
---|
| 431 | dw UnsupportedFunction ; 1Dh, |
---|
[493] | 432 | %ifdef MODULE_8BIT_IDE_ADVANCED |
---|
[471] | 433 | dw AH1Eh_HandlerForXTCFfeatures ; 1Eh, Lo-tech XT-CF features (XTIDE Universal BIOS) |
---|
| 434 | %else |
---|
[525] | 435 | dw UnsupportedFunction ; 1Eh, |
---|
[471] | 436 | %endif |
---|
[417] | 437 | dw UnsupportedFunction ; 1Fh, |
---|
| 438 | dw UnsupportedFunction ; 20h, |
---|
| 439 | dw UnsupportedFunction ; 21h, Read Disk Sectors, Multiple Blocks (PS/1) |
---|
| 440 | dw UnsupportedFunction ; 22h, Write Disk Sectors, Multiple Blocks (PS/1) |
---|
| 441 | dw AH23h_HandlerForSetControllerFeatures ; 23h, Set Controller Features Register (PS/1) |
---|
| 442 | dw AH24h_HandlerForSetMultipleBlocks ; 24h, Set Multiple Blocks (PS/1) |
---|
| 443 | dw AH25h_HandlerForGetDriveInformation ; 25h, Get Drive Information (PS/1) |
---|
[165] | 444 | |
---|
[176] | 445 | %ifdef MODULE_EBIOS |
---|
[165] | 446 | g_rgwEbiosFunctionJumpTable: |
---|
[417] | 447 | dw AH41h_HandlerForCheckIfExtensionsPresent ; 41h, Check if Extensions Present (EBIOS)* |
---|
| 448 | dw AH42h_HandlerForExtendedReadSectors ; 42h, Extended Read Sectors (EBIOS)* |
---|
| 449 | dw AH43h_HandlerForExtendedWriteSectors ; 43h, Extended Write Sectors (EBIOS)* |
---|
| 450 | dw AH44h_HandlerForExtendedVerifySectors ; 44h, Extended Verify Sectors (EBIOS)* |
---|
| 451 | dw UnsupportedFunction ; 45h, Lock and Unlock Drive (EBIOS)*** |
---|
| 452 | dw UnsupportedFunction ; 46h, Eject Media Request (EBIOS)*** |
---|
| 453 | dw AH47h_HandlerForExtendedSeek ; 47h, Extended Seek (EBIOS)* |
---|
| 454 | dw AH48h_HandlerForGetExtendedDriveParameters ; 48h, Get Extended Drive Parameters (EBIOS)* |
---|
| 455 | ; dw UnsupportedFunction ; 49h, Get Extended Disk Change Status (EBIOS)*** |
---|
| 456 | ; dw UnsupportedFunction ; 4Ah, Initiate Disk Emulation (Bootable CD-ROM) |
---|
| 457 | ; dw UnsupportedFunction ; 4Bh, Terminate Disk Emulation (Bootable CD-ROM) |
---|
| 458 | ; dw UnsupportedFunction ; 4Ch, Initiate Disk Emulation and Boot (Bootable CD-ROM) |
---|
| 459 | ; dw UnsupportedFunction ; 4Dh, Return Boot Catalog (Bootable CD-ROM) |
---|
| 460 | ; dw UnsupportedFunction ; 4Eh, Set Hardware Configuration (EBIOS)** |
---|
[150] | 461 | ; |
---|
| 462 | ; * = Enhanced Drive Access Support (minimum required EBIOS functions) |
---|
| 463 | ; ** = Enhanced Disk Drive (EDD) Support |
---|
| 464 | ; *** = Drive Locking and Ejecting Support |
---|
[181] | 465 | %endif |
---|