flat assembler
Message board for the users of flat assembler.
  
       
      Index
      > Main > proc getPos, lParam, thisPos:RECT | 
  
| Author | 
  | 
              
| 
                  
                   ouadji 14 Jun 2011, 10:46 
                  Code: mov eax,RECT stdcall getPos,x,x,eax proc getPos, lParam, thisPos:dword mov ebx,[thisPos] mov ecx,[ebx] endp  | 
              |||
                  
  | 
              
| 
                  
                   procyon 14 Jun 2011, 10:49 
                  Is that a typo ouadji?
 
                  
                You're passing 3 params to a 2 param proc  | 
              |||
                  
  | 
              
| 
                  
                   ouadji 14 Jun 2011, 10:56 
                  yes, typo, sorry ! BSOD for me ! Code: stdcall getPos,x,eax  | 
              |||
                  
  | 
              
| 
                  
                   bitshifter 14 Jun 2011, 18:50 
                  Actually you dont need to put into eax first, just pass its offset.
 
                  
                In high level languages like C, there are internals to handle passing structures to a procedure as opposed to passing a pointer to the structure. With ASM we pass a pointer to the structure as ouadji has demonstrated.  | 
              |||
                  
  | 
              
| 
                  
                   r22 14 Jun 2011, 18:51 
                  My fASM is a bit rusty but wouldn't this work...
 
                  
                ------- text below may be completely untrue ------ Code: proc getPos, lParam, thisPos pushad mov eax, [lParam] mov ebx, eax and eax, 0xFFFF shr ebx, 16 mov edi, [thisPos] mov [edi + RECT.left], eax mov [edi + RECT.top], ebx popad ret endp What would [thisPos.left] translate to? thisPos is EQU to EBP+8 so you have to MOV edi, [EBP+8] ; MOV edi, [thisPos] to get the address to your RECT. From there you can do a ? virtual at edi / RECT / end virtual ? may that would let you reference [edi .left]  | 
              |||
                  
  | 
              
| 
                  
                   ouadji 14 Jun 2011, 19:04 
                  .... as ouadji has demonstrated. thank you bitshifter for the green color  | 
              |||
                  
  | 
              
| 
                  
                   procyon 14 Jun 2011, 19:10 
                  hi bitshifter, the RECT struct is being passed in [thisPos], not [lparam]. I move [lparam] into eax to manipulate it then move the results into [thisPos].
 
                  
                Hi r22, long time no speak It appears your fasm isn't as rusty as mine, lol. I knew there was a way to reference the RECT 'correctly', just couldn't get my head around it Many thanks pro  | 
              |||
                  
  | 
              
| 
                  
                   bitshifter 14 Jun 2011, 21:53 
                  I understand you, but what i meant was to pass thisPos -- not [thisPos]
 
                  
                thisPos == offset of structure [thisPos] == first member of structure (RECT.left)  | 
              |||
                  
  | 
              
< Last Thread | Next Thread >  | 
    
Forum Rules: 
  | 
    
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.