Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror
×

Comment Re:xor my heart (Score 2, Informative) 209

No, that snippet compares AL and DX, leaving AX with 1's everywhere except the first different bit, which will hold a 0.

Ex:
AL= 00001101
DX= 00000010 00011001

CWD just puts a 0 in AH
AX= 00000000 00001101
DX= 00000010 00011001

XOR ax,dx computes ax ^= dx
AX=00000010 00010100
DX unchanged

SUB ax,dx computes ax -= dx
AX=1111111111111011
DX unchanged

The XOR swap algorithm to swap ax and dx is:
xor ax,dx
xor dx,ax
xor ax,dx

Slashdot Top Deals

If you think the system is working, ask someone who's waiting for a prompt.

Working...