Changeset 148 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src
- Timestamp:
- Mar 19, 2011, 8:09:41 PM (14 years ago)
- google:author:
- aitotat
- Location:
- trunk/XTIDE_Universal_BIOS/Src
- Files:
-
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Boot/BootSector.asm
r143 r148 85 85 mov ah, 0Dh ; AH=Dh, Reset Hard Disk (Alternate reset) 86 86 .SkipAltReset: 87 int INTV_DISK_FUNC87 int BIOS_DISK_INTERRUPT_13h 88 88 ret 89 89 … … 106 106 mov cx, 1 ; Cylinder 0, Sector 1 107 107 xor dh, dh ; Head 0 108 int INTV_DISK_FUNC108 int BIOS_DISK_INTERRUPT_13h 109 109 ret -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h.asm
r90 r148 4 4 ; Section containing code 5 5 SECTION .text 6 7 ;--------------------------------------------------------------------8 ; Macro that prints drive and function number.9 ; Used only for debugging.10 ;11 ; DEBUG_PRINT_DRIVE_AND_FUNCTION12 ; Parameters:13 ; AH: INT 13h function number14 ; DL: Drive number15 ; Returns:16 ; Nothing17 ; Corrupts registers:18 ; Nothing19 ;--------------------------------------------------------------------20 %macro DEBUG_PRINT_DRIVE_AND_FUNCTION 021 push dx22 push ax23 mov al, dl24 call Print_IntHexW25 pop ax26 pop dx27 %endmacro28 29 6 30 7 ;-------------------------------------------------------------------- … … 32 9 ; Jumps to specific function defined in AH. 33 10 ; 34 ; Int13h_Jump 11 ; Note to developers: Do not make recursive INT 13h calls! 12 ; 13 ; Int13h_DiskFunctionsHandler 35 14 ; Parameters: 36 15 ; AH: Bios function 37 16 ; DL: Drive number 17 ; Other: Depends on function 18 ; Returns: 19 ; Depends on function 20 ;-------------------------------------------------------------------- 21 ALIGN JUMP_ALIGN 22 Int13h_DiskFunctionsHandler: 23 sti ; Enable interrupts 24 SAVE_AND_GET_INTPACK_TO_SSBP 25 26 call RamVars_GetSegmentToDS 27 call DriveXlate_ToOrBack 28 mov [RAMVARS.xlateVars+XLATEVARS.bXlatedDrv], dl 29 call RamVars_IsFunctionHandledByThisBIOS 30 jnc SHORT Int13h_DirectCallToAnotherBios 31 call FindDPT_ForDriveNumber ; DS:DI now points to DPT 32 33 ; Jump to correct BIOS function 34 JumpToBiosFunctionInAH: 35 cmp ah, 25h ; Valid BIOS function? 36 ja SHORT Int13h_UnsupportedFunction 37 eMOVZX bx, ah 38 shl bx, 1 39 jmp [cs:bx+g_rgw13hFuncJump] ; Jump to BIOS function 40 41 42 ;-------------------------------------------------------------------- 43 ; Int13h_UnsupportedFunction 44 ; Int13h_DirectCallToAnotherBios 45 ; Parameters: 46 ; DL: Translated drive number 47 ; DS: RAMVARS segment 48 ; SS:BP: Ptr to INTPACK 49 ; BX, DI: Corrupted on Int13h_DiskFunctionsHandler 50 ; Other: Function specific INT 13h parameters 38 51 ; Returns: 39 52 ; Depends on function … … 42 55 ;-------------------------------------------------------------------- 43 56 ALIGN JUMP_ALIGN 44 Int13h_DiskFunctions: 45 ; Save registers 46 sti ; Enable interrupts 47 push ds ; Store DS 48 push di ; Store DI 49 50 ;DEBUG_PRINT_DRIVE_AND_FUNCTION 57 Int13h_UnsupportedFunction: 58 Int13h_DirectCallToAnotherBios: 59 call ExchangeCurrentInt13hHandlerWithOldInt13hHandler 60 mov bx, [bp+INTPACK.bx] 61 mov di, [bp+INTPACK.di] 62 mov ds, [bp+INTPACK.ds] 63 push WORD [bp+INTPACK.flags] 64 popf 65 push bp 66 mov bp, [bp+INTPACK.bp] 67 int BIOS_DISK_INTERRUPT_13h ; Can safely do as much recursion as it wants 68 69 ; Store returned values to INTPACK 70 pop bp ; Standard INT 13h functions never uses BP as return register 71 %ifdef USE_386 72 mov [bp+INTPACK.gs], gs 73 mov [bp+INTPACK.fs], fs 74 %endif 75 mov [bp+INTPACK.es], es 76 mov [bp+INTPACK.ds], ds 77 mov [bp+INTPACK.di], di 78 mov [bp+INTPACK.si], si 79 mov [bp+INTPACK.bx], bx 80 mov [bp+INTPACK.dh], dh 81 mov [bp+INTPACK.cx], cx 82 mov [bp+INTPACK.ax], ax 83 pushf 84 pop WORD [bp+INTPACK.flags] 51 85 call RamVars_GetSegmentToDS 52 call DriveXlate_WhenEnteringInt13h 53 call RamVars_IsFunctionHandledByThisBIOS 54 jnc SHORT Int13h_DirectCallToAnotherBios 55 ;DEBUG_PRINT_DRIVE_AND_FUNCTION 56 57 ; Jump to correct BIOS function 58 cmp ah, 25h ; Valid BIOS function? 59 ja SHORT Int13h_UnsupportedFunction 60 mov di, ax 61 %ifndef USE_186 ; This uses 9 bytes less and is about 5 cycles faster 62 mov al, ah ; Copy bits in AH to AL and then 63 shl al, 1 ; shift them "back" 1 step 64 and al, 7Eh ; AND them (clears the MSB) 65 cbw ; Clear AH using sign extension 66 xchg di, ax ; and finally swap DI with AX 67 %else 68 eSHR_IM di, 7 ; Shift function to DI... 69 and di, BYTE 7Eh ; ...and prepare for word lookup 70 %endif 71 jmp [cs:di+g_rgw13hFuncJump] ; Jump to BIOS function 72 73 74 ;-------------------------------------------------------------------- 75 ; Directs call to another INT13h function whose pointer is 76 ; stored to RAMVARS. 77 ; 78 ; Int13h_DirectCallToAnotherBios 79 ; Parameters: 80 ; AH: Bios function 86 cmp dl, [RAMVARS.xlateVars+XLATEVARS.bXlatedDrv] 87 je SHORT .ExchangeInt13hHandlers 88 mov [bp+INTPACK.dl], dl ; Something is returned in DL 89 ALIGN JUMP_ALIGN 90 .ExchangeInt13hHandlers: 91 call ExchangeCurrentInt13hHandlerWithOldInt13hHandler 92 ; Fall to Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 93 94 95 ;-------------------------------------------------------------------- 96 ; Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 97 ; Int13h_ReturnFromHandlerWithoutStoringErrorCode 98 ; Parameters: 99 ; AH: BIOS Error code 100 ; SS:BP: Ptr to INTPACK 101 ; Returns: 102 ; All registers are loaded from INTPACK 103 ;-------------------------------------------------------------------- 104 ALIGN JUMP_ALIGN 105 Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH: 106 call HError_SetErrorCodeToBdaAndToIntpackInSSBPfromAH 107 Int13h_ReturnFromHandlerWithoutStoringErrorCode: 108 or WORD [bp+INTPACK.flags], FLG_FLAGS_IF ; Return with interrupts enabled 109 mov sp, bp ; Now we can exit anytime 110 RESTORE_INTPACK_FROM_SSBP 111 112 113 ;-------------------------------------------------------------------- 114 ; Int13h_CallPreviousInt13hHandler 115 ; Parameters: 116 ; AH: INT 13h function to call 81 117 ; DL: Drive number 82 118 ; DS: RAMVARS segment 83 ; DI: Corrupted84 ; Stack from top to down:85 ; Original DI86 ; Original DS87 119 ; Returns: 88 120 ; Depends on function 89 121 ; Corrupts registers: 90 ; Flags 91 ;-------------------------------------------------------------------- 92 ALIGN JUMP_ALIGN 93 Int13h_UnsupportedFunction: 94 Int13h_DirectCallToAnotherBios: 95 ; Temporarily store original DI and DS from stack to RAMVARS 96 pop WORD [RAMVARS.wI13hDI] 97 pop WORD [RAMVARS.wI13hDS] 98 99 ; Special return processing required if target function 100 ; returns something in DL 101 mov di, Int13h_ReturnFromAnotherBiosWithValueInDL 102 call DriveXlate_DoesFunctionReturnSomethingInDL 103 jc SHORT .PushIretAddress 104 add di, BYTE Int13h_ReturnFromAnotherBios - Int13h_ReturnFromAnotherBiosWithValueInDL 105 .PushIretAddress: 106 pushf ; Push FLAGS to simulate INT 107 push cs ; Push return segment 108 push di ; Push return offset 109 110 ; "Return" to another INT 13h with original DI and DS 111 push WORD [RAMVARS.fpOldI13h+2] ; Segment 112 push WORD [RAMVARS.fpOldI13h] ; Offset 113 lds di, [RAMVARS.dwI13DIDS] 114 cli ; Disable interrupts as INT would 115 retf 116 117 118 ;-------------------------------------------------------------------- 119 ; Int13h_CallPreviousInt13hHandler 120 ; Parameters: 121 ; AH: Bios function 122 ; BX, DI, ES 123 ;-------------------------------------------------------------------- 124 ALIGN JUMP_ALIGN 125 Int13h_CallPreviousInt13hHandler: 126 push di 127 call ExchangeCurrentInt13hHandlerWithOldInt13hHandler 128 int BIOS_DISK_INTERRUPT_13h 129 call ExchangeCurrentInt13hHandlerWithOldInt13hHandler 130 pop di 131 ret 132 133 134 ;-------------------------------------------------------------------- 135 ; ExchangeCurrentInt13hHandlerWithOldInt13hHandler 136 ; Parameters: 122 137 ; DS: RAMVARS segment 123 ; Other: Depends on function to call 124 ; Returns: 125 ; Depends on function to call 138 ; Returns: 139 ; Nothing 126 140 ; Corrupts registers: 127 ; Nothing 128 ;-------------------------------------------------------------------- 129 ALIGN JUMP_ALIGN 130 Int13h_CallPreviousInt13hHandler: 131 pushf ; Push flags to simulate INT 132 cli ; Disable interrupts since INT does that 133 call FAR [RAMVARS.fpOldI13h] 134 sti 141 ; DI 142 ;-------------------------------------------------------------------- 143 ALIGN JUMP_ALIGN 144 ExchangeCurrentInt13hHandlerWithOldInt13hHandler: 145 push es 146 LOAD_BDA_SEGMENT_TO es, di 147 mov di, [RAMVARS.fpOldI13h] 148 xchg di, [es:BIOS_DISK_INTERRUPT_13h*4] 149 mov [RAMVARS.fpOldI13h], di 150 mov di, [RAMVARS.fpOldI13h+2] 151 xchg di, [es:BIOS_DISK_INTERRUPT_13h*4+2] 152 mov [RAMVARS.fpOldI13h+2], di 153 pop es 135 154 ret 136 155 137 138 ;--------------------------------------------------------------------139 ; Int13h_ReturnFromAnotherBiosWithValueInDL140 ; Int13h_ReturnFromAnotherBios141 ; Parameters:142 ; AH: Error code143 ; DL: Drive number (only on Int13h_ReturnFromAnotherBios)144 ; CF: Error status145 ; Returns:146 ; Depends on function147 ; Corrupts registers:148 ; Nothing (not even FLAGS)149 ;--------------------------------------------------------------------150 ALIGN JUMP_ALIGN151 Int13h_ReturnFromAnotherBiosWithValueInDL:152 push ds153 push di154 pushf ; Store return flags155 call RamVars_GetSegmentToDS156 call DriveXlate_WhenLeavingInt13hWithReturnValueInDL157 jmp SHORT Int13h_Leave158 159 ALIGN JUMP_ALIGN160 Int13h_ReturnFromAnotherBios:161 push ds162 push di163 pushf ; Store return flags164 call RamVars_GetSegmentToDS165 call DriveXlate_WhenLeavingInt13h166 jmp SHORT Int13h_Leave167 168 169 ;--------------------------------------------------------------------170 ; Returns from any BIOS function implemented by this BIOS.171 ;172 ; Int13h_ReturnWithValueInDL173 ; Int13h_PopXRegsAndReturn174 ; Int13h_PopDiDsAndReturn175 ; Parameters:176 ; DL: Drive number (not Int13h_ReturnWithoutSwappingDrives)177 ; DS: RAMVARS segment178 ; Returns:179 ; Depends on function180 ; Corrupts registers:181 ; Nothing (not even FLAGS)182 ;--------------------------------------------------------------------183 ALIGN JUMP_ALIGN184 Int13h_ReturnWithValueInDL:185 pushf186 call DriveXlate_WhenLeavingInt13hWithReturnValueInDL187 jmp SHORT Int13h_LeaveAfterStoringErrorCodeToBDA188 189 ALIGN JUMP_ALIGN190 Int13h_PopXRegsAndReturn:191 pop bx ; Pop old AX to BX192 mov al, bl ; Restore AL193 pop bx194 pop cx195 pop dx196 ; Fall to Int13h_PopDiDsAndReturn197 198 ALIGN JUMP_ALIGN199 Int13h_PopDiDsAndReturn:200 pushf201 call DriveXlate_WhenLeavingInt13h202 ; Fall to Int13h_LeaveAfterStoringErrorCodeToBDA203 204 Int13h_LeaveAfterStoringErrorCodeToBDA:205 LOAD_BDA_SEGMENT_TO ds, di206 mov [BDA.bHDStatus], ah207 ; Fall to Int13h_Leave208 209 Int13h_Leave:210 popf211 pop di212 pop ds213 retf 2214 156 215 157 -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH0h_HReset.asm
r128 r148 10 10 ; AH0h_HandlerForDiskControllerReset 11 11 ; Parameters: 12 ; AH: Bios function 0h 13 ; DL: Drive number (ignored so all drives are reset) 12 ; DL: Translated Drive number (ignored so all drives are reset) 14 13 ; If bit 7 is set all hard disks and floppy disks reset. 15 ; Parameters loaded by Int13h_Jump:16 ; DS: RAMVARS segment17 ; Returns :14 ; DS:DI: Ptr to DPT (in RAMVARS segment) 15 ; SS:BP: Ptr to INTPACK 16 ; Returns with INTPACK in SS:BP: 18 17 ; AH: Int 13h return status (from drive requested in DL) 19 18 ; CF: 0 if succesfull, 1 if error 20 ; IF: 121 ; Corrupts registers:22 ; Flags23 19 ;-------------------------------------------------------------------- 24 20 ALIGN JUMP_ALIGN 25 21 AH0h_HandlerForDiskControllerReset: 26 push dx27 push cx28 push bx29 push ax30 31 22 eMOVZX bx, dl ; Copy requested drive to BL, zero BH to assume no errors 32 23 call ResetFloppyDrivesWithInt40h … … 35 26 call ResetForeignHardDisks 36 27 call AH0h_ResetHardDisksHandledByOurBIOS 37 ALIGN JUMP_ALIGN38 28 .SkipHardDiskReset: 39 mov ah, bh ; Copy error code to AH 40 xor al, al ; Zero AL... 41 cmp al, bh ; ...and set CF if error 42 jmp Int13h_PopXRegsAndReturn 29 mov ah, bh 30 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 43 31 44 32 … … 57 45 and dl, 7Fh ; Clear hard disk bit 58 46 xor ah, ah ; Disk Controller Reset 59 int INTV_FLOPPY_FUNC47 int BIOS_DISKETTE_INTERRUPT_40h 60 48 jmp SHORT BackupErrorCodeFromTheRequestedDriveToBH 61 49 … … 96 84 jnc SHORT .Return ; Return what was in BL unmodified 97 85 mov dl, 80h 98 ALIGN JUMP_ALIGN99 86 .Return: 100 87 ret … … 171 158 BackupErrorCodeFromTheRequestedDriveToBH: 172 159 cmp dl, bl ; Requested drive? 173 jne SHORT .Return 174 mov bh, ah 175 ALIGN JUMP_ALIGN 176 .Return: 160 eCMOVE bh, ah 177 161 ret -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH10h_HReady.asm
r3 r148 1 ; File name : AH10h_HReady.asm 2 ; Project name : IDE BIOS 3 ; Created date : 9.12.2007 4 ; Last update : 12.4.2010 5 ; Author : Tomi Tilli 1 ; Project name : XTIDE Universal BIOS 6 2 ; Description : Int 13h function AH=10h, Check Drive Ready. 7 3 … … 14 10 ; AH10h_HandlerForCheckDriveReady 15 11 ; Parameters: 16 ; AH: Bios function 10h 17 ; DL: Drive number (8xh) 18 ; Parameters loaded by Int13h_Jump: 19 ; DS: RAMVARS segment 20 ; Returns: 12 ; DL: Translated Drive number 13 ; DS:DI: Ptr to DPT (in RAMVARS segment) 14 ; SS:BP: Ptr to INTPACK 15 ; Returns with INTPACK in SS:BP: 21 16 ; AH: Int 13h return status 22 17 ; CF: 0 if succesfull, 1 if error 23 ; IF: 124 ; Corrupts registers:25 ; Flags26 18 ;-------------------------------------------------------------------- 27 19 ALIGN JUMP_ALIGN 28 20 AH10h_HandlerForCheckDriveReady: 29 ; Save registers30 push dx31 push cx32 push bx33 push ax34 35 ; Wait until drive is ready36 call FindDPT_ForDriveNumber ; DS:DI now points to DPT37 21 call HStatus_WaitRdyDefTime 38 jmp Int13h_PopXRegsAndReturn 22 xor ah, ah 23 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH11h_HRecal.asm
r84 r148 1 ; File name : AH11h_HRecal.asm 2 ; Project name : IDE BIOS 3 ; Created date : 28.9.2007 4 ; Last update : 14.1.2011 5 ; Author : Tomi Tilli, 6 ; : Krister Nordvall (optimizations) 1 ; Project name : XTIDE Universal BIOS 7 2 ; Description : Int 13h function AH=11h, Recalibrate. 8 3 … … 15 10 ; AH11h_HandlerForRecalibrate 16 11 ; Parameters: 17 ; AH: Bios function 11h 18 ; DL: Drive number 19 ; Parameters loaded by Int13h_Jump: 20 ; DS: RAMVARS segment 21 ; Returns: 12 ; DL: Translated Drive number 13 ; DS:DI: Ptr to DPT (in RAMVARS segment) 14 ; SS:BP: Ptr to INTPACK 15 ; Returns with INTPACK in SS:BP: 22 16 ; AH: BIOS Error code 23 17 ; CF: 0 if succesfull, 1 if error 24 ; IF: 125 ; Corrupts registers:26 ; Flags27 18 ;-------------------------------------------------------------------- 28 19 ALIGN JUMP_ALIGN 29 20 AH11h_HandlerForRecalibrate: 30 push dx31 push cx32 push bx33 push ax34 21 %ifndef USE_186 35 22 call AH11h_RecalibrateDrive 36 jmp Int13h_ PopXRegsAndReturn23 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 37 24 %else 38 push Int13h_ PopXRegsAndReturn25 push Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 39 26 ; Fall through to AH11h_RecalibrateDrive 40 27 %endif … … 42 29 43 30 ;-------------------------------------------------------------------- 44 ; Int 13h function AH=11h, Recalibrate.45 ;46 31 ; AH11h_HRecalibrate 47 32 ; Parameters: 48 ; DL: Drive number 49 ; DS: RAMVARS segment 33 ; DS:DI: Ptr to DPT (in RAMVARS segment) 50 34 ; Returns: 51 ; DS:DI: Ptr to DPT52 35 ; AH: BIOS Error code 53 36 ; CF: 0 if succesfull, 1 if error … … 55 38 ; AL, BX, CX, DX 56 39 ;-------------------------------------------------------------------- 57 ALIGN JUMP_ALIGN58 40 AH11h_RecalibrateDrive: 59 41 ; Recalibrate command is optional, vendor specific and not even -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH15h_HSize.asm
r117 r148 10 10 ; AH15h_HandlerForReadDiskDriveSize 11 11 ; Parameters: 12 ; AH: Bios function 15h 13 ; DL: Drive number 14 ; Parameters loaded by Int13h_Jump: 15 ; DS: RAMVARS segment 16 ; Returns: 12 ; DL: Translated Drive number 13 ; DS:DI: Ptr to DPT (in RAMVARS segment) 14 ; SS:BP: Ptr to INTPACK 15 ; Returns with INTPACK in SS:BP: 17 16 ; If succesfull: 18 17 ; AH: 3 (Hard disk accessible) … … 23 22 ; CX:DX: 0 24 23 ; CF: 1 25 ; IF: 126 ; Corrupts registers:27 ; Flags28 24 ;-------------------------------------------------------------------- 29 25 ALIGN JUMP_ALIGN 30 26 AH15h_HandlerForReadDiskDriveSize: 31 push bx 32 push ax 27 call HCapacity_GetSectorCountFromOurAH08h ; Sector count to DX:AX 28 mov [bp+INTPACK.cx], dx ; HIWORD to CX 29 mov [bp+INTPACK.dx], ax ; LOWORD to DX 33 30 34 call HCapacity_GetSectorCountFromOurAH08h; Sector count to DX:AX (clears CF) 35 mov cx, dx ; HIWORD to CX 36 xchg dx, ax ; LOWORD to DX 37 38 pop ax 39 pop bx 40 mov ah, 3 ; Type code = Hard disk 41 jmp Int13h_ReturnWithValueInDL 31 xor ah, ah 32 call HError_SetErrorCodeToIntpackInSSBPfromAH ; Store success to BDA and CF 33 mov BYTE [bp+INTPACK.ah], 3 ; Type code = Hard disk 34 jmp Int13h_ReturnFromHandlerWithoutStoringErrorCode -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH1h_HStatus.asm
r116 r148 10 10 ; AH1h_HandlerForReadDiskStatus 11 11 ; Parameters: 12 ; AH: Bios function 1h 13 ; DL: Drive number (8xh) 14 ; Parameters loaded by Int13h_Jump: 15 ; DS: RAMVARS segment 16 ; Returns: 12 ; DL: Translated Drive number 13 ; DS:DI: Ptr to DPT (in RAMVARS segment) 14 ; SS:BP: Ptr to INTPACK 15 ; Returns with INTPACK in SS:BP: 17 16 ; AH: Int 13h floppy return status 18 17 ; CF: 0 if AH = RET_HD_SUCCESS, 1 otherwise (error) 19 ; IF: 120 ; Corrupts registers:21 ; Flags22 18 ;-------------------------------------------------------------------- 23 19 ALIGN JUMP_ALIGN 24 20 AH1h_HandlerForReadDiskStatus: 25 push ds 26 27 LOAD_BDA_SEGMENT_TO ds, di 28 mov ah, [BDA.bHDLastSt] ; Last error to AH 29 cmp ah, 1 ; Set CF if error code is zero 30 cmc ; Invert CF 31 32 pop ds 33 jmp Int13h_PopDiDsAndReturn 21 LOAD_BDA_SEGMENT_TO ds, ax, ! 22 xchg ah, [BDA.bHDLastSt] ; Load and clear last error 23 call HError_SetErrorCodeToIntpackInSSBPfromAH 24 jmp Int13h_ReturnFromHandlerWithoutStoringErrorCode -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH23h_HFeatures.asm
r3 r148 1 ; File name : AH23h_HFeatures.asm 2 ; Project name : IDE BIOS 3 ; Created date : 28.12.2009 4 ; Last update : 12.4.2010 5 ; Author : Tomi Tilli 1 ; Project name : XTIDE Universal BIOS 6 2 ; Description : Int 13h function AH=23h, 7 3 ; Set Controller Features Register. … … 15 11 ; AH23h_HandlerForSetControllerFeatures 16 12 ; Parameters: 17 ; AH: Bios function 23h 13 ; AL, CX: Same as in INTPACK 14 ; DL: Translated Drive number 15 ; DS:DI: Ptr to DPT (in RAMVARS segment) 16 ; SS:BP: Ptr to INTPACK 17 ; Parameters on INTPACK in SS:BP: 18 18 ; AL: Feature Number (parameter to Features Register = subcommand) 19 ; DL: Drive number (8xh) 20 ; Parameters loaded by Int13h_Jump: 21 ; DS: RAMVARS segment 22 ; Parameter registers are undocumented, specific for this BIOS: 19 ; (Parameter registers are undocumented, there are specific for this BIOS): 23 20 ; BH: Parameter to Sector Count Register (subcommand specific) 24 21 ; BL: Parameter to Sector Number Register (subcommand specific) 25 22 ; CL: Parameter to Low Cylinder Register (subcommand specific) 26 23 ; CH: Parameter to High Cylinder Register (subcommand specific) 24 ; Returns with INTPACK in SS:BP: 25 ; AH: Int 13h return status 26 ; CF: 0 if succesfull, 1 if error 27 ;-------------------------------------------------------------------- 28 ALIGN JUMP_ALIGN 29 AH23h_HandlerForSetControllerFeatures: 30 %ifndef USE_186 31 call AH23h_SetControllerFeatures 32 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 33 %else 34 push Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 35 ; Fall through to AH23h_SetControllerFeatures 36 %endif 37 38 39 ;-------------------------------------------------------------------- 40 ; AH23h_SetControllerFeatures 41 ; Parameters: 42 ; AL: Feature Number (parameter to Features Register = subcommand) 43 ; BH: Parameter to Sector Count Register (subcommand specific) 44 ; BL: Parameter to Sector Number Register (subcommand specific) 45 ; CL: Parameter to Low Cylinder Register (subcommand specific) 46 ; CH: Parameter to High Cylinder Register (subcommand specific) 47 ; DS:DI: Ptr to DPT (in RAMVARS segment) 27 48 ; Returns: 28 49 ; AH: Int 13h return status 29 50 ; CF: 0 if succesfull, 1 if error 30 ; IF: 131 51 ; Corrupts registers: 32 ; Flags52 ; AX, BX, CX, DX, SI 33 53 ;-------------------------------------------------------------------- 34 54 ALIGN JUMP_ALIGN 35 AH23h_HandlerForSetControllerFeatures: 36 push dx 37 push cx 38 push bx 39 push ax 40 push si 41 55 AH23h_SetControllerFeatures: 42 56 ; Backup AL and BH to SI 43 57 mov ah, bh … … 45 59 46 60 ; Select Master or Slave and wait until ready 47 call FindDPT_ForDriveNumber ; DS:DI now points to DPT48 61 call HDrvSel_SelectDriveAndDisableIRQ 49 jc SHORT .Return ; Return if error62 jc SHORT .ReturnWithErrorCodeInAH 50 63 51 64 ; Output Feature Number … … 66 79 call HCommand_OutputSectorCountAndCommand 67 80 68 call HStatus_WaitBsyDefTime ; Wait until drive ready 69 .Return: 70 pop si 71 jmp Int13h_PopXRegsAndReturn 81 jmp HStatus_WaitBsyDefTime ; Wait until drive ready 82 .ReturnWithErrorCodeInAH: 83 ret -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH24h_HSetBlocks.asm
r84 r148 1 ; File name : AH24h_HSetBlocks.asm 2 ; Project name : IDE BIOS 3 ; Created date : 28.12.2009 4 ; Last update : 14.1.2011 5 ; Author : Tomi Tilli, 6 ; : Krister Nordvall (optimizations) 1 ; Project name : XTIDE Universal BIOS 7 2 ; Description : Int 13h function AH=24h, Set Multiple Blocks. 8 3 … … 15 10 ; AH24h_HandlerForSetMultipleBlocks 16 11 ; Parameters: 17 ; AH: Bios function 24h 12 ; AL: Same as in INTPACK 13 ; DL: Translated Drive number 14 ; DS:DI: Ptr to DPT (in RAMVARS segment) 15 ; SS:BP: Ptr to INTPACK 16 ; Parameters on INTPACK in SS:BP: 18 17 ; AL: Number of Sectors per Block (1, 2, 4, 8, 16, 32, 64 or 128) 19 ; DL: Drive number 20 ; Parameters loaded by Int13h_Jump: 21 ; DS: RAMVARS segment 22 ; Returns: 18 ; Returns with INTPACK in SS:BP: 23 19 ; AH: Int 13h return status 24 20 ; CF: 0 if succesfull, 1 if error 25 ; IF: 126 ; Corrupts registers:27 ; Flags28 21 ;-------------------------------------------------------------------- 29 22 ALIGN JUMP_ALIGN 30 23 AH24h_HandlerForSetMultipleBlocks: 31 push dx32 push cx33 push bx34 push ax35 24 %ifndef USE_186 36 25 call AH24h_SetBlockSize 37 jmp Int13h_ PopXRegsAndReturn26 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 38 27 %else 39 push Int13h_ PopXRegsAndReturn28 push Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 40 29 ; Fall through to AH24h_SetBlockSize 41 30 %endif … … 48 37 ; Parameters: 49 38 ; AL: Number of Sectors per Block (1, 2, 4, 8, 16, 32, 64 or 128) 50 ; DL: Drive number 51 ; DS: RAMVARS segment 39 ; DS:DI: Ptr to DPT (in RAMVARS segment) 52 40 ; Returns: 53 ; DS:DI: Ptr to DPT54 41 ; AH: Int 13h return status 55 42 ; CF: 0 if succesfull, 1 if error 56 43 ; Corrupts registers: 57 ; AL, BX, CX, DX , DI44 ; AL, BX, CX, DX 58 45 ;-------------------------------------------------------------------- 59 46 ALIGN JUMP_ALIGN … … 61 48 ; Select Master or Slave and wait until ready 62 49 mov bl, al ; Backup block size 63 call FindDPT_ForDriveNumber ; DS:DI now points to DPT64 50 call HDrvSel_SelectDriveAndDisableIRQ ; Select drive and wait until ready 65 jc SHORT .Return 51 jc SHORT .ReturnWithErrorCodeInAH ; Return if error 66 52 67 53 ; Output block size and command … … 80 66 .DisableBlockMode: 81 67 mov BYTE [di+DPT.bSetBlock], 1 ; Disable block mode 82 .Return :68 .ReturnWithErrorCodeInAH: 83 69 ret -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH25h_HDrvID.asm
r120 r148 10 10 ; AH25h_HandlerForGetDriveInformation 11 11 ; Parameters: 12 ; AH: Bios function 25h 13 ; DL: Drive number 12 ; ES: Same as in INTPACK 13 ; DL: Translated Drive number 14 ; DS:DI: Ptr to DPT (in RAMVARS segment) 15 ; SS:BP: Ptr to INTPACK 16 ; Parameters on INTPACK in SS:BP: 14 17 ; ES:BX: Ptr to buffer to receive 512-byte drive information 15 ; Parameters loaded by Int13h_Jump: 16 ; DS: RAMVARS segment 17 ; Returns: 18 ; ES:BX: Ptr to 512-byte buffer to receive drive Information 18 ; Returns with INTPACK in SS:BP: 19 19 ; AH: Int 13h return status 20 20 ; CF: 0 if succesfull, 1 if error 21 ; IF: 122 ; Corrupts registers:23 ; Flags24 21 ;-------------------------------------------------------------------- 25 22 ALIGN JUMP_ALIGN 26 23 AH25h_HandlerForGetDriveInformation: 27 push dx28 push cx29 push bx30 push ax31 push es32 33 24 ; Wait until previously selected drive is ready 34 call FindDPT_ForDriveNumber ; DS:DI now points to DPT35 25 call HDrvSel_SelectDriveAndDisableIRQ 36 jc SHORT .Return 26 jc SHORT .ReturnWithErrorCodeInAH ; Return if error 37 27 38 28 ; Get drive information 29 mov bx, [bp+INTPACK.bx] 39 30 call HPIO_NormalizeDataPointer 40 31 push bx … … 45 36 pop di ; Pop buffer offset to DI 46 37 call AH25h_GetDriveInfo ; Get drive information 47 .Return: 48 pop es 49 jmp Int13h_PopXRegsAndReturn 38 .ReturnWithErrorCodeInAH: 39 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 50 40 51 41 … … 87 77 eCMOVE cl, B_TIMEOUT_RESET ; If so, load long timeout 88 78 call HStatus_WaitRdy ; Wait until ready to accept commands 89 jc SHORT .Return ; Return if error79 jc SHORT .ReturnWithErrorCodeInAH 90 80 91 81 ; Output command … … 93 83 out dx, al ; Output command 94 84 call HStatus_WaitDrqDefTime ; Wait until ready to transfer (no IRQ!) 95 jc SHORT .Return ; Return if error85 jc SHORT .ReturnWithErrorCodeInAH 96 86 97 87 ; Transfer data … … 102 92 call HStatus_WaitRdyDefTime ; Wait until drive ready 103 93 104 .Return :94 .ReturnWithErrorCodeInAH: 105 95 pop bx 106 96 pop dx -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH2h_HRead.asm
r35 r148 1 ; File name : AH2h_HRead.asm 2 ; Project name : IDE BIOS 3 ; Created date : 27.9.2007 4 ; Last update : 24.8.2010 5 ; Author : Tomi Tilli 1 ; Project name : XTIDE Universal BIOS 6 2 ; Description : Int 13h function AH=2h, Read Disk Sectors. 7 3 … … 14 10 ; AH2h_HandlerForReadDiskSectors 15 11 ; Parameters: 16 ; AH: Bios function 2h 12 ; AL, CX, DH, ES: Same as in INTPACK 13 ; DL: Translated Drive number 14 ; DS:DI: Ptr to DPT (in RAMVARS segment) 15 ; SS:BP: Ptr to INTPACK 16 ; Parameters on INTPACK in SS:BP: 17 17 ; AL: Number of sectors to read (1...255) 18 18 ; CH: Cylinder number, bits 7...0 … … 20 20 ; Bits 5...0: Starting sector number (1...63) 21 21 ; DH: Starting head number (0...255) 22 ; DL: Drive number (8xh)23 22 ; ES:BX: Pointer to buffer recieving data 24 ; Parameters loaded by Int13h_Jump: 25 ; DS: RAMVARS segment 26 ; Returns: 23 ; Returns with INTPACK in SS:BP: 27 24 ; AH: Int 13h/40h floppy return status 28 ; AL: Burst error length if AH =11h, undefined otherwise25 ; AL: Burst error length if AH returns 11h, undefined otherwise 29 26 ; CF: 0 if successfull, 1 if error 30 ; IF: 131 ; Corrupts registers:32 ; Flags33 27 ;-------------------------------------------------------------------- 34 28 ALIGN JUMP_ALIGN … … 37 31 jz SHORT AH2h_ZeroCntErr ; If so, return with error 38 32 39 ; Save registers40 push dx41 push cx42 push bx43 push ax44 45 33 ; Select sector or block mode command 46 call FindDPT_ForDriveNumber ; DS:DI now points to DPT47 34 mov ah, HCMD_READ_SECT ; Load sector mode command 48 35 cmp BYTE [di+DPT.bSetBlock], 1 ; Block mode enabled? 49 jbe SHORT .XferData ; If not, jump to transfer 50 mov ah, HCMD_READ_MUL ; Load block mode command 36 eCMOVA ah, HCMD_READ_MUL ; Load block mode command 51 37 52 38 ; Transfer data 53 ALIGN JUMP_ALIGN54 .XferData:55 39 call HCommand_OutputCountAndLCHSandCommand 56 jc SHORT .Return ; Return if error 40 jc SHORT .ReturnWithErrorCodeInAH 41 mov bx, [bp+INTPACK.bx] 57 42 call HPIO_ReadBlock ; Read data from IDE-controller 58 .Return :59 jmp Int13h_ PopXRegsAndReturn43 .ReturnWithErrorCodeInAH: 44 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 60 45 61 46 ; Invalid sector count (also for AH=3h and AH=4h) 62 47 AH2h_ZeroCntErr: 63 48 mov ah, RET_HD_INVALID ; Invalid value passed 64 stc ; Set CF since error 65 jmp Int13h_PopDiDsAndReturn 49 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH3h_HWrite.asm
r3 r148 1 ; File name : AH3h_HWrite.asm 2 ; Project name : IDE BIOS 3 ; Created date : 13.10.2007 4 ; Last update : 12.4.2010 5 ; Author : Tomi Tilli 1 ; Project name : XTIDE Universal BIOS 6 2 ; Description : Int 13h function AH=3h, Write Disk Sectors. 7 3 … … 14 10 ; AH3h_HandlerForWriteDiskSectors 15 11 ; Parameters: 16 ; AH: Bios function 3h 12 ; AL, CX, DH, ES: Same as in INTPACK 13 ; DL: Translated Drive number 14 ; DS:DI: Ptr to DPT (in RAMVARS segment) 15 ; SS:BP: Ptr to INTPACK 16 ; Parameters on INTPACK in SS:BP: 17 17 ; AL: Number of sectors to write 18 18 ; CH: Cylinder number, bits 7...0 … … 20 20 ; Bits 5...0: Starting sector number (1...63) 21 21 ; DH: Starting head number (0...255) 22 ; DL: Drive number (8xh)23 22 ; ES:BX: Pointer to source data 24 ; Parameters loaded by Int13h_Jump: 25 ; DS: RAMVARS segment 26 ; Returns: 23 ; Returns with INTPACK in SS:BP: 27 24 ; AH: Int 13h/40h floppy return status 28 25 ; CF: 0 if successfull, 1 if error 29 ; IF: 130 ; Corrupts registers:31 ; Flags32 26 ;-------------------------------------------------------------------- 33 27 ALIGN JUMP_ALIGN … … 36 30 jz SHORT AH2h_ZeroCntErr ; If so, return with error 37 31 38 ; Save registers39 push dx40 push cx41 push bx42 push ax43 44 32 ; Select sector or block mode command 45 call FindDPT_ForDriveNumber ; DS:DI now points to DPT46 33 mov ah, HCMD_WRITE_SECT ; Load sector mode command 47 34 cmp BYTE [di+DPT.bSetBlock], 1 ; Block mode enabled? 48 jbe SHORT .XferData ; If not, jump to transfer 49 mov ah, HCMD_WRITE_MUL ; Load block mode command 35 eCMOVA ah, HCMD_WRITE_MUL ; Load block mode command 50 36 51 37 ; Transfer data 52 ALIGN JUMP_ALIGN53 .XferData:54 38 call HCommand_OutputCountAndLCHSandCommand 55 jc SHORT .Return ; Return if error 39 jc SHORT .ReturnWithErrorCodeInAH 40 mov bx, [bp+INTPACK.bx] 56 41 call HPIO_WriteBlock ; Write data to IDE-controller 57 .Return :58 jmp Int13h_ PopXRegsAndReturn42 .ReturnWithErrorCodeInAH: 43 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH4h_HVerify.asm
r84 r148 1 ; File name : AH4h_HVerify.asm 2 ; Project name : IDE BIOS 3 ; Created date : 13.10.2007 4 ; Last update : 14.1.2011 5 ; Author : Tomi Tilli, 6 ; : Krister Nordvall (optimizations) 1 ; Project name : XTIDE Universal BIOS 7 2 ; Description : Int 13h function AH=4h, Verify Disk Sectors. 8 3 … … 15 10 ; AH4h_HandlerForVerifyDiskSectors 16 11 ; Parameters: 17 ; AH: Bios function 4h 12 ; AL, CX, DH: Same as in INTPACK 13 ; DL: Translated Drive number 14 ; DS:DI: Ptr to DPT (in RAMVARS segment) 15 ; SS:BP: Ptr to INTPACK 16 ; Parameters on INTPACK in SS:BP: 18 17 ; AL: Number of sectors to verify 19 18 ; CH: Cylinder number, bits 7...0 … … 21 20 ; Bits 5...0: Starting sector number (1...63) 22 21 ; DH: Starting head number (0...255) 23 ; DL: Drive number 24 ; ES:BX: Pointer to source data (not used) 25 ; Parameters loaded by Int13h_Jump: 26 ; DS: RAMVARS segment 27 ; Returns: 22 ; Returns with INTPACK in SS:BP: 28 23 ; AH: Int 13h/40h floppy return status 29 24 ; CF: 0 if successfull, 1 if error 30 ; IF: 131 ; Corrupts registers:32 ; Flags33 25 ;-------------------------------------------------------------------- 34 26 ALIGN JUMP_ALIGN … … 36 28 test al, al ; Invalid sector count? 37 29 jz SHORT AH2h_ZeroCntErr ; If so, return with error 38 push dx39 push cx40 push bx41 push ax42 %ifndef USE_18643 call AH4h_VerifySectors44 jmp Int13h_PopXRegsAndReturn45 %else46 push Int13h_PopXRegsAndReturn47 ; Fall through to AH4h_VerifySectors48 %endif49 30 50 51 ;--------------------------------------------------------------------52 ; Verifies hard disk sectors.53 ;54 ; AH4h_VerifySectors55 ; Parameters:56 ; AL: Number of sectors to verify57 ; CH: Cylinder number, bits 7...058 ; CL: Bits 7...6: Cylinder number bits 9 and 859 ; Bits 5...0: Starting sector number (1...63)60 ; DH: Starting head number (0...255)61 ; DL: Drive number62 ; DS: RAMVARS segment63 ; Returns:64 ; DS:DI: Ptr to DPT65 ; AH: Int 13h/40h floppy return status66 ; CF: 0 if successfull, 1 if error67 ; Corrupts registers:68 ; AL, BX, CX, DX69 ;--------------------------------------------------------------------70 ALIGN JUMP_ALIGN71 AH4h_VerifySectors:72 call FindDPT_ForDriveNumber ; DS:DI now points to DPT73 31 mov ah, HCMD_VERIFY_SECT ; Load command to AH 74 32 call HCommand_OutputCountAndLCHSandCommand 75 jc SHORT .Return ; Return if error33 jc SHORT .ReturnWithErrorCodeInAH 76 34 mov bx, di ; DS:BX now points to DPT 77 jmpHStatus_WaitIrqOrRdy ; Wait for IRQ or RDY78 .Return :79 ret35 call HStatus_WaitIrqOrRdy ; Wait for IRQ or RDY 36 .ReturnWithErrorCodeInAH: 37 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH8h_HParams.asm
r93 r148 10 10 ; AH8h_HandlerForReadDiskDriveParameters 11 11 ; Parameters: 12 ; AH: Bios function 8h 13 ; DL: Drive number 14 ; Parameters loaded by Int13h_Jump: 15 ; DS: RAMVARS segment 16 ; Returns: 12 ; DL: Translated Drive number 13 ; DS:DI: Ptr to DPT (in RAMVARS segment) 14 ; SS:BP: Ptr to INTPACK 15 ; Returns with INTPACK in SS:BP: 17 16 ; CH: Maximum cylinder number, bits 7...0 18 17 ; CL: Bits 7...6: Cylinder number bits 9...8 … … 22 21 ; AH: Int 13h/40h floppy return status 23 22 ; CF: 0 if successfull, 1 if error 24 ; IF: 125 ; Corrupts registers:26 ; Flags27 23 ;-------------------------------------------------------------------- 28 24 ALIGN JUMP_ALIGN … … 30 26 call RamVars_IsDriveHandledByThisBIOS 31 27 jnc SHORT .GetDriveParametersForForeignHardDiskInDL 28 call AH8h_GetDriveParameters 29 jmp SHORT .ReturnAfterStoringValuesToIntpack 32 30 33 push bx34 call AH8h_GetDriveParameters35 pop bx36 jmp Int13h_ReturnWithValueInDL37 38 ALIGN JUMP_ALIGN39 31 .GetDriveParametersForForeignHardDiskInDL: 40 32 call Int13h_CallPreviousInt13hHandler 41 33 jc SHORT .ReturnErrorFromPreviousInt13hHandler 42 34 call RamVars_GetCountOfKnownDrivesToDL 43 jmp Int13h_ReturnWithValueInDL 35 .ReturnAfterStoringValuesToIntpack: 36 mov [bp+INTPACK.cx], cx 37 mov [bp+INTPACK.dx], dx 38 xor ah, ah 44 39 .ReturnErrorFromPreviousInt13hHandler: 45 jmp Int13h_ PopDiDsAndReturn40 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 46 41 47 42 … … 51 46 ; AH8h_GetDriveParameters 52 47 ; Parameters: 53 ; DL: Drive number 54 ; DS: RAMVARS segment 48 ; DS:DI: Ptr to DPT (in RAMVARS segment) 55 49 ; Returns: 56 50 ; CH: Maximum cylinder number, bits 7...0 … … 59 53 ; DH: Maximum head number (0...255) 60 54 ; DL: Number of drives 61 ; DS:DI: Ptr to DPT62 ; AH: Int 13h/40h floppy return status63 ; CF: 0 if successfull, 1 if error64 55 ; Corrupts registers: 65 ; A L, BX56 ; AX, BX 66 57 ;-------------------------------------------------------------------- 67 58 ALIGN JUMP_ALIGN 68 59 AH8h_GetDriveParameters: 69 call FindDPT_ForDriveNumber70 60 call AccessDPT_GetLCHSfromPCHS ; AX=sectors, BX=cylinders, DX=heads 71 call AH8h_PackReturnValues 72 xor ax, ax ; Clear AH and CF 73 ret 74 61 ; Fall to .PackReturnValues 75 62 76 63 ;-------------------------------------------------------------------- 77 64 ; Packs L-CHS values to INT 13h, AH=08h return values. 78 65 ; 79 ; AH8h_PackReturnValues66 ; .PackReturnValues 80 67 ; Parameters: 81 68 ; AX: Number of L-CHS sectors per track (1...63) … … 92 79 ; AX, BX 93 80 ;-------------------------------------------------------------------- 94 ALIGN JUMP_ALIGN 95 AH8h_PackReturnValues: 81 .PackReturnValues: 96 82 dec bx ; Cylinder count to last cylinder 97 83 dec dx ; Head count to max head number -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm
r84 r148 1 ; File name : AH9h_HInit.asm 2 ; Project name : IDE BIOS 3 ; Created date : 9.12.2007 4 ; Last update : 14.1.2011 5 ; Author : Tomi Tilli, 6 ; : Krister Nordvall (optimizations) 1 ; Project name : XTIDE Universal BIOS 7 2 ; Description : Int 13h function AH=9h, Initialize Drive Parameters. 8 3 … … 15 10 ; AH9h_HandlerForInitializeDriveParameters 16 11 ; Parameters: 17 ; AH: Bios function 9h 18 ; DL: Drive number 19 ; Parameters loaded by Int13h_Jump: 20 ; DS: RAMVARS segment 21 ; Returns: 12 ; DL: Translated Drive number 13 ; DS:DI: Ptr to DPT (in RAMVARS segment) 14 ; SS:BP: Ptr to INTPACK 15 ; Returns with INTPACK in SS:BP: 22 16 ; AH: Int 13h return status 23 17 ; CF: 0 if succesfull, 1 if error 24 ; IF: 125 ; Corrupts registers:26 ; Flags27 18 ;-------------------------------------------------------------------- 28 19 ALIGN JUMP_ALIGN 29 20 AH9h_HandlerForInitializeDriveParameters: 30 push dx31 push cx32 push bx33 push ax34 21 %ifndef USE_186 35 22 call AH9h_InitializeDriveForUse 36 jmp Int13h_ PopXRegsAndReturn23 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 37 24 %else 38 push Int13h_ PopXRegsAndReturn25 push Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 39 26 ; Fall through to AH9h_InitializeDriveForUse 40 27 %endif … … 46 33 ; AH9h_InitializeDriveForUse 47 34 ; Parameters: 48 ; DL: Drive number 49 ; DS: RAMVARS segment 35 ; DS:DI: Ptr to DPT (in RAMVARS segment) 50 36 ; Returns: 51 ; DS:DI: Ptr to DPT52 37 ; AH: Int 13h return status 53 38 ; CF: 0 if succesfull, 1 if error 54 39 ; Corrupts registers: 55 ; AL, BX 40 ; AL, BX, DX 56 41 ;-------------------------------------------------------------------- 57 42 ALIGN JUMP_ALIGN 58 43 AH9h_InitializeDriveForUse: 59 push dx60 44 push cx 61 45 62 46 ; Try to select drive and wait until ready 63 call FindDPT_ForDriveNumber64 47 or BYTE [di+DPT.bReset], MASK_RESET_ALL ; Everything uninitialized 65 48 call HDrvSel_SelectDriveAndDisableIRQ … … 76 59 .RecalibrateDrive: 77 60 call AH11h_RecalibrateDrive 78 mov dl, [di+DPT.bDrvNum] ; Restore DL79 61 jc SHORT .InitializeBlockMode 80 62 and BYTE [di+DPT.bReset], ~FLG_RESET_nRECALIBRATE 81 63 82 64 ; Initialize block mode transfers 83 ALIGN JUMP_ALIGN84 65 .InitializeBlockMode: 85 66 call AH9h_InitializeBlockMode 86 ;mov dl, [di+DPT.bDrvNum] ; Restore DL87 67 jc SHORT .ReturnNotSuccessfull 88 and BYTE [di+DPT.bReset], ~FLG_RESET_nSETBLOCK 68 and BYTE [di+DPT.bReset], ~FLG_RESET_nSETBLOCK ; Keeps CF clear 89 69 90 70 .ReturnNotSuccessfull: 91 71 pop cx 92 pop dx93 72 ret 94 73 … … 135 114 ; AH9h_InitializeBlockMode 136 115 ; Parameters: 137 ; DL: Drive number138 116 ; DS:DI: Ptr to DPT 139 117 ; Returns: -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHCh_HSeek.asm
r116 r148 10 10 ; AHCh_HandlerForSeek 11 11 ; Parameters: 12 ; AH: Bios function Ch 12 ; CX, DH: Same as in INTPACK 13 ; DL: Translated Drive number 14 ; DS:DI: Ptr to DPT (in RAMVARS segment) 15 ; SS:BP: Ptr to INTPACK 16 ; Parameters on INTPACK in SS:BP: 13 17 ; CH: Cylinder number, bits 7...0 14 18 ; CL: Bits 7...6: Cylinder number bits 9 and 8 15 19 ; Bits 5...0: Starting sector number (1...63) 16 20 ; DH: Starting head number (0...255) 17 ; DL: Drive number 18 ; Parameters loaded by Int13h_Jump: 19 ; DS: RAMVARS segment 20 ; Returns: 21 ; Returns with INTPACK in SS:BP: 21 22 ; AH: BIOS Error code 22 23 ; CF: 0 if succesfull, 1 if error 23 ; IF: 124 ; Corrupts registers:25 ; Flags26 24 ;-------------------------------------------------------------------- 27 25 ALIGN JUMP_ALIGN 28 26 AHCh_HandlerForSeek: 29 push dx30 push cx31 push bx32 push ax33 27 %ifndef USE_186 34 28 call AHCh_SeekToCylinder 35 jmp Int13h_ PopXRegsAndReturn29 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 36 30 %else 37 push Int13h_ PopXRegsAndReturn31 push Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 38 32 ; Fall through to AHCh_SeekToCylinder 39 33 %endif … … 41 35 42 36 ;-------------------------------------------------------------------- 43 ; Seeks to a cylinder.44 ;45 37 ; AHCh_SeekToCylinder 46 38 ; Parameters: … … 49 41 ; Bits 5...0: Starting sector number (1...63) 50 42 ; DH: Starting head number (0...255) 51 ; DL: Drive Number 52 ; DS: RAMVARS segment 43 ; DS:DI: Ptr to DPT (in RAMVARS segment) 53 44 ; Returns: 54 ; DS:DI: Ptr to DPT55 45 ; AH: BIOS Error code 56 46 ; CF: 0 if succesfull, 1 if error … … 58 48 ; AL, BX, CX, DX 59 49 ;-------------------------------------------------------------------- 60 ALIGN JUMP_ALIGN61 50 AHCh_SeekToCylinder: 62 call FindDPT_ForDriveNumber ; DS:DI now points to DPT63 51 mov ax, HCMD_SEEK<<8 ; Load cmd to AH, AL=zero sector cnt 64 52 call HCommand_OutputCountAndLCHSandCommand 65 jc SHORT .Return ; Return if error53 jc SHORT .ReturnWithErrorCodeInAH 66 54 mov bx, di ; DS:BX now points to DPT 67 55 jmp HStatus_WaitIrqOrRdy ; Wait for IRQ or RDY 68 .Return :56 .ReturnWithErrorCodeInAH: 69 57 ret -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHDh_HReset.asm
r143 r148 10 10 ; AHDh_HandlerForResetHardDisk 11 11 ; Parameters: 12 ; AH: Bios function Dh 13 ; DL: Drive number 14 ; Returns: 12 ; DL: Translated Drive number 13 ; DS:DI: Ptr to DPT (in RAMVARS segment) 14 ; SS:BP: Ptr to INTPACK 15 ; Returns with INTPACK in SS:BP: 15 16 ; AH: Int 13h return status 16 17 ; CF: 0 if succesfull, 1 if error 17 ; IF: 118 ; Corrupts registers:19 ; Flags20 18 ;-------------------------------------------------------------------- 21 19 ALIGN JUMP_ALIGN … … 23 21 %ifndef USE_186 24 22 call AHDh_ResetDrive 25 jmp Int13h_ PopDiDsAndReturn23 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 26 24 %else 27 push Int13h_ PopDiDsAndReturn25 push Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 28 26 ; Fall through to AHDh_ResetDrive 29 27 %endif … … 41 39 ; CF: 0 if succesfull, 1 if error 42 40 ; Corrupts registers: 43 ; DI41 ; AL, CX, DI 44 42 ;-------------------------------------------------------------------- 45 43 ALIGN JUMP_ALIGN 46 44 AHDh_ResetDrive: 47 45 push dx 48 push cx49 46 push bx 50 push ax51 47 52 48 call FindDPT_ForDriveNumber ; DS:DI now points to DPT … … 60 56 call AHDh_InitializeMasterAndSlave 61 57 62 pop bx ; Pop old AX63 mov al, bl ; Restore AL64 58 pop bx 65 pop cx66 59 pop dx 67 60 ret … … 90 83 call HDrvSel_OutputDeviceControlByte 91 84 mov ax, 5 ; Delay at least 5us 92 call HTimer_ MicrosecondsFromAX85 call HTimer_DelayMicrosecondsFromAX 93 86 94 87 ; HSR1: Clear_wait … … 96 89 out dx, al ; End Reset 97 90 mov ax, 2000 ; Delay at least 2ms 98 call HTimer_ MicrosecondsFromAX91 call HTimer_DelayMicrosecondsFromAX 99 92 100 93 ; HSR2: Check_status -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HCapacity.asm
r117 r148 13 13 ; DL: Drive number 14 14 ; DS: RAMVARS segment 15 ; DS:DI: Ptr to DPT (HCapacity_GetSectorCountFromOurAH08h) 15 16 ; Returns: 16 17 ; DX:AX: Total sector count … … 21 22 ALIGN JUMP_ALIGN 22 23 HCapacity_GetSectorCountFromForeignAH08h: 23 mov ah, 08h ; Get Drive Parameters24 mov ah, GET_DRIVE_PARAMETERS 24 25 call Int13h_CallPreviousInt13hHandler 25 jmp SHORT HCapacity_ConvertAH08hReturnValuesToSectorCount26 jmp SHORT ConvertAH08hReturnValuesToSectorCount 26 27 27 28 ALIGN JUMP_ALIGN 28 29 HCapacity_GetSectorCountFromOurAH08h: 29 push di30 30 call AH8h_GetDriveParameters 31 pop di 32 ; Fall to HCapacity_ConvertAH08hReturnValuesToSectorCount 31 ; Fall to ConvertAH08hReturnValuesToSectorCount 33 32 34 ALIGN JUMP_ALIGN 35 HCapacity_ConvertAH08hReturnValuesToSectorCount: 33 ConvertAH08hReturnValuesToSectorCount: 36 34 call HAddress_ExtractLCHSFromBiosParams 37 35 xor ax, ax ; Zero AX -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HDrvSel.asm
r88 r148 4 4 ; Section containing code 5 5 SECTION .text 6 7 ;-------------------------------------------------------------------- 8 ; Selects Master or Slave drive and disables interrupts. Interrupts should 9 ; be disabled for commands that do not transfer data. 10 ; This function returns after drive is ready to accept commands. 11 ; 12 ; HDrvSel_SelectDriveAndDisableIRQ 13 ; Parameters: 14 ; DS:DI: Ptr to DPT 15 ; Returns: 16 ; AH: BIOS Error code 17 ; CF: 0 if drive selected successfully 18 ; 1 if any error 19 ; Corrupts registers: 20 ; AL 21 ;-------------------------------------------------------------------- 22 ALIGN JUMP_ALIGN 23 HDrvSel_SelectDriveAndDisableIRQ: 24 push bx 25 mov al, [di+DPT.bDrvCtrl] ; Load Device Control Byte 26 or al, FLG_IDE_CTRL_nIEN ; Disable interrupts 27 call HDrvSel_SelectDriveAndSetControlByte 28 pop bx 29 ret 30 6 31 7 32 ;-------------------------------------------------------------------- … … 81 106 out dx, al ; Output Device Control byte 82 107 ret 83 84 85 ;--------------------------------------------------------------------86 ; Selects Master or Slave drive and disables interrupts. Interrupts should87 ; be disabled for commands that do not transfer data.88 ; This function returns after drive is ready to accept commands.89 ;90 ; HDrvSel_SelectDriveAndDisableIRQ91 ; Parameters:92 ; DS:DI: Ptr to DPT93 ; Returns:94 ; AH: BIOS Error code95 ; CF: 0 if drive selected successfully96 ; 1 if any error97 ; Corrupts registers:98 ; AL99 ;--------------------------------------------------------------------100 ALIGN JUMP_ALIGN101 HDrvSel_SelectDriveAndDisableIRQ:102 push bx103 mov al, [di+DPT.bDrvCtrl] ; Load Device Control Byte104 or al, FLG_IDE_CTRL_nIEN ; Disable interrupts105 call HDrvSel_SelectDriveAndSetControlByte106 pop bx107 ret -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HError.asm
r86 r148 1 ; Project name : IDEBIOS1 ; Project name : XTIDE Universal BIOS 2 2 ; Description : Error checking functions for BIOS Hard disk functions. 3 3 … … 6 6 7 7 ;-------------------------------------------------------------------- 8 ; HError_ProcessTimeoutAfterPollingBSYandSomeOtherStatusBit 9 ; HError_ProcessErrorsAfterPollingBSY 8 ; HError_GetErrorCodeToAHforTimeoutWhenPolling 10 9 ; Parameters: 11 10 ; DS: RAMVARS segment … … 18 17 ;-------------------------------------------------------------------- 19 18 ALIGN JUMP_ALIGN 20 HError_ProcessTimeoutAfterPollingBSYandSomeOtherStatusBit: 21 call HError_GetStatusAndErrorRegistersToAXandStoreThemToBDA 22 call GetBiosErrorCodeToAHfromStatusAndErrorRegistersInAX 19 HError_GetErrorCodeToAHforTimeoutWhenPolling: 20 call HError_GetErrorCodeToAHafterPolling 23 21 jc SHORT .ReturnErrorCodeInAH 24 22 mov ah, RET_HD_TIMEOUT ; Force timeout since no actual error... … … 28 26 29 27 28 ;-------------------------------------------------------------------- 29 ; HError_GetErrorCodeToAHafterPolling 30 ; Parameters: 31 ; DS: RAMVARS segment 32 ; Returns: 33 ; AH: BIOS error code 34 ; CF: Set if error 35 ; Cleared if no error 36 ; Corrupts registers: 37 ; AL 38 ;-------------------------------------------------------------------- 30 39 ALIGN JUMP_ALIGN 31 HError_ ProcessErrorsAfterPollingBSY:40 HError_GetErrorCodeToAHafterPolling: 32 41 %ifndef USE_186 33 42 call HError_GetStatusAndErrorRegistersToAXandStoreThemToBDA … … 131 140 db RET_HD_BADSECTOR ; Bit7=BBK, Bad Block Detected 132 141 db RET_HD_STATUSERR ; When Error Register is zero 142 143 144 ;-------------------------------------------------------------------- 145 ; HError_SetErrorCodeToBdaAndToIntpackInSSBPfromAH 146 ; HError_SetErrorCodeToIntpackInSSBPfromAH 147 ; Parameters: 148 ; AH: BIOS error code (00h = no error) 149 ; SS:BP: Ptr to INTPACK 150 ; Returns: 151 ; SS:BP: Ptr to INTPACK with error condition set 152 ; Corrupts registers: 153 ; DS, DI 154 ;-------------------------------------------------------------------- 155 ALIGN JUMP_ALIGN 156 HError_SetErrorCodeToBdaAndToIntpackInSSBPfromAH: 157 ; Store error code to BDA 158 LOAD_BDA_SEGMENT_TO ds, di 159 mov [BDA.bHDLastSt], ah 160 161 ; Store error code to INTPACK 162 HError_SetErrorCodeToIntpackInSSBPfromAH: 163 mov [bp+INTPACK.ah], ah 164 test ah, ah 165 jnz SHORT .SetCFtoIntpack 166 and BYTE [bp+INTPACK.flags], ~FLG_FLAGS_CF 167 ret 168 .SetCFtoIntpack: 169 or BYTE [bp+INTPACK.flags], FLG_FLAGS_CF 170 ret -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HIRQ.asm
r116 r148 8 8 ; HIRQ_WaitForIRQ 9 9 ; Parameters: 10 ; DS: RAMVARS segment10 ; DS:BX: Ptr to DPT 11 11 ; Returns: 12 12 ; CF: Set if wait done by operating system … … 36 36 37 37 LOAD_BDA_SEGMENT_TO ds, ax, ! ; Zero AX 38 mov ah, OS_HOOK_DEVICE_BUSY ; Hard disk busy (AX=9000h) 38 39 cli ; Disable interrupts 39 40 cmp al, [BDA.bHDTaskFlg] ; Task flag already set? 40 41 jc SHORT .ReturnFromWaitNotify ; If so, skip OS notification 41 42 mov ah, 90h ; Hard disk busy (AX=9000h) 43 int INTV_SYSTEM_SERVICES ; OS hook, device busy 42 int BIOS_SYSTEM_INTERRUPT_15h ; OS hook, device busy 44 43 jnc SHORT .ReturnFromWaitNotify ; CF cleared, BIOS handles waiting 45 44 … … 106 105 107 106 ; Issue Int 15h, function AX=9100h (Interrupt ready) 108 mov ax, 9100h; Interrupt ready, device 0 (HD)109 int INTV_SYSTEM_SERVICES107 mov ax, OS_HOOK_DEVICE_POST<<8 ; Interrupt ready, device 0 (HD) 108 int BIOS_SYSTEM_INTERRUPT_15h 110 109 111 110 pop ax ; Restore AX -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HStatus.asm
r140 r148 21 21 ALIGN JUMP_ALIGN 22 22 HStatus_WaitIrqOrRdy: 23 call HIRQ_WaitForIRQ 23 call HIRQ_WaitForIRQ ; For OS hook (we still need error processing) 24 24 jnc SHORT .PollRdySinceNoWaitingOnOsHook 25 jmp HError_ ProcessErrorsAfterPollingBSY25 jmp HError_GetErrorCodeToAHafterPolling 26 26 27 27 ALIGN JUMP_ALIGN … … 48 48 call HIRQ_WaitForIRQ 49 49 jnc SHORT .PollDrqSinceNoWaitingOnOsHook 50 jmp HError_ ProcessErrorsAfterPollingBSY50 jmp HError_GetErrorCodeToAHafterPolling 51 51 52 52 ALIGN JUMP_ALIGN … … 185 185 .UpdateTimeout: 186 186 call HTimer_SetCFifTimeout 187 jnc SHORT .PollLoop ; Loop if time left (sets CF on timeout)188 jmp HError_ ProcessTimeoutAfterPollingBSYandSomeOtherStatusBit187 jnc SHORT .PollLoop ; Loop if time left 188 jmp HError_GetErrorCodeToAHforTimeoutWhenPolling 189 189 190 190 ;-------------------------------------------------------------------- … … 218 218 ALIGN JUMP_ALIGN 219 219 GetErrorCodeFromPollingToAH: 220 jmp HError_ ProcessErrorsAfterPollingBSY220 jmp HError_GetErrorCodeToAHafterPolling -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HTimer.asm
r143 r148 45 45 ; RTC resolution is 977 microsecs. 46 46 ; 47 ; HTimer_ MicrosecondsFromAX47 ; HTimer_DelayMicrosecondsFromAX 48 48 ; Parameters: 49 49 ; AX: Number of microsecs to wait … … 53 53 ; AX 54 54 ;-------------------------------------------------------------------- 55 HTimer_ MicrosecondsFromAX:55 HTimer_DelayMicrosecondsFromAX: 56 56 %ifndef USE_AT 57 57 mov ax, 1 … … 62 62 63 63 xor cx, cx 64 xchg dx, ax 64 xchg dx, ax ; Microsecs now in CX:DX 65 65 mov ah, EVENT_WAIT 66 66 int BIOS_SYSTEM_INTERRUPT_15h 67 sti 67 sti ; XT BIOSes return with interrupt disabled 68 68 69 69 pop cx 70 70 pop dx 71 mov ax, 1 ; Prepare to wait 1 timer tick72 jc SHORT HTimer_ TimerTicksFromAX ; Event Wait was unsupported or busy71 mov ax, 1 ; Prepare to wait 1 timer tick 72 jc SHORT HTimer_DelayTimerTicksFromAX ; Event Wait was unsupported or busy 73 73 ret 74 74 %endif … … 79 79 ; will occur at 54.9 ms intervals. 80 80 ; 81 ; HTimer_ TimerTicksFromAX81 ; HTimer_DelayTimerTicksFromAX 82 82 ; Parameters: 83 83 ; AX: Number of timer ticks to wait … … 87 87 ; AX 88 88 ;-------------------------------------------------------------------- 89 HTimer_ TimerTicksFromAX:89 HTimer_DelayTimerTicksFromAX: 90 90 sti ; Make sure that interrupts are enabled 91 91 call ReadTimeFromBdaToCX -
trunk/XTIDE_Universal_BIOS/Src/Initialization/DriveXlate.asm
r128 r148 6 6 7 7 ;-------------------------------------------------------------------- 8 ; Translates drive number when entering INT 13h.9 ;10 ; DriveXlate_WhenEnteringInt13h11 ; Parameters:12 ; DL: Drive number to be possibly translated13 ; DS: RAMVARS segment14 ; Returns:15 ; DL: Translated drive number16 ; Corrupts registers:17 ; DI18 ;--------------------------------------------------------------------19 ALIGN JUMP_ALIGN20 DriveXlate_WhenEnteringInt13h:21 inc BYTE [RAMVARS.xlateVars+XLATEVARS.bRecurCnt]22 cmp BYTE [RAMVARS.xlateVars+XLATEVARS.bRecurCnt], 123 je SHORT DriveXlate_ToOrBack24 ret25 26 27 ;--------------------------------------------------------------------28 ; DriveXlate_WhenLeavingInt13hWithReturnValueInDL29 ; Parameters:30 ; DS: RAMVARS segment31 ; Returns:32 ; Nothing33 ; Corrupts registers:34 ; DI35 ;--------------------------------------------------------------------36 ALIGN JUMP_ALIGN37 DriveXlate_WhenLeavingInt13hWithReturnValueInDL:38 dec BYTE [RAMVARS.xlateVars+XLATEVARS.bRecurCnt]39 ret40 41 ;--------------------------------------------------------------------42 ; Translates drive number when leaving INT 13h.43 ;44 ; DriveXlate_WhenLeavingInt13h45 ; Parameters:46 ; DL: Drive number to be possibly translated47 ; DS: RAMVARS segment48 ; Returns:49 ; DL: Translated drive number50 ; Corrupts registers:51 ; DI52 ;--------------------------------------------------------------------53 ALIGN JUMP_ALIGN54 DriveXlate_WhenLeavingInt13h:55 dec BYTE [RAMVARS.xlateVars+XLATEVARS.bRecurCnt]56 jz SHORT DriveXlate_ToOrBack57 ret58 59 60 ;--------------------------------------------------------------------61 ; Translates drive number to or back.62 ;63 8 ; DriveXlate_ToOrBack 64 9 ; Parameters: … … 75 20 jz SHORT .Return ; Return if translation disabled 76 21 xchg di, ax ; Backup AX 77 call DriveXlate_SwapFloppyDriveOrHardDisk22 call SwapFloppyDriveOrHardDisk 78 23 xchg ax, di 79 24 .Return: … … 82 27 83 28 ;-------------------------------------------------------------------- 84 ; Swaps Floppy Drive or Hard Disk number. 85 ; 86 ; DriveXlate_SwapFloppyDriveOrHardDisk 29 ; SwapFloppyDriveOrHardDisk 87 30 ; Parameters: 88 31 ; DL: Drive number to be possibly swapped … … 94 37 ;-------------------------------------------------------------------- 95 38 ALIGN JUMP_ALIGN 96 DriveXlate_SwapFloppyDriveOrHardDisk:39 SwapFloppyDriveOrHardDisk: 97 40 mov ah, 80h ; Assume hard disk 98 41 mov al, BYTE [RAMVARS.xlateVars+XLATEVARS.bHDSwap] … … 145 88 DriveXlate_Reset: 146 89 mov WORD [RAMVARS.xlateVars], 8000h ; .bFDSwap and .bHDSwap 147 mov BYTE [RAMVARS.xlateVars+XLATEVARS.bRecurCnt], 0148 90 ret 149 91 … … 172 114 mov [RAMVARS.xlateVars+XLATEVARS.bHDSwap], dl 173 115 ret 174 175 176 ;--------------------------------------------------------------------177 ; Checks if INT 13h function returns some value in DL178 ; (other than the drive number that was also parameter).179 ;180 ; DriveXlate_DoesFunctionReturnSomethingInDL181 ; Parameters:182 ; AH: INT 13h BIOS Function183 ; DL: Drive number184 ; Returns:185 ; CF: Set if something is returned in DL186 ; Cleared if only drive number parameter is returned in DL187 ; Corrupts registers:188 ; Nothing189 ;--------------------------------------------------------------------190 ALIGN JUMP_ALIGN191 DriveXlate_DoesFunctionReturnSomethingInDL:192 cmp ah, 08h ; AH=08h, Read Disk Drive Parameters?193 je SHORT DriveXlate_FunctionReturnsSomethingInDL194 test dl, dl195 jns SHORT DriveXlate_DoesFloppyFunctionReturnSomethingInDL196 ; Fall to DriveXlate_DoesHardDiskFunctionReturnSomethingInDL197 198 ;--------------------------------------------------------------------199 ; Checks if INT 13h hard disk or floppy drive function returns some200 ; value in DL other than the drive number that was also parameter).201 ; Some functions return different values for hard disks and floppy drives.202 ;203 ; DriveXlate_DoesHardDiskFunctionReturnSomethingInDL204 ; DriveXlate_DoesFloppyFunctionReturnSomethingInDL205 ; Parameters:206 ; AH: INT 13h BIOS Function207 ; DL: Hard Disk number208 ; Returns:209 ; CF: Set if something is returned in DL210 ; Cleared if only drive number parameter is returned in DL211 ; Corrupts registers:212 ; Nothing213 ;--------------------------------------------------------------------214 ; ALIGN JUMP_ALIGN215 DriveXlate_DoesHardDiskFunctionReturnSomethingInDL:216 cmp ah, 15h ; AH=15h, Read Disk Drive Size?217 je SHORT DriveXlate_FunctionReturnsSomethingInDL218 DriveXlate_DoesFloppyFunctionReturnSomethingInDL:219 clc220 ret221 222 ALIGN JUMP_ALIGN223 DriveXlate_FunctionReturnsSomethingInDL:224 stc225 ret -
trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm
r123 r148 34 34 mov [RAMVARS.fpOldI13h+2], dx ; Store old INT 13h segment 35 35 mov bx, INTV_DISK_FUNC ; INT 13h interrupt vector offset 36 mov si, Int13h_DiskFunctions 36 mov si, Int13h_DiskFunctionsHandler ; Interrupt handler offset 37 37 call Interrupts_InstallHandlerToVectorInBXFromCSSI 38 38 -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm
r145 r148 149 149 ; Cleared if drive belongs to some other BIOS 150 150 ; Corrupts registers: 151 ; DI151 ; Nothing 152 152 ;-------------------------------------------------------------------- 153 153 ALIGN JUMP_ALIGN 154 154 RamVars_IsDriveHandledByThisBIOS: 155 xchg di, ax ; Backup AX155 push ax 156 156 mov ax, [RAMVARS.wDrvCntAndFirst] ; Drive count to AL, First number to AH 157 157 add al, ah ; One past last drive to AL … … 161 161 ja SHORT .DriveNotHandledByThisBIOS 162 162 stc 163 ALIGN JUMP_ALIGN164 163 .DriveNotHandledByThisBIOS: 165 xchg ax, di164 pop ax 166 165 ret 167 166
Note:
See TracChangeset
for help on using the changeset viewer.