Rahul Sharma (Editor)

FASM

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit
Developer(s)
  
Tomasz Grysztar

Type
  
Assembler

Platform
  
x86, x86-64

FASM

Initial release
  
March 2000; 17 years ago (2000-03)

Stable release
  
1.71.54 / June 9, 2016; 8 months ago (2016-06-09)

Operating system
  
MS-DOS and IDE, Windows and IDE, Unix-like (Linux, OpenBSD, etc.), MenuetOS, KolibriOS, OctaOS, DexOS and IDE, SkyOS, Solar_OS

FASM (flat assembler) is an assembler for x86 processors. It supports Intel-style assembly language on the IA-32 and x86-64 computer architectures. It claims high speed, size optimizations, operating system (OS) portability, and macro abilities. It is a low-level assembler and intentionally uses very few command-line options. It is free and open-source software.

Contents

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 (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 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 only ran in 16-bit flat real mode. 32-bit support was added and then supplemented with optional DPMI support. It was written in a way that made it easy to port to any operating system that allowed flat 32-bit addressing; it was ported to Windows and then Linux.

Design

FASM does not support as many high-level statements as MASM or TASM. 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.

Fresh IDE

Fresh, an internet community supported project started by John Found, is an integrated development environment (IDE) for flat assembler language. The primary goal of Fresh is to make programming in assembly as fast and efficient as in other visual languages, without sacrificing the small application size and the raw power of assembly language. Fresh can be used for Windows programming, but also to create programs for any OS that FASM supports: MS-DOS, Linux, FreeBSD, BeOS, MenuetOS.

Use

Operating systems written with FASM:

  • DexOS by Ville Turijanmaa
  • MenuetOS – 32- and 64-bit GUI operating systems
  • KolibriOS
  • Compilers that use FASM as a backend:

  • PureBasic
  • High Level Assembly (HLA)
  • BlitzMax
  • References

    FASM Wikipedia