flat assembler
Message board for the users of flat assembler.
  
       
      Index
      > Main > how to mov a register into a qword | 
  
| Author | 
  | 
              
| 
                  
                   revolution 21 Jun 2014, 04:46 
                  A DQ sized value is 64-bits so it won't fit into a 32-bit register. There are various options.     
                  
                Code: buffer1 dq ? value = qword 255.5 mov eax,value and 0xffffffff mov ecx,value shr 32 mov dword[buffer1+4*0],eax mov dword[buffer1+4*1],ecx ;or maybe mov dword[buffer1+4*0],value and 0xffffffff mov dword[buffer1+4*1],value shr 32  | 
              |||
                  
  | 
              
| 
                  
                   patchariadog 21 Jun 2014, 05:20 
                  thanks for helping revolution, but I still can't get it to do what I want.
 
                  
                I have a proc that will calculate the area of a triangle and shove the result into the eax register I was wondering how can I get the eax register into the buffer1 dq ? in the example you provided I don't understand why the value is their, and frankly I have never seen half of the instructions, lol. i tried this Code: mov eax,1.0 mov ecx,1.0 mov dword[buffer1+4*0],eax mov dword[buffer1+4*1],ecx but instead of buffer1 containing 1.0 it contained 0.00781 thanks  | 
              |||
                  
  | 
              
| 
                  
                   revolution 21 Jun 2014, 05:36 
                  Oh, so you want to convert from single precision to double? Is that your query?
 
                  
                If so then perhaps: Code: mov dword[buffer1],eax fld dword[buffer1] fstp qword[buffer1]  | 
              |||
                  
  | 
              
| 
                  
                   patchariadog 21 Jun 2014, 05:48 
                  thanks revolution, you taught me something new again, lol
 
                  
                if you don't mind could you explain to me a few things on the first code you posted. first of all what was the first code for(what is the purpose of it?) second I have never seen multiple instructions on the same line? like the "mov eax,value and 0xffffffff " lastly I know what the [buffer1+4] is but I have never seen the [buffer1+4*0] what is the * for? thanks for helping me!  | 
              |||
                  
  | 
              
| 
                  
                   revolution 21 Jun 2014, 05:57 
                  There are not multiple instructions on one line. It is an "expression" that is evaluated by fasm to get the final constant. "value" is 64-bits so it is broken into two pieces of 32-bits and placed into the buffer. And the * is just a multiply, the same as +, - and / where fasm computes the value at assembly time. So 4*0 is just 0, and 4*1 is 4. 
                  
                 | 
              |||
                  
  | 
              
| 
                  
                   patchariadog 21 Jun 2014, 06:00 
                  oh okay. thanks! 
                  
                 | 
              |||
                  
  | 
              
< Last Thread | Next Thread >  | 
    
Forum Rules: 
  | 
    
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.