21790 <1>
21791 <1> ;--------------------------------------------------------------------
21792 <1> ; IdeWait_PollStatusFlagInBLwithTimeoutInBH
21793 <1> ; Parameters:
21794 <1> ; BH: Timeout ticks
21795 <1> ; BL: IDE Status Register bit to poll
21796 <1> ; DS:DI: Ptr to DPT (in RAMVARS segment)
21797 <1> ; Returns:
21798 <1> ; AH: INT 13h Error Code
21799 <1> ; CF: Cleared if success, Set if error
21800 <1> ; Corrupts registers:
21801 <1> ; AL, BX, CX, DX
21802 <1> ;--------------------------------------------------------------------
21803 <1> IdeWait_PollStatusFlagInBLwithTimeoutInBH:
21804 00001AE3 88DC <1> mov ah, bl
21805 00001AE5 88F9 <1> mov cl, bh
21806 00001AE7 E865FB <1> call Timer_InitializeTimeoutWithTicksInCL
21807 00001AEA E87D00 <1> call IdeIO_InputStatusRegisterToAL ; Discard contents of first read
21808 00001AED 80E47F <1> and ah, ~FLG_STATUS_BSY
21809 00001AF0 7419 <1> jz SHORT PollBsyOnly
21810 <1> ; Fall to PollBsyAndFlgInAH
21812 <1> ;--------------------------------------------------------------------
21813 <1> ; PollBsyAndFlgInAH
21814 <1> ; Parameters:
21815 <1> ; AH: Status Register Flag to poll (until set) when device not busy
21816 <1> ; DS: DI: Ptr to DPT (in RAMVARS segment)
21817 <1> ; Returns:
21818 <1> ; AH: BIOS Error code
21819 <1> ; CF: Clear if wait completed successfully (no errors)
21820 <1> ; Set if any error
21821 <1> ; Corrupts registers:
21822 <1> ; AL, BX, CX, DX
21823 <1> ;--------------------------------------------------------------------
21824 <1> PollBsyAndFlgInAH:
21825 <1> [COLOR=#FF0000].PollLoop:[/COLOR]
21826 00001AF2 E87500 <1> call IdeIO_InputStatusRegisterToAL
21827 00001AF5 A880 <1> test al, FLG_STATUS_BSY ; Controller busy?
21828 00001AF7 7504 <1> jnz SHORT .UpdateTimeout ; If so, jump to timeout update
21829 00001AF9 84E0 <1> test al, ah ; Test secondary flag
21830 00001AFB 751A <1> jnz SHORT IdeError_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL
21831 <1> .UpdateTimeout:
21832 00001AFD E85BFB <1> call Timer_SetCFifTimeout
21833 00001B00 73F0 <1> [COLOR=#FF0000]jnc SHORT .PollLoop[/COLOR] ; Loop if time left
21834 00001B02 E81200 <1> call IdeError_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL
21835 00001B05 7203 <1> jc SHORT .ReturnErrorCodeInAH
21836 00001B07 B480 <1> mov ah, RET_HD_TIMEOUT ; Expected bit never got set
21837 00001B09 F9 <1> stc
21838 <1> .ReturnErrorCodeInAH:
21839 00001B0A C3 <1> ret