FASM (''flat assembler'') is an
assembler for
x86 processors. It supports
Intel-style assembly language
In computer programming, assembly language (or assembler language, or symbolic machine code), often referred to simply as Assembly and commonly abbreviated as ASM or asm, is any low-level programming language with a very strong correspondence be ...
on the
IA-32 and
x86-64 computer architectures. It claims high speed, size optimizations,
operating system (OS) portability, and
macro
Macro (or MACRO) may refer to:
Science and technology
* Macroscopic, subjects visible to the eye
* Macro photography, a type of close-up photography
* Image macro, a picture with text superimposed
* Monopole, Astrophysics and Cosmic Ray Observat ...
abilities.
It is a
low-level
High-level and low-level, as technical terms, are used to classify, describe and point to specific goals of a systematic operation; and are applied in a wide range of contexts, such as, for instance, in domains as widely varied as computer scienc ...
assembler
and intentionally uses very few
command-line options. It is
free and open-source software
Free and open-source software (FOSS) is a term used to refer to groups of software consisting of both free software and open-source software where anyone is freely licensed to use, copy, study, and change the software in any way, and the source ...
.
All versions of FASM can directly output any of the following: flat "raw"
binary (usable also as MS-DOS
COM executable or SYS driver), objects:
Executable and Linkable Format (ELF) or
Common Object File Format (COFF) (classic or MS-specific), or executables in either
MZ, ELF, or
Portable Executable (PE) format (including WDM drivers, allows custom MZ DOS stub). An unofficial port targeting the
ARM architecture
ARM (stylised in lowercase as arm, formerly an acronym for Advanced RISC Machines and originally Acorn RISC Machine) is a family of reduced instruction set computer (RISC) instruction set architectures for computer processors, configured ...
FASMARM also exists.
History
The project was started in 1999 by Tomasz Grysztar, a.k.a. ''Privalov'', at that time an undergraduate student of mathematics from
Poland. It was released publicly in March 2000.
FASM is completely written in
assembly language
In computer programming, assembly language (or assembler language, or symbolic machine code), often referred to simply as Assembly and commonly abbreviated as ASM or asm, is any low-level programming language with a very strong correspondence be ...
and comes with full source. It is
self-hosting and has been able to assemble itself since version 0.90 (May 4, 1999).
FASM originally ran in 16-bit
flat real mode. 32-bit support was added and then supplemented with optional
DPMI support. Designed to be easy to port to any operating system with flat 32-bit addressing, it was ported to Windows, then Linux.
Design
FASM does not support as many
high-level
High-level and low-level, as technical terms, are used to classify, describe and point to specific goals of a systematic operation; and are applied in a wide range of contexts, such as, for instance, in domains as widely varied as computer scienc ...
statements as
MASM
The Microsoft Macro Assembler (MASM) is an x86 assembler that uses the Intel syntax for MS-DOS and Microsoft Windows. Beginning with MASM 8.0, there are two versions of the assembler: One for 16-bit & 32-bit assembly sources, and another (ML64) ...
or
TASM
Turbo Assembler (sometimes shortened to the name of the executable, TASM) is an assembler for software development published by Borland in 1989. It runs on and produces code for 16- or 32-bit x86 MS-DOS and compatible on Microsoft Windows. It ...
.
It provides syntax features and macros, which make it possible to customize or create missing statements.
Its memory-addressing syntax is similar to TASM's ideal mode and
NASM. Brackets are used to denote memory operands as in both assemblers, but their size is placed outside the brackets, like in NASM.
FASM is a multi-pass assembler. It makes extensive code-size optimization and allows unconstrained forward referencing.
An unusual FASM construct is defining procedures only if they are used somewhere in the code, something that in most languages is done per-object by the
linker.
FASM is based on the "same source, same output" principle: the contents of the resulting file are not affected by the command line.
Such an approach saves FASM sources from compiling problems often present in many assembly projects. On the other hand, it makes it harder to maintain a project that consists of multiple separately compiled source files or mixed-language projects. However, there exists a Win32
wrapper called FA, which mitigates this problem.
FASM projects can be built from one source file directly into an executable file without a linking stage.
IDE
Fresh, an internet community supported project started by John Found, is an
integrated development environment for FASM.
Fresh currently supports Microsoft Windows and Linux.
[
]
Use
Operating systems written with FASM:
* MenuetOS
MenuetOS is an operating system with a monolithic preemptive, real-time kernel written in FASM assembly language. The system also includes video drivers. It runs on 64-bit and 32-bit x86 architecture computers. Its author is Ville M. Turjanma ...
– 32- and 64-bit GUI operating systems by Ville Turijanmaa
* KolibriOS
KolibriOS, or Kolibri, is a small, open-source x86 operating system written completely in assembly. It was forked from MenuetOS in 2004 and has run under independent development since.
In a 2009 review piece on alternative operating systems, ''T ...
Compilers that use FASM as a backend:
* PureBasic
PureBasic is a commercially distributed procedural computer programming language and integrated development environment based on BASIC and developed by Fantaisie Software for Windows, Linux, and macOS. An Amiga version is available, although ...
* High Level Assembly
High Level Assembly (HLA) is a language developed by Randall Hyde that allows the use of higher-level language constructs to aid both beginners and advanced assembly developers. It fully supports advanced data types and object-oriented programmi ...
(HLA)
* BlitzMax
Blitz BASIC is the programming language dialect of the first Blitz compilers, devised by New Zealand-based developer Mark Sibly. Being derived from BASIC, Blitz syntax was designed to be easy to pick up for beginners first learning to program. T ...
See also
* Comparison of assemblers
This is an incomplete list of assemblers: computer programs that translate assembly language source code into binary programs. Some assemblers are components of a compiler system for a high level language and may have limited or no usable functio ...
References
External links
* FASM project:
FASMLIB
0.8.0 – portable 32-bit x86 asm lib for FASM/MASM/YASM/NASM/GASM
FASMARM
– FASM for ARM processors, v1.27,
The Fresh IDE
{{X86 assembly topics
2000 software
Assemblers
DOS software
Free software primarily written in assembly language
Linux programming tools
Programming tools for Windows
Self-hosting software
Unix programming tools