问题描述
我试图运行在装配以下code:
I am trying to run the following code in assembly:
mov %si, %ax
mov $15, %si
div %si
mov %eax, %esi
当我把我的程序,它编译,但在运行时它给了我一个浮点异常。
我试图通过%啊
和%SI
。
When I make my program, it compiles, but at runtime it gives me a floating point exception.I tried to replace the last line's parameters by %ah
and %si
.
简单地说,我想通过 15
来划分%ESI
。我只想要一个 INT
,以及有没有必要为一个双击
。
Briefly, I am trying to divide %esi
by 15
. I only want an int
, and have no need for a double
.
感谢您
推荐答案
的 DIV
指令分为双字参数 DX / AX
的操作数。如果商太大,无法成为一个单词,它会抛出该异常。
The div
instruction divides the two-word parameter dx/ax
by the operand. If the quotient is too large to fit into a word, it will throw that exception.
参考:http://siyobik.info.gf/main/reference/instruction/DIV
你有没有在 DX
注册怎么办?最有可能的 DX / AX
按 15
分不适合在一个16位字。
What do you have in the dx
register? Most likely dx/ax
divided by 15
does not fit in a 16-bit word.
这篇关于获取浮点异常,而试图在装配使用DIV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!