
; Set iBitPos bit (0-31) in iValue.

; Sub SetBit(iValue As Long, ByVal iBitPos As Long)

; 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

SetBit proc near

    mov edx,[esp+8]  ; extract address of value
    mov ecx,[esp+12] ; position of bit to set
    mov eax,[edx]    ; extract value to modify
    bts eax, ecx     ; perform the bit set
    mov[edx],eax     ; assign the value result
    xor eax, eax     ; clear eax tell vb all okay
    ret 12           ; cleanup (lpObj, P1, P2)

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