当前位置: 动力学知识库 > 问答 > 编程问答 >

intel - What is wrong in this assembly code, conditional jmp

问题描述:

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).

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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: