汇编代码混乱?解决这两个问题

assembly code confusion? stock at these two problems

  1. add指令执行后状态标志位(0或1)的值。解释

     mov bx, 8000h
     add bx, 8000h
     c  this should be 0 because carry flag is not changed?
     0  this should be 1 because the sum is not zero?
     s  this should be not signed?
     z  ?
    
  2. 将伪代码转换为汇编,假设值是有符号整数并使用短路计算。代码应该紧凑。

    if(eax<ecx) AND (ebx != edx) {
     mov edi, esi;
     add ebx, eax;
    }
    

我真的很迷茫有人想提供一些指导吗?

啊,作业。杰克丹尼尔斯在我的血管里说我应该帮助你:)

1 0x8000 + 0x8000 = 0x10000。结果是 17 位,因此你的寄存器只有 16 位。所以,BX中只会存入0x0000。
有了这个,您将获得以下标志集:
- OF 已设置(总和大于寄存器可以容纳的值);
- CF 已设置(结果的最高位为 1)
- PF 已设置(数字为偶数)
- ZF 已设置 (BX = 0)
- SF 未设置(不是有符号数)

2(fasm 语法)

cmp eax, ecx
jge short @f
cmp ebx, edx
jz short @f
mov esi, edi
add eax, ebx
@@: