I know i could just do it in asm and test bit 11 of the flags, ie for an 8 bit add. (this is just a quick test code, i know theres better ways)
Code: Select all
ASM
xor eax, eax
mov al, 127
add al, 5
pushf
pop edx
shr edx, 11
and edx, 1
mov dword ptr [was_overflow], edx
End ASM
Code: Select all
Dim As Byte a, b
Dim As Short tmp
a = 125
b = 3
tmp = (a + b)
Print ((a Xor (Not (b))) And (a XOR tmp) AND &H80) <> 0
Sleep