Changeset 150 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common
- Timestamp:
- Apr 29, 2011, 7:04:13 PM (14 years ago)
- google:author:
- aitotat
- Location:
- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common
- Files:
-
- 7 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HAddress.asm
r3 r150 1 ; File name : HAddress.asm 2 ; Project name : IDE BIOS 3 ; Created date : 11.3.2010 4 ; Last update : 4.4.2010 5 ; Author : Tomi Tilli 1 ; Project name : XTIDE Universal BIOS 6 2 ; Description : Functions for address translations. 7 3 … … 9 5 SECTION .text 10 6 7 ; Jump table for conversion functions 8 ALIGN WORD_ALIGN 9 g_rgfnAddressTranslation: 10 dw DoNotConvertLCHS ; 0, ADDR_DPT_LCHS 11 dw ConvertLCHStoPCHS ; 1, ADDR_DPT_PCHS 12 dw ConvertLCHStoLBARegisterValues ; 2, ADDR_DPT_LBA28 13 dw ConvertLCHStoLBARegisterValues ; 3, ADDR_DPT_LBA48 14 15 11 16 ;-------------------------------------------------------------------- 12 ; Outputs sector count, L-CHS address and command to IDE registers. 13 ; This function does not wait until command has been completed. 14 ; 15 ; HAddress_ConvertParamsFromBiosLCHStoIDE 17 ; HAddress_OldInt13hAddressToIdeAddress 16 18 ; Parameters: 17 19 ; CH: Cylinder number, bits 7...0 … … 28 30 ; AX, DX 29 31 ;-------------------------------------------------------------------- 30 ALIGN WORD_ALIGN31 g_rgfnAddressTranslation:32 dw HAddress_DoNotConvertLCHS ; 0, ADDR_DPT_LCHS33 dw HAddress_ConvertLCHStoPCHS ; 1, ADDR_DPT_PCHS34 dw HAddress_ConvertLCHStoLBARegisterValues ; 2, ADDR_DPT_LBA2835 dw HAddress_ConvertLCHStoLBARegisterValues ; 3, ADDR_DPT_LBA4836 37 32 ALIGN JUMP_ALIGN 38 HAddress_ConvertParamsFromBiosLCHStoIDE: 39 mov bl, [di+DPT.bFlags] 40 and bx, BYTE MASK_DPT_ADDR ; Addressing mode to BX 33 HAddress_OldInt13hAddressToIdeAddress: 34 call AccessDPT_GetAddressingModeForWordLookToBX 41 35 push WORD [cs:bx+g_rgfnAddressTranslation] ; Push return address 42 ; Fall to HAddress_ExtractLCHS FromBiosParams36 ; Fall to HAddress_ExtractLCHSparametersFromOldInt13hAddress 43 37 44 38 ;--------------------------------------------------------------------- 45 ; Extracts L-CHS parameters from BIOS function parameters. 46 ; 47 ; HAddress_ExtractLCHSFromBiosParams: 39 ; HAddress_ExtractLCHSparametersFromOldInt13hAddress 48 40 ; Parameters: 49 41 ; CH: Cylinder number, bits 7...0 … … 58 50 ; Nothing 59 51 ;-------------------------------------------------------------------- 60 ALIGN JUMP_ALIGN 61 HAddress_ExtractLCHSFromBiosParams: 52 HAddress_ExtractLCHSparametersFromOldInt13hAddress: 62 53 mov bl, cl ; Copy sector number... 63 54 and bl, 3Fh ; ...and limit to 1...63 … … 70 61 71 62 ;--------------------------------------------------------------------- 72 ; Converts BIOSLCHS parameters to IDE P-CHS parameters.63 ; Converts LCHS parameters to IDE P-CHS parameters. 73 64 ; PCylinder = (LCylinder << n) + (LHead / PHeadCount) 74 65 ; PHead = LHead % PHeadCount … … 89 80 ;-------------------------------------------------------------------- 90 81 ALIGN JUMP_ALIGN 91 HAddress_ConvertLCHStoPCHS:82 ConvertLCHStoPCHS: 92 83 ; LHead / PHeadCount and LHead % PHeadCount 93 84 eMOVZX ax, bh ; Copy L-CHS Head number to AX 94 div BYTE [di+DPT.bP Heads]; AL = LHead / PHeadCount, AH = LHead % PHeadCount85 div BYTE [di+DPT.bPchsHeads]; AL = LHead / PHeadCount, AH = LHead % PHeadCount 95 86 mov bh, ah ; Copy P-CHS Head number to BH 96 87 xor ah, ah ; AX = LHead / PHeadCount … … 98 89 ; (LCylinder << n) + (LHead / PHeadCount) 99 90 mov dx, cx ; Copy L-CHS Cylinder number to DX 100 mov cl, [di+DPT.bShLtoP] ; Load shift count 91 mov cl, [di+DPT.wFlags] ; Load shift count 92 and cl, MASK_DPT_CHS_SHIFT_COUNT 101 93 shl dx, cl ; DX = LCylinder << n 102 94 add ax, dx ; AX = P-CHS Cylinder number 103 95 mov cx, ax ; Copy P-CHS Cylinder number to CX 104 ALIGN JUMP_ALIGN 105 HAddress_DoNotConvertLCHS: 96 DoNotConvertLCHS: 106 97 ret 107 98 … … 109 100 ;--------------------------------------------------------------------- 110 101 ; Converts LCHS parameters to 28-bit LBA address. 102 ; Only 24-bits are used since LHCS to LBA28 conversion has 8.4GB limit. 103 ; LBA = ((cylToSeek*headsPerCyl+headToSeek)*sectPerTrack)+sectToSeek-1 104 ; 111 105 ; Returned address is in same registers that 112 106 ; HAddress_DoNotConvertLCHS and HAddress_ConvertLCHStoPCHS returns. 113 107 ; 114 ; HAddress_ConvertLCHStoLBARegisterValues:108 ; ConvertLCHStoLBARegisterValues: 115 109 ; Parameters: 116 110 ; BL: Sector number (1...63) … … 127 121 ;-------------------------------------------------------------------- 128 122 ALIGN JUMP_ALIGN 129 HAddress_ConvertLCHStoLBARegisterValues: 130 call HAddress_ConvertLCHStoLBA28 131 mov bl, al ; Sector Number Register (LBA 7...0) 132 mov cl, ah ; Low Cylinder Register (LBA 15...8) 133 mov ch, dl ; High Cylinder Register (LBA 23...16) 134 mov bh, dh ; Drive and Head Register (LBA 27...24) 135 ret 136 137 ;--------------------------------------------------------------------- 138 ; Converts LCHS parameters to 28-bit LBA address. 139 ; Only 24-bits are used since LHCS to LBA28 conversion has 8.4GB limit. 140 ; LBA = ((cylToSeek*headsPerCyl+headToSeek)*sectPerTrack)+sectToSeek-1 141 ; 142 ; HAddress_ConvertLCHStoLBA28: 143 ; Parameters: 144 ; BL: Sector number (1...63) 145 ; BH: Head number (0...255) 146 ; CX: Cylinder number (0...1023) 147 ; DS:DI: Ptr to Disk Parameter Table 148 ; Returns: 149 ; DX:AX: 28-bit LBA address (DH is always zero) 150 ; Corrupts registers: 151 ; BX, CX 152 ;-------------------------------------------------------------------- 153 ALIGN JUMP_ALIGN 154 HAddress_ConvertLCHStoLBA28: 123 ConvertLCHStoLBARegisterValues: 155 124 ; cylToSeek*headsPerCyl (18-bit result) 156 125 mov ax, cx ; Copy Cylinder number to AX 157 mul WORD [di+DPT.wLHeads] ; DX:AX = cylToSeek*headsPerCyl 126 eMOVZX dx, BYTE [di+DPT.bLchsHeads] 127 mul dx ; DX:AX = cylToSeek*headsPerCyl 158 128 159 129 ; +=headToSeek (18-bit result) … … 163 133 164 134 ; *=sectPerTrack (18-bit by 6-bit multiplication with 24-bit result) 165 eMOVZX cx, BYTE [di+DPT.bP Sect]; Load Sectors per Track135 eMOVZX cx, BYTE [di+DPT.bPchsSectors] ; Load Sectors per Track 166 136 xchg ax, dx ; Hiword to AX, loword to DX 167 137 mul cl ; AX = hiword * Sectors per Track … … 176 146 add ax, bx ; Add to loword 177 147 adc dl, bh ; Add possible carry to byte2, BH=zero 148 149 ; Copy DX:AX to proper return registers 150 xchg bx, ax ; BL = Sector Number Register (LBA 7...0) 151 mov cl, bh ; Low Cylinder Register (LBA 15...8) 152 mov ch, dl ; High Cylinder Register (LBA 23...16) 153 mov bh, dh ; Drive and Head Register (LBA 27...24) 178 154 ret -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HTimer.asm
r148 r150 6 6 7 7 ;-------------------------------------------------------------------- 8 ; HTimer_InitializeTimeoutWithTicksInC L8 ; HTimer_InitializeTimeoutWithTicksInCX 9 9 ; Parameters: 10 ; C L: Timeout value in system timer ticks10 ; CX: Timeout value in system timer ticks 11 11 ; DS: Segment to RAMVARS 12 12 ; Returns: … … 16 16 ;-------------------------------------------------------------------- 17 17 ALIGN JUMP_ALIGN 18 HTimer_InitializeTimeoutWithTicksInCL: 19 xor ch, ch ; Timeout ticks now in CX 18 HTimer_InitializeTimeoutWithTicksInCX: 20 19 mov [RAMVARS.wTimeoutCounter], cx ; Store timeout ticks 21 20 call ReadTimeFromBdaToCX … … 55 54 HTimer_DelayMicrosecondsFromAX: 56 55 %ifndef USE_AT 57 mov ax, 156 mov ax, 2 58 57 ; Fall to Delay_TimerTicksFromAX 59 58 %else
Note:
See TracChangeset
for help on using the changeset viewer.