条件转移指令

条件转移指令

重要寄存器

ZF:零标志位。代码执行后结果为0那么ZF=1;结果不为0则ZF=0;

SF:符号标志位。相关指令执行后结果为负(-),那么SF=1;结果非负数,则SF=0;

OF:溢出标志位。记录了有符号运算的结果是否发生了溢出,如果发生溢出OF=1;如果没有OF=0;

比较指令

整数比较指令

cmp test //cmp eax,3

相当于 sub eax,3 即结果 eax= 3-3,用这个结果,去给出标志位,影响条件跳转

结果为0就是相等,ZF也就是1

反之非0就是不相等,ZF不为1

test eax,eax

判断寄存器eax是否为0

无符号条件跳转指令

指令 关系 检测条件 功能描述
JE/JZ = ZF=1 Jump equal or jump zero 等于转移
JNE/JNZ != ZF=0 Jump not equal or Jump not zero 不等于时转移
JA/JNBE > CF=0 && ZF=0 Jump above or Jump not below or equal 高于时转移
JAE/JNB >= CF=0 Jump above or equal or Jump not below 高于或等于转移
JB/JNAE < CF=1 Jump below or Jump not above or equal 低于转移
JBE/JNA <= CF=1 || ZF=1 Jump below or equal or Jump not above 低于或等于转移

有符号条件转移指令

指令 关系 检测条件 功能描述
JE/JZ = ZF=1 Jump equal or jump zero 等于转移
JNE/JNZ != ZF=0 Jump not equal or Jump not zero 不等于时转移
JG/JNLE > SF=OF && ZF=0 Jump greater or Jump not less or equal 大于转移
JGE/JNL >= SF=OF || ZF=1 Jump greater or equal or Jump not less 大于等于转移
JL/JNGE < SF!=OF && ZF=0 Jump less or Jump not greater or equal 小于转移
JLE/JNG <= SF!=OF || ZF=1 Jump less or equal or Jump not greater 小于或等于转移
posted @ 2022-04-27 00:25  MuRKuo  阅读(461)  评论(0编辑  收藏  举报