
; Get state of iBitPos bit (0-31) in iValue.

; Function GetBit(ByVal iValue As Long, ByVal iBitPos As Long) As Boolean

; If the specified bit position is less then zero,
; or greater than 31, the result is undefined.

 .486          ; 32-bit instruction set
 .model flat   ; Protected memory, 4GB limit
 .code         ; Start of code

GetBit proc near

    mov eax,[esp+8]  ; extract value to test
    mov ecx,[esp+12] ; position of bit to test
    mov edx,[esp+16] ; function return pointer
    bt  eax, ecx     ; perform the bit test
    sbb eax, eax     ; assign carry flag value
    mov[edx],ax      ; assign the function result
    xor eax, eax     ; clear eax tell vb all okay
    ret 16           ; cleanup (lpObj, P1, P2, rc)

GetBit endp    ; end of procedure
end GetBit     ; end of code, indicate entry point
