flat assembler
Message board for the users of flat assembler.

Index > Windows > Code conversion (MASM to FASM)

Author
Thread Post new topic Reply to topic
ManOfSteel



Joined: 02 Feb 2005
Posts: 1154
ManOfSteel 20 Apr 2007, 17:33
Hello,

I'm trying to convert a piece of code from MASM to FASM.

Could you tell me what "ASSUME esi:PTR PARTICAL" does exactly ("PARTICAL" is a structure)?

Also, REAL4 in "math_da REAL4 6.135923151E-3" is a float, right? Can floats be used with FASM?

Thanks in advance.
Post 20 Apr 2007, 17:33
View user's profile Send private message Reply with quote
Vasilev Vjacheslav



Joined: 11 Aug 2004
Posts: 392
Vasilev Vjacheslav 21 Apr 2007, 09:12
masm: math_da REAL4 6.135923151E-3
fasm: math_da dd 6.135923151E-3

i think you must show us your code after "ASSUME esi:PTR PARTICAL"
Post 21 Apr 2007, 09:12
View user's profile Send private message Reply with quote
ManOfSteel



Joined: 02 Feb 2005
Posts: 1154
ManOfSteel 22 Apr 2007, 10:27
Here it is:
Code:
    mov esi, pMem
    ASSUME esi:PTR PARTICAL

    fld math_da
    fldpi
    mov ecx, NUM_OBJECTS

    .REPEAT

...

        mov [esi].x, eax
        mov [esi].y, edx

        fstp [esi].vx
        fstp [esi].vy

        fsub st, st(1)      ;// a   da

        add esi, SIZEOF PARTICAL
        dec ecx

    .UNTIL ZERO?
...
    


What will be the content of esi at every step?
Post 22 Apr 2007, 10:27
View user's profile Send private message Reply with quote
farrier



Joined: 26 Aug 2004
Posts: 274
Location: North Central Mississippi
farrier 22 Apr 2007, 13:54
ManOfSteel,

Try:
Code:
       mov     esi, [pMem]
         virtual at esi
                      my_PARTICAL     PARTICAL
            end virtual
 mov     [my_PARTICAL.x], eax
        mov     [my_PARTICAL.y], edx
        fstp    [my_PARTICAL.vx]
    fstp    [my_PARTICAL.vy]
    


hth,

farrier

_________________
Some Assembly Required
It's a good day to code!
U.S.Constitution; Bill of Rights; Amendment 1:
... the right of the people peaceably to assemble, ...
The code is dark, and full of errors!
Post 22 Apr 2007, 13:54
View user's profile Send private message Reply with quote
Vasilev Vjacheslav



Joined: 11 Aug 2004
Posts: 392
Vasilev Vjacheslav 22 Apr 2007, 17:02
my version:

Code:
   mov     esi,[pMem]
  fld     [math_da]
   fldpi
       mov     ecx,NUM_OBJECTS

  .lp:
        mov        [esi+PARTICAL.x],eax
        mov     [esi+PARTICAL.y],edx
        fstp    [esi+PARTICAL.vx]
        fstp       [esi+PARTICAL.vy]
        fsub       st,st(1)
        add         esi,sizeof.PARTICAL
        dec      ecx
        jnz      .lp
    
Post 22 Apr 2007, 17:02
View user's profile Send private message Reply with quote
ManOfSteel



Joined: 02 Feb 2005
Posts: 1154
ManOfSteel 23 Apr 2007, 06:11
Thank you very much, both versions are perfect!
Post 23 Apr 2007, 06:11
View user's profile Send private message Reply with quote
HexEdit



Joined: 31 Jul 2006
Posts: 6
Location: Russia
HexEdit 28 Apr 2007, 14:54
I think, that the "virtual" version is better.
Post 28 Apr 2007, 14:54
View user's profile Send private message ICQ Number Reply with quote
Vasilev Vjacheslav



Joined: 11 Aug 2004
Posts: 392
Vasilev Vjacheslav 28 Apr 2007, 15:57
i thinks they're same
Post 28 Apr 2007, 15:57
View user's profile Send private message Reply with quote
ManOfSteel



Joined: 02 Feb 2005
Posts: 1154
ManOfSteel 29 Apr 2007, 05:39
Indeed, they give the same output. The virtual method results in a smaller and clearer source code, though.
Post 29 Apr 2007, 05:39
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.