I'm trying to make it so that two values are compared.
If the values are equal then the carry flag should be set to one state
If the values are not equal, then the carry flag should be in the opposite state.
I don't care if the original values are destroyed after checking for equality.
This code is an example of what I want to achieve. It sets carry if values of AX and BX are different, or it clears carry if they are equal:
comparefunction:
cmp AX,BX
je ok
stc
ret
ok:
clc
ret
I also want to work with 32-bit values as well.
The closest thing that comes to mind which wont work with every number is this:
sub AX,BX
This is because I'll get a carry bit if AX is less than BX.
Is there a simple 1-liner command that can replace the code way up above that will work for my needs?