鸸鹋分8086装配误差 [英] divide emu 8086 assembly error
问题描述
可能重复:结果
ASM 86整数溢出
块引用>我得到一个鸿沟无差错溢出,我不知道为什么。
下面是完整的code重现错误包括emu8086.inc组织100H MOV AX,2
MOV BX,10
DIV BX MOV AX,2
MOV BX,2
DIV BX
RET
解决方案尝试添加
XOR DX,DX
前各DIV
,看看是否有没有帮助。既然你指定一个16位的目标,
DIV
分歧DX:AX
由该目标。如果DX
开出含有大量的(更准确地说,是什么,但相当数量少),结果就会溢出。即使不会溢出,你的结果将不只是斧
/BX
,你显然打算。Possible Duplicate:
ASM x86 integer overflowI get a divide error- overflow and am not sure why. Here is the complete code that reproduces the error
include emu8086.inc org 100h mov ax, 2 mov bx, 10 div bx mov ax, 2 mov bx, 2 div bx ret
解决方案Try adding
xor dx, dx
before eachdiv
and see if that doesn't help.Since you're specifying a 16-bit target,
div
dividesdx:ax
by that target. Ifdx
starts out containing a large number (more accurately, anything but quite a small number), the result will overflow. Even if it doesn't overflow, your result won't just beax
/bx
as you apparently intend.这篇关于鸸鹋分8086装配误差的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!