I can save a float into a 32 bit register with the following command:
mov ebx,__?float32?__(1.23)
movd xmm1,ebx ; works
However when I try the following code, I get an error:
mov bx,__?float16?__(1.23)
movd xmm1,bx ; /tmp/SASM/program.asm:9: error: invalid combination of opcode and operands
How can I use mov
to save a 8.8 float into a 16- bit register? Or is there some other way to do so?
Fixed point values have an implied shift value.
To save an 8.8 fixed point value in a register in NASM you'd have to do the implied shift yourself; like maybe mov ebx,320 ;1.25 << 8 = 320
.
Note: Based on this stackoverflow question I don't think there's a way to convert the result of a floating point constant expression into an integer when assembling in NASM, so something cleaner (like a hypothetical mov ebx, __?int32?__ (1.25 << 8)
) won't work.