Changeset 88 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h
- Timestamp:
- Jan 27, 2011, 8:14:13 AM (14 years ago)
- google:author:
- aitotat
- Location:
- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH25h_HDrvID.asm
r3 r88 1 ; File name : AH25h_HDrvID.asm 2 ; Project name : IDE BIOS 3 ; Created date : 24.10.2009 4 ; Last update : 14.4.2010 5 ; Author : Tomi Tilli 1 ; Project name : XTIDE Universal BIOS 6 2 ; Description : Int 13h function AH=25h, Get Drive Information. 7 3 … … 91 87 mov al, HCMD_ID_DEV ; Load Identify Device command to AL 92 88 out dx, al ; Output command 93 call SoftDelay_BeforePollingStatusRegister94 89 call HStatus_WaitDrqDefTime ; Wait until ready to transfer (no IRQ!) 95 90 jc SHORT .Return ; Return if error -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHDh_HReset.asm
r84 r88 1 ; File name : AHDh_HReset.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=Dh, Reset Hard Disk (Alternate reset). 8 3 … … 94 89 or al, FLG_IDE_CTRL_SRST ; Set Reset bit 95 90 call HDrvSel_OutputDeviceControlByte 96 mov cx, 5 ; Delay at least 5us97 call SoftDelay_us91 mov ax, 5 ; Delay at least 5us 92 call Delay_MicrosecondsFromAX 98 93 99 94 ; HSR1: Clear_wait 100 and al, ~FLG_IDE_CTRL_SRST ; Clear Reset bit95 mov al, [di+DPT.bDrvCtrl] ; Load value for ACR 101 96 out dx, al ; End Reset 102 mov cx, 2000 ; Delay at least 2ms103 call SoftDelay_us97 mov ax, 2000 ; Delay at least 2ms 98 call Delay_MicrosecondsFromAX 104 99 105 100 ; HSR2: Check_status -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HCapacity.asm
r32 r88 1 ; File name : HCapacity.asm 2 ; Project name : IDE BIOS 3 ; Created date : 16.3.2010 4 ; Last update : 3.8.2010 5 ; Author : Tomi Tilli 1 ; Project name : XTIDE Universal BIOS 6 2 ; Description : Functions for hard disk capacity calculations. 7 3 … … 47 43 xor bx, bx ; Zero BX for 48-bit sector count 48 44 ret 49 50 51 ;--------------------------------------------------------------------52 ; Converts sector count to hard disk size.53 ;54 ; HCapacity_ConvertSectorCountToSize:55 ; Parameters:56 ; BX:DX:AX: Total sector count57 ; Returns:58 ; AX: Size in magnitude59 ; SI: Tenths60 ; CX: Magnitude character:61 ; 'k' = *1024 B = kiB62 ; 'M' = *1024 kiB = MiB63 ; 'G' = *1024 MiB = GiB64 ; 'T' = *1024 GiB = TiB65 ; 'P' = *1024 TiB = PiB66 ; Corrupts registers:67 ; BX, DX68 ;--------------------------------------------------------------------69 ALIGN JUMP_ALIGN70 HCapacity_ConvertSectorCountToSize:71 call HCapacity_ConvertSectorCountToKiB72 mov cx, 1 ; Magnitude is 1 for kiB73 ALIGN JUMP_ALIGN74 .MagnitudeLoop:75 test bx, bx ; Bits 32...47 in use?76 jnz SHORT .ShiftByMagnitude ; If so, jump to shift77 test dx, dx ; Bits 16...31 in use?78 jnz SHORT .ShiftByMagnitude ; If so, jump to shift79 cmp ax, 10000 ; 5 digits needed?80 jb SHORT .ShiftComplete ; If less, all done81 ALIGN JUMP_ALIGN82 .ShiftByMagnitude:83 call HCapacity_ShiftForNextMagnitude84 jmp SHORT .MagnitudeLoop85 ALIGN JUMP_ALIGN86 .ShiftComplete:87 mov bx, cx ; Copy shift count to BX88 mov cl, [cs:bx+.rgbMagnitudeToChar]89 jmp SHORT HCapacity_ConvertSizeRemainderToTenths90 ALIGN WORD_ALIGN91 .rgbMagnitudeToChar: db " kMGTP"92 93 ;--------------------------------------------------------------------94 ; Converts 48-bit sector count to size in kiB.95 ;96 ; HCapacity_ConvertSectorCountToKiB:97 ; Parameters:98 ; BX:DX:AX: Total sector count99 ; Returns:100 ; BX:DX:AX: Total size in kiB101 ; CF: Remainder from division102 ; Corrupts registers:103 ; Nothing104 ;--------------------------------------------------------------------105 ALIGN JUMP_ALIGN106 HCapacity_ConvertSectorCountToKiB:107 HCapacity_DivideSizeByTwo:108 shr bx, 1 ; Divide sector count by 2...109 rcr dx, 1 ; ...to get disk size in...110 rcr ax, 1 ; ...kiB111 ret112 113 ;--------------------------------------------------------------------114 ; Divides size by 1024 and increments magnitude.115 ;116 ; HCapacity_ShiftForNextMagnitude:117 ; Parameters:118 ; BX:DX:AX: Size in magnitude119 ; CX: Magnitude (0=B, 1=kiB, 2=MiB...)120 ; Returns:121 ; BX:DX:AX: Size in magnitude122 ; SI: Remainder (0...1023)123 ; CX: Magnitude (1=kiB, 2=MiB...)124 ; Corrupts registers:125 ; Nothing126 ;--------------------------------------------------------------------127 ALIGN JUMP_ALIGN128 HCapacity_ShiftForNextMagnitude:129 push cx130 xor si, si ; Zero remainder131 mov cl, 10 ; Divide by 1024132 ALIGN JUMP_ALIGN133 .ShiftLoop:134 call HCapacity_DivideSizeByTwo135 rcr si, 1 ; Update remainder136 loop .ShiftLoop137 eSHR_IM si, 6 ; Remainder to SI beginning138 pop cx139 inc cx ; Increment shift count140 ret141 142 ;--------------------------------------------------------------------143 ; Converts remainder from HCapacity_ShiftForNextMagnitude to tenths.144 ;145 ; HCapacity_ConvertSizeRemainderToTenths:146 ; Parameters:147 ; BX:DX:AX: Size in magnitude148 ; SI: Remainder from last magnitude division (0...1023)149 ; Returns:150 ; BX:DX:AX: Size in magnitude151 ; SI: Tenths152 ; Corrupts registers:153 ; Nothing154 ;--------------------------------------------------------------------155 ALIGN JUMP_ALIGN156 HCapacity_ConvertSizeRemainderToTenths:157 push dx158 push ax159 160 mov ax, 10161 mul si ; DX:AX = remainder * 10162 eSHR_IM ax, 10 ; Divide AX by 1024163 xchg si, ax ; SI = tenths164 165 pop ax166 pop dx167 ret -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HCommand.asm
r3 r88 1 ; File name : HCommand.asm 2 ; Project name : IDE BIOS 3 ; Created date : 28.3.2010 4 ; Last update : 16.4.2010 5 ; Author : Tomi Tilli 1 ; Project name : XTIDE Universal BIOS 6 2 ; Description : Functions for outputting IDE commands and parameters. 7 3 … … 113 109 out dx, al 114 110 mov al, ah ; Restore sector count to AL 115 jmp SoftDelay_BeforePollingStatusRegister111 ret -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HDrvSel.asm
r3 r88 1 ; File name : HDrvSel.asm 2 ; Project name : IDE BIOS 3 ; Created date : 25.2.2010 4 ; Last update : 13.4.2010 5 ; Author : Tomi Tilli 1 ; Project name : XTIDE Universal BIOS 6 2 ; Description : Functions for selecting Master or Slave drive. 7 3 … … 60 56 61 57 ; Wait until drive is ready to accept commands 62 call SoftDelay_BeforePollingStatusRegister63 58 call HStatus_WaitRdyDefTime 64 59 pop cx -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HStatus.asm
r34 r88 1 ; File name : HStatus.asm 2 ; Project name : IDE BIOS 3 ; Created date : 15.12.2009 4 ; Last update : 23.8.2010 5 ; Author : Tomi Tilli 1 ; Project name : XTIDE Universal BIOS 6 2 ; Description : IDE Status Register polling functions. 7 3 … … 176 172 ALIGN JUMP_ALIGN 177 173 HStatus_PollBsyAndFlg: 178 call SoftDelay_InitTimeout; Initialize timeout counter174 call InitializeTimeoutWithTicksInCL ; Initialize timeout counter 179 175 in al, dx ; Discard contents for first read 180 176 ; (should read Alternate Status Register) … … 188 184 ALIGN JUMP_ALIGN 189 185 .UpdateTimeout: 190 call S oftDelay_UpdTimeout ; Update timeout counter186 call SetCFifTimeout 191 187 jnc SHORT .PollLoop ; Loop if time left (sets CF on timeout) 192 188 jmp HError_ProcessTimeoutAfterPollingBSYandSomeOtherStatusBit … … 210 206 ALIGN JUMP_ALIGN 211 207 HStatus_PollBsy: 212 call SoftDelay_InitTimeout; Initialize timeout counter208 call InitializeTimeoutWithTicksInCL ; Initialize timeout counter 213 209 in al, dx ; Discard contents for first read 214 210 ; (should read Alternate Status Register) … … 218 214 test al, FLG_IDE_ST_BSY ; Controller busy? 219 215 jz SHORT GetErrorCodeFromPollingToAH ; If not, jump to check errors 220 call S oftDelay_UpdTimeout; Update timeout counter216 call SetCFifTimeout ; Update timeout counter 221 217 jnc SHORT .PollLoop ; Loop if time left (sets CF on timeout) 222 218 ALIGN JUMP_ALIGN 223 219 GetErrorCodeFromPollingToAH: 224 220 jmp HError_ProcessErrorsAfterPollingBSY 221 222 223 ;-------------------------------------------------------------------- 224 ; InitializeTimeoutWithTicksInCL 225 ; Parameters: 226 ; CL: Timeout value in system timer ticks 227 ; DS: Segment to RAMVARS 228 ; Returns: 229 ; Nothing 230 ; Corrupts registers: 231 ; CX 232 ;-------------------------------------------------------------------- 233 ALIGN JUMP_ALIGN 234 InitializeTimeoutWithTicksInCL: 235 push bx 236 xchg cx, ax 237 238 xor ah, ah ; Timeout ticks now in AX 239 mov bx, RAMVARS.wTimeoutCounter 240 call TimerTicks_InitializeTimeoutFromAX 241 242 xchg ax, cx ; Restore AX 243 pop bx 244 ret 245 246 ;-------------------------------------------------------------------- 247 ; SetCFifTimeout 248 ; Parameters: 249 ; DS: Segment to RAMVARS 250 ; Returns: 251 ; Nothing 252 ; Corrupts registers: 253 ; CX 254 ;-------------------------------------------------------------------- 255 ALIGN JUMP_ALIGN 256 SetCFifTimeout: 257 push bx 258 xchg cx, ax 259 260 mov bx, RAMVARS.wTimeoutCounter 261 call TimerTicks_GetTimeoutTicksLeftToAXfromDSBX 262 263 xchg ax, cx ; Restore AX 264 pop bx 265 ret
Note:
See TracChangeset
for help on using the changeset viewer.