|
When you divide with asm this is what happens.
You take usually a 32bit value (though it can be 16bit, or 8bit) perform the division and store both the result and the remainder (no decimal values here) into the same block of data we performed the operation on.
Which means dividing a 32bit value results in that 32bit value being broken into a 16bit result and a 16bit remainder. I am sure you can see where this goes wrong now...
What happens if you take a 32bit value, which requires all 32 bits and divide that value by 1? Well as you can imagine the result WILL NOT fit in the 16 bit register in which it is supposed to fit. One of your flags should be raised for this exception, probably OF, you will need to verify that and start checking that flag to make sure that the division occured without error and deal with the error when it occures appropriatly.
|