简体   繁体   English

“div”命令在程序集中不起作用

[英]The "div" command doesn't work in Assembly

In my code, everything worked as expected but after a regulad "div bx" command it stopped working.在我的代码中,一切都按预期工作,但在执行“div bx”命令后,它停止工作。 I used the command several times befor in the same code and it worked perfectly (I wrote cwd at the beggining).我在相同的代码中多次使用该命令,它运行良好(我在开始时写了 cwd)。 has it happen to you?它发生在你身上吗? what is wrong?怎么了? here is the part of the code:这是代码的一部分:

    proc Reduction
mov dx,0
mov cx,0
mov ax,0
mov bx,0
mov cx, [sheerit]
tsim:
mov ax,0
mov ax,[sheerit]
mov [sheerit1],ax
mov ax,[number2]
mov [number22],ax
mov dx,0
mov ax,[sheerit1]
mov bx,[counter]

div bx
cmp dx,0
jne next
mov ax,[number22]
mov bx, [counter]
div bx
cmp dx,0
jne next
mov ax,[counter]
mov [big],ax
next:
add [counter],1
loop tsim
mov ax,0
mov bx,0
mov cx,0
mov dx,0
mov ax,[sheerit]
mov bx,[big]
; here it stopped working:
div bx
mov [sheerit1],ax
mov ax,0
mov bx,0
mov cx,0
mov dx,0
mov ax,[number2]
mov bx,[big]
div bx
mov [number2],ax
ret
endp Reduction
mov bx,[big] ; here it stopped working: div bx

This will happen if the big variable is still zero at this point which in turn could happen if in the tsim loop the counter was never transferred to big .如果此时big变量仍然为零,则会发生这种情况,如果在tsim循环中计数器从未转移到big ,则可能会发生这种情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM