Why should EDX be 0 before using the DIV instruction?

前端 未结 2 1052
独厮守ぢ
独厮守ぢ 2020-11-21 23:59

I noticed when EDX contains some random default value like 00401000, and I then use a DIV instruction like this:

mov eax,10
mov ebx,5
div ebx
2条回答
  •  醉话见心
    2020-11-22 00:17

    The DIV instruction divides EDX:EAX by the r/m32 that follows the DIV instruction. So, if you fail to set EDX to zero, the value you are using becomes extremely large.

    Trust that helps

提交回复
热议问题