[此贴子已经被作者于2007-8-11 21:55:38编辑过]
[此贴子已经被作者于2007-8-11 21:55:38编辑过]
看了,那个说法肯定是错误的,建议找一些比较正规的书籍教材来学习为好。
[QUOTE]
DIV INSTRUCTION
Purpose: Division without sign.
Syntax:
DIV source
The divider can be a byte or a word and it is the operator which is given the instruction.
If the divider is 8 bits, the 16 bits AX register is taken as dividend and if the divider is 16 bits the even DX:AX register will be taken as dividend, taking the DX high word and AX as the low.
If the divider was a byte then the quotient will be stored on the AL register and the residue on AH, if it was a word then the quotient is stored on AX and the residue on DX.
IDIV INSTRUCTION
Purpose: Division with sign.
Syntax:
IDIV source
It basically consists on the same as the DIV instruction, and the only difference is that this one performs the operation with sign.For its results it used the same registers as the DIV instruction.[/QUOTE]
这是intel开发手册上的内容,应该够权威了。
[此贴子已经被作者于2007-8-12 18:21:52编辑过]
DIV,无符号数的除法指令,和8086一样,指令给出一个操作数,被除数已默认。如果指令中给出的操作数为32,那么被除数将是EDX:EAX, 最终的商将存放在EAX, 余数将存放在EDX中。如果指令给出操作数为16位,那么被除数为EAX,最终得到的商放在AX,余数放在DX。如果指令中给出的操作数为8位,那么被除数是16位,最终得到的商将放在AL中,余数放在DL中。
这回对了吧 hkbyest检查一下
记得先清eax哦
这类代码我写过许多了,不会骗你的,^_^
[此贴子已经被作者于2007-8-13 22:55:27编辑过]