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

; Sub InvertBit(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

InvertBit proc near

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

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