flat assembler
Message board for the users of flat assembler.

 Index > Main > Understanding fasm (draft) Goto page Previous  1, 2
Author
Tomasz Grysztar

Joined: 16 Jun 2003
Posts: 8346
Location: Kraków, Poland
Tomasz Grysztar 29 Jan 2006, 14:02
The exact algorithms used to make predictions are the inner secrets of fasm It may find the solution, or fail, but what you can always be sure is that when it make you an output, it is always the correct one.
As for revealing what exactly the prediction mechanism are, I'm not doing it just because they still may change when something better is invented. I even rewrote the section 2.2.6 of manual to not define too much about behaviour of prediction algorithms, to prevent programmers from relying on them.
To one thing you should always assume: you cannot know what values the labels have during the intermediate passes.

Last edited by Tomasz Grysztar on 29 Jan 2006, 14:04; edited 1 time in total
29 Jan 2006, 14:02

Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
I'm sorry, there was an error in my calculations - I edited, but you were quicker

EDIT: Removed everything my logic didn't calculate

Last edited by Madis731 on 29 Jan 2006, 14:35; edited 2 times in total
29 Jan 2006, 14:04
Tomasz Grysztar

Joined: 16 Jun 2003
Posts: 8346
Location: Kraków, Poland
Tomasz Grysztar 29 Jan 2006, 14:10
And there is one more thing: y is calculated after the x, and here the interpreted layer comes in - y uses just the value of x already calculated in the current pass. That gives me a hint to write something about it in the article.
29 Jan 2006, 14:10

Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Nice - can't wait to read another section

btw, an easy code to make the assembler suffer:
Code:
```dd x,y
;7 passes
x= 14+y
y= 120/x
```

Code:
```dd x,y
64 passes
x=y+y
y=x-2
```

I'm doing Neural Networks right now so I'm really interested in "learning" like this
29 Jan 2006, 14:19
Tomasz Grysztar

Joined: 16 Jun 2003
Posts: 8346
Location: Kraków, Poland
Tomasz Grysztar 29 Jan 2006, 18:44
Well, this 64-passes one is really interesting. Sometimes fasm suprises even me.
(Don't get me wrong - I understand what happens here, I just didn't realize earlier that this may actually happen and that fasm is able to solve this one)
29 Jan 2006, 18:44
Tomasz Grysztar

Joined: 16 Jun 2003
Posts: 8346
Location: Kraków, Poland
Tomasz Grysztar 30 Jan 2006, 09:02
r22 wrote:

http://developer.amd.com/devtools.aspx
At the bottom of this page it lists NASM and YASM as suggested free assemblers to use.

If you feel as I do, that FASM should be on that list, then make sure to click on the "Contact Us" link at the bottom of the page and voice your opinion to AMD.

They say NASM has an AMD64 support? Moreover, the link they provide doesn't work.

30 Jan 2006, 09:02
rugxulo

Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 30 Jan 2006, 19:49
http://sourceforge.net/projects/nasm/ is the only working URL for NASM right now (and has been like that for a few weeks, dunno why). Mach-O output support seems to be the only recent major feature update.
30 Jan 2006, 19:49
Tomasz Grysztar

Joined: 16 Jun 2003
Posts: 8346
Location: Kraków, Poland
Tomasz Grysztar 11 Mar 2006, 21:39
Slowly getting more close to the "meat". After I finish explaining some important fact about macroinstructions there will come section summarizing the analogous features of different layers (like difference between REPEAT and REPT), and then some "lessons" about how to make the layers cooperate and utilize them to the extremes - I plan a step-by-step explanation of the complex macros like "struct" or "proc" as a base examples for those "lessons".
11 Mar 2006, 21:39

Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Good progress, but seems like you were a little in a hurry in the end, in the last section, just a few type'os:

1) '...fed into the assembled' <= shouldn't it be 'assembler' or 'assembled <something>'?
and a few lines later:
2)"This example show how" <= should be 'shows'

11 Mar 2006, 23:43
Tomasz Grysztar

Joined: 16 Jun 2003
Posts: 8346
Location: Kraków, Poland
Tomasz Grysztar 18 Mar 2006, 10:49
After I started the section about macros I decided to move it to the documentation section, since the text became too large to maintain it here. It doesn't really mean it's close to be finished, though - there are so many things I'd like to write about, however I have to keep the track of what should be explained in what order to make it as clear as possible.

BTW, I also updated the manual there to the most up-to-date one for fasm 1.65, and called the 1.64 the "last milestone" release instead of the "last stable" - to avoid preventing people from getting the latest fixes and features just because of considering the development releases "unstable" (though some of them sometimes are ).
18 Mar 2006, 10:49

Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
In the macros section under the child macro there is:
"And the manual explain" in the end of a fourth line, should be "And the manual explains"

six lines down:
"and thus they only way to close", should be "and thus the only way to close"

Good examples at the end of the article
20 Mar 2006, 09:51
Tomasz Grysztar

Joined: 16 Jun 2003
Posts: 8346
Location: Kraków, Poland
Tomasz Grysztar 21 Mar 2006, 08:34
21 Mar 2006, 08:34
Matrix

Joined: 04 Sep 2004
Posts: 1166
Location: Overflow
Matrix 08 Apr 2006, 08:49
Nice - can't wait to read another section

btw, an easy code to make the assembler suffer:
Code:
```dd x,y
;7 passes
x= 14+y
y= 120/x
```

Code:
```dd x,y
64 passes
x=y+y
y=x-2
```

I'm doing Neural Networks right now so I'm really interested in "learning" like this

wow
fasm can solve linear equations?
next thing whould be to add support for matrices, solve with cramer's law let's say.

hehe better code to make a parser suffer is:
Code:
```dd x,y,z
x=2*y+1
y=z-2*x
z=x+2*y

;2*y+1=x
;z-2*x=y
;x+2*y=z
;
;2*y+1=x
;(x+2*y)-2*x=y
;
;(2*y+1+2*y)-2*(2*y+1)=y
;
;4y+1-4y-2=y
;
;-1=y
;-1=x
;-3=z
```

we could give an assembler the 4x3 matrix with variables
could do your homework too by writing the steps ...
08 Apr 2006, 08:49
vid
Verbosity in development

Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 08 Apr 2006, 09:07
Matrix: this is just side effect of fasm's multi-pass system. It's way it solves such things is not very mathematical and not very good, and often it doesn't lead to result. It's main feature is that: if it produces some result, you can be sure it is good. There's reason need to add such things, that would be counterproductive.
08 Apr 2006, 09:07
UCM

Joined: 25 Feb 2005
Posts: 285
UCM 09 Apr 2006, 18:01
the problem is mainly that division is integer-only, so any problems involving division will have reduced accuracy
09 Apr 2006, 18:01
Tomasz Grysztar

Joined: 16 Jun 2003
Posts: 8346
Location: Kraków, Poland
Tomasz Grysztar 15 Jun 2006, 12:21
I'm back and just wrote another section - explaining the tokenization in order to prepare ground for detailed explanations on IRPS and MATCH.
But at the same time I had a good opportunity to describe the things about "source reader" in details (and, in particular, explain the current place of the FIX directive in the overall image).

Perhaps this whole article is still too much a compact form in some places, but there are so many important things I want to write about there, that I'm not able to dwell too long about some single details. I just hope this can be enough to understand how all those things work by some people that may then write their own, easier, tutorials etc.
15 Jun 2006, 12:21
Tomasz Grysztar

Joined: 16 Jun 2003
Posts: 8346
Location: Kraków, Poland
Tomasz Grysztar 04 Aug 2006, 17:01
r22 wrote:

http://developer.amd.com/devtools.aspx
At the bottom of this page it lists NASM and YASM as suggested free assemblers to use.

If you feel as I do, that FASM should be on that list, then make sure to click on the "Contact Us" link at the bottom of the page and voice your opinion to AMD.

They don't seem to be interested in revalidating/updating that page, do they?
04 Aug 2006, 17:01
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

 Jump to: Select a forum Official----------------AssemblyPeripheria General----------------MainTutorials and ExamplesDOSWindowsLinuxUnixMenuetOS Specific----------------MacroinstructionsOS ConstructionIDE DevelopmentProjects and IdeasNon-x86 architecturesHigh Level LanguagesProgramming Language DesignCompiler Internals Other----------------FeedbackHeapTest Area
Goto page Previous  1, 2

Forum Rules:
 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum