Changeset 160 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS
- Timestamp:
- May 4, 2011, 5:49:22 PM (14 years ago)
- google:author:
- aitotat
- Location:
- trunk/XTIDE_Universal_BIOS/Src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm
r158 r160 10 10 ; DS:DI: Ptr to Disk Parameter Table 11 11 ; ES:SI: Ptr to 512-byte ATA information read from the drive 12 ; CS:BP: Ptr to IDEVARS for the controller 12 13 ; Returns: 13 14 ; Nothing … … 103 104 xor ax, ax 104 105 ret 105 106 107 ;--------------------------------------------------------------------108 ; Device_OutputALtoIdeRegisterInDL109 ; Parameters:110 ; AL: Byte to output111 ; DL: IDE Register112 ; DS:DI: Ptr to DPT (in RAMVARS segment)113 ; Returns:114 ; Nothing115 ; Corrupts registers:116 ; BX, DX117 ;--------------------------------------------------------------------118 ALIGN JUMP_ALIGN119 Device_OutputALtoIdeRegisterInDL:120 mov bx, IdeIO_OutputALtoIdeRegisterInDX121 jmp SHORT TranslateRegisterAddressInDLifNecessaryThenJumpToBX122 123 124 ;--------------------------------------------------------------------125 ; Device_OutputALtoIdeControlBlockRegisterInDL126 ; Parameters:127 ; AL: Byte to output128 ; DL: IDE Control Block Register129 ; DS:DI: Ptr to DPT (in RAMVARS segment)130 ; Returns:131 ; Nothing132 ; Corrupts registers:133 ; BX, DX134 ;--------------------------------------------------------------------135 ALIGN JUMP_ALIGN136 Device_OutputALtoIdeControlBlockRegisterInDL:137 mov bx, IdeIO_OutputALtoIdeControlBlockRegisterInDX138 jmp SHORT TranslateRegisterAddressInDLifNecessaryThenJumpToBX139 140 141 ;--------------------------------------------------------------------142 ; Device_InputToALfromIdeRegisterInDL143 ; Parameters:144 ; DL: IDE Register145 ; DS:DI: Ptr to DPT (in RAMVARS segment)146 ; Returns:147 ; AL: Inputted byte148 ; Corrupts registers:149 ; BX, DX150 ;--------------------------------------------------------------------151 ALIGN JUMP_ALIGN152 Device_InputToALfromIdeRegisterInDL:153 mov bx, IdeIO_InputToALfromIdeRegisterInDX154 ; Fall to TranslateRegisterAddressInDLifNecessaryThenJumpToBX155 156 157 ;--------------------------------------------------------------------158 ; TranslateRegisterAddressInDLifNecessaryThenJumpToBX159 ; Parameters:160 ; AL: Byte to output (if output function in BX)161 ; DL: IDE Register162 ; BX: I/O function to jump to163 ; DS:DI: Ptr to DPT (in RAMVARS segment)164 ; Returns:165 ; AL: Inputted byte (if input function in BX)166 ; Corrupts registers:167 ; BX, DX168 ;--------------------------------------------------------------------169 TranslateRegisterAddressInDLifNecessaryThenJumpToBX:170 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_REVERSED_A0_AND_A3171 jz SHORT .JumpToIoFunctionInSI172 173 ; Exchange address lines A0 and A3 from DL174 mov dh, MASK_A3_AND_A0_ADDRESS_LINES175 and dh, dl ; DH = 0, 1, 8 or 9, we can ignore 0 and 9176 jz SHORT .JumpToIoFunctionInSI ; Jump out since DH is 0177 xor dh, MASK_A3_AND_A0_ADDRESS_LINES178 jz SHORT .JumpToIoFunctionInSI ; Jump out since DH was 9179 and dl, ~MASK_A3_AND_A0_ADDRESS_LINES180 or dl, dh ; Address lines now reversed181 182 ALIGN JUMP_ALIGN183 .JumpToIoFunctionInSI:184 push bx185 xor dh, dh186 eMOVZX bx, BYTE [di+DPT.bIdevarsOffset]; CS:BX now points to IDEVARS187 ret -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm
r158 r160 20 20 or al, FLG_DEVCONTROL_SRST | FLG_DEVCONTROL_nIEN ; Set Reset bit 21 21 mov dl, DEVICE_CONTROL_REGISTER_out 22 call Device_OutputALtoIdeControlBlockRegisterInDL22 call IdeIO_OutputALtoIdeControlBlockRegisterInDL 23 23 mov ax, HSR0_RESET_WAIT_US 24 24 call Timer_DelayMicrosecondsFromAX … … 29 29 and al, ~FLG_DEVCONTROL_SRST ; Clear reset bit 30 30 mov dl, DEVICE_CONTROL_REGISTER_out 31 call Device_OutputALtoIdeControlBlockRegisterInDL31 call IdeIO_OutputALtoIdeControlBlockRegisterInDL 32 32 mov ax, HSR1_RESET_WAIT_US 33 33 call Timer_DelayMicrosecondsFromAX … … 55 55 call FindDPT_ForNewDriveToDSDI 56 56 eMOVZX ax, bh 57 cmp BYTE [cs:bp+IDEVARS.bDevice], DEVICE_XTIDE_WITH_REVERSED_A3_AND_A058 eCMOVE ah, FLGH_DPT_REVERSED_A0_AND_A359 57 mov [di+DPT.wFlags], ax 60 58 mov [di+DPT.bIdevarsOffset], bp 61 59 mov BYTE [di+DPT_ATA.bSetBlock], 1 ; Block = 1 sector 60 call IdeDPT_StoreReversedAddressLinesFlagIfNecessary 62 61 63 62 ; Wait until drive motors have reached max speed … … 121 120 .DoNotSetInterruptInServiceFlag: 122 121 mov dl, DEVICE_CONTROL_REGISTER_out 123 call Device_OutputALtoIdeControlBlockRegisterInDL122 call IdeIO_OutputALtoIdeControlBlockRegisterInDL 124 123 125 124 ; Output Feature Number 126 125 mov dl, FEATURES_REGISTER_out 127 126 mov al, [bp+IDEPACK.bFeatures] 128 call Device_OutputALtoIdeRegisterInDL127 call IdeIO_OutputALtoIdeRegisterInDL 129 128 130 129 ; Output Sector Address High (only used by LBA48) … … 141 140 mov dl, COMMAND_REGISTER_out 142 141 mov al, [bp+IDEPACK.bCommand] 143 call Device_OutputALtoIdeRegisterInDL142 call IdeIO_OutputALtoIdeRegisterInDL 144 143 145 144 ; Wait until command completed … … 184 183 mov dl, DRIVE_AND_HEAD_SELECT_REGISTER 185 184 mov al, [bp+IDEPACK.bDrvAndHead] 186 call Device_OutputALtoIdeRegisterInDL185 call IdeIO_OutputALtoIdeRegisterInDL 187 186 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRDY, FLG_STATUS_DRDY) 188 187 cmp BYTE [bp+IDEPACK.bCommand], COMMAND_IDENTIFY_DEVICE … … 207 206 OutputSectorCountAndAddress: 208 207 mov dl, SECTOR_COUNT_REGISTER 209 call Device_OutputALtoIdeRegisterInDL208 call IdeIO_OutputALtoIdeRegisterInDL 210 209 211 210 mov al, ah 212 211 mov dl, LBA_LOW_REGISTER 213 call Device_OutputALtoIdeRegisterInDL212 call IdeIO_OutputALtoIdeRegisterInDL 214 213 215 214 mov al, cl 216 215 mov dl, LBA_MIDDLE_REGISTER 217 call Device_OutputALtoIdeRegisterInDL216 call IdeIO_OutputALtoIdeRegisterInDL 218 217 219 218 mov al, ch 220 219 mov dl, LBA_HIGH_REGISTER 221 jmp Device_OutputALtoIdeRegisterInDL220 jmp IdeIO_OutputALtoIdeRegisterInDL -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDPT.asm
r150 r160 10 10 ; DS:DI: Ptr to Disk Parameter Table 11 11 ; ES:SI: Ptr to 512-byte ATA information read from the drive 12 ; CS:BP: Ptr to IDEVARS for the controller 12 13 ; Returns: 13 14 ; Nothing … … 23 24 ; DS:DI: Ptr to Disk Parameter Table 24 25 ; ES:SI: Ptr to 512-byte ATA information read from the drive 26 ; CS:BP: Ptr to IDEVARS for the controller 25 27 ; Returns: 26 28 ; Nothing … … 32 34 mov ah, [es:si+ATA1.bBlckSize] ; Max block size in sectors 33 35 mov [di+DPT_ATA.wSetAndMaxBlock], ax 34 ; Fall to .EndDPT36 ; Fall to IdeDPT_StoreReversedAddressLinesFlagIfNecessary 35 37 38 ;-------------------------------------------------------------------- 39 ; IdeDPT_StoreReversedAddressLinesFlagIfNecessary 40 ; Parameters: 41 ; DS:DI: Ptr to Disk Parameter Table 42 ; CS:BP: Ptr to IDEVARS for the controller 43 ; Returns: 44 ; Nothing 45 ; Corrupts registers: 46 ; Nothing 47 ;-------------------------------------------------------------------- 48 IdeDPT_StoreReversedAddressLinesFlagIfNecessary: 49 cmp BYTE [cs:bp+IDEVARS.bDevice], DEVICE_XTIDE_WITH_REVERSED_A3_AND_A0 50 jne SHORT .EndDPT 51 or BYTE [di+DPT.bFlagsHigh], FLGH_DPT_REVERSED_A0_AND_A3 36 52 37 53 .EndDPT: -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeError.asm
r150 r160 21 21 mov ah, al ; IDE Status Register to AH 22 22 mov dl, ERROR_REGISTER_in 23 call Device_InputToALfromIdeRegisterInDL23 call IdeIO_InputToALfromIdeRegisterInDL 24 24 xchg al, ah ; Status Register now in AL, Error Register now in AH 25 25 -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIO.asm
r150 r160 6 6 7 7 ;-------------------------------------------------------------------- 8 ; IdeIO_OutputALtoIdeRegisterInD X8 ; IdeIO_OutputALtoIdeRegisterInDL 9 9 ; Parameters: 10 10 ; AL: Byte to output 11 ; D X: IDE Register12 ; CS:BX: Ptr to IDEVARS11 ; DL: IDE Register 12 ; DS:DI: Ptr to DPT (in RAMVARS segment) 13 13 ; Returns: 14 14 ; Nothing 15 15 ; Corrupts registers: 16 ; DX16 ; BX, DX 17 17 ;-------------------------------------------------------------------- 18 18 ALIGN JUMP_ALIGN 19 IdeIO_OutputALtoIdeRegisterInDX: 20 add dx, [cs:bx+IDEVARS.wPort] 19 IdeIO_OutputALtoIdeRegisterInDL: 20 mov bx, IDEVARS.wPort 21 call GetPortToDXandTranslateA0andA3ifNecessary 21 22 out dx, al 22 23 ret … … 24 25 25 26 ;-------------------------------------------------------------------- 26 ; IdeIO_OutputALtoIdeControlBlockRegisterInD X27 ; IdeIO_OutputALtoIdeControlBlockRegisterInDL 27 28 ; Parameters: 28 29 ; AL: Byte to output 29 ; D X: IDE Control Block Register30 ; CS:BX: Ptr to IDEVARS30 ; DL: IDE Control Block Register 31 ; DS:DI: Ptr to DPT (in RAMVARS segment) 31 32 ; Returns: 32 33 ; Nothing 33 34 ; Corrupts registers: 34 ; DX35 ; BX, DX 35 36 ;-------------------------------------------------------------------- 36 37 ALIGN JUMP_ALIGN 37 IdeIO_OutputALtoIdeControlBlockRegisterInDX: 38 add dx, [cs:bx+IDEVARS.wPortCtrl] 38 IdeIO_OutputALtoIdeControlBlockRegisterInDL: 39 mov bx, IDEVARS.wPortCtrl 40 call GetPortToDXandTranslateA0andA3ifNecessary 39 41 out dx, al 40 42 ret … … 42 44 43 45 ;-------------------------------------------------------------------- 44 ; IdeIO_InputToALfromIdeRegisterInD X46 ; IdeIO_InputToALfromIdeRegisterInDL 45 47 ; Parameters: 46 ; D X: IDE Register47 ; CS:BX: Ptr to IDEVARS48 ; DL: IDE Register 49 ; DS:DI: Ptr to DPT (in RAMVARS segment) 48 50 ; Returns: 49 51 ; AL: Inputted byte 50 52 ; Corrupts registers: 51 ; DX53 ; BX, DX 52 54 ;-------------------------------------------------------------------- 53 55 ALIGN JUMP_ALIGN 54 IdeIO_InputToALfromIdeRegisterInDX: 55 add dx, [cs:bx+IDEVARS.wPort] 56 IdeIO_InputToALfromIdeRegisterInDL: 57 mov bx, IDEVARS.wPort 58 call GetPortToDXandTranslateA0andA3ifNecessary 56 59 in al, dx 57 60 ret 61 62 63 ;-------------------------------------------------------------------- 64 ; GetPortToDXandTranslateA0andA3ifNecessary 65 ; Parameters: 66 ; BX: Offset to port in IDEVARS (IDEVARS.wPort or IDEVARS.wPortCtrl) 67 ; DL: IDE Register 68 ; DS:DI: Ptr to DPT (in RAMVARS segment) 69 ; Returns: 70 ; DX: Source/Destination Port 71 ; Corrupts registers: 72 ; BX 73 ;-------------------------------------------------------------------- 74 ALIGN JUMP_ALIGN 75 GetPortToDXandTranslateA0andA3ifNecessary: 76 xor dh, dh ; DX now has IDE register offset 77 add bl, [di+DPT.bIdevarsOffset] ; CS:BX now points port address 78 add dx, [cs:bx] 79 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_REVERSED_A0_AND_A3 80 jz SHORT .ReturnPortInDX 81 82 ; Exchange address lines A0 and A3 from DL 83 mov bl, dl 84 mov bh, MASK_A3_AND_A0_ADDRESS_LINES 85 and bh, bl ; BH = 0, 1, 8 or 9, we can ignore 0 and 9 86 jz SHORT .ReturnPortInDX ; Jump out since DH is 0 87 xor bh, MASK_A3_AND_A0_ADDRESS_LINES 88 jz SHORT .ReturnPortInDX ; Jump out since DH was 9 89 and dl, ~MASK_A3_AND_A0_ADDRESS_LINES 90 or dl, bh ; Address lines now reversed 91 .ReturnPortInDX: 92 ret -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIrq.asm
r158 r160 111 111 call FindDPT_ToDSDIforInterruptInService 112 112 mov dl, STATUS_REGISTER_in 113 call Device_InputToALfromIdeRegisterInDL113 call IdeIO_InputToALfromIdeRegisterInDL 114 114 115 115 ; Clear Interrupt In-Service Flag from DPT -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeWait.asm
r155 r160 127 127 ReadIdeStatusRegisterToAL: 128 128 mov dl, STATUS_REGISTER_in 129 jmp Device_InputToALfromIdeRegisterInDL129 jmp IdeIO_InputToALfromIdeRegisterInDL -
trunk/XTIDE_Universal_BIOS/Src/Main.asm
r158 r160 64 64 at ROMVARS.ideVars0+IDEVARS.wPortCtrl, dw 3F0h ; Controller Control Block base port 65 65 at ROMVARS.ideVars0+IDEVARS.bDevice, db DEVICE_16BIT_ATA 66 at ROMVARS.ideVars0+IDEVARS.bIRQ, db 1466 at ROMVARS.ideVars0+IDEVARS.bIRQ, db 0 67 67 at ROMVARS.ideVars0+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE 68 68 at ROMVARS.ideVars0+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE … … 71 71 at ROMVARS.ideVars1+IDEVARS.wPortCtrl, dw 370h ; Controller Control Block base port 72 72 at ROMVARS.ideVars1+IDEVARS.bDevice, db DEVICE_16BIT_ATA 73 at ROMVARS.ideVars1+IDEVARS.bIRQ, db 1573 at ROMVARS.ideVars1+IDEVARS.bIRQ, db 0 74 74 at ROMVARS.ideVars1+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE 75 75 at ROMVARS.ideVars1+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm
r158 r160 103 103 ; DS:DI: Ptr to Disk Parameter Table 104 104 ; ES:SI: Ptr to 512-byte ATA information read from the drive 105 ; CS:BP: Ptr to IDEVARS for the controller 105 106 ; Returns: 106 107 ; Nothing … … 131 132 ; DS:DI: Ptr to Disk Parameter Table 132 133 ; ES:SI: Ptr to 512-byte ATA information read from the drive 134 ; CS:BP: Ptr to IDEVARS for the controller 133 135 ; Returns: 134 136 ; Nothing … … 164 166 ; DS:DI: Ptr to Disk Parameter Table 165 167 ; ES:SI: Ptr to 512-byte ATA information read from the drive 168 ; CS:BP: Ptr to IDEVARS for the controller 166 169 ; Returns: 167 170 ; Nothing … … 181 184 ; DS:DI: Ptr to Disk Parameter Table 182 185 ; ES:SI: Ptr to 512-byte ATA information read from the drive 186 ; CS:BP: Ptr to IDEVARS for the controller 183 187 ; Returns: 184 188 ; Nothing … … 195 199 ; DS:DI: Ptr to Disk Parameter Table 196 200 ; ES:SI: Ptr to 512-byte ATA information read from the drive 201 ; CS:BP: Ptr to IDEVARS for the controller 197 202 ; ES: BDA Segment 198 203 ; Returns:
Note:
See TracChangeset
for help on using the changeset viewer.