Assembly Division [duplicate]

跟風遠走 提交于 2019-11-29 11:16:04
Henning Makholm

The DIV BX instruction divides the 32-bit value in DX:AX by BX. Since you're not initializing DX, the upper word of the dividend is whatever garbage was left in the DX register from the previous computation, so you're really dividing 0x00040078=262314 by 10. The result is correct: a quotient of 26231 with a remainder of 4.

In the first division is must have been pure luck that DX happened to be 0 initially.

Intel instruction DIV divides the register pair DX:AX with the argument.

In the first case DX happens to be zero.
The second time DX must have been 4.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!