Changeset 473 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src
- Timestamp:
- Oct 10, 2012, 6:22:23 PM (12 years ago)
- google:author:
- aitotat@gmail.com
- Location:
- trunk/XTIDE_Universal_BIOS/Src
- Files:
-
- 1 added
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm
r443 r473 82 82 ; Parameters: 83 83 ; BH: Drive Select byte for Drive and Head Select Register 84 ; DX: Autodetected port (for devices that support autodetection) 84 85 ; DS: Segment to RAMVARS 85 86 ; ES:SI: Ptr to normalized buffer to receive 512-byte IDE Information -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm
r445 r473 56 56 ; Parameters: 57 57 ; BH: Drive Select byte for Drive and Head Select Register 58 ; DX: Autodetected port for XT-CF 58 59 ; DS: Segment to RAMVARS 59 60 ; ES:SI: Ptr to buffer to receive 512-byte IDE Information … … 70 71 eMOVZX ax, bh 71 72 mov [di+DPT.wFlags], ax 72 mov [di+DPT.bIdevarsOffset], bp 73 call CreateDPT_StoreIdevarsOffsetAndBasePortFromCSBPtoDPTinDSDI 74 call IdeDPT_StoreDeviceTypeToDPTinDSDIfromIdevarsInCSBP 73 75 mov BYTE [di+DPT_ATA.bBlockSize], 1 ; Block = 1 sector 74 call IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI75 76 76 77 ; Wait until drive motors have reached full speed 77 cmp bp, BYTE ROMVARS.ideVars0 78 cmp bp, BYTE ROMVARS.ideVars0 ; First controller? 78 79 jne SHORT .SkipLongWaitSinceDriveIsNotPrimaryMaster 79 test bh, FLG_DRVNHEAD_DRV 80 test bh, FLG_DRVNHEAD_DRV ; Wait already done for Master 80 81 jnz SHORT .SkipLongWaitSinceDriveIsNotPrimaryMaster 81 82 call AHDh_WaitUntilDriveMotorHasReachedFullSpeed … … 87 88 88 89 %ifdef MODULE_8BIT_IDE 89 ; Enable 8-bit PIO mode for Lo-tech XT-CF 90 ; We set XT-CF to 8-bit PIO mode for Identify Device command. 91 ; Correct XT-CF mode is later set on AH=09h (after all drives are detected). 92 call AccessDPT_IsThisDeviceXTCF 93 jne SHORT .SkipXTCFmodeChange 94 95 xor al, al ; XTCF_8BIT_PIO_MODE 90 96 push si 91 call AH 9h_Enable8bitPioModeForXTCF97 call AH1Eh_ChangeXTCFmodeBasedOnControlRegisterInAL 92 98 pop si 93 99 jc SHORT .FailedToSet8bitMode 94 %endif 100 .SkipXTCFmodeChange: 101 %endif ; MODULE_8BIT_IDE 95 102 96 103 ; Prepare to output Identify Device command … … 170 177 cmp bl, FLG_STATUS_DRQ ; Data transfer started? 171 178 jne SHORT .WaitUntilNonTransferCommandCompletes 172 %ifdef MODULE_JRIDE 173 cmp BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_JRIDE_ISA 174 je SHORT JrIdeTransfer_StartWithCommandInAL 179 %ifdef MODULE_8BIT_IDE 180 cmp BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_DMA 181 je SHORT 0 ; IdeDma_StartTransferWithCommandInAL 182 ja SHORT JrIdeTransfer_StartWithCommandInAL ; DEVICE_8BIT_XTCF_MEMMAP or DEVICE_8BIT_JRIDE_ISA 175 183 %endif 176 184 jmp IdeTransfer_StartWithCommandInAL … … 205 213 ; We use different timeout value when detecting drives. 206 214 ; This prevents unnecessary long delays when drive is not present. 207 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRDY, FLG_STATUS_DRDY)215 mov cx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRDY, FLG_STATUS_DRDY) 208 216 cmp WORD [RAMVARS.wDrvDetectSignature], RAMVARS_DRV_DETECT_SIGNATURE 209 eCMOVE bh, TIMEOUT_SELECT_DRIVE_DURING_DRIVE_DETECTION217 eCMOVE ch, TIMEOUT_SELECT_DRIVE_DURING_DRIVE_DETECTION 210 218 211 219 ; Select Master or Slave Drive 212 220 mov al, [bp+IDEPACK.bDrvAndHead] 213 221 OUTPUT_AL_TO_IDE_REGISTER DRIVE_AND_HEAD_SELECT_REGISTER 222 mov bx, cx 214 223 call IdeWait_PollStatusFlagInBLwithTimeoutInBH 215 224 … … 248 257 249 258 mov al, ch 250 JUMP_TO_OUTPUT_AL_TO_IDE_REGISTER LBA_HIGH_REGISTER 259 OUTPUT_AL_TO_IDE_REGISTER LBA_HIGH_REGISTER 260 ret -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDPT.asm
r410 r473 64 64 ;-------------------------------------------------------------------- 65 65 .StoreDeviceType: 66 call IdeDPT_StoreDeviceType FromIdevarsInCSBPtoDPTinDSDI66 call IdeDPT_StoreDeviceTypeToDPTinDSDIfromIdevarsInCSBP 67 67 68 68 … … 111 111 ;-------------------------------------------------------------------- 112 112 .DetectAdvancedIdeController: 113 call AccessDPT_GetIdeBasePortToBX113 mov bx, [di+DPT.wBasePort] 114 114 call AdvAtaInit_DetectControllerForIdeBaseInBX 115 115 mov [di+DPT_ADVANCED_ATA.wControllerID], ax ; Store zero if none detected … … 138 138 139 139 ;-------------------------------------------------------------------- 140 ; IdeDPT_StoreDeviceType FromIdevarsInCSBPtoDPTinDSDI140 ; IdeDPT_StoreDeviceTypeToDPTinDSDIfromIdevarsInCSBP 141 141 ; Parameters: 142 142 ; DS:DI: Ptr to Disk Parameter Table … … 147 147 ; AL 148 148 ;-------------------------------------------------------------------- 149 IdeDPT_StoreDeviceType FromIdevarsInCSBPtoDPTinDSDI:149 IdeDPT_StoreDeviceTypeToDPTinDSDIfromIdevarsInCSBP: 150 150 mov al, [cs:bp+IDEVARS.bDevice] 151 151 mov [di+DPT_ATA.bDevice], al -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIO.asm
r443 r473 1 1 ; Project name : XTIDE Universal BIOS 2 ; Description : IDE Register I/O functions. 2 ; Description : IDE Register I/O functions when supporting 8-bit 3 ; devices that need address translations. 3 4 4 5 ; … … 22 23 23 24 ;-------------------------------------------------------------------- 25 ; IdeIO_InputStatusRegisterToAL 26 ; Parameters: 27 ; DS:DI: Ptr to DPT (in RAMVARS segment) 28 ; Returns: 29 ; AL: IDE Status Register contents 30 ; Corrupts registers: 31 ; BX, DX 32 ;-------------------------------------------------------------------- 33 ALIGN JUMP_ALIGN 34 IdeIO_InputStatusRegisterToAL: 35 %ifndef MODULE_8BIT_IDE 36 INPUT_TO_AL_FROM_IDE_REGISTER STATUS_REGISTER_in 37 ret 38 39 %else 40 mov dl, STATUS_REGISTER_in 41 ; Fall to IdeIO_InputToALfromIdeRegisterInDL 42 43 ;-------------------------------------------------------------------- 44 ; IdeIO_InputToALfromIdeRegisterInDL 45 ; Parameters: 46 ; DL: IDE Register 47 ; DS:DI: Ptr to DPT (in RAMVARS segment) 48 ; Returns: 49 ; AL: Inputted byte 50 ; Corrupts registers: 51 ; BX, DX 52 ;-------------------------------------------------------------------- 53 IdeIO_InputToALfromIdeRegisterInDL: 54 xor dh, dh ; IDE Register index now in DX 55 56 mov al, [di+DPT_ATA.bDevice] 57 cmp al, DEVICE_8BIT_XTIDE_REV2 58 je SHORT .ReverseA0andA3fromRegisterIndexInDX 59 jb SHORT .InputToALfromRegisterInDX ; Standard IDE controllers and XTIDE rev 1 60 cmp al, DEVICE_8BIT_JRIDE_ISA 61 jne SHORT .ShlRegisterIndexInDX ; All XT-CF modes 62 ; Fall to .InputToALfromMemoryMappedRegisterInDX 63 64 .InputToALfromMemoryMappedRegisterInDX: 65 mov bx, JRIDE_COMMAND_BLOCK_REGISTER_WINDOW_OFFSET 66 add bx, dx 67 push ds 68 mov ds, [di+DPT.wBasePort] ; Segment for JR-IDE/ISA 69 mov al, [bx] 70 pop ds 71 ret 72 73 .ReverseA0andA3fromRegisterIndexInDX: 74 mov bx, dx 75 mov dl, [cs:bx+g_rgbSwapA0andA3fromIdeRegisterIndex] 76 SKIP2B bx ; Skip shl dx, 1 77 78 .ShlRegisterIndexInDX: 79 shl dx, 1 80 ; Fall to .InputToALfromRegisterInDX 81 82 .InputToALfromRegisterInDX: 83 add dx, [di+DPT.wBasePort] 84 in al, dx 85 ret 86 87 88 ;-------------------------------------------------------------------- 24 89 ; IdeIO_OutputALtoIdeControlBlockRegisterInDL 25 90 ; Parameters: … … 33 98 ;-------------------------------------------------------------------- 34 99 IdeIO_OutputALtoIdeControlBlockRegisterInDL: 35 %ifdef MODULE_8BIT_IDE 36 mov dh, [di+DPT_ATA.bDevice] 37 %ifdef MODULE_JRIDE 38 test dh, dh 39 jnz SHORT .OutputToIoMappedIde 40 41 add dx, JRIDE_CONTROL_BLOCK_REGISTER_WINDOW_OFFSET 42 jmp SHORT OutputToJrIdeRegister 43 .OutputToIoMappedIde: 44 %endif ; MODULE_JRIDE 45 %endif ; MODULE_8BIT_IDE 100 ; Note! We do not need to reverse A0 and A3 for XTIDE rev 2 since 101 ; the only Control Block Register we access is DEVICE_CONTROL_REGISTER_out 102 ; at offset 6 (0110b). 103 xor dh, dh ; IDE Register index now in DX 46 104 47 mov bl, IDEVARS.wPortCtrl 48 jmp SHORT OutputALtoIdeRegisterInDLwithIdevarsOffsetToBasePortInBL 105 mov bl, [di+DPT_ATA.bDevice] 106 cmp bl, DEVICE_8BIT_XTIDE_REV2 107 jbe SHORT .OutputALtoControlBlockRegisterInDX ; Standard IDE controllers and XTIDE rev 1 108 cmp bl, DEVICE_8BIT_JRIDE_ISA 109 jne SHORT .ShlRegisterIndexInDX ; All XT-CF modes 110 ; Fall to .OutputALtoMemoryMappedRegisterInDX 111 112 .OutputALtoMemoryMappedRegisterInDX: 113 mov bx, JRIDE_CONTROL_BLOCK_REGISTER_WINDOW_OFFSET 114 jmp SHORT IdeIO_OutputALtoIdeRegisterInDL.OutputALtoMemoryMappedRegisterInDXwithWindowOffsetInBX 115 116 .ShlRegisterIndexInDX: 117 add dl, OFFSET_TO_CONTROL_BLOCK_REGISTERS 118 shl dx, 1 119 jmp SHORT OutputALtoRegisterInDX 120 121 .OutputALtoControlBlockRegisterInDX: 122 call AccessDPT_GetIdevarsToCSBX 123 add dx, [cs:bx+IDEVARS.wControlBlockPort] 124 jmp SHORT OutputALtoPortInDX 49 125 50 126 … … 62 138 ALIGN JUMP_ALIGN 63 139 IdeIO_OutputALtoIdeRegisterInDL: 64 %ifdef MODULE_8BIT_IDE 65 mov dh, [di+DPT_ATA.bDevice] 66 %ifdef MODULE_JRIDE 67 test dh, dh 68 jnz SHORT OutputALtoIOmappedIdeRegisterInDL 69 70 %if JRIDE_COMMAND_BLOCK_REGISTER_WINDOW_OFFSET & 0FFh = 0 71 mov dh, JRIDE_COMMAND_BLOCK_REGISTER_WINDOW_OFFSET >> 8 72 %else 73 add dx, JRIDE_COMMAND_BLOCK_REGISTER_WINDOW_OFFSET 74 %endif 75 OutputToJrIdeRegister: 76 mov bx, dx 77 mov [cs:bx], al 78 ret 79 ALIGN JUMP_ALIGN 80 OutputALtoIOmappedIdeRegisterInDL: 81 %endif ; MODULE_JRIDE 82 %endif ; MODULE_8BIT_IDE 140 xor dh, dh ; IDE Register index now in DX 83 141 84 mov bl, IDEVARS.wPort 85 OutputALtoIdeRegisterInDLwithIdevarsOffsetToBasePortInBL: 86 call GetIdePortToDX 142 mov bl, [di+DPT_ATA.bDevice] 143 cmp bl, DEVICE_8BIT_XTIDE_REV2 144 je SHORT .ReverseA0andA3fromRegisterIndexInDX 145 jb SHORT OutputALtoRegisterInDX ; Standard IDE controllers and XTIDE rev 1 146 cmp bl, DEVICE_8BIT_JRIDE_ISA 147 jne SHORT .ShlRegisterIndexInDX ; All XT-CF modes 148 ; Fall to .OutputALtoMemoryMappedRegisterInDX 149 150 .OutputALtoMemoryMappedRegisterInDX: 151 mov bx, JRIDE_COMMAND_BLOCK_REGISTER_WINDOW_OFFSET 152 .OutputALtoMemoryMappedRegisterInDXwithWindowOffsetInBX: 153 add bx, dx 154 push ds 155 mov ds, [di+DPT.wBasePort] ; Segment for JR-IDE/ISA 156 mov [bx], al 157 pop ds 158 ret 159 160 .ReverseA0andA3fromRegisterIndexInDX: 161 mov bx, dx 162 mov dl, [cs:bx+g_rgbSwapA0andA3fromIdeRegisterIndex] 163 SKIP2B bx ; Skip shl dx, 1 164 165 .ShlRegisterIndexInDX: 166 shl dx, 1 167 ; Fall to OutputALtoRegisterInDX 168 169 ALIGN JUMP_ALIGN 170 OutputALtoRegisterInDX: 171 add dx, [di+DPT.wBasePort] 172 OutputALtoPortInDX: 87 173 out dx, al 88 174 ret 89 175 90 176 91 ;--------------------------------------------------------------------92 ; IdeIO_InputStatusRegisterToAL93 ; Parameters:94 ; DS:DI: Ptr to DPT (in RAMVARS segment)95 ; Returns:96 ; AL: IDE Status Register contents97 ; Corrupts registers:98 ; BX, DX99 ;--------------------------------------------------------------------100 ALIGN JUMP_ALIGN101 IdeIO_InputStatusRegisterToAL:102 mov dl, STATUS_REGISTER_in103 ; Fall to IdeIO_InputToALfromIdeRegisterInDL104 177 105 ;-------------------------------------------------------------------- 106 ; IdeIO_InputToALfromIdeRegisterInDL 107 ; Parameters: 108 ; DL: IDE Register 109 ; DS:DI: Ptr to DPT (in RAMVARS segment) 110 ; Returns: 111 ; AL: Inputted byte 112 ; Corrupts registers: 113 ; BX, DX 114 ;-------------------------------------------------------------------- 115 IdeIO_InputToALfromIdeRegisterInDL: 116 %ifdef MODULE_8BIT_IDE 117 mov dh, [di+DPT_ATA.bDevice] 118 %ifdef MODULE_JRIDE 119 test dh, dh 120 jnz SHORT .InputToALfromIOmappedIdeRegisterInDL 121 122 %if JRIDE_COMMAND_BLOCK_REGISTER_WINDOW_OFFSET & 0FFh = 0 123 mov dh, JRIDE_COMMAND_BLOCK_REGISTER_WINDOW_OFFSET >> 8 124 %else 125 add dx, JRIDE_COMMAND_BLOCK_REGISTER_WINDOW_OFFSET 126 %endif 127 mov bx, dx 128 mov al, [cs:bx] 129 ret 130 .InputToALfromIOmappedIdeRegisterInDL: 131 %endif ; MODULE_JRIDE 132 %endif ; MODULE_8BIT_IDE 133 mov bl, IDEVARS.wPort 134 call GetIdePortToDX 135 in al, dx 136 ret 178 ; A0 <-> A3 lookup table 179 g_rgbSwapA0andA3fromIdeRegisterIndex: 180 db 0000b ; <-> 0000b, 0 181 db 1000b ; <-> 0001b, 1 182 db 0010b ; <-> 0010b, 2 183 db 1010b ; <-> 0011b, 3 184 db 0100b ; <-> 0100b, 4 185 db 1100b ; <-> 0101b, 5 186 db 0110b ; <-> 0110b, 6 187 db 1110b ; <-> 0111b, 7 137 188 138 139 ;-------------------------------------------------------------------- 140 ; GetIdePortToDX 141 ; Parameters: 142 ; BL: Offset to port in IDEVARS (IDEVARS.wPort or IDEVARS.wPortCtrl) 143 ; DH: Device Type (IDEVARS.bDevice) 144 ; DL: IDE Register 145 ; DS:DI: Ptr to DPT (in RAMVARS segment) 146 ; Returns: 147 ; DX: Source/Destination Port 148 ; Corrupts registers: 149 ; BX 150 ;-------------------------------------------------------------------- 151 ALIGN JUMP_ALIGN 152 GetIdePortToDX: 153 %ifdef MODULE_8BIT_IDE 154 ; Point CS:BX to IDEVARS 155 xor bh, bh 156 add bl, [di+DPT.bIdevarsOffset] ; CS:BX now points port address 157 158 ; Load port address and check if A0 and A3 address lines need to be reversed 159 cmp dh, DEVICE_8BIT_XTIDE_REV1 160 mov dh, bh ; DX now has IDE register offset 161 jae SHORT .ReturnUntranslatedPortInDX ; No need to swap address lines 162 163 ; Exchange address lines A0 and A3 from DL 164 add dx, [cs:bx] ; DX now has port address 165 mov bl, dl ; Port low byte to BL 166 and bl, MASK_A3_AND_A0_ADDRESS_LINES ; Clear all bits except A0 and A3 167 jz SHORT .ReturnTranslatedPortInDX ; A0 and A3 both zeroes, no change needed 168 cmp bl, MASK_A3_AND_A0_ADDRESS_LINES 169 je SHORT .ReturnTranslatedPortInDX ; A0 and A3 both ones, no change needed 170 xor dl, MASK_A3_AND_A0_ADDRESS_LINES ; Invert A0 and A3 171 .ReturnTranslatedPortInDX: 172 ret 173 174 .ReturnUntranslatedPortInDX: 175 add dx, [cs:bx] 176 ret 177 178 %else ; Only standard IDE devices 179 xor bh, bh 180 add bl, [di+DPT.bIdevarsOffset] ; CS:BX now points port address 181 xor dh, dh 182 add dx, [cs:bx] ; DX now has port address 183 ret 184 %endif 189 %endif ; MODULE_8BIT_IDE -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm
r445 r473 206 206 ALIGN JUMP_ALIGN 207 207 InitializePiovarsInSSBPwithSectorCountInAH: 208 ; Store sizes 208 ; Store sizes and Data Port 209 209 mov [bp+PIOVARS.bSectorsLeft], ah 210 mov ax, [di+DPT.wBasePort] 211 mov [bp+PIOVARS.wDataPort], ax 210 212 eMOVZX ax, [di+DPT_ATA.bBlockSize] 211 213 mov [bp+PIOVARS.wSectorsInBlock], ax … … 214 216 ; Get transfer function based on bus type 215 217 xchg ax, bx ; Lookup table offset to AX 216 mov bl, [di+DPT.bIdevarsOffset] ; CS:BX now points to IDEVARS217 mov dx, [cs:bx+IDEVARS.wPort] ; Load IDE Data port address218 218 mov bl, [di+DPT_ATA.bDevice] 219 219 add bx, ax 220 221 mov [bp+PIOVARS.wDataPort], dx222 220 mov ax, [cs:bx] ; Load offset to transfer function 223 221 mov [bp+PIOVARS.fnXfer], ax … … 225 223 226 224 227 ;--------------------------------------------------------------------228 ; ReadBlockFromXtideRev1 XTIDE rev 1229 ; ReadBlockFromXtideRev2 XTIDE rev 2 or rev 1 with swapped A0 and A3 (chuck-mod)230 ; ReadBlockFrom8bitDataPort CF-XT when using 8-bit PIO231 ; ReadBlockFrom16bitDataPort Normal 16-bit IDE232 ; ReadBlockFrom32bitDataPort VLB/PCI 32-bit IDE233 ; Parameters:234 ; CX: Block size in 512 byte sectors235 ; DX: IDE Data port address236 ; ES:DI: Normalized ptr to buffer to receive data237 ; Returns:238 ; Nothing239 ; Corrupts registers:240 ; AX, BX, CX241 ;--------------------------------------------------------------------242 %ifdef MODULE_8BIT_IDE243 244 ALIGN JUMP_ALIGN245 ReadBlockFromXtideRev1:246 UNROLL_SECTORS_IN_CX_TO_OWORDS247 mov bl, 8 ; Bit mask for toggling data low/high reg248 ALIGN JUMP_ALIGN249 .InswLoop:250 %rep 8 ; WORDs251 XTIDE_INSW252 %endrep253 loop .InswLoop254 ret255 256 ;--------------------------------------------------------------------257 %ifndef USE_186 ; 8086/8088 compatible WORD read258 ALIGN JUMP_ALIGN259 ReadBlockFromXtideRev2:260 UNROLL_SECTORS_IN_CX_TO_OWORDS261 ALIGN JUMP_ALIGN262 .ReadNextOword:263 %rep 8 ; WORDs264 in ax, dx ; Read WORD265 stosw ; Store WORD to [ES:DI]266 %endrep267 loop .ReadNextOword268 ret269 %endif270 271 ;--------------------------------------------------------------------272 %ifdef USE_186273 ALIGN JUMP_ALIGN274 ReadBlockFrom8bitDataPort:275 shl cx, 9 ; Sectors to BYTEs276 rep insb277 ret278 279 %else ; If 8088/8086280 ALIGN JUMP_ALIGN281 ReadBlockFrom8bitDataPort:282 UNROLL_SECTORS_IN_CX_TO_OWORDS283 ALIGN JUMP_ALIGN284 .ReadNextOword:285 %rep 16 ; BYTEs286 in al, dx ; Read BYTE287 stosb ; Store BYTE to [ES:DI]288 %endrep289 loop .ReadNextOword290 ret291 %endif292 %endif ; MODULE_8BIT_IDE293 294 ;--------------------------------------------------------------------295 %ifdef USE_186296 ALIGN JUMP_ALIGN297 ReadBlockFrom16bitDataPort:298 xchg cl, ch ; Sectors to WORDs299 rep insw300 ret301 %endif302 303 ;--------------------------------------------------------------------304 %ifdef USE_AT305 ALIGN JUMP_ALIGN306 ReadBlockFrom32bitDataPort:307 shl cx, 7 ; Sectors to DWORDs308 rep309 db 66h ; Override operand size to 32-bit310 db 6Dh ; INSW/INSD311 ret312 %endif313 314 315 ;--------------------------------------------------------------------316 ; WriteBlockToXtideRev1 XTIDE rev 1317 ; WriteBlockToXtideRev2 XTIDE rev 2 or rev 1 with swapped A0 and A3 (chuck-mod)318 ; WriteBlockTo8bitDataPort XT-CF when using 8-bit PIO319 ; WriteBlockTo16bitDataPort Normal 16-bit IDE320 ; WriteBlockTo32bitDataPort VLB/PCI 32-bit IDE321 ; Parameters:322 ; CX: Block size in 512-byte sectors323 ; DX: IDE Data port address324 ; ES:SI: Normalized ptr to buffer containing data325 ; Returns:326 ; Nothing327 ; Corrupts registers:328 ; AX, BX, CX, DX329 ;--------------------------------------------------------------------330 %ifdef MODULE_8BIT_IDE331 332 ALIGN JUMP_ALIGN333 WriteBlockToXtideRev1:334 push ds335 UNROLL_SECTORS_IN_CX_TO_QWORDS336 mov bl, 8 ; Bit mask for toggling data low/high reg337 push es ; Copy ES...338 pop ds ; ...to DS339 ALIGN JUMP_ALIGN340 .OutswLoop:341 %rep 4 ; WORDs342 XTIDE_OUTSW343 %endrep344 loop .OutswLoop345 pop ds346 ret347 348 ;--------------------------------------------------------------------349 ALIGN JUMP_ALIGN350 WriteBlockToXtideRev2:351 UNROLL_SECTORS_IN_CX_TO_QWORDS352 push ds353 push es ; Copy ES...354 pop ds ; ...to DS355 ALIGN JUMP_ALIGN356 .WriteNextQword:357 %rep 4 ; WORDs358 XTIDE_MOD_OUTSW359 %endrep360 loop .WriteNextQword361 pop ds362 ret363 364 ;--------------------------------------------------------------------365 %ifdef USE_186366 ALIGN JUMP_ALIGN367 WriteBlockTo8bitDataPort:368 shl cx, 9 ; Sectors to BYTEs369 es ; Source is ES segment370 rep outsb371 ret372 373 %else ; If 8088/8086374 ALIGN JUMP_ALIGN375 WriteBlockTo8bitDataPort:376 UNROLL_SECTORS_IN_CX_TO_DWORDS377 push ds378 push es379 pop ds380 ALIGN JUMP_ALIGN381 .WriteNextDword:382 %rep 4 ; BYTEs383 lodsb ; Load BYTE from [DS:SI]384 out dx, al ; Write BYTE385 %endrep386 loop .WriteNextDword387 pop ds388 ret389 %endif390 %endif ; MODULE_8BIT_IDE391 392 ;--------------------------------------------------------------------393 %ifdef USE_AT394 ALIGN JUMP_ALIGN395 WriteBlockTo16bitDataPort:396 xchg cl, ch ; Sectors to WORDs397 es ; Source is ES segment398 rep outsw399 ret400 401 ;--------------------------------------------------------------------402 ALIGN JUMP_ALIGN403 WriteBlockTo32bitDataPort:404 shl cx, 7 ; Sectors to DWORDs405 es ; Source is ES segment406 rep407 db 66h ; Override operand size to 32-bit408 db 6Fh ; OUTSW/OUTSD409 ret410 %endif ; USE_AT411 412 413 225 414 226 ; Lookup tables to get transfer function based on bus type 415 227 ALIGN WORD_ALIGN 416 228 g_rgfnPioRead: 229 %ifdef USE_AT 230 dw IdePioBlock_ReadFrom16bitDataPort ; 0, DEVICE_16BIT_ATA 231 dw IdePioBlock_ReadFrom32bitDataPort ; 1, DEVICE_32BIT_ATA 232 %else 233 dd 0 234 %endif 417 235 %ifdef MODULE_8BIT_IDE 418 dw 0 ; 0, DEVICE_8BIT_JRIDE_ISA 419 dw ReadBlockFrom8bitDataPort ; 1, DEVICE_8BIT_XTCF 420 %ifdef USE_186 421 dw ReadBlockFrom16bitDataPort ; 2, DEVICE_8BIT_XTIDE_REV2 422 %else 423 dw ReadBlockFromXtideRev2 ; 2, DEVICE_8BIT_XTIDE_REV2 236 dw IdePioBlock_ReadFromXtideRev1 ; 2, DEVICE_8BIT_XTIDE_REV1 237 %ifndef USE_AT 238 g_rgfnPioWrite: 424 239 %endif 425 dw ReadBlockFromXtideRev1 ; 3, DEVICE_XTIDE_REV1 426 427 %else 428 times COUNT_OF_8BIT_IDE_DEVICES dw 0 429 %endif 240 dw IdePioBlock_ReadFromXtideRev2 ; 3, DEVICE_8BIT_XTIDE_REV2 241 dw IdePioBlock_ReadFrom8bitDataPort ; 4, DEVICE_8BIT_XTCF_PIO8 242 %endif 243 430 244 %ifdef USE_AT 431 dw ReadBlockFrom16bitDataPort ; 4, DEVICE_16BIT_ATA432 dw ReadBlockFrom32bitDataPort ; 5, DEVICE_32BIT_ATA433 %endif434 435 436 245 g_rgfnPioWrite: 246 dw IdePioBlock_WriteTo16bitDataPort ; 0, DEVICE_16BIT_ATA 247 dw IdePioBlock_WriteTo32bitDataPort ; 1, DEVICE_32BIT_ATA 248 %endif 437 249 %ifdef MODULE_8BIT_IDE 438 dw 0 ; 0, DEVICE_8BIT_JRIDE_ISA 439 dw WriteBlockTo8bitDataPort ; 1, DEVICE_8BIT_XTCF 440 dw WriteBlockToXtideRev2 ; 2, DEVICE_XTIDE_REV2 441 dw WriteBlockToXtideRev1 ; 3, DEVICE_XTIDE_REV1 442 443 %else 444 times COUNT_OF_8BIT_IDE_DEVICES dw 0 445 %endif 446 %ifdef USE_AT 447 dw WriteBlockTo16bitDataPort ; 4, DEVICE_16BIT_ATA 448 dw WriteBlockTo32bitDataPort ; 5, DEVICE_32BIT_ATA 449 %endif 250 dw IdePioBlock_WriteToXtideRev1 ; 2, DEVICE_8BIT_XTIDE_REV1 251 dw IdePioBlock_WriteToXtideRev2 ; 3, DEVICE_8BIT_XTIDE_REV2 252 dw IdePioBlock_WriteTo8bitDataPort ; 4, DEVICE_8BIT_XTCF_PIO8 253 %endif -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/JrIdeTransfer.asm
r445 r473 28 28 endstruc 29 29 30 SECTOR_ACCESS_WINDOW_SIZE EQU 512 ; 512 bytes 31 30 32 31 33 ; Section containing code … … 37 39 ; AL: IDE command that was used to start the transfer 38 40 ; (all PIO read and write commands including Identify Device) 39 ; ES:SI: Ptr to normalized data buffer 41 ; ES:SI: Ptr to normalized data buffer (SI 0...15) 40 42 ; DS:DI: Ptr to DPT (in RAMVARS segment) 41 43 ; SS:BP: Ptr to IDEPACK … … 49 51 ALIGN JUMP_ALIGN 50 52 JrIdeTransfer_StartWithCommandInAL: 51 push cs ; We push CS here (segment of SAW) and later pop it to DS (reads) or ES (writes) 52 53 ; Initialize PIOVARS 54 xor cx, cx 55 mov [bp+MEMPIOVARS.bSectorsDone], cl 56 mov cl, [bp+IDEPACK.bSectorCount] 57 mov [bp+MEMPIOVARS.bSectorsLeft], cl 58 mov cl, [di+DPT_ATA.bBlockSize] 59 mov [bp+MEMPIOVARS.wSectorsInBlock], cx 53 ; Initialize MEMPIOVARS 54 xchg cx, ax ; IDE command to CL 55 xor ax, ax 56 mov [bp+MEMPIOVARS.bSectorsDone], al 57 mov al, [bp+IDEPACK.bSectorCount] 58 mov [bp+MEMPIOVARS.bSectorsLeft], al 59 mov al, [di+DPT_ATA.bBlockSize] 60 mov [bp+MEMPIOVARS.wSectorsInBlock], ax 60 61 mov [bp+MEMPIOVARS.fpDPT], di 61 62 mov [bp+MEMPIOVARS.fpDPT+2], ds 62 63 64 ; Get far pointer to Sector Access Window 65 mov dx, [di+DPT.wBasePort] 66 cmp BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_JRIDE_ISA 67 jne SHORT .GetSectorAccessWindowForXTCF 68 69 ; Get Sector Access Window for JR-IDE/ISA 70 mov di, JRIDE_SECTOR_ACCESS_WINDOW_OFFSET 71 mov ds, dx ; Segment for JR-IDE/ISA 72 jmp SHORT .SectorAccessWindowLoadedToDSDI 73 74 .GetSectorAccessWindowForXTCF: 75 xor di, di 76 add dl, XTCF_CONTROL_REGISTER 77 in al, dx ; Read high byte for Sector Access Window segment 78 xchg ah, al 79 mov ds, ax 80 63 81 ; Are we reading or writing? 64 test al, 16 ; Bit 4 is cleared on all the read commands but set on 3 of the 4 write commands 82 .SectorAccessWindowLoadedToDSDI: 83 test cl, 16 ; Bit 4 is cleared on all the read commands but set on 3 of the 4 write commands 65 84 jnz SHORT WriteToSectorAccessWindow 66 cmp al, COMMAND_WRITE_MULTIPLE85 cmp cl, COMMAND_WRITE_MULTIPLE 67 86 je SHORT WriteToSectorAccessWindow 68 87 ; Fall to ReadFromSectorAccessWindow … … 71 90 ; ReadFromSectorAccessWindow 72 91 ; Parameters: 73 ; Stack: Segment part of ptr to Sector Access Window92 ; DS:DI: Ptr to Sector Access Window 74 93 ; ES:SI: Normalized ptr to buffer to receive data 75 94 ; SS:BP: Ptr to MEMPIOVARS … … 84 103 ;-------------------------------------------------------------------- 85 104 ReadFromSectorAccessWindow: 86 pop ds ; CS -> DS 87 mov di, si ; ES:DI = destination 88 mov si, JRIDE_SECTOR_ACCESS_WINDOW_OFFSET ; DS:SI = source 89 105 xchg si, di ; DS:SI = source, ES:DI = Destination 90 106 call WaitUntilReadyToTransferNextBlock 91 107 jc SHORT ReturnWithMemoryIOtransferErrorInAH … … 140 156 ; WriteToSectorAccessWindow 141 157 ; Parameters: 142 ; Stack: Segment part of ptr to Sector Access Window158 ; DS:DI: Ptr to Sector Access Window 143 159 ; ES:SI: Normalized ptr to buffer containing data 144 160 ; SS:BP: Ptr to MEMPIOVARS … … 155 171 WriteToSectorAccessWindow: 156 172 push es 157 p opds158 pop es ; CS -> ES159 mov di, JRIDE_SECTOR_ACCESS_WINDOW_OFFSET173 push ds 174 pop es ; ES:DI = Sector Access Window (destination) 175 pop ds ; DS:SI = Ptr to source buffer 160 176 161 177 ; Always poll when writing first block (IRQs are generated for following blocks) … … 205 221 ALIGN JUMP_ALIGN 206 222 .WriteBlock: 207 mov ch, JRIDE_SECTOR_ACCESS_WINDOW_SIZE >> 9223 mov ch, SECTOR_ACCESS_WINDOW_SIZE >> 9 208 224 rep movsw 209 225 mov di, bx ; Reset for next sector … … 232 248 ALIGN JUMP_ALIGN 233 249 .ReadBlock: 234 mov ch, JRIDE_SECTOR_ACCESS_WINDOW_SIZE >> 9250 mov ch, SECTOR_ACCESS_WINDOW_SIZE >> 9 235 251 rep movsw 236 252 mov si, bx ; Reset for next sector … … 261 277 262 278 263 %if JRIDE_SECTOR_ACCESS_WINDOW_SIZE <> 512264 %error " JRIDE_SECTOR_ACCESS_WINDOW_SIZE is no longer equal to 512. JrIdeTransfer.asm needs changes."279 %if SECTOR_ACCESS_WINDOW_SIZE <> 512 280 %error "SECTOR_ACCESS_WINDOW_SIZE is no longer equal to 512. JrIdeTransfer.asm needs changes." 265 281 %endif -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH1Eh_XTCF.asm
r472 r473 38 38 ;-------------------------------------------------------------------- 39 39 AH1Eh_HandlerForXTCFfeatures: 40 xor ah, ah ; Subcommand now in AX41 40 %ifndef USE_186 42 call AH1Eh_ProcessXTCFsubcommandFromA X41 call AH1Eh_ProcessXTCFsubcommandFromAL 43 42 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 44 43 %else 45 44 push Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 46 ; Fall to AH1Eh_ProcessXTCFsubcommandFromA X45 ; Fall to AH1Eh_ProcessXTCFsubcommandFromAL 47 46 %endif 48 47 49 48 50 49 ;-------------------------------------------------------------------- 51 ; AH1Eh_ProcessXTCFsubcommandFromA X50 ; AH1Eh_ProcessXTCFsubcommandFromAL 52 51 ; Parameters: 53 ; A X: XT-CF subcommand (see XTCF.inc for more info)52 ; AL: XT-CF subcommand (see XTCF.inc for more info) 54 53 ; DS:DI: Ptr to DPT (in RAMVARS segment) 55 54 ; SS:BP: Ptr to IDEPACK … … 58 57 ; CF: 0 if successful, 1 if error 59 58 ; Corrupts registers: 60 ; AL, BX, CX, DX 59 ; AL, BX, CX, DX, SI 61 60 ;-------------------------------------------------------------------- 62 AH1Eh_ProcessXTCFsubcommandFromA X:61 AH1Eh_ProcessXTCFsubcommandFromAL: 63 62 ; IS_THIS_DRIVE_XTCF. We check this for all commands. 64 dec ax ; Subcommand65 mov dx, [di+DPT.wXTCFport]66 test dx, dx ; Never zero for XT-CF, Always zero for other devices67 jz SHORT XTCFnotFound63 call AccessDPT_IsThisDeviceXTCF 64 jne SHORT XTCFnotFound 65 and ax, BYTE 7Fh ; Subcommand now in AX 66 jz SHORT .ReturnWithSuccess ; IS_THIS_DRIVE_XTCF 68 67 69 68 ; READ_XTCF_CONTROL_REGISTER_TO_DH 70 add dl, XTCF_CONTROL_REGISTER ; DX to Control Register 71 dec ax ; Subcommand 69 dec ax ; Subcommand 72 70 jnz SHORT .SkipReadXtcfControlRegisterToDH 71 mov dx, [di+DPT.wBasePort] 72 add dl, XTCF_CONTROL_REGISTER 73 73 in al, dx 74 74 mov [bp+IDEPACK.intpack+INTPACK.dh], al 75 jmp SHORT .ReturnWithSuccess 75 .ReturnWithSuccess: 76 xor ah, ah 77 ret 76 78 .SkipReadXtcfControlRegisterToDH: 77 79 78 80 ; WRITE_DH_TO_XTCF_CONTROL_REGISTER 79 dec ax ; Subcommand81 dec ax ; Subcommand 80 82 jnz SHORT XTCFnotFound ; Invalid subcommand 81 83 mov al, [bp+IDEPACK.intpack+INTPACK.dh] 84 ; Fall to AH1Eh_ChangeXTCFmodeBasedOnControlRegisterInAL 85 86 87 ;-------------------------------------------------------------------- 88 ; AH1Eh_ChangeXTCFmodeBasedOnControlRegisterInAL 89 ; Parameters: 90 ; AL: XT-CF Control Register 91 ; DS:DI: Ptr to DPT (in RAMVARS segment) 92 ; SS:BP: Ptr to IDEPACK 93 ; Returns: 94 ; AH: Int 13h return status 95 ; CF: 0 if successful, 1 if error 96 ; Corrupts registers: 97 ; AL, BX, CX, DX, SI 98 ;-------------------------------------------------------------------- 99 AH1Eh_ChangeXTCFmodeBasedOnControlRegisterInAL: 100 ; Output Control Register 101 mov dx, [di+DPT.wBasePort] 102 add dl, XTCF_CONTROL_REGISTER 82 103 out dx, al 83 .ReturnWithSuccess: 84 xor ah, ah 85 ret 104 105 ; Convert Control Register Contents to device code 106 test al, al 107 jz SHORT .Set8bitPioMode 108 cmp al, XTCF_MEMORY_MAPPED_MODE 109 jae SHORT .SetMemoryMappedMode 110 111 ; Set DMA Mode 112 mov BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_DMA 113 jmp AH23h_Disable8bitPioMode 114 115 .SetMemoryMappedMode: 116 mov BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_MEMMAP 117 jmp AH23h_Disable8bitPioMode 118 119 .Set8bitPioMode: 120 mov BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_PIO8 121 jmp AH23h_Enable8bitPioMode 86 122 87 123 … … 96 132 ; Set if XT-CF not found 97 133 ; Corrupts registers: 98 ; AL , DX134 ; AL 99 135 ;-------------------------------------------------------------------- 100 136 AH1Eh_DetectXTCFwithBasePortInDX: 137 push dx 101 138 add dl, XTCT_CONTROL_REGISTER_INVERTED_in ; set DX to XT-CF config register (inverted) 102 139 in al, dx ; get value … … 104 141 inc dx ; set DX to XT-CF config register (non-inverted) 105 142 in al, dx ; get value 106 not al ; invert it 143 not al ; invert value 144 pop dx 107 145 sub ah, al ; do they match? (clear AH if they do) 108 146 jz SHORT XTCFfound 109 147 110 148 XTCFnotFound: 149 AH1Eh_LoadInvalidCommandToAHandSetCF: 111 150 stc ; set carry flag since XT-CF not found 112 151 mov ah, RET_HD_INVALID -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH23h_HFeatures.asm
r376 r473 74 74 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_BSY, FLG_STATUS_BSY) 75 75 jmp Idepack_StoreNonExtParametersAndIssueCommandFromAL 76 77 78 %ifdef MODULE_8BIT_IDE 79 ;-------------------------------------------------------------------- 80 ; AH23h_Enable8bitPioMode 81 ; AH23h_Disable8bitPioMode 82 ; Parameters: 83 ; DS:DI: Ptr to DPT (in RAMVARS segment) 84 ; SS:BP: Ptr to IDEPACK 85 ; Returns: 86 ; AH: Int 13h return status 87 ; CF: 0 if successful, 1 if error 88 ; Corrupts registers: 89 ; AL, BX, CX, DX, SI 90 ;-------------------------------------------------------------------- 91 AH23h_Enable8bitPioMode: 92 mov si, FEATURE_ENABLE_8BIT_PIO_TRANSFER_MODE 93 jmp SHORT AH23h_SetControllerFeatures 94 AH23h_Disable8bitPioMode: 95 mov si, FEATURE_DISABLE_8BIT_PIO_TRANSFER_MODE 96 jmp SHORT AH23h_SetControllerFeatures 97 %endif ; MODULE_8BIT_IDE -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH24h_HSetBlocks.asm
r376 r473 59 59 ;-------------------------------------------------------------------- 60 60 AH24h_SetBlockSize: 61 ; XT-CF does not support largest block size in DMA mode. 62 %ifdef MODULE_8BIT_IDE 63 call AccessDPT_IsThisDeviceXTCF 64 cmp ah, DEVICE_8BIT_XTCF_DMA 65 jne SHORT .NoNeedToLimitBlockSize 66 cmp al, XTCF_DMA_MODE_MAX_BLOCK_SIZE 67 ja SHORT AH1Eh_LoadInvalidCommandToAHandSetCF 68 .NoNeedToLimitBlockSize: 69 %endif ; MODULE_8BIT_IDE 70 61 71 push bx 62 72 -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm
r445 r473 104 104 jmp .ReturnWithErrorCodeInAH 105 105 .ContinueInitializationSinceDriveSelectedSuccesfully: 106 107 108 ;;; Set XT-CF mode 109 %ifdef MODULE_8BIT_IDE 110 call AccessDPT_IsThisDeviceXTCF 111 jne SHORT .DoNotSetXTCFmode 112 113 call AccessDPT_GetIdevarsToCSBX 114 mov al, [cs:bx+IDEVARS.bXTCFcontrolRegister] 115 call AH1Eh_ChangeXTCFmodeBasedOnControlRegisterInAL 116 STORE_ERROR_FLAG_TO_DPT FLG_INITERROR_FAILED_TO_SET_XTCF_MODE 117 .DoNotSetXTCFmode: 118 %endif 106 119 107 120 … … 125 138 STORE_ERROR_FLAG_TO_DPT FLG_INITERROR_FAILED_TO_INITIALIZE_CHS_PARAMETERS 126 139 .SkipInitializeDeviceParameters: 127 128 129 %ifdef MODULE_8BIT_IDE130 ;;; Enable 8-bit PIO Transfer Mode for Lo-tech XT-CF (CF and Microdrives only)131 call AH9h_Enable8bitPioModeForXTCF132 STORE_ERROR_FLAG_TO_DPT FLG_INITERROR_FAILED_TO_ENABLE_8BIT_PIO_MODE133 %endif134 140 135 141 … … 244 250 ; Nothing 245 251 ;-------------------------------------------------------------------- 246 DoNotEnable8bitMode:247 252 IgnoreInvalidCommandError: 248 253 xor ah, ah ; Clears CF … … 256 261 .NoErrorFlagToSet: 257 262 ret 258 259 260 %ifdef MODULE_8BIT_IDE261 ;--------------------------------------------------------------------262 ; AH9h_Enable8bitPioModeForXTCF263 ; Parameters:264 ; DS:DI: Ptr to DPT265 ; SS:BP: Ptr to IDEPACK266 ; Returns:267 ; AH: Int 13h return status268 ; CF: 0 if successful, 1 if error269 ; Corrupts registers:270 ; AL, BX, CX, DX, SI271 ;--------------------------------------------------------------------272 AH9h_Enable8bitPioModeForXTCF:273 eMOVZX bx, [di+DPT.bIdevarsOffset]274 cmp BYTE [cs:bx+IDEVARS.bDevice], DEVICE_8BIT_XTCF275 jne SHORT DoNotEnable8bitMode276 277 mov si, FEATURE_ENABLE_8BIT_PIO_TRANSFER_MODE278 jmp AH23h_SetControllerFeatures279 %endif ; MODULE_8BIT_IDE -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHDh_HReset.asm
r445 r473 70 70 71 71 ; Initialize Master and Slave drives 72 eMOVZX ax, [di+DPT.bIdevarsOffset] ; (AL) pointer to controller we are looking to reset 72 call AccessDPT_GetIdevarsToCSBX 73 xchg ax, bx ; (AL) pointer to controller we are looking to reset 73 74 ; (AH) initialize error code, assume success 74 75 -
trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta/Vision.asm
r398 r473 179 179 ; QD6500 has only one channel that can be Primary at 1F0h or Secondary at 170h. 180 180 ; QD6580 always has Primary channel at 1F0h. Secondary channel at 170h can be Enabled or Disabled. 181 call AccessDPT_GetIdeBasePortToBX181 mov bx, [di+DPT.wBasePort] 182 182 cmp bx, DEVICE_ATA_PRIMARY_PORT 183 183 je SHORT .CalculateTimingTicksForQD6580 ; Primary Channel so no need to modify DX -
trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm
r441 r473 150 150 ; None 151 151 ; Corrupts registers: 152 ; AX, B X, CX, DX, SI, DI152 ; AX, BL, CX, DX, SI, DI 153 153 ;-------------------------------------------------------------------- 154 154 StartDetectionWithDriveSelectByteInBHandStringInCX: … … 157 157 call HotkeyBar_UpdateDuringDriveDetection 158 158 %endif 159 ; Fall to .AutodetectXTCFport or .ReadAtaInfoFromHardDisk 160 161 162 %ifdef MODULE_8BIT_IDE 163 ;-------------------------------------------------------------------- 164 ; .AutodetectXTCFport 165 ; Parameters: 166 ; BH: Drive Select byte for Drive and Head Register 167 ; CS:BP: Ptr to IDEVARS for the drive 168 ; DS: RAMVARS segment 169 ; ES: Zero (BDA segment) 170 ; Returns: 171 ; DX: Autodetected port (for devices that support autodetection) 172 ; Corrupts registers: 173 ; AX 174 ;-------------------------------------------------------------------- 175 .AutodetectXTCFport: 176 ; Detect port for XTCF 177 call DetectDrives_DoesIdevarsInCSBPbelongToXTCF 178 jne SHORT .SkipXTCFportDetection 179 180 ; XT-CF do not support slave drives so we can safely update port 181 ; for next drive (another XT-CF card on same system) 182 .DetectNextPort: 183 call BootVars_GetNextXTCFportToDetectToDX 184 cmp dx, XTCF_BASE_PORT_4 185 ja SHORT DetectDrives_DriveNotFound ; XT-CF not found from any port 186 187 call AH1Eh_DetectXTCFwithBasePortInDX 188 jc SHORT .DetectNextPort ; XT-CF not found from this port 189 .SkipXTCFportDetection: 159 190 ; Fall to .ReadAtaInfoFromHardDisk 191 %endif ; MODULE_8BIT_IDE 192 160 193 161 194 ;-------------------------------------------------------------------- … … 163 196 ; Parameters: 164 197 ; BH: Drive Select byte for Drive and Head Register 198 ; DX: Autodetected port (for devices that support autodetection) 165 199 ; CS:BP: Ptr to IDEVARS for the drive 166 200 ; DS: RAMVARS segment … … 176 210 push es 177 211 push si 212 push dx 178 213 push bx 179 214 call Device_IdentifyToBufferInESSIwithDriveSelectByteInBH 180 215 pop bx 216 pop dx 181 217 pop si 182 218 pop es … … 208 244 ; Parameters: 209 245 ; BH: Drive Select byte for Drive and Head Register 246 ; DX: Autodetected port (for devices that support autodetection) 210 247 ; CS:BP: Ptr to IDEVARS for the drive 211 248 ; ES:SI Ptr to ATA information for the drive … … 226 263 call DriveDetectInfo_CreateForHardDisk 227 264 jmp SHORT DetectPrint_DriveNameFromDrvDetectInfoInESBX 265 266 267 %ifdef MODULE_8BIT_IDE 268 ;-------------------------------------------------------------------- 269 ; DetectDrives_DoesIdevarsInCSBPbelongToXTCF 270 ; Parameters: 271 ; CS:BP: Ptr to IDEVARS for the drive 272 ; Returns: 273 ; ZF: Set if IDEVARS belongs to XT-CF device 274 ; Cleared if some other device 275 ; Corrupts registers: 276 ; AL 277 ;-------------------------------------------------------------------- 278 DetectDrives_DoesIdevarsInCSBPbelongToXTCF: 279 mov al, [cs:bp+IDEVARS.bDevice] 280 cmp al, DEVICE_8BIT_XTCF_PIO8 281 je SHORT .DeviceIsXTCF 282 cmp al, DEVICE_8BIT_XTCF_DMA 283 je SHORT .DeviceIsXTCF 284 cmp al, DEVICE_8BIT_XTCF_MEMMAP 285 .DeviceIsXTCF: 286 ret 287 %endif ; MODULE_8BIT_IDE -
trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm
r400 r473 79 79 ; Nothing 80 80 ; Corrupts registers: 81 ; AX, SI, DI, CX 81 ; AX, SI, DI, CX, DX 82 82 ;-------------------------------------------------------------------- 83 83 DetectPrint_StartDetectWithMasterOrSlaveStringInCXandIdeVarsInCSBP: 84 mov ax, [cs:bp+IDEVARS.w Port]; for IDE: AX=port address, DH=.bDevice84 mov ax, [cs:bp+IDEVARS.wBasePort] ; for IDE: AX=port address, DH=.bDevice 85 85 mov dx, [cs:bp+IDEVARS.bDevice-1] ; for Serial: AL=port address>>2, AH=baud rate 86 86 ; DL=COM number character, DH=.bDevice 87 %ifdef MODULE_JRIDE88 cmp dh, DEVICE_8BIT_JRIDE_ISA89 eCMOVE ax, cs ; Use segment address for JR-IDE/ISA90 %endif91 87 92 88 push bp ; setup stack for call to -
trunk/XTIDE_Universal_BIOS/Src/Main.asm
r471 r473 88 88 at ROMVARS.bIdleTimeout, db 0 ; Standby timer disabled by default 89 89 90 at ROMVARS.ideVars0+IDEVARS.w Port, dw DEVICE_ATA_PRIMARY_PORT ; Controller Command Block base port91 at ROMVARS.ideVars0+IDEVARS.w PortCtrl,dw DEVICE_ATA_PRIMARY_PORTCTRL ; Controller Control Block base port92 at ROMVARS.ideVars0+IDEVARS.bDevice, db DEVICE_16BIT_ATA93 at ROMVARS.ideVars0+IDEVARS.bIRQ, db 090 at ROMVARS.ideVars0+IDEVARS.wBasePort, dw DEVICE_ATA_PRIMARY_PORT ; Controller Command Block base port 91 at ROMVARS.ideVars0+IDEVARS.wControlBlockPort, dw DEVICE_ATA_PRIMARY_PORTCTRL ; Controller Control Block base port 92 at ROMVARS.ideVars0+IDEVARS.bDevice, db DEVICE_16BIT_ATA 93 at ROMVARS.ideVars0+IDEVARS.bIRQ, db 0 94 94 at ROMVARS.ideVars0+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, dw DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION) 95 95 at ROMVARS.ideVars0+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, dw DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION) 96 96 97 at ROMVARS.ideVars1+IDEVARS.wPort, dw DEVICE_ATA_SECONDARY_PORT 98 at ROMVARS.ideVars1+IDEVARS.wPortCtrl, dw DEVICE_ATA_SECONDARY_PORTCTRL 99 at ROMVARS.ideVars1+IDEVARS.bDevice, db DEVICE_16BIT_ATA 100 at ROMVARS.ideVars1+IDEVARS.bIRQ, db 0 97 at ROMVARS.ideVars1+IDEVARS.bXTCFcontrolRegister, db 0 98 at ROMVARS.ideVars1+IDEVARS.bDevice, db DEVICE_8BIT_XTCF_PIO8 99 ;at ROMVARS.ideVars1+IDEVARS.wBasePort, dw DEVICE_ATA_SECONDARY_PORT 100 ;at ROMVARS.ideVars1+IDEVARS.wControlBlockPort, dw DEVICE_ATA_SECONDARY_PORTCTRL 101 ;at ROMVARS.ideVars1+IDEVARS.bDevice, db DEVICE_16BIT_ATA 102 ;at ROMVARS.ideVars1+IDEVARS.bIRQ, db 0 101 103 at ROMVARS.ideVars1+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, dw DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION) 102 104 at ROMVARS.ideVars1+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, dw DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION) 103 105 104 at ROMVARS.ideVars2+IDEVARS.w Port, dw DEVICE_ATA_TERTIARY_PORT105 at ROMVARS.ideVars2+IDEVARS.w PortCtrl,dw DEVICE_ATA_TERTIARY_PORTCTRL106 at ROMVARS.ideVars2+IDEVARS.bDevice, db DEVICE_16BIT_ATA107 at ROMVARS.ideVars2+IDEVARS.bIRQ, db 0106 at ROMVARS.ideVars2+IDEVARS.wBasePort, dw DEVICE_ATA_TERTIARY_PORT 107 at ROMVARS.ideVars2+IDEVARS.wControlBlockPort, dw DEVICE_ATA_TERTIARY_PORTCTRL 108 at ROMVARS.ideVars2+IDEVARS.bDevice, db DEVICE_16BIT_ATA 109 at ROMVARS.ideVars2+IDEVARS.bIRQ, db 0 108 110 at ROMVARS.ideVars2+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, dw DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION) 109 111 at ROMVARS.ideVars2+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, dw DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION) 110 112 111 at ROMVARS.ideVars3+IDEVARS.w Port, dw DEVICE_ATA_QUATERNARY_PORT112 at ROMVARS.ideVars3+IDEVARS.w PortCtrl,dw DEVICE_ATA_QUATERNARY_PORTCTRL113 at ROMVARS.ideVars3+IDEVARS.bDevice, db DEVICE_16BIT_ATA114 at ROMVARS.ideVars3+IDEVARS.bIRQ, db 0113 at ROMVARS.ideVars3+IDEVARS.wBasePort, dw DEVICE_ATA_QUATERNARY_PORT 114 at ROMVARS.ideVars3+IDEVARS.wControlBlockPort, dw DEVICE_ATA_QUATERNARY_PORTCTRL 115 at ROMVARS.ideVars3+IDEVARS.bDevice, db DEVICE_16BIT_ATA 116 at ROMVARS.ideVars3+IDEVARS.bIRQ, db 0 115 117 at ROMVARS.ideVars3+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, dw DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION) 116 118 at ROMVARS.ideVars3+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, dw DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION) … … 128 130 at ROMVARS.wBootTimeout, dw BOOT_MENU_DEFAULT_TIMEOUT 129 131 %endif 130 at ROMVARS.bIdeCnt, db 1; Number of supported controllers132 at ROMVARS.bIdeCnt, db 2 ; Number of supported controllers 131 133 at ROMVARS.bBootDrv, db 80h ; Boot Menu default drive 132 134 at ROMVARS.bMinFddCnt, db 0 ; Do not force minimum number of floppy drives … … 134 136 at ROMVARS.bIdleTimeout, db 0 ; Standby timer disabled by default 135 137 136 at ROMVARS.ideVars0+IDEVARS.w Port, dw DEVICE_XTIDE_DEFAULT_PORT ; Controller Command Block base port137 at ROMVARS.ideVars0+IDEVARS.w PortCtrl,dw DEVICE_XTIDE_DEFAULT_PORTCTRL ; Controller Control Block base port138 at ROMVARS.ideVars0+IDEVARS.bDevice, db DEVICE_8BIT_XTIDE_REV1138 at ROMVARS.ideVars0+IDEVARS.wBasePort, dw DEVICE_XTIDE_DEFAULT_PORT ; Controller Command Block base port 139 at ROMVARS.ideVars0+IDEVARS.wControlBlockPort, dw DEVICE_XTIDE_DEFAULT_PORTCTRL ; Controller Control Block base port 140 at ROMVARS.ideVars0+IDEVARS.bDevice, db DEVICE_8BIT_XTIDE_REV1 139 141 at ROMVARS.ideVars0+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, db DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION) 140 142 at ROMVARS.ideVars0+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, db DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION) 141 143 144 at ROMVARS.ideVars1+IDEVARS.bXTCFcontrolRegister, db 0 145 at ROMVARS.ideVars1+IDEVARS.bDevice, db DEVICE_8BIT_XTCF_PIO8 142 146 at ROMVARS.ideVars1+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, db DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION) 143 147 at ROMVARS.ideVars1+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, db DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION) … … 223 227 %endif 224 228 %include "IdeCommand.asm" 225 %ifdef MODULE_ JRIDE229 %ifdef MODULE_8BIT_IDE 226 230 %include "JrIdeTransfer.asm" ; Must be included after IdeCommand.asm 227 231 %endif 228 232 %include "IdeTransfer.asm" 233 %include "IdePioBlock.asm" 229 234 %include "IdeWait.asm" 230 235 %include "IdeError.asm" ; Must be included after IdeWait.asm -
trunk/XTIDE_Universal_BIOS/Src/Menus/BootMenu/BootMenuPrintCfg.asm
r422 r473 88 88 89 89 ;-------------------------------------------------------------------- 90 ; Push BusType90 ; PushDeviceType 91 91 ; Parameters: 92 92 ; DS:DI: Ptr to DPT … … 97 97 ; AX, DX 98 98 ;-------------------------------------------------------------------- 99 .PushBusType: 100 mov al,g_szBusTypeValues_Displacement 101 mul BYTE [cs:bx+IDEVARS.bDevice] 99 .PushDeviceType: 100 mov al,g_szDeviceTypeValues_Displacement 101 %ifdef MODULE_SERIAL 102 mov ah, [cs:bx+IDEVARS.bDevice] 103 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE 104 eCMOVZ ah, [di+DPT_ATA.bDevice] ; DPT_ATA contains up to date device information for IDE drives 105 mul ah 106 %else 107 mul BYTE [di+DPT_ATA.bDevice] 108 %endif 102 109 103 110 shr ax,1 ; divide by 2 since IDEVARS.bDevice is multiplied by 2 104 111 105 add ax, g_szBusTypeValues112 add ax, g_szDeviceTypeValues 106 113 push ax 107 114 -
trunk/XTIDE_Universal_BIOS/Src/Strings.asm
r421 r473 117 117 %endif 118 118 119 g_szBusTypeValues: 120 g_szBusTypeValues_8JrIde: db "M8 ",NULL 121 g_szBusTypeValues_8Fast: db "F8 ",NULL 122 g_szBusTypeValues_8Reversed: db "X8 ",NULL 123 g_szBusTypeValues_8Dual: db "D8 ",NULL 124 g_szBusTypeValues_16: db " 16",NULL 125 g_szBusTypeValues_32: db " 32",NULL 126 g_szBusTypeValues_Serial: db "SER",NULL 127 128 g_szBusTypeValues_Displacement equ (g_szBusTypeValues_8Fast - g_szBusTypeValues) 129 ; 130 ; Ensure that bus type strings are correctly spaced in memory 131 ; 132 %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS 133 %if g_szBusTypeValues_8JrIde <> g_szBusTypeValues 134 %error "g_szBusTypeValues Displacement Incorrect 1" 135 %endif 136 %if g_szBusTypeValues_8Fast <> g_szBusTypeValues + g_szBusTypeValues_Displacement 137 %error "g_szBusTypeValues Displacement Incorrect 2" 138 %endif 139 %if g_szBusTypeValues_8Reversed <> g_szBusTypeValues_8Fast + g_szBusTypeValues_Displacement 140 %error "g_szBusTypeValues Displacement Incorrect 3" 141 %endif 142 %if g_szBusTypeValues_8Dual <> g_szBusTypeValues_8Reversed + g_szBusTypeValues_Displacement 143 %error "g_szBusTypeValues Displacement Incorrect 4" 144 %endif 145 %if g_szBusTypeValues_16 <> g_szBusTypeValues_8Dual + g_szBusTypeValues_Displacement 146 %error "g_szBusTypeValues Displacement Incorrect 5" 147 %endif 148 %if g_szBusTypeValues_32 <> g_szBusTypeValues_16 + g_szBusTypeValues_Displacement 149 %error "g_szBusTypeValues Displacement Incorrect 6" 150 %endif 151 %if g_szBusTypeValues_Serial <> g_szBusTypeValues_32 + g_szBusTypeValues_Displacement 152 %error "g_szBusTypeValues Displacement Incorrect 7" 119 g_szDeviceTypeValues: 120 g_szDeviceTypeValues_16bit: db " 16",NULL 121 g_szDeviceTypeValues_32bit: db " 32",NULL 122 g_szDeviceTypeValues_XTIDEr1: db "D8 ",NULL ; Dual 8-bit 123 g_szDeviceTypeValues_XTIDEr2: db "X8 ",NULL ; A0<->A3 swapped 8-bit 124 g_szDeviceTypeValues_XTCFpio8: db "T8 ",NULL ; True 8-bit 125 g_szDeviceTypeValues_XTCFdma: db "8MA",NULL ; DMA 8-bit 126 g_szDeviceTypeValues_XTCFmem: db "M8 ",NULL ; Memory Mapped 8-bit 127 g_szDeviceTypeValues_JrIde: db "M8 ",NULL 128 g_szDeviceTypeValues_Serial: db "SER",NULL 129 130 g_szDeviceTypeValues_Displacement equ (g_szDeviceTypeValues_32bit - g_szDeviceTypeValues) 131 ; 132 ; Ensure that device type strings are correctly spaced in memory 133 ; 134 %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS 135 %if g_szDeviceTypeValues_16bit <> g_szDeviceTypeValues 136 %error "g_szDeviceTypeValues Displacement Incorrect 1" 137 %endif 138 %if g_szDeviceTypeValues_32bit <> g_szDeviceTypeValues + g_szDeviceTypeValues_Displacement 139 %error "g_szDeviceTypeValues Displacement Incorrect 2" 140 %endif 141 %if g_szDeviceTypeValues_XTIDEr1 <> g_szDeviceTypeValues_32bit + g_szDeviceTypeValues_Displacement 142 %error "g_szDeviceTypeValues Displacement Incorrect 3" 143 %endif 144 %if g_szDeviceTypeValues_XTIDEr2 <> g_szDeviceTypeValues_XTIDEr1 + g_szDeviceTypeValues_Displacement 145 %error "g_szDeviceTypeValues Displacement Incorrect 4" 146 %endif 147 %if g_szDeviceTypeValues_XTCFpio8 <> g_szDeviceTypeValues_XTIDEr2 + g_szDeviceTypeValues_Displacement 148 %error "g_szDeviceTypeValues Displacement Incorrect 5" 149 %endif 150 %if g_szDeviceTypeValues_XTCFdma <> g_szDeviceTypeValues_XTCFpio8 + g_szDeviceTypeValues_Displacement 151 %error "g_szDeviceTypeValues Displacement Incorrect 6" 152 %endif 153 %if g_szDeviceTypeValues_XTCFmem <> g_szDeviceTypeValues_XTCFdma + g_szDeviceTypeValues_Displacement 154 %error "g_szDeviceTypeValues Displacement Incorrect 7" 155 %endif 156 %if g_szDeviceTypeValues_JrIde <> g_szDeviceTypeValues_XTCFmem + g_szDeviceTypeValues_Displacement 157 %error "g_szDeviceTypeValues Displacement Incorrect 8" 158 %endif 159 %if g_szDeviceTypeValues_Serial <> g_szDeviceTypeValues_JrIde + g_szDeviceTypeValues_Displacement 160 %error "g_szDeviceTypeValues Displacement Incorrect 9" 153 161 %endif 154 162 %endif -
trunk/XTIDE_Universal_BIOS/Src/StringsCompressed.asm
r421 r473 217 217 %endif 218 218 219 g_szBusTypeValues: 220 g_szBusTypeValues_8JrIde: ; db "M8 ",NULL 221 ; db 4dh, 38h, 20h, 00h ; uncompressed 222 db 53h, 31h, 00h ; compressed 223 224 g_szBusTypeValues_8Fast: ; db "F8 ",NULL 225 ; db 46h, 38h, 20h, 00h ; uncompressed 226 db 4ch, 31h, 00h ; compressed 227 228 g_szBusTypeValues_8Reversed: ; db "X8 ",NULL 229 ; db 58h, 38h, 20h, 00h ; uncompressed 230 db 5eh, 31h, 00h ; compressed 231 232 g_szBusTypeValues_8Dual: ; db "D8 ",NULL 233 ; db 44h, 38h, 20h, 00h ; uncompressed 234 db 4ah, 31h, 00h ; compressed 235 236 g_szBusTypeValues_16: ; db " 16",NULL 237 ; db 20h, 31h, 36h, 00h ; uncompressed 238 db 20h, 2bh, 10h ; compressed 239 240 g_szBusTypeValues_32: ; db " 32",NULL 241 ; db 20h, 33h, 32h, 00h ; uncompressed 242 db 20h, 2dh, 0ch ; compressed 243 244 g_szBusTypeValues_Serial: ; db "SER",NULL 245 ; db 53h, 45h, 52h, 00h ; uncompressed 246 db 59h, 4bh, 98h ; compressed 247 248 249 g_szBusTypeValues_Displacement equ (g_szBusTypeValues_8Fast - g_szBusTypeValues) 250 ; 251 ; Ensure that bus type strings are correctly spaced in memory 219 g_szDeviceTypeValues: 220 g_szDeviceTypeValues_16bit: ; db " 16",NULL 221 ; db 20h, 31h, 36h, 00h ; uncompressed 222 db 20h, 2bh, 10h ; compressed 223 224 g_szDeviceTypeValues_32bit: ; db " 32",NULL 225 ; db 20h, 33h, 32h, 00h ; uncompressed 226 db 20h, 2dh, 0ch ; compressed 227 228 g_szDeviceTypeValues_XTIDEr1: ; db "D8 ",NULL ; Dual 8-bit 229 ; db 44h, 38h, 20h, 00h ; uncompressed 230 db 4ah, 31h, 00h ; compressed 231 232 g_szDeviceTypeValues_XTIDEr2: ; db "X8 ",NULL ; A0<->A3 swapped 8-bit 233 ; db 58h, 38h, 20h, 00h ; uncompressed 234 db 5eh, 31h, 00h ; compressed 235 236 g_szDeviceTypeValues_XTCFpio8: ; db "T8 ",NULL ; True 8-bit 237 ; db 54h, 38h, 20h, 00h ; uncompressed 238 db 5ah, 31h, 00h ; compressed 239 240 g_szDeviceTypeValues_XTCFdma: ; db "8MA",NULL ; DMA 8-bit 241 ; db 38h, 4dh, 41h, 00h ; uncompressed 242 db 31h, 53h, 87h ; compressed 243 244 g_szDeviceTypeValues_XTCFmem: ; db "M8 ",NULL ; Memory Mapped 8-bit 245 ; db 4dh, 38h, 20h, 00h ; uncompressed 246 db 53h, 31h, 00h ; compressed 247 248 g_szDeviceTypeValues_JrIde: ; db "M8 ",NULL 249 ; db 4dh, 38h, 20h, 00h ; uncompressed 250 db 53h, 31h, 00h ; compressed 251 252 g_szDeviceTypeValues_Serial: ; db "SER",NULL 253 ; db 53h, 45h, 52h, 00h ; uncompressed 254 db 59h, 4bh, 98h ; compressed 255 256 257 g_szDeviceTypeValues_Displacement equ (g_szDeviceTypeValues_32bit - g_szDeviceTypeValues) 258 ; 259 ; Ensure that device type strings are correctly spaced in memory 252 260 ; 253 261 %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS 254 %if g_szBusTypeValues_8JrIde <> g_szBusTypeValues 255 %error "g_szBusTypeValues Displacement Incorrect 1" 256 %endif 257 %if g_szBusTypeValues_8Fast <> g_szBusTypeValues + g_szBusTypeValues_Displacement 258 %error "g_szBusTypeValues Displacement Incorrect 2" 259 %endif 260 %if g_szBusTypeValues_8Reversed <> g_szBusTypeValues_8Fast + g_szBusTypeValues_Displacement 261 %error "g_szBusTypeValues Displacement Incorrect 3" 262 %endif 263 %if g_szBusTypeValues_8Dual <> g_szBusTypeValues_8Reversed + g_szBusTypeValues_Displacement 264 %error "g_szBusTypeValues Displacement Incorrect 4" 265 %endif 266 %if g_szBusTypeValues_16 <> g_szBusTypeValues_8Dual + g_szBusTypeValues_Displacement 267 %error "g_szBusTypeValues Displacement Incorrect 5" 268 %endif 269 %if g_szBusTypeValues_32 <> g_szBusTypeValues_16 + g_szBusTypeValues_Displacement 270 %error "g_szBusTypeValues Displacement Incorrect 6" 271 %endif 272 %if g_szBusTypeValues_Serial <> g_szBusTypeValues_32 + g_szBusTypeValues_Displacement 273 %error "g_szBusTypeValues Displacement Incorrect 7" 262 %if g_szDeviceTypeValues_16bit <> g_szDeviceTypeValues 263 %error "g_szDeviceTypeValues Displacement Incorrect 1" 264 %endif 265 %if g_szDeviceTypeValues_32bit <> g_szDeviceTypeValues + g_szDeviceTypeValues_Displacement 266 %error "g_szDeviceTypeValues Displacement Incorrect 2" 267 %endif 268 %if g_szDeviceTypeValues_XTIDEr1 <> g_szDeviceTypeValues_32bit + g_szDeviceTypeValues_Displacement 269 %error "g_szDeviceTypeValues Displacement Incorrect 3" 270 %endif 271 %if g_szDeviceTypeValues_XTIDEr2 <> g_szDeviceTypeValues_XTIDEr1 + g_szDeviceTypeValues_Displacement 272 %error "g_szDeviceTypeValues Displacement Incorrect 4" 273 %endif 274 %if g_szDeviceTypeValues_XTCFpio8 <> g_szDeviceTypeValues_XTIDEr2 + g_szDeviceTypeValues_Displacement 275 %error "g_szDeviceTypeValues Displacement Incorrect 5" 276 %endif 277 %if g_szDeviceTypeValues_XTCFdma <> g_szDeviceTypeValues_XTCFpio8 + g_szDeviceTypeValues_Displacement 278 %error "g_szDeviceTypeValues Displacement Incorrect 6" 279 %endif 280 %if g_szDeviceTypeValues_XTCFmem <> g_szDeviceTypeValues_XTCFdma + g_szDeviceTypeValues_Displacement 281 %error "g_szDeviceTypeValues Displacement Incorrect 7" 282 %endif 283 %if g_szDeviceTypeValues_JrIde <> g_szDeviceTypeValues_XTCFmem + g_szDeviceTypeValues_Displacement 284 %error "g_szDeviceTypeValues Displacement Incorrect 8" 285 %endif 286 %if g_szDeviceTypeValues_Serial <> g_szDeviceTypeValues_JrIde + g_szDeviceTypeValues_Displacement 287 %error "g_szDeviceTypeValues Displacement Incorrect 9" 274 288 %endif 275 289 %endif … … 475 489 ;; translated usage stats 476 490 ;; 33:1 477 ;; 32:2 6491 ;; 32:27 478 492 ;; 181:1 479 493 ;; 53:2 … … 490 504 ;; 34:3 491 505 ;; 49:1 492 ;; 56: 4506 ;; 56:6 493 507 ;; 45:1 494 508 ;; 175:1 … … 519 533 ;; 63,?: 520 534 ;; 64,@:1 521 ;; 65,A: 4535 ;; 65,A:5 522 536 ;; 66,B:8 523 537 ;; 67,C:2 524 538 ;; 68,D:10 525 539 ;; 69,E:3 526 ;; 70,F: 4540 ;; 70,F:3 527 541 ;; 71,G:3 528 542 ;; 72,H:2 … … 531 545 ;; 75,K:1 532 546 ;; 76,L:4 533 ;; 77,M: 5547 ;; 77,M:7 534 548 ;; 78,N:2 535 549 ;; 79,O:2 … … 538 552 ;; 82,R:7 539 553 ;; 83,S:3 540 ;; 84,T: 554 ;; 84,T:1 541 555 ;; 85,U:2 542 556 ;; 86,V: … … 576 590 ;; 120,x: 577 591 ;; 121,y:2 578 ;; alphabet used count: 4 4592 ;; alphabet used count: 45 579 593 %endif ; STRINGSCOMPRESSED_TABLES 580 594 -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AccessDPT.asm
r443 r473 20 20 ; Section containing code 21 21 SECTION .text 22 23 %ifdef MODULE_ADVANCED_ATA24 ;--------------------------------------------------------------------25 ; AccessDPT_GetIdeBasePortToBX26 ; Parameters:27 ; DS:DI: Ptr to Disk Parameter Table28 ; Returns:29 ; BX: IDE Base Port Address30 ; Corrupts registers:31 ; Nothing32 ;--------------------------------------------------------------------33 ALIGN JUMP_ALIGN34 AccessDPT_GetIdeBasePortToBX:35 eMOVZX bx, [di+DPT.bIdevarsOffset] ; CS:BX points to IDEVARS36 mov bx, [cs:bx+IDEVARS.wPort]37 ret38 %endif ; MODULE_ADVANCED_ATA39 40 22 41 23 ;-------------------------------------------------------------------- … … 113 95 114 96 97 %ifdef MODULE_8BIT_IDE 98 ;-------------------------------------------------------------------- 99 ; AccessDPT_IsThisDeviceXTCF 100 ; Parameters: 101 ; DS:DI: Ptr to Disk Parameter Table 102 ; Returns: 103 ; AH: Device Type 104 ; ZF: Set if XTCF 105 ; Cleared if some other device 106 ; Corrupts registers: 107 ; Nothing 108 ;-------------------------------------------------------------------- 109 AccessDPT_IsThisDeviceXTCF: 110 mov ah, [di+DPT_ATA.bDevice] 111 cmp ah, DEVICE_8BIT_XTCF_PIO8 112 je SHORT .DeviceIsXTCF 113 cmp ah, DEVICE_8BIT_XTCF_DMA 114 je SHORT .DeviceIsXTCF 115 cmp ah, DEVICE_8BIT_XTCF_MEMMAP 116 .DeviceIsXTCF: 117 ret 118 %endif ; MODULE_8BIT_IDE 119 120 115 121 %ifdef MODULE_EBIOS 116 122 ;-------------------------------------------------------------------- … … 142 148 ; Nothing 143 149 ;-------------------------------------------------------------------- 144 ALIGN JUMP_ALIGN145 150 AccessDPT_GetPointerToDRVPARAMStoCSBX: 146 eMOVZX bx, BYTE [di+DPT.bIdevarsOffset] ; CS:BX points to IDEVARS151 call AccessDPT_GetIdevarsToCSBX 147 152 add bx, BYTE IDEVARS.drvParamsMaster ; CS:BX points to Master Drive DRVPARAMS 148 153 test BYTE [di+DPT.bFlagsLow], FLGL_DPT_SLAVE … … 150 155 add bx, BYTE DRVPARAMS_size ; CS:BX points to Slave Drive DRVPARAMS 151 156 .ReturnPointerToDRVPARAMS: 157 ret 158 159 160 ;-------------------------------------------------------------------- 161 ; Needed many times during initialization so it is better to 162 ; make it as a function to save bytes. 163 ; 164 ; AccessDPT_GetIdevarsToCSBX 165 ; Parameters: 166 ; DS:DI: Ptr to Disk Parameter Table 167 ; Returns: 168 ; CS:BX: Ptr to IDEVARS for the drive 169 ; Corrupts registers: 170 ; Nothing 171 ;-------------------------------------------------------------------- 172 AccessDPT_GetIdevarsToCSBX: 173 eMOVZX bx, BYTE [di+DPT.bIdevarsOffset] 152 174 ret 153 175 -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/BootVars.asm
r397 r473 32 32 ;-------------------------------------------------------------------- 33 33 BootVars_Initialize: 34 %ifdef MODULE_8BIT_IDE 35 mov WORD [es:BOOTVARS.wNextXTCFportToScan], XTCF_BASE_PORT_1 36 %endif 37 34 38 ; Clear to zero 35 39 mov al, DRVDETECTINFO_size … … 66 70 67 71 %endif ; MODULE_HOTKEYS 72 73 74 %ifdef MODULE_8BIT_IDE 75 ;-------------------------------------------------------------------- 76 ; BootVars_GetNextXTCFportToDetectToDX 77 ; Parameters: 78 ; ES: BDA Segment 79 ; Returns: 80 ; DX: Next XT-CF port to detect 81 ; Corrupts registers: 82 ; AX 83 ;-------------------------------------------------------------------- 84 BootVars_GetNextXTCFportToDetectToDX: 85 mov dx, [es:BOOTVARS.wNextXTCFportToScan] 86 test dl, dl 87 jz SHORT .NextOneIs240hor340h 88 add WORD [es:BOOTVARS.wNextXTCFportToScan], XTCF_BASE_PORT_3 - XTCF_BASE_PORT_2 89 ret 90 .NextOneIs240hor340h: 91 mov BYTE [es:BOOTVARS.wNextXTCFportToScan], XTCF_BASE_PORT_2 & 0FFh ; 40h 92 ret 93 %endif ; MODULE_8BIT_IDE -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm
r445 r473 28 28 ; Parameters: 29 29 ; BH: Drive Select byte for Drive and Head Register 30 ; DX: Autodetected port (for devices that support autodetection) 30 31 ; ES:SI: Ptr to 512-byte ATA information read from the drive 31 32 ; CS:BP: Ptr to IDEVARS for the controller … … 47 48 ; Parameters: 48 49 ; BH: Drive Select byte for Drive and Head Register 50 ; DX: Autodetected port (for devices that support autodetection) 49 51 ; DS:DI: Ptr to Disk Parameter Table 50 52 ; CS:BP: Ptr to IDEVARS for the controller … … 55 57 ;-------------------------------------------------------------------- 56 58 .InitializeDPT: 57 mov [di+DPT.bIdevarsOffset], bp ; IDEVARS must start in first 256 bytes of ROM59 call CreateDPT_StoreIdevarsOffsetAndBasePortFromCSBPtoDPTinDSDI 58 60 ; Fall to .StoreDriveSelectAndDriveControlByte 59 61 … … 230 232 231 233 ;-------------------------------------------------------------------- 234 ; CreateDPT_StoreIdevarsOffsetAndBasePortFromCSBPtoDPTinDSDI 235 ; Parameters: 236 ; DX: Autodetected port (for devices that support autodetection) 237 ; DS:DI: Ptr to Disk Parameter Table 238 ; CS:BP: Ptr to IDEVARS for the controller 239 ; Returns: 240 ; Nothing 241 ; Corrupts registers: 242 ; AX 243 ;-------------------------------------------------------------------- 244 CreateDPT_StoreIdevarsOffsetAndBasePortFromCSBPtoDPTinDSDI: 245 mov [di+DPT.bIdevarsOffset], bp ; IDEVARS must start in first 256 bytes of ROM 246 247 %ifdef MODULE_8BIT_IDE 248 call DetectDrives_DoesIdevarsInCSBPbelongToXTCF 249 jne SHORT .DeviceUsesPortSpecifiedInIDEVARS 250 mov [di+DPT.wBasePort], dx 251 ret 252 .DeviceUsesPortSpecifiedInIDEVARS: 253 %endif ; MODULE_8BIT_IDE 254 255 mov ax, [cs:bp+IDEVARS.wBasePort] 256 mov [di+DPT.wBasePort], ax 257 ret 258 259 260 ;-------------------------------------------------------------------- 232 261 ; GetUserDefinedCapacityToBXAXandFlagsToCXandModeToDXfromROMVARS 233 262 ; Parameters: -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm
r444 r473 208 208 ret 209 209 210 210 211 %ifdef MODULE_SERIAL_FLOPPY 211 212 ;-------------------------------------------------------------------- 212 213 ; RamVars_UnpackFlopCntAndFirstToAL 213 214 ; Parameters: 214 ; Nothing215 ; DS: RAMVARS segment 215 216 ; Returns: 216 217 ; AL: First floppy drive number supported … … 226 227 ret 227 228 %endif 229 230 231 ;-------------------------------------------------------------------- 232 ; RamVars_IsDriveDetectionInProgress 233 ; Parameters: 234 ; DS: RAMVARS segment 235 ; Returns: 236 ; ZF: Set if drive detection is in progress (ROM initialization) 237 ; Corrupts registers: 238 ; None 239 ;-------------------------------------------------------------------- 240 RamVars_IsDriveDetectionInProgress: 241 cmp WORD [RAMVARS.wSignature], RAMVARS_DRV_DETECT_SIGNATURE 242 ret
Note:
See TracChangeset
for help on using the changeset viewer.