What is wrong in this assembly code, conditional jmp
In the below intel assembly code, I use a cmp (compare) instruction before a condi开发者_开发百科tional jump, but for below code, it should not jump but it does & prints the string.
What is going wrong.(Flat assembler, Win-7 x32).
ORG 100h
USE16
mov ah, 09
mov dx, message
cmp ah, 10d
je condjmp
condjmp:
int 21h
mov ah,01
int 21h
mov ah,4ch
int 21h
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:
int 0x21
I mean,
If JE not true ---> next instruction = int 0x21 if JE true -------> next instruction = int 0x21
Hope this was clear enough for you.
精彩评论