The MASM Forum

Miscellaneous => The Orphanage => Topic started by: LiaoMi on August 29, 2021, 11:56:52 PM

Title: Macro Assembler Syntax vs NASM - YASM - FASM
Post by: LiaoMi on August 29, 2021, 11:56:52 PM
Hello everybody  :cool:,

I have a question, why parallel projects like NASM or FASM are so popular among system programmers? Even Microsoft and Intel, as well as Linux developers use these assemblers in their work. All projects are often assembled with only two assemblers, NASM and FASM. Intel, for example, wrote a small python converter to convert MASM to NASM.

Nasm vs Masm? - http://www.asmcommunity.net/forums/topic/?id=28555
What differs MASM from NASM? http://www.asmcommunity.net/forums/topic/?id=6544

QuoteNASM is considered to be one of the most popular assemblers for Linux.
Is this the reason for the popularity?

QuoteNASM can create flat binary files, usable to write boot loaders, read-only memory (ROM) images, and in various facets of OS development.
Maybe this is the reason?

QuoteIn July 2009, as of version 2.07, NASM was released under the Simplified (2-clause) BSD license. Previously, because NASM was licensed under LGPL, it led to development of Yasm, a complete rewrite of the NASM under the New BSD License. Yasm offered support for x86-64 earlier than NASM. It also added support for GNU Assembler syntax.

Chapter 4: The NASM Preprocessor
https://www.nasm.us/xdoc/2.14.02/html/nasmdoc4.html

From those who use these assemblers, I often hear that the macro assembler(MASM) is too complicated.

https://en.wikipedia.org/wiki/Comparison_of_assemblers
FASM   Tomasz Grysztar   Windows, DOS, Linux, Unix-like
MASM   Microsoft                   Windows, DOS, OS/2
NASM   Simon Tatham     Linux, macOS, Windows, DOS, OS/2
Yasm   xxx                       Windows, DOS, Linux, Unix-like

https://www.reddit.com/r/asm/comments/gzycfn/ive_been_looking_at_fasm_instead_of_using_nasm/
QuoteI've been looking at FASM instead of using NASM. What are the benefits?
I am a Linux user. I use Netwide Assembler in x86, and I want to use FASM (I am mainly learning assembler for OS Development). Here is what I want from my assembler:

To be simple to use. I don't like having all this complex syntax, such as GAS assembler with it's AT&T syntax.
To be fast. I don't want to wait long to compile my code, and it should also run fast.

Quick Start for MASM Users
https://www.nasm.us/doc/nasmdoc2.html#section-2.2

After all, I came to the conclusion that most assembler programmers who do not use macro assembler do not know how to combine high-level logic with assembler, logic, that is clearly reflected in the syntax of macro assembler. This was a great discovery for me!

Alternative opinions are welcome  :tongue: :thup:
Title: Re: Macro Assembler Syntax vs NASM - YASM - FASM
Post by: HSE on August 30, 2021, 05:13:05 AM
Hi Liaomi!!

Quote from: LiaoMi on August 29, 2021, 11:56:52 PM
why parallel projects like NASM or FASM are so popular among system programmers? Even Microsoft and Intel, as well as Linux developers use these assemblers in their work. All projects are often assembled with only two assemblers, NASM and FASM.
They usually build small and specifics tools. For sure there are source code templates available in that flavors.

Quote from: LiaoMi on August 29, 2021, 11:56:52 PM
...most assembler programmers who do not use macro assembler do not know how to combine high-level logic with assembler, logic, that is clearly reflected in the syntax of macro assembler.
At least they don't have the training, NASM and FASM are not well suited for big projects or fast projects. Their macros are almost bare metal. In MASM we can see complex projects builded by people with training in Basic or C++ projects, and is possible to translate some of that projects easily.

Quote from: LiaoMi on August 29, 2021, 11:56:52 PM
From those who use these assemblers, I often hear that the macro assembler(MASM) is too complicated.
Yes, you need a forum  :biggrin: :biggrin: :biggrin:

Regards, HSE.
Title: Re: Macro Assembler Syntax vs NASM - YASM - FASM
Post by: jj2007 on August 30, 2021, 11:46:34 PM
IIRC they don't have macros that return values as in print str$(ecx). Otherwise, no big differences. Speedwise they are probably similar, especially if you consider the fast MASM clones AsmC and UAsm.
Title: Re: Macro Assembler Syntax vs NASM - YASM - FASM
Post by: nidud on August 31, 2021, 02:47:31 AM
deleted
Title: Re: Macro Assembler Syntax vs NASM - YASM - FASM
Post by: nidud on August 31, 2021, 08:02:25 AM
deleted
Title: Re: Macro Assembler Syntax vs NASM - YASM - FASM
Post by: hutch-- on August 31, 2021, 09:32:52 AM
 :biggrin:

I guess its the case that different assembler target different tasks. NASM has long been a specialised tool that can be used in unusual places and that is much of its strength. FASM is in fact a very good tool that produces good quality code when written properly as is the case with GAS that is highly under rated.

MASM (32 bit) is an old industry standard and had been going since 1982 so M$ have had long enough to keep tweaking it for later OS versions. The 64 bit version is much later and apart from a very similar pre-processor, it is a different animal to the old ML.EXE, its simpler and faster to use than the old ML.EXE.

The collection of Watcom derivatives effectively use the architecture (user level) of the 32 bit version of MASM and cater for a market where MASM licencing excludes their use. Both John and Nidud have done quality development work on Watcom derivatives and the only problem with John's work is the lack of support with libraries and includes. I don't know enough about Nidud's assembler to make any detailed comments.

One factor that is missed by many is the duration and availability over long periods. Many have fallen by the wayside over time but MASM just keeps going and while it is hardly altruism from M$, it just happens to be that an OS vendor must have their own for their own internal purpose.
Title: Re: Macro Assembler Syntax vs NASM - YASM - FASM
Post by: TouEnMasm on August 31, 2021, 04:50:10 PM
Quote
The 64 bit version is much later and apart from a very similar pre-processor, it is a different animal to the old ML.EXE, its simpler and faster to use than the old ML.EXE.
:toothy:
Title: Re: Macro Assembler Syntax vs NASM - YASM - FASM
Post by: hutch-- on September 02, 2021, 11:14:47 AM
 :toothy:

This is a comment from someone who still tries to use ML64 like the olf ML.  :tongue:  :skrewy:
Title: Re: Macro Assembler Syntax vs NASM - YASM - FASM
Post by: daydreamer on September 02, 2021, 08:21:16 PM
so which assembler is most suited for bare metal coder?,masm must be a waste with all its macros for bare metal coder :greenclp:
Title: Re: Macro Assembler Syntax vs NASM - YASM - FASM
Post by: hutch-- on September 02, 2021, 09:19:40 PM
Any assembler can write pure mnemonic code. Not so many assembler programmers can write it.  :tongue:

No one forces you to use the pre-processor and as you know, REAL MEN[tm] write in HEX notation.  :skrewy:
Title: Re: Macro Assembler Syntax vs NASM - YASM - FASM
Post by: HSE on September 02, 2021, 11:27:14 PM
Quote from: hutch-- on September 02, 2021, 09:19:40 PM
REAL MEN[tm] write in HEX notation.  :skrewy:
Yesss!  And they can build computers with needles and coconuts.  :biggrin:
Title: Re: Macro Assembler Syntax vs NASM - YASM - FASM
Post by: TimoVJL on September 03, 2021, 12:10:57 AM
Most programmers just use use best available tools :undecided:
Title: Re: Macro Assembler Syntax vs NASM - YASM - FASM
Post by: daydreamer on September 04, 2021, 03:51:17 AM
Quote from: TimoVJL on September 03, 2021, 12:10:57 AM
Most programmers just use use best available tools :undecided:
But with online compiling, run programs to exercises don't that mean you can't avoid indirectly use server side scripting? :D
Title: Re: Macro Assembler Syntax vs NASM - YASM - FASM
Post by: hutch-- on September 05, 2021, 08:00:53 PM
 :biggrin:

Hector,

> And they can build computers with needles and coconuts.

You will have to share this technique with me.
Title: Re: Macro Assembler Syntax vs NASM - YASM - FASM
Post by: askm on September 06, 2021, 12:23:38 AM
The following is a transcript:
The only thing I can think is the abacus, using a hieroglyphic level language
constructs. Did history ever record the Abacus Machine Language Manual ?
Like the transistors that shrank later, the early abacus foundries had to shrink
the coconuts to something smaller, like some tree wood or soft mineral chunk.
Branch (tree) prediction ? Micro (soft) minerals ?
We have it easy today. Imagine having to push and pop coconuts with crude
tools while possibly being poked with needles that overflowed the abacus stacks.
There must be some evidence of this in the archaeological digs.
I know what you're thinking. Yes there was an iAbacus, and was first used in-cave.
Hackers later came in. They knew they had to backup. Hit over the head, the
first memory bugs and vulnerabilities were created. Come to thump of it, why
coconuts? Why not onions? Thus the beginnings of cryptography, and onion
networks. Monkey please... get off my backup ! Sorry, about that.
We need to uncover further and explore further the earliest unknowns of syntax.
Title: Re: Macro Assembler Syntax vs NASM - YASM - FASM
Post by: HSE on September 06, 2021, 06:02:08 AM
 :biggrin: :biggrin:

Quote from: hutch-- on September 05, 2021, 08:00:53 PM
> And they can build computers with needles and coconuts.

You will have to share this technique with me.

Only Real Men trademark can do that!!

I can't write in Hex notation   :eusa_snooty:
Title: Re: Macro Assembler Syntax vs NASM - YASM - FASM
Post by: HSE on September 06, 2021, 06:26:37 AM
Quote from: askm on September 06, 2021, 12:23:38 AM
Imagine having to push and pop coconuts with crude
tools while possibly being poked with needles that overflowed the abacus stacks.

:biggrin: :eusa_clap:

Quote from: askm on September 06, 2021, 12:23:38 AM
Did history ever record the Abacus Machine Language Manual ?

Abacus is still in use recently. For sure there is a manual. If not, should be not a big problem to write one.

But is know that Greeks (~400 BC) maked calculations using some kind of wood boxes in wich they placed little stones. And nobody know how that worked. They write results in what we know now as "roman" numbers, and is pretty hard to make calculations using them.
Title: Re: Macro Assembler Syntax vs NASM - YASM - FASM
Post by: hutch-- on September 06, 2021, 02:19:13 PM
 :biggrin:

Ah, now I get it, a mystical device whose origin is lost in the mists of time that was so powerful that mere mortals prostrated themselves in the presence of those who could operate these magical devices. While modern technology has downgraded the heights of such ancient technology to electric idiots that can only count in 1s and 0s, a true master of such an ancient device could eat them alive with their analogue interface and magical methods of calculation that were completed while ordinary mortals were trying to work out how to enter that data with a keyboard.

Now the artisans of such magical devices were not willing to share their trade secrets so later researchers had to try and learn these secrets by trial and error and they have only had minor success in such an undertaking. So far they have learnt that the beads have to have the right mass and while this may have religious connotations, it also meant that the weight had to be right, too light and they bounced which produced rounding errors, too heavy and you trimmed off the last few digits.

Construction techniques were subject to rare and difficult to find materials, the tracks that the beads ran on had to have the lowest coefficience of friction possible so the very best was skinned with woven pubic hair of virgins that lived in red light areas. To get the right resonance, the frame to hang it all off was constructed from the wishbone of an ass then coloured with rare and exotic substances that were transported by camel train from equally rare and exotic locations in the world than no sane person would ever enter.

With such difficulties, now you know why the electric idiots have gained in popularity as a high end ancient device was generally beyond the means of the great unwashed.  :tongue:
Title: Re: Macro Assembler Syntax vs NASM - YASM - FASM
Post by: TouEnMasm on September 06, 2021, 06:28:38 PM

The masm macros are the way to avoid hieroglyphic coding.
Perhaps nasm have some popularity I don't understand for what.
Some say than nasm have few bugs than masm but it stay to made proof of that.
Title: Re: Macro Assembler Syntax vs NASM - YASM - FASM
Post by: TimoVJL on September 06, 2021, 07:32:20 PM
Quote from: TouEnMasm on September 06, 2021, 06:28:38 PM

The masm macros are the way to avoid hieroglyphic coding.
Perhaps nasm have some popularity I don't understand for what.
Some say than nasm have few bugs than masm but it stay to made proof of that.
masm exists only in DOS / Windows
Title: Re: Macro Assembler Syntax vs NASM - YASM - FASM
Post by: TouEnMasm on September 06, 2021, 07:41:08 PM
Quote
masm exists only in DOS / Windows
Only ????????????????
The only is just 96% of the computers in the world.Ok linux exist but i am not sure he couldn't use masm.
https://halcyoona.wordpress.com/2018/09/15/run-masm-on-linux/
and now what stay ?
Title: Re: Macro Assembler Syntax vs NASM - YASM - FASM
Post by: jj2007 on September 06, 2021, 08:22:59 PM
Quote from: hutch-- on September 06, 2021, 02:19:13 PMpubic hair of virgins that lived in red light areas

That might be difficult to find, I agree :tongue:
Title: Re: Macro Assembler Syntax vs NASM - YASM - FASM
Post by: HSE on September 06, 2021, 10:42:54 PM

Quote from: hutch-- on September 06, 2021, 02:19:13 PM
Ah, now I get it, a mystical device whose origin is lost in the mists of time that was so powerful that mere mortals prostrated themselves in the presence of those who could operate these magical devices. While modern technology has downgraded the heights of such ancient technology to electric idiots that can only count in 1s and 0s, a true master of such an ancient device could eat them alive with their analogue interface and magical methods of calculation that were completed while ordinary mortals were trying to work out how to enter that data with a keyboard.

That it's true. I can't imagine how to enter data with a keyboard in a simple piece of wood.  :biggrin:  It's just like a board game, you move the stones with the hand.

Very interesting, searching a litttle, happen that greek board evolved in roman board (or roman abacus). Roman name for litlle stone is "calculi", then calculation is to move the stones!!

Of course, until Newton and Leibniz, calculation was sum, rest, multiplication and division.  :biggrin:

Apparently all this kind of devices evolve from Sumerian abacus that appeared between 2700–2300 BC. For sure at that time the wood with some lines drawed on it was a mystical device.

Title: Re: Macro Assembler Syntax vs NASM - YASM - FASM
Post by: daydreamer on September 06, 2021, 11:38:40 PM
first ever chess computer was a fraud,inside the box they hid a dwarf that took care of "computer" chess moves :greenclp:
some ancient civilisation had 60 as base,seem even more advanced than hexadecimal
but we inherit 60s=minute,60minutes=hour from them
Title: Re: Macro Assembler Syntax vs NASM - YASM - FASM
Post by: hutch-- on October 04, 2021, 09:09:45 AM
In the days of yaw, 60 was a good number, it could be divided by 12, 6, 5, 4, 3 and 2. We have base 10 for an obvious reason, if you can count fingers and two thumbs you have hit the big time for analogue calculations. Its only electric idiots that use powers of 2.
Title: Re: Macro Assembler Syntax vs NASM - YASM - FASM
Post by: mineiro on October 04, 2021, 09:47:54 AM
I believe it was the Incas, Aztecs or Mayans who used base 20; fingers and toes.

We use base 10 for several reasons; initially for having 10 fingers on the hands. But he stuck with Pythagoras. He created the word math and philosopher. For him 10 was a beautiful, harmonic number. It was the sum of 1+2+3+4; or just earth, fire, water and air.
Pythagoreans discovered that certain quantities could not be represented by a whole integers numbers or a fraction of whole integers numbers.
Title: Re: Macro Assembler Syntax vs NASM - YASM - FASM
Post by: daydreamer on October 07, 2021, 08:02:57 PM
Quote from: mineiro on October 04, 2021, 09:47:54 AM
I believe it was the Incas, Aztecs or Mayans who used base 20; fingers and toes.

We use base 10 for several reasons; initially for having 10 fingers on the hands. But he stuck with Pythagoras. He created the word math and philosopher. For him 10 was a beautiful, harmonic number. It was the sum of 1+2+3+4; or just earth, fire, water and air.
Pythagoreans discovered that certain quantities could not be represented by a whole integers numbers or a fraction of whole integers numbers.
hot climate without shoes=you could also count with the toes,but European climate shoes capped it to be only 10 fingers :bgrin:
wonder if tristate base 3,electronic circuits one and zeros and third state is signal=idle
would solve the 10/3 =3.3333333333... endless 3's and other endless decimals problems?
Title: Re: Macro Assembler Syntax vs NASM - YASM - FASM
Post by: mineiro on October 09, 2021, 04:05:56 AM
Quote from: daydreamer on October 07, 2021, 08:02:57 PM
would solve the 10/3 =3.3333333333... endless 3's and other endless decimals problems?
This type of problem happens with any numeric base.
I think was russians that developed a ternary machine.
Title: Re: Macro Assembler Syntax vs NASM - YASM - FASM
Post by: hutch-- on October 10, 2021, 06:30:25 AM
 :biggrin:


Base 3. = 1,2,3

conversion,
                 1 = .3 repeater
                 2 = .6 repeater
                 3 = 1.0


    or

One Third.
Title: Re: Macro Assembler Syntax vs NASM - YASM - FASM
Post by: nidud on October 10, 2021, 11:39:06 PM
deleted