![]() Here's an example with WriteInt, IDIV and IMUL: ((A + B) / C) * ((D - A) + E)Ĭall WriteInt Write a positive or negative numberĭivide PROC USES ECX EDX EAX = ECX / EDX The CPU doesn't care about such things - the results will be always the same. If he/she/it decides that this is an unsigned number, then it is an unsigned number. It's just a thing of interpretation: if the programmer decides that this should be a signed number, then it is a signed number. This was the main reason for introducing the 2's complement coding. There are no different versions of ADD and SUB for signed and unsigned numbers. Since the high part is not needed in this case, it is not mandatory to use IMUL. MUL and IMUL differ in the high part of the result ( EDX). DIV performs the division 6/-2 positively (6/4294967294) and gets the result 0 = 0x00000000, with IDIV the result is correct: -3 = 0xFFFFFFFD. Inside the CPU, the negative "-2" and the positive "4294967294" are transformed to the same value: 0xFFFFFFFE. Irvines's WriteDec should be replaced by WriteInt which handles the argument EAX as signed number.
0 Comments
Leave a Reply. |