为什么没有实现 DIV 指令来设置 CF 而不是引发异常 没有其他 8086 数学指令需要截断,如果你考虑 FLAGShigh_half < divisor 是 无符号除法的证明

问题描述

我知道在汇编中分割时必须非常小心,即 这样做:

          mov ah,10h
          mov al,00h ; dividend = 1000h
          mov bl,10h ; divisor = 10h
          div bl      ; Integer overflow exception,/result 100h cannot fit into al

我已经编写了一些可能无法证明的逻辑来为除法创建一个更友好的环境:

          mov ah,00h
          mov bl,10h 
TryDivide:
          cmp bl,ah
          jna CatchClause
          div bl
          clc
          jmp TryEnd
CatchClause:
          stc
TryEnd:
     

有没有人知道类似这样的事情没有实现的技术原因,我们有例外而不是标志设置/寄存器被截断?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)