As the light bulb correctly says in its answer, you cannot work with floating point values ββwhen using general purpose registers ( eax , etc.). You can use the FPU as the light bulb suggests, but it is relatively tedious.
Alternatively, if your code should not run on older processors, you can use SSE instructions for this task, which is much simpler. Code similar to what you are showing might look like this:
.data OneHalf dd 0.5 bal2 dd ? .code movss xmm0, OneHalf ; instead of mov edx, 1/2 subss xmm1, xmm2 ; instead of sub ecx, ebx subss xmm1, xmm0 ; instead of sub ecx, edx movss bal2, xmm1 ; instead of mov bal2, ecx
source share