Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Assembly x86 div指令错误_Assembly_X86_Division - Fatal编程技术网

Assembly x86 div指令错误

Assembly x86 div指令错误,assembly,x86,division,Assembly,X86,Division,我正在windows 7上工作,但我也尝试了dosbox上的代码 我想知道如何在16位模式下将双字逐字分割 我使用fasm。并制作.com文件 以下代码正确运行 但当dx大于0时,它只是关闭仿真窗口 org 100h mov dx, 0 mov ax, 10 mov bx, 10 div bx add ax, '0' int 29h mov ax, 00h int 16h mov ax, 4c00h int 21h 如果我像下面这样更改代码。。 当dx高于0xf时,它将关闭 我不知道为什

我正在windows 7上工作,但我也尝试了dosbox上的代码

我想知道如何在16位模式下将双字逐字分割

我使用fasm。并制作.com文件

以下代码正确运行 但当dx大于0时,它只是关闭仿真窗口

org 100h
mov dx, 0
mov ax, 10
mov bx, 10
div bx
add ax, '0'
int 29h   
mov ax, 00h
int 16h
mov ax, 4c00h
int 21h
如果我像下面这样更改代码。。 当dx高于0xf时,它将关闭 我不知道为什么

org 100h
mov dx, 0xf
mov ax, 10
div word [divby]
add ax, '0'
int 29h
mov ax, 00h
int 16h
mov ax, 4c00h
int 21h
divby:
        dw 0x10           
如何在没有关机错误的情况下将双字逐字除法?

当dx:ax/bx无法放入ax时(或当一个字被零除法时),会发生“关机”或除法溢出异常

假设在aa:bb:cc:dd中有一个“大”值,那么除以bx,就必须执行以下步骤:

 lea si,[aa]
 lea di,[result]
 mov dx,0
 mov cx,4
 again:
 lodsw      ;; load ax
 div bx
 stosw      ;; store result of division
 loop again
 ;; at this point dx will contain the remainder of the big_int % bx
当dx:ax/bx无法装入ax时(或当一个除以零时),会发生“关机”或除法溢出异常

假设在aa:bb:cc:dd中有一个“大”值,那么除以bx,就必须执行以下步骤:

 lea si,[aa]
 lea di,[result]
 mov dx,0
 mov cx,4
 again:
 lodsw      ;; load ax
 div bx
 stosw      ;; store result of division
 loop again
 ;; at this point dx will contain the remainder of the big_int % bx