flat assembler
Message board for the users of flat assembler.

flat assembler > Windows > How fasm calculate expressions?

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 497
Code:
mov ebx,3+7*2/2-2+2*2+3*(3+2) ;=27    

I want find this in fasm source.

And what is do fp_optimize:
Code:
mov     eax,[edi]
        mov     ebp,[edi+4]
        or      ebp,[edi]
        or      ebp,[edi+12]
        jz      fp_zero
      .loop:
        test    byte [edi+7],80h
        jnz     .done
        shld    [edi+4],eax,1
        mov     ebp,[edi+12]
        shld    eax,ebp,1
        mov     [edi],eax
        shl     dword [edi+12],1
        dec     dword [edi+8]
        jmp     .loop
      .done:
        ret
      fp_zero:
        mov     dword [edi+8],8000h
        ret
    
Post 19 Jul 2019, 01:59
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4208
Location: 2018
this is related to compiler internals.

you should better read the understanding fasm documentation.
Post 19 Jul 2019, 07:41
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7322
Location: Kraków, Poland
EXPRPARS.INC contains code that converts the original expression (in a preprocessed format, see TOOLS\FAS.TXT for the description of how text tokens are stored) into an RPN bytecode. This is done once per assembly.

EXPRCALC.INC contains code that evaluates the expression in the bytecode form, it is a like running a simple script on a stack-based VM.
Post 19 Jul 2019, 09:52
View user's profile Send private message Visit poster's website 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-2019, Tomasz Grysztar.

Powered by rwasa.