Why should EDX be 0 before using the DIV instruction?
问题 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 it causes an INTEGER OVERFLOW ERROR. However, if I set edx to 0 and do the same thing it works. I believed that using div would result in the quotient overwriting eax and the remainder overwriting edx . Getting this INTEGER OVERFLOW ERROR really confuses me. 回答1: What to do For 32-bit / 32-bit => 32-bit division: zero- or sign-extend the 32-bit dividend