flat assembler
Message board for the users of flat assembler.
Index
> Main > Why can't I assign dt |
Author |
|
Tomasz Grysztar 01 Mar 2005, 18:41
It accepts floating point values only, so it should be:
Code: fp_real dt 0.0 or Code: fp_real dt 0f |
|||
01 Mar 2005, 18:41 |
|
asmdemon 01 Mar 2005, 23:30
ah, sorry bout that and thanx for the fast reply
|
|||
01 Mar 2005, 23:30 |
|
r22 02 Mar 2005, 00:23
Speaking of floating point (new-bie question). How do you assign and output an 80bit value like that.
mov [fp_val], st0 but how would you pass it to say a wsprintf function or the console? |
|||
02 Mar 2005, 00:23 |
|
MCD 02 Mar 2005, 09:05
you can't use usual integer "mov" instruction to copy a whole 80bit FPU register. If you want to store a FPU register into memory, you must use FPU instructions:
Code: fst [fp_val] Code: fstp [fp_val] An optimization tip: if you want to copy FPU values from memory to memory, you should better avoid FPU instruction unless you need to do some floating point calculations. For only copying them, use integer (or MMX/SSE...) instructions. Code: ;This examples copies an 80bit value from memory in [esi] to [edi] mov eax,[esi] mov edx,[esi+4] mov cx,[esi+8] mov [edi],eax mov [edi+4],edx mov [edi+8],cx You can naturally loop this instruction cluster for copying arrays. But I recommend you to align/use your 80bit fp values as 12byte (or even 16byte) values, thus you may replace the "mov cx,[esi+8]" by "mov ecx,[esi+8]" which speed/size optimizes this a bit. When you need it super fast, try considering MMX/SSE with dqword alignment, but anyway, supper fast fp_copying should try to avoid 80bit values, since they are a bit difficult to handle outside the FPU stack. |
|||
02 Mar 2005, 09:05 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.