Jump to content

FASM

From Niidae Wiki
Revision as of 13:20, 26 April 2025 by imported>Widefox (top: fix hatnote)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Template:Short description Template:For Template:Infobox software

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.<ref name="Manual">Template:Cite web</ref><ref name="WhichAsm"/> It is a low-level assembler<ref name="WhichAsm"/> and intentionally uses very few command-line options. It is free and open-source software.

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.<ref name="ARM">Template:Cite web</ref>

History

[edit]

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.<ref name="Interview">Template:Cite web</ref><ref name="Release">Template:Cite web</ref> 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 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

[edit]

FASM does not support as many high-level statements as MASM or TASM.<ref name="WhichAsm">Template:Cite web</ref> It provides syntax features and macros, which make it possible to customize or create missing statements.<ref name="Interview"/> 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.<ref name="Design"/>

FASM is a multi-pass assembler. It makes extensive code-size optimization and allows unconstrained forward referencing.<ref name="WhichAsm"/><ref name="Design">Template:Cite web</ref> 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.<ref name="Design"/> 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.<ref name="FA">Template:Cite web</ref> FASM projects can be built from one source file directly into an executable file without a linking stage.<ref name="WhichAsm" />

IDE

[edit]

Fresh, an internet community supported project started by John Found, is an integrated development environment for FASM.<ref name="fresh">Template:Cite web</ref> Fresh currently supports Microsoft Windows and Linux.<ref name=fresh/>

Use

[edit]

Operating systems written with FASM:

Compilers that use FASM as a backend:

See also

[edit]

References

[edit]

Template:Reflist

[edit]

Template:X86 assembly topics