【发布时间】:2025-12-30 05:15:07
【问题描述】:
显然有标志标志。但是当我有一个代码块时:
;starts with parry, zero set
mov eax, 100 ; mov does not affect the flags
neg eax ; sets carry, adjust and sign, unsets zero
mov ebx, 4000000000; mov does not affect the flags
mov ecx, eax ; mov does not affect the flags
mov edx, 50 ; mov does not affect the flags
add ebx, edx ; unsets all set flags, value of ebx is 4000000050
我很难理解程序如何知道add ebx, edx 是4000000050。
请记住,符号标志仍然设置为否定eax。
因为汇编没有像 C 这样区分 signed 和 unsigned 和 ebx 的类型,所以设置了最高位,存储在 ebx 中的值可能是它的实际值,也可能是它的 2 的补码。我们不知道。
至少这是我的理解。那么程序是如何知道ebx 是+4000000000 而不是二进制的2 的补码是4000000000 的负值。
【问题讨论】:
标签: assembly nasm cpu-registers flags twos-complement