问题描述
我想检查辅助进位标志是否为 1 然后做一些事情。我找不到任何关于仅辅助进位标志的参考。
mov al,00011010b
mov bl,10011010b
add al,bl
;jump if AF == 1
解决方法
没有基于 AF 的条件跳转。正如 Peter Cordes 所说,最简单的解决方案是将标志加载到堆栈或 AH 中并在其上进行分支:
add al,bl ; some operation that sets AF
lahf ; load flags into AH
test ah,10h ; check if AF is set
jnz afset ; branch to afset if AF was set
或者,如果您愿意丢弃 AL,您可以在值 aaa
上使用 00h
来检查是否发生了一半进位。
add al,bl ; some operation that sets AF
mov al,0 ; clear AL for testing
aaa ; set CF = AF,trash AX
jc afset ; branch to afset if AF was set