
Educators: Earn a free Gold upgrade by joining the PBwiki Back To School Challenge.

Questions? Join PBwiki's weekly office hours today at 1 PM Eastern and get live answers.
How to zero a register? Let me count the ways:
What, if any are the differences in the above?
Camron: Each instruction zeros the register in a different way which also results in different flags being set.
MOV ax, 0 puts the binary of the number 0 (which is 0) into the ax register, completely replacing the original value(if any). Does not set any flags.
SUB ax, ax uses arithimetic to subtract the value stored in the ax register by itself which will always result in 0. Sets all flags.
11010110
- 11010110
00000000
XOR ax, ax Performs an 'exlusive or' to itself which will always result in 0. Sets the Overflow and Carry flag to 0, sets the Sign and Zero flags, and leaves the Auxiliary flag unpredictable.
1011
XOR
1011
0000
Page Information
|
Wiki Information |
Recent PBwiki Blog Posts |