Author Topic: Macro Assembler Syntax vs NASM - YASM - FASM  (Read 3391 times)

LiaoMi

  • Member
  • *****
  • Posts: 1014
Macro Assembler Syntax vs NASM - YASM - FASM
« 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

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

Quote
NASM 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?

Quote
In 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/
Quote
I'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:

HSE

  • Member
  • *****
  • Posts: 2078
  • AMD 7-32 / i3 10-64
Re: Macro Assembler Syntax vs NASM - YASM - FASM
« Reply #1 on: August 30, 2021, 05:13:05 AM »
Hi Liaomi!!

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.

...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.
 
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.
Equations in Assembly: SmplMath

jj2007

  • Member
  • *****
  • Posts: 12469
  • Assembler is fun ;-)
    • MasmBasic
Re: Macro Assembler Syntax vs NASM - YASM - FASM
« Reply #2 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.

nidud

  • Member
  • *****
  • Posts: 2390
    • https://github.com/nidud/asmc
Re: Macro Assembler Syntax vs NASM - YASM - FASM
« Reply #3 on: August 31, 2021, 02:47:31 AM »
deleted
« Last Edit: February 26, 2022, 05:07:49 AM by nidud »

nidud

  • Member
  • *****
  • Posts: 2390
    • https://github.com/nidud/asmc
Re: Macro Assembler Syntax vs NASM - YASM - FASM
« Reply #4 on: August 31, 2021, 08:02:25 AM »
deleted
« Last Edit: February 26, 2022, 05:08:01 AM by nidud »

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 9341
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Macro Assembler Syntax vs NASM - YASM - FASM
« Reply #5 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.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

TouEnMasm

  • Member
  • *****
  • Posts: 1804
    • EditMasm
Re: Macro Assembler Syntax vs NASM - YASM - FASM
« Reply #6 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:
Fa is a musical note to play with CL

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 9341
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Macro Assembler Syntax vs NASM - YASM - FASM
« Reply #7 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:
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

daydreamer

  • Member
  • *****
  • Posts: 1987
  • "follow the blue star!!!"
Re: Macro Assembler Syntax vs NASM - YASM - FASM
« Reply #8 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:
SIMD fan and macro fan
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Teacher "REAL8 + QWORD is like apples and oranges,you cant mix them"
Student "ofcourse you can,it becomes a fruit salad" :)

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 9341
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Macro Assembler Syntax vs NASM - YASM - FASM
« Reply #9 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:
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

HSE

  • Member
  • *****
  • Posts: 2078
  • AMD 7-32 / i3 10-64
Re: Macro Assembler Syntax vs NASM - YASM - FASM
« Reply #10 on: September 02, 2021, 11:27:14 PM »
REAL MEN[tm] write in HEX notation.  :skrewy:
Yesss!  And they can build computers with needles and coconuts.  :biggrin:
Equations in Assembly: SmplMath

TimoVJL

  • Member
  • ****
  • Posts: 999
Re: Macro Assembler Syntax vs NASM - YASM - FASM
« Reply #11 on: September 03, 2021, 12:10:57 AM »
Most programmers just use use best available tools :undecided:
May the source be with you

daydreamer

  • Member
  • *****
  • Posts: 1987
  • "follow the blue star!!!"
Re: Macro Assembler Syntax vs NASM - YASM - FASM
« Reply #12 on: September 04, 2021, 03:51:17 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
SIMD fan and macro fan
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Teacher "REAL8 + QWORD is like apples and oranges,you cant mix them"
Student "ofcourse you can,it becomes a fruit salad" :)

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 9341
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Macro Assembler Syntax vs NASM - YASM - FASM
« Reply #13 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.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

askm

  • Regular Member
  • *
  • Posts: 6
Re: Macro Assembler Syntax vs NASM - YASM - FASM
« Reply #14 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.