Changeset 150 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH25h_HDrvID.asm
- Timestamp:
- Apr 29, 2011, 7:04:13 PM (14 years ago)
- google:author:
- aitotat
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH25h_HDrvID.asm
r148 r150 13 13 ; DL: Translated Drive number 14 14 ; DS:DI: Ptr to DPT (in RAMVARS segment) 15 ; SS:BP: Ptr to I NTPACK16 ; Parameters on INTPACK in SS:BP:15 ; SS:BP: Ptr to IDEPACK 16 ; Parameters on INTPACK: 17 17 ; ES:BX: Ptr to buffer to receive 512-byte drive information 18 ; Returns with INTPACK in SS:BP:18 ; Returns with INTPACK: 19 19 ; AH: Int 13h return status 20 20 ; CF: 0 if succesfull, 1 if error … … 22 22 ALIGN JUMP_ALIGN 23 23 AH25h_HandlerForGetDriveInformation: 24 ; Wait until previously selected drive is ready 25 call HDrvSel_SelectDriveAndDisableIRQ 26 jc SHORT .ReturnWithErrorCodeInAH ; Return if error 24 push bp 27 25 28 ; Get drive information 29 mov bx, [bp+INTPACK.bx] 30 call HPIO_NormalizeDataPointer 31 push bx 32 mov dx, [RAMVARS.wIdeBase] ; Load base port address 33 eMOVZX bx, BYTE [di+DPT.bIdeOff] ; Load offset to IDEVARS 34 mov bl, [cs:bx+IDEVARS.bBusType]; Load bus type to BL 35 mov bh, [di+DPT.bDrvSel] ; Load drive sel byte to BH 36 pop di ; Pop buffer offset to DI 37 call AH25h_GetDriveInfo ; Get drive information 38 .ReturnWithErrorCodeInAH: 26 mov si, [bp+IDEPACK.intpack+INTPACK.bx] 27 call AccessDPT_GetDriveSelectByteToAL 28 mov bh, al 29 eMOVZX ax, BYTE [di+DPT.bIdevarsOffset] 30 xchg bp, ax 31 call Device_IdentifyToBufferInESSIwithDriveSelectByteInBH 32 33 pop bp 39 34 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 40 41 42 ;--------------------------------------------------------------------43 ; Gets drive information using Identify Device command.44 ;45 ; AH25h_GetDriveInfo46 ; Parameters:47 ; BH: Drive Select byte for Drive and Head Select Register48 ; BL: Bus type49 ; DX: IDE Controller base port address50 ; DS: Segment to RAMVARS51 ; ES:DI: Ptr to buffer to receive 512 byte drive information52 ; Returns:53 ; AH: Int 13h return status (will be stored to BDA)54 ; CF: 0 if succesfull, 1 if error55 ; Corrupts registers:56 ; AL, CX57 ;--------------------------------------------------------------------58 ALIGN JUMP_ALIGN59 AH25h_GetDriveInfo:60 push di61 push dx62 push bx63 64 ; Select Master or Slave drive.65 ; DO NOT WAIT UNTIL CURRENTLY SELECTED IS READY!66 ; It makes slave drive detection impossible if master is not present.67 mov [RAMVARS.wIdeBase], dx ; Store IDE Base port to RAMVARS68 add dx, BYTE REG_IDE_DRVHD ; DX to Drive and Head Sel Register69 mov al, bh ; Drive Select byte to AL70 out dx, al ; Select Master or Slave drive71 sub dx, BYTE REG_IDE_DRVHD ; Back to IDE Base port72 73 ; Wait until ready to accept commands74 xor bh, bh ; BX now contains bus type75 mov cl, B_TIMEOUT_DRVINFO ; Load short timeout76 cmp [RAMVARS.bDrvCnt], bh ; Detecting first drive?77 eCMOVE cl, B_TIMEOUT_RESET ; If so, load long timeout78 call HStatus_WaitRdy ; Wait until ready to accept commands79 jc SHORT .ReturnWithErrorCodeInAH80 81 ; Output command82 mov al, HCMD_ID_DEV ; Load Identify Device command to AL83 out dx, al ; Output command84 call HStatus_WaitDrqDefTime ; Wait until ready to transfer (no IRQ!)85 jc SHORT .ReturnWithErrorCodeInAH86 87 ; Transfer data88 sub dx, BYTE REGR_IDE_ST ; DX to IDE Data Reg89 mov cx, 256 ; Transfer 256 words (single sector)90 cld ; INSW to increment DI91 call [cs:bx+g_rgfnPioRead] ; Read ID sector92 call HStatus_WaitRdyDefTime ; Wait until drive ready93 94 .ReturnWithErrorCodeInAH:95 pop bx96 pop dx97 pop di98 ret
Note:
See TracChangeset
for help on using the changeset viewer.