In the below intel assembly code, I use a cmp (compare) instruction before a conditional jump, but for below code, it should not jump but it does & prints the string.
What is going wrong.(Flat assembler, Win-7 x32).
mov ah, 09
mov dx, message
cmp ah, 10d
message db 'conditional jump', 0Ah, '$'
The jump goes to a label that is immediately following the jmp instruction, so it does not matter if the jump is taken or not, you always end up at the label.
Yes Goldenmean, like Simon said to you,
If you follow the logical FLOW of your program you will find that in both cases of the conditional jump, the next instruction executed right will be:
If JE not true ---> next instruction = int 0x21 if JE true -------> next instruction = int 0x21
Hope this was clear enough for you.