flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Match for double esp correct.

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1792
Roman 01 Sep 2024, 02:48
In Fasmw 1.73 problems with double. ESP not add 4 for each double.
invoke or cinvoke perceives double as dword !
Code:
macro par_ [ar] { common
       ESP_add@  =  0
      reverse
      match g j,ar \{ ;display g
      if g eq double
      push dword j+4
      push dword j
      ESP_add@ = ESP_add@ + 1
      else
      push g
      end if
      \}
}
macro par@ {
display ESP_add@+48
 if ESP_add@ > 0
    add esp,ESP_add@*4
 end if
}            

;in code
par_  [space],double [aa],double [aa+8],double [aa+16]
par@      ;must do add esp,3*4 ;because three double
    


Last edited by Roman on 01 Sep 2024, 03:05; edited 1 time in total
Post 01 Sep 2024, 02:48
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20337
Location: In your JS exploiting you and your system
revolution 01 Sep 2024, 02:56
"double" isn't part of the fasm syntax.

It is up to you how you want to define and use it.
Post 01 Sep 2024, 02:56
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1792
Roman 01 Sep 2024, 03:01
And how right define double ?
Post 01 Sep 2024, 03:01
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20337
Location: In your JS exploiting you and your system
revolution 01 Sep 2024, 03:34
I don't think there is a "right" way.

It is 100% up to you how you define it, and what it means in your code.
Post 01 Sep 2024, 03:34
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1792
Roman 01 Sep 2024, 03:46
I do this variant
Code:
macro par_ [ar] {
      common
       ESP_add@  =  0
      reverse
      match g j,ar \{ display `g,';'
      if g eq double

        if j eqtype [0]
      lea eax,j
      push dword [eax]
      push dword [eax+4]

      else
      ;display 'o;'
      push dword 0
      push dword j
      end if
      ESP_add@ = ESP_add@ + 8
      end if
      if g eq dword
      ESP_add@ = ESP_add@ + 4
      push dword j
      end if
      \}
}
macro par@ {
display "ESP+ =",ESP_add@+48
 if ESP_add@ > 0
   ; nop
    add esp,ESP_add@
 end if
}
;in code
        par_ double 0,double 0,double -0.98
        cinvoke  dWorldSetGravity,[bodyWorld]
        par@

        par_ dword [space],double [aa],double [aa+8],double [aa+16]
        cinvoke dCreateBox 
        par@
    
Post 01 Sep 2024, 03:46
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.