flat assembler
Message board for the users of flat assembler.

Index > Main > fasm&fasmg

Author
Thread Post new topic Reply to topic
l4m2



Joined: 15 Jan 2015
Posts: 657
l4m2
In fasm there are three kinds of IF X=0:
Code:
match =0, x {
  ...
}    
Code:
if x = 0
  ...
end if    
Code:
cmp x, 0
jnz lab
...
lab:    

In fasmg only two?
Code:
if x = 0 
  ...
end if    
Code:
jnz lab, x
...
lab:    




How does fasm&fasmg know x is linear function of a, b, c?(a, a+b, a+b+1 are, but a*a, a+d aren't)
Post 14 Aug 2016, 16:08
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17716
Location: In your JS exploiting you and your system
revolution
You are mixing all the stages of the process together and confusing yourself. fasm has preprocessor and assembler stages, whereas fasmg has combined those into the same stage. The generated code is executed at runtime.

To answer your second question: fasm doesn't know if anything is a linear function of anything else. It just tries to find values that produce a valid solution. There may be other solutions that are also valid and fasm can completely miss them.
Post 14 Aug 2016, 19:32
View user's profile Send private message Visit poster's website Reply with quote
l4m2



Joined: 15 Jan 2015
Posts: 657
l4m2
revolution wrote:

You are mixing all the stages of the process together and confusing yourself. fasm has preprocessor and assembler stages, whereas fasmg has combined those into the same stage. The generated code is executed at runtime.

When I see a topic, usually I can't know whether it's a processing code or an executing code, thus mixing them is acceptable.
revolution wrote:

fasm doesn't know if anything is a linear function of anything else.

I tried these cases:
Code:
lea eax, [3*ecx-2*ecx]      ;OK
lea eax, [ecx*ecx-ecx*ecx]  ;Error    

which means that fasm requires all the summed elements to be linear
Post 15 Aug 2016, 01:28
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17716
Location: In your JS exploiting you and your system
revolution
l4m2 wrote:
I tried these cases:
Code:
lea eax, [3*ecx-2*ecx]      ;OK
lea eax, [ecx*ecx-ecx*ecx]  ;Error    

which means that fasm requires all the summed elements to be linear
Now you are talking about registers, rather than your previous example of variables. The x86 CPU addressing doesn't support multiplication of addresses, only shifts and adds.

BTW: Did you try [ecx*(ecx-ecx)*ecx]?
Post 15 Aug 2016, 01:51
View user's profile Send private message Visit poster's website Reply with quote
l4m2



Joined: 15 Jan 2015
Posts: 657
l4m2
revolution wrote:
Did you try [ecx*(ecx-ecx)*ecx]?
No. But maybe my "element" should be "monomial" Very Happy
Post 15 Aug 2016, 02:06
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17716
Location: In your JS exploiting you and your system
revolution
l4m2 wrote:
When I see a topic, usually I can't know whether it's a processing code or an executing code, thus mixing them is acceptable.
Only if you find it acceptable to confuse yourself. Wink

But seriously, if you don't understand at least the preprocessor vs assembler difference then you will have a hard time understanding complex macros.
Post 15 Aug 2016, 02:27
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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.