Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这个非常简单的汇编代码:
start: add ax, 100 ; if ax overflow add to bx 1 jmp start
但我不知道如何检测 ax 寄存器溢出,有人可以帮我吗?
ADD指令集适当FLAGS反映溢出情况。溢出有两种:有符号和无符号。您必须决定什么是合适的,并jc/jnc用于未签名和jo/jno已签名。
ADD
FLAGS
jc/jnc
jo/jno
add ax, 100 jnc noUnsignedOverflow ... noUnsignedOverflow: add ax, 100 jno noSignedOverflow ... noSignedOverflow:
使用jo(jump if overflow) 或jno(jump if no overflow)
jo
jno
查看Intel x86 JUMP 快速参考