Thread: jne without cmp
View Single Post
Old Mar 20th, 2006, 8:38 AM   #4
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Think of it like this: if you want 'jne', what isn't equal to what? You have to set up some equality test somewhere and store the result somewhere. In assembly language this is in the nuts and bolts part of the processor. Many instructions include the states of the flag register as part of the conditions for their execution. Some that you might think should do so, do not. This can bite you in the butt. In the 8080, incrementing a register and adding 1 to a register were the same operation, and set the zero flag according to the result. The Z80, which was SUPPOSED to be perfectly downward-compatible with the 8080 missed a beat. Adding 1 to a register set the zero flag appropriately; incrementing the register didn't touch the flag.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote