Fact-checked by Grok 2 weeks ago

FASM

FASM, commonly known as the flat assembler, is an open-source assembler for x86 assembly language programming, primarily designed to compile code for IA-32 and x86-64 architectures. Developed by Tomasz Grysztar since 1999, it operates as a self-hosting tool that runs on multiple operating systems including DOS, Windows, Linux, and others, while producing output formats such as plain binary, MZ, PE, COFF, ELF, and Mach-O. Its name reflects a historical emphasis on flat memory models in early x86 programming. The project originated as a fast and efficient assembler for and has evolved through continuous development, with major versions including FASM 1, FASM 2 (which introduced scripting and header systems based on an advanced engine), and FASMg (a successor engine adaptable to various architectures via modular packages). FASM remains actively maintained under Grysztar's leadership, with its source code available on , fostering a community for enthusiasts. Key milestones include support for instruction set extensions like MMX, (up to ), AVX (up to ), 3DNow!, and XOP, enabling optimization for modern processors. Notable features of FASM include a powerful macroinstruction for and reuse, multi-pass for optimization and symbol resolution, and a compact that prioritizes speed and simplicity without relying on external libraries. It supports Intel-style syntax and is particularly valued in low-level programming, operating system development, and embedded due to its ability to produce highly efficient binaries. The tool's , including user manuals and advanced guides, is freely accessible, emphasizing its role in and coding.

Development History

Origins and Initial Release

FASM, or Flat Assembler, originated as a personal project initiated by Tomasz Grysztar, a Polish programmer based in , in 1999. Motivated by his interest in programming for games and operating system development during high school, Grysztar sought to create an efficient tool for x86 assembly that addressed limitations in existing assemblers like NASM and TASM, which he found unsatisfactory for his needs in producing optimized code without a personal copy of commercial alternatives. The project began as a effort, with Grysztar writing the entire assembler in to ensure it could bootstrap itself and run independently. Initial development centered on a 16-bit assembler designed for flat operation, reflecting the era's environment constraints. This foundation quickly evolved to incorporate 32-bit support, including optional extensions, enabling execution for more sophisticated programs while preserving compatibility with legacy systems. The core goal was to produce compact, self-contained tools that minimized overhead, allowing programmers to generate flat binary outputs directly—ideal for bootloaders, kernels, and files—without external dependencies like linkers or debuggers. The first public release, version 1.00, arrived in March 2000, with Grysztar announcing it on the developers on March 15. Distributed as a free, open-source package complete with its , this version emphasized speed and portability across , Windows, and early systems, marking FASM's entry as a viable for x86 developers seeking tools. From its inception, FASM adopted a simplified BSD license with a weak provision, which permitted free modification and redistribution while requiring attribution to the original author and inclusion of the license text in any derivatives. This licensing approach encouraged community contributions and adaptations, aligning with Grysztar's vision of an accessible, evolving assembler unburdened by restrictive terms.

Key Milestones and Versions

One of the early key milestones in FASM's development was the achievement of self-hosting in version 0.90, released on May 4, 1999, which enabled the assembler to compile its own source code. This capability marked a significant step in its maturity, allowing for efficient bootstrapping and verification of the tool's core functionality without reliance on external assemblers. In the early 2000s, FASM expanded its portability across operating systems, with versions supporting , Windows, and environments to facilitate cross-platform assembly of x86 code. A major enhancement came in version 1.64, released in , which introduced support for the instruction set, enabling the generation of 64-bit executables and broadening its applicability to modern architectures. The stable 1.73 series, beginning around , focused on reliability and incremental improvements, culminating in version 1.73.32 on December 4, 2023, which incorporated bug fixes and support for additional x86 instructions. Performance enhancements during this period included the refinement of multi-pass techniques for code optimization and forward referencing, which allowed developers to use symbols before their definitions without initial size calculations, improving coding flexibility. Community contributions played a vital role in shaping later versions, such as 1.70 released in 2012, which integrated user-submitted macros and addressed bug reports to enhance output formats like ELF and PE for better compatibility with Linux and Windows executables. These updates ensured FASM remained a robust tool for low-level programming, with ongoing refinements driven by developer feedback up to the 1.73 series.

Emergence of FASMg as Successor

In 2015, Tomasz Grysztar announced FASMg, initially under the working title "fasm g," as a successor to the assembly engine of the original Flat Assembler (FASM), aiming to create a generic, architecture-agnostic framework written entirely in . This development marked a shift from FASM's x86-centric design toward a more adaptable system capable of supporting multiple architectures, such as x86, , 8051, AVR, and even JVM , through macro-based descriptions of instruction sets that allow users to build custom assemblers. Unlike the original FASM, which integrated x86-specific instructions directly, FASMg employs a unified macroinstruction language without a separate , enabling multi-pass processing for dependency resolution while prioritizing flexibility over initial speed. Key differences include FASMg's core as a bare engine for data generation (e.g., via directives like and ), where instruction sets are implemented as loadable macros rather than hardcoded, facilitating easier extension to new architectures. It maintains partial compatibility with FASM syntax through a of directives, but introduces incompatibilities in macros and lacks built-in x86 support, requiring additional headers for such functionality. The goals emphasize broader applicability beyond x86, adherence to a "same source, same output" principle for reproducible results, and with FASM via layered macro implementations, allowing existing code to run atop the new with minimal adjustments. In July 2023, Grysztar released a preview of FASM 2 as a set of scripts and headers built on FASMg, demonstrating x86 assembler compatibility and new features like flexible encoding options (e.g., AVX support) while achieving with FASM 1 sources. This integration continued with updates through February 2024, addressing bugs in struct handling and label resolution to enhance stability. By March 2024, FASM 2 reached a demonstrable release, combining FASMg's engine with x86-specific enhancements for broader use. As of November 2025, FASMg remains in active development without a full stable release designated as a direct FASM successor, though it powers experimental multi-platform projects, including community efforts for ports and ongoing x86 optimizations. Discussions in early 2025 highlight compatibility refinements between FASM 2 and FASMg, with focus shifting toward the former for x86 tasks while FASMg evolves as the foundational engine for diverse architectures.

Technical Design

Core Assembler Architecture

The core assembler architecture of FASM (Flat Assembler) is designed as a multi-pass optimized for x86 processors, enabling efficient through iterative refinement. It performs multiple assembly passes—up to 100 by default (configurable up to a maximum of ), though typically far fewer in practice—to resolve forward references and minimize the size of the resulting . In the initial pass, the assembler scans the source to identify symbols and predict instruction lengths using the shortest possible encodings, such as short jumps where applicable. Subsequent passes update these predictions based on resolved addresses, adjusting instruction sizes as needed until no further changes occur or the pass limit is reached; this optimistic approach ensures compact output without the overhead of intermediate object files. FASM natively supports syntax for and instructions, including advanced extensions like and AVX, while eschewing high-level directives such as MASM's .MODEL in favor of explicit ing via directives like section and use32 or use64. This x86-specific design emphasizes direct control over layout and instruction encoding, allowing programmers to specify , , and other segments manually without relying on automated models. The assembler's flat philosophy underpins its output mechanism, producing raw binaries directly from the source without generating intermediate object files; portability across operating systems is achieved through the format directive, which adapts the output to specifications like or while maintaining the core raw stream. Symbol and label handling in FASM operates with and scopes, where labels prefixed with a period (.) are to the enclosing , and others are , facilitating modular code organization. Constants are defined using the equ directive, which assigns immediate values to at assembly time without generating code. Absent a built-in linker, FASM requires section alignment via the align directive to ensure proper boundaries for executable segments, placing the onus on the user for final linking in multi-module projects. Error handling is integrated inline during , providing immediate diagnostics for issues such as symbols or invalid opcodes, with messages like "error: illegal instruction" halting processing if unresolvable. Verbose output options, configurable via command-line flags, display details including pass counts, time, and bytes written, aiding without external tools. This streamlined error reporting aligns with FASM's lightweight , prioritizing speed and simplicity in the core engine.

Macro and Preprocessing System

FASM's macro system provides a flexible mechanism for and , allowing developers to define reusable constructs that expand into code during processing. Macros are defined using the macro directive followed by the macro name and optional parameters, with the body enclosed in a terminated by end macro or curly braces {}. Parameters are referenced positionally using the % symbol, such as %1 for the first argument, supporting both required arguments (marked with *) and those with defaults (marked with =). This design enables the creation of parameterized templates that substitute text directly into the source code, facilitating without altering the underlying assembler pipeline. The system supports recursive macros, where a macro can invoke itself within its definition, which is useful for generating complex structures like nested loops or tree-like data but requires careful guarding to prevent infinite . Preprocessor directives complement this by handling file inclusion, conditionals, and : the include directive imports external source files for modular organization; if evaluates expressions for conditional ; match performs string and to branch logic based on input forms; and repe (or rept) repeats blocks of code a specified number of times or until a fails. Unlike traditional assemblers with a distinct preprocessing phase, FASM integrates these operations seamlessly into its multi-pass process, ensuring that expansions and directives are resolved iteratively alongside symbol resolution and . Customization through allows for high-level abstractions, such as defining procedures with calling conventions (e.g., a proc macro that handles management and labels) or structures for layout, promoting cleaner and more maintainable . For instance, a loop-generation macro can be defined as follows:
macro loop count {
    repeat count
        [nop](/page/NOP)
    end repeat
}
loop 5
This expands to five nop instructions, demonstrating how macros abstract repetitive patterns into concise invocations. However, limitations arise from the text-based nature of substitutions, which lack type checking and can lead to errors if parameters are mismatched, and unguarded may cause assembly failures due to overflows or endless s. These features make FASM's macro system particularly suited for creating domain-specific languages or optimizing output through conditional expansions, though detailed optimization techniques are covered elsewhere.

Optimization and Output Mechanisms

FASM employs a multi-pass process to perform automatic size optimizations, resolving labels and adjusting instruction encodings to minimize the generated length. This approach includes peephole-style optimizations, such as selecting the shortest variants for jumps and combining redundant instructions where possible during successive passes. The assembler iterates up to a configurable limit (default 100 passes, maximum ) to refine displacements and ensure all references are resolved, exiting with an error if unresolved elements persist. Users can influence optimization through directives that control , though the core process prioritizes compactness without a dedicated 'optimize' keyword; instead, features like conditional allow tweaks for efficiency. For instance, in scenarios involving loops or branches, developers may use conditional directives to select compact sequences based on parameters evaluated at time. This results in executables that are notably smaller than those produced by alternatives like NASM in equivalent benchmarks, such as a minimal "hello world" program yielding around 30-160 bytes depending on the target format. The output format is specified via the 'format' directive, enabling generation of various executable types including plain binary (default for raw machine code), for 16-bit DOS programs, COFF/PE for Windows, and for Linux/Unix systems. Sections are defined with the 'section' directive, specifying attributes like alignment and executability (e.g., 'section .text executable' for code segments), which ensures proper structure within the chosen format. FASM supports 16-bit, 32-bit, and 64-bit modes via 'use16', 'use32', or 'use64' directives, with defaulting to 16-bit unless overridden. Relocation is handled manually through directives like 'org' for setting origin addresses and 'dd' for defining data at specific offsets, as FASM performs no automatic linking; however, format-specific macros facilitate handling of imports and exports, such as in files for calls. This manual approach aligns with FASM's emphasis on low-level control, avoiding built-in linkers to keep the tool lightweight. For complex relocations, operators like 'rva' provide relative virtual addressing in supported formats. FASM ensures portability by supporting cross-compilation across operating systems, allowing the same source code to produce binaries for , , or targets when run from any supported host (e.g., 2.0+ or +). A key design principle is output , encapsulated as "same source, same output" (SSSO), guaranteeing identical binaries regardless of the assembly or version, provided the source remains unchanged. This stems from the multi-pass resolution and environment-independent directives, making FASM ideal for in .

Programming Interface

Basic Syntax and Instructions

FASM employs the Intel syntax for assembly instructions, where each instruction consists of a mnemonic followed by zero to three operands separated by commas, with the destination operand listed first. For instance, the instruction mov eax, 5 moves the immediate value 5 into the 32-bit register EAX. Operands can be registers (such as EAX, EBX, or ESI), immediate values (constants like 5 or hexadecimal 0x100), or memory references enclosed in square brackets, such as [ESI + 4], which accesses memory at the address in ESI plus an offset of 4 bytes. Programs in FASM are organized into sections to separate , , and other elements, particularly when targeting formats like for . The section directive defines these, for example, section .text executable for executable and section .data writeable for initialized . The of the program is specified using the entry directive, such as entry main, which marks the starting label for execution. Key directives in FASM include org to set the address, for example, org 0x1000 to begin assembly at 1000 , though this is often omitted for standard executables where the loader handles addressing. Data definition directives such as db (define byte), dw (define word, 2 bytes), and dd (define doubleword, 4 bytes) allocate and initialize memory; for instance, msg db 'Hello', 0 reserves bytes for the "Hello" followed by a null . Labels are defined by appending a colon to a name, like main:, allowing jumps or calls to that location. FASM supports various x86 addressing modes to access flexibly. Direct addressing uses an immediate , such as mov EAX, [0x1000]. Indirect addressing references via a , like mov EAX, [EBX]. Scaled-index addressing combines registers with scales and offsets, for example, mov EAX, [EBX + ECX*4 + 8], which computes the effective as the sum of EBX, ECX multiplied by 4, and the constant 8—useful for array access where ECX holds an and 4 is the element size. A simple "Hello World" program for Linux x86 demonstrates these elements, producing a compact executable of approximately 50 bytes. The code uses system calls via interrupt 0x80: syscall number 4 for sys_write to output to stdout (file descriptor 1), followed by syscall number 1 for sys_exit with status 0. Here is the complete source:
format ELF executable
section '.text' executable
entry main

main:
    [mov](/page/MOV) EAX, 4      ; sys_write
    mov EBX, 1      ; stdout
    mov ECX, msg    ; message address
    mov EDX, len    ; message length
    int 0x80

    mov EAX, 1      ; sys_exit
    xor EBX, EBX    ; status 0
    int 0x80

section '.data' writeable
msg db 'Hello World!', 0xA
len = $ - msg
This example labels the entry point as main:, defines in the .data section with db and a computed length using $ (current position), and employs register operands for syscall parameters. Assemble it with fasm hello.asm hello to generate the .

Advanced Constructs and Examples

FASM supports through user-defined macros that emulate high-level constructs, such as and loops, which are not native to the assembler but built atop its capabilities. The proc and endp macros, commonly included in FASM's standard libraries, define boundaries by managing frames and local labels, allowing developers to organize code into reusable blocks. For instance, a basic can be declared as follows, with parameters accessed via offsets:
proc MyProcedure
    push ebp
    mov ebp, esp
    sub esp, 4      ; space for localVar
    local localVar:esp

    mov eax, [ebp+8]    ; param1
    mov ebx, [ebp+12]   ; param2
    add eax, ebx
    mov [localVar], eax

    mov esp, ebp
    pop ebp
    ret 8
endp
This expands to stack management operations for parameters and returns, facilitating cleaner code than raw jumps. Parameters are passed via the , with the first at [ebp+8] and second at [ebp+12] under the stdcall convention. Loops in FASM are implemented using the repeat directive combined with conditional jumps, often wrapped in macros for while-like behavior. A common macro for a employs repeat with a large fixed iteration count (e.g., 9999) and break via conditional if statements to exit early, preventing infinite loops during . An example definition is:
macro while condition
{
    repeat 9999
        if ~ condition
            break
        end if
        ; loop body here
    end repeat
}
Usage might approximate a square root calculation:
s = x / 2
while x / s <> s
    s = (s + x / s) / 2
    if % = 100
        break
    end if
end while
This leverages FASM's multi-pass optimization to resolve forward references without . Here, % represents the current iteration number, starting from 1. handling in FASM relies on the match directive for compile-time of tokens, enabling sophisticated expansions for expression or custom syntax. The match allows with wildcards like {any} or literals (e.g., ==), processing input as sequences rather than strings. For example, a multi-line using match can parse and evaluate simple assignments (invocations without spaces around operators):
macro let param
{
    match dest == src, param
    {
        mov dest, src
    }
    match dest += src, param
    {
        add dest, src
    }
}
Invocations like let eax=5 or let ebx+=3 expand to corresponding instructions, simulating higher-level variable handling during preprocessing. A more advanced detection macro demonstrates quoted literals:
macro isString what
{
    display 'Probing ', `what, ': -> '
    match 'o', what { display 'Single quoted',13,10 ; db 'o',0 }
    else match "o", what { display 'Double quoted',13,10 ; db "o",0 }
    else { display 'Not a string',13,10 }
    end match
}
This highlights match's role in conditional code generation, though it treats quoted strings as single tokens, limiting deep parsing. Practical examples illustrate FASM's power in generating platform-specific binaries. A minimal PE executable skeleton for Windows uses macros to handle imports and API calls, such as displaying a message box. The library and import macros build the import table, while invoke simplifies calling conventions:
format PE GUI 4.0
entry start

include '%fasminc%\win32a.inc'

section '.text' code readable executable
start:
    invoke MessageBox, 0, msgText, msgTitle, MB_OK
    invoke ExitProcess, 0

section '.data' data readable writeable
msgTitle db 'FASM Example', 0
msgText db 'Hello, World!', 0

section '.idata' import data readable
    library kernel32, 'KERNEL32.DLL', \
            user32, 'USER32.DLL'
    import kernel32, ExitProcess, 'ExitProcess'
    import user32, MessageBox, 'MessageBoxA'
The invoke macro reverses and pushes arguments, then calls the imported function indirectly via [MessageBox], ensuring proper PE loading. FASMg, FASM's successor engine, extends these features to non-x86 architectures via macro-based instruction sets. For ARM64, includes like aarch64.inc define macros for registers and operations, enabling cross-compilation. A simple Windows on ARM64 example uses address-relative loading and branches:
use 'aarch64.inc'

define xIP0? x16

.Machine dw IMAGE_FILE_MACHINE_ARM64

EntryPoint:
    mov x0, 0
    adr x1, MessageString
    adr x2, CaptionString
    mov x3, 0
    bl stub_MessageBoxA
    bl stub_ExitProcess

stub_MessageBoxA:
    adr xIP0, MessageBoxA
    ldr xIP0, [xIP0]
    br xIP0

; Data and imports follow...
This snippet employs [adr](/page/ADR) for position-independent addressing and [bl](/page/BL)/br for calls, with macros handling PE/ARM64 specifics. Developers must avoid common pitfalls in advanced usage, such as unaligned sections that trigger runtime faults (e.g., instructions require 16-byte alignment via align 16), or macro parameter mismatches causing unresolved symbols during expansion. Proper nesting of directives like if/repeat prevents assembly errors, and forward references should be minimized to avoid multi-pass inefficiencies. Interfacing FASM with higher-level languages often involves macros to mimic calling conventions, such as stdcall for inline C function calls:
macro stdcall proc, [arg]
{
    reverse push arg
    common call proc
}
This allows embedding assembly in C via inline blocks or generating wrappers, with extern for shared symbols, though full integration requires tools like linkers for mixed binaries.

Tools and Ecosystem

Integrated Development Environments

Fresh IDE, developed by John Found since 2003, serves as a primary for FASM programming, supporting both Windows and platforms. It emphasizes visual design capabilities for creating applications, integrating a built-in FASM assembler to streamline the development workflow from editing to compilation. This IDE is particularly suited for middle- to large-scale projects, offering cross-platform compatibility for outputs targeting , , , , and . Key features of Fresh IDE include syntax highlighting for efficient code navigation, a macro expansion viewer to inspect preprocessor outputs, and emulator integration for testing assembled code directly within the environment. It also provides code explorer, IntelliSense for autocompletion, instant error detection, and support for 64-bit architectures, enabling developers to generate flat binaries or platform-specific executables seamlessly. These tools facilitate and visual programming, with built-in help systems covering FASM syntax, FreshLib utilities, and system calls. Beyond dedicated IDEs like Fresh, FASM's supports modes, allowing automated assembly of multiple source files via scripts for efficient build pipelines. Third-party editors, such as RadASM, extend FASM compatibility through plugins and configurations that enable , project management, and integration with the assembler for Windows-based development. A notable limitation of Fresh IDE is the absence of a native , requiring reliance on external tools such as for runtime analysis and breakpoint management in Windows applications. This setup demands additional configuration for and integration but aligns with FASM's lightweight philosophy.

Supporting Libraries and Extensions

FASM benefits from a rich of community-contributed libraries and headers that extend its functionality beyond core tasks, enabling developers to with operating system , implement specialized algorithms, and target diverse architectures. Standard include files, distributed with the FASM package and downloadable from the official , provide essential definitions for platform-specific programming. For Windows development, files such as kernel32.inc in the APIA subdirectory declare functions from the , including kernel32.dll imports for process management and file operations, while win32a.inc offers macros for ASCII-based string handling and resource sections. Similarly, for , linux.inc supplies syscall constants and structures, such as those for file I/O (e.g., open, read, write) and process control, facilitating direct interactions without external linkers. These includes are organized in subdirectories like INCLUDE\API for imports and are accessed via the 'include' directive, with paths configurable through environment variables. Macro libraries further enhance FASM by encapsulating reusable code for common operations, often shared via the Flat Assembler Board. Collections for graphics include macros for VGA mode initialization and pixel manipulation, as seen in legacy examples for 13h mode (320x200, 256 colors) using interrupts or VESA extensions. Networking macros appear in libraries like HeavyThing, which provide routines for socket creation, / handling, and even a lightweight implementation. For mathematical computations, community macros support , such as Q15.16 format operations for multiplication and division in contexts, avoiding floating-point overhead on integer-only processors. These libraries typically consist of .inc files with define and macro statements, promoting modular across projects. Extensions broaden FASM's applicability through wrappers and architecture-specific headers. Scripting integrations include wrappers like Fasm.NET, a library embedding FASM as a callable module for dynamic generation within .NET applications, originally developed around 2013 for runtime code compilation. More recently, FASMg (FASM for multiple architectures, introduced in 2020 and updated through 2025) incorporates headers, such as those for instructions and modes, enabling cross-compilation to ARMv8 targets via repositories like txmx/fasmg-arm6m for support. These extensions maintain compatibility with FASM's syntax while adding target-specific opcodes and formats. The community sustains this ecosystem through dedicated forums and platforms. The Flat Assembler Board at board.flatassembler.net serves as a primary for and discussing libraries, with threads aggregating examples and updates since 2001. As of 2025, hosts numerous modern extensions, including FasmMacroLib for multi-platform macros ( x86/, , BSD) and EFI/ samples, fostering collaborative development. Licensing remains permissive across these resources; FASM itself uses a Simplified BSD with a weak clause, and most community libraries adopt similar open terms like BSD or , ensuring seamless integration into or open-source projects without redistribution restrictions.

Applications and Impact

Use in Operating Systems

FASM has been instrumental in the development of complete operating systems, particularly those emphasizing minimalism and direct hardware control. The most prominent example is , a lightweight operating system where the , (), drivers, and applications are written entirely in . This approach allows to boot from a standard 1.44 MB , with the entire OS fitting on the disk and a minimum RAM requirement of 8 MB. The OS supports preemptive multitasking, file systems like FAT32, and hardware drivers for graphics, networking, and sound, all assembled via FASM without relying on higher-level languages or runtimes. KolibriOS originated as a continuation of MenuetOS and has seen continuous development, with stable releases like version 0.7.7.0 in 2009 introducing enhancements to bootloaders and multitasking mechanisms, both implemented in FASM for efficient low-level operations. In this version, FASM facilitates the assembly of boot code that initializes directly and sets up a cooperative-to-preemptive multitasking scheduler, enabling concurrent execution of GUI elements and drivers while maintaining a compact footprint. Subsequent updates through 2025 have expanded compatibility and refined these FASM-based components, with nightly builds incorporating recent enhancements. Beyond , FASM supports various hobbyist operating system projects, including BOOTBOOT-compliant kernels that leverage its flat binary output for simple bootloader-to-kernel transitions. Examples include minimalistic clones like MiniDOS, a FASM-assembled system replicating basic command-line interfaces and file operations for educational purposes. Other efforts, such as Zicronix, a 32-bit OS developed entirely in FASM, demonstrate its utility in prototyping full-featured systems with custom and handling. FASM and its variants, including FASMg, support cross-assembly for architectures, enabling development for resource-constrained environments. A key advantage of FASM in OS development is its ability to produce executables with a small memory footprint, facilitating floppy-bootable systems that bypass the overhead of C runtimes and enable direct hardware access via inline assembly.

Role in Compilers and Low-Level Tools

FASM serves as an effective backend for custom compilers, leveraging its efficient assembly generation and optimization passes to translate intermediate representations into optimized machine code. The PureBasic compiler, a development environment for a BASIC-like language, utilizes FASM to process its generated assembly output into portable executables across Windows and Linux platforms. Similarly, modifications to the LCC retargetable compiler have integrated FASM as a backend, enabling the production of ELF-compatible binaries on 32-bit Linux systems while maintaining fast compilation times. Experimental projects further demonstrate this role, such as the "Ground" language compiler, written in C#, which outputs assembly code directly assembled by FASM for applications like graphics demos and games, and various toy compilers that pipe intermediate code to FASM for final assembly. In low-level tool development, FASM excels due to its compact output and single-pass efficiency, making it suitable for resource-constrained utilities like . Developers have created numerous examples with FASM, including 16-bit real-mode loaders that transition to and 64-bit UEFI-compatible variants capable of parsing partitions and loading /COFF kernels. These implementations highlight FASM's control over output formats, such as raw binaries or flat files, which are essential for constraints. While direct examples of disassemblers or scanners built with FASM are limited, its macro system supports the creation of specialized utilities requiring precise low-level manipulation. FASM's preprocessor functions as a versatile macro expander in build systems, enabling declarative for complex structures beyond simple . For instance, can automate the assembly of data tables or instruction sequences, streamlining toolchain workflows. Integration with occurs primarily through object file linking; FASM generates COFF or objects that link seamlessly with GCC-compiled code, as demonstrated in hybrid projects combining kernels with libraries. Inline with GCC requires adapting FASM's Intel-syntax output to GAS conventions, but this approach allows embedding FASM-assembled routines within larger applications. The impact of FASM in these areas stems from its size-optimizing multiple passes, which produce executables significantly smaller than those from multi-tool chains, ideal for tools where memory is limited. This capability is particularly valued in custom toolchains, where FASM's flexibility surpasses NASM's, allowing advanced features like generation without external preprocessors.

References

  1. [1]
    Download - flat assembler
    A fast assembler running in a variety of operating systems, in continued development since 1999. It was designed primarily for the assembly of x86 instructions.
  2. [2]
    flat assembler
    Welcome to the site of the flat assembler! This is a place dedicated to assembly language programming and contains many resources for both beginners and ...Documentation · Flat assembler · Examples
  3. [3]
    Design Principles - flat assembler
    The purpose of this article is to describe the main ideas that led the flat assembler project during the all time of its development.
  4. [4]
    Documentation - flat assembler
    This section provides browsable versions of the manuals and other documentation included in the flat assembler packages, as well as few other relevant texts.Flat assembler g User Manual · Successor · Manual
  5. [5]
    Some game with insight into origins of flat assembler
    ### Summary of FASM Origins from Tomasz Grysztar’s Posts
  6. [6]
    flat assembler - YouTube
    My name is Tomasz Grysztar and I'm the creator of flat assembler, a self-hosting assembler for x86 architectures in continuous development since 1999.Missing: origins history
  7. [7]
  8. [8]
    How does the fasm license work? - flat assembler
    Dec 20, 2018 · The only obligation you have is to include fasm's license and the name of original author (me) when you redistribute fasm in any form. This ...How to include a text file?building fasm from the sources on linuxMore results from board.flatassembler.netMissing: text | Show results with:text
  9. [9]
    FASM - Free Software Directory
    This program uses the FreeBSD with an additional clause potentially make it a copyleft program which is incompatible with other licenses including the GPLv2, ...
  10. [10]
    tgrysztar/fasm: flat assembler 1 - reconstructed source history - GitHub
    This is an official repository of the source code of flat assembler (fasm). The history going back to 1999 has been reconstructed from the preserved snapshots.Missing: text | Show results with:text
  11. [11]
    fasm on GitHub: reconstructed source history - flat assembler
    Sep 13, 2020 · It is a Git repository with reconstructed history of fasm's source code, going back to unreleased versions developed back in 1999 for private ...Fresh IDE v2.6.0 released (and v2.6.1) - flat assemblerwhen was FASM first released? - flat assemblerMore results from board.flatassembler.net
  12. [12]
    flat assembler download | SourceForge.net
    Apr 16, 2013 · ZASM is a 2 pass assembler for Zilog's 8-bit CPU Z80. Supported platforms: Unix-style OS, e.g. MacOS X, Linux, BSD. Special support for ZX ...
  13. [13]
    Flat Assembler 1.67.29 (Default branch) - Unix Linux Community
    Nov 15, 2008 · It supports all 8086-80486/Pentium instructions with MMX, SSE, SSE2, SSE3, and 3DNow! extensions and x86-64 (both AMD64 and EM64T) instructions.
  14. [14]
    Types of multi-pass assembly
    Dec 11, 2017 · With fasm's unrestricted forward-referencing you can write some self-dependencies that may create "size oscillation" even with x86 ...Pitfalls of optimistic multi-pass assembly[fasmg] how to use virtual for the output file? - flat assemblerMore results from board.flatassembler.net
  15. [15]
    The NetBSD package collection - pkgsrc.se
    Currently it supports all 8086-80486/Pentium instructions with MMX, SSE, SSE2, SSE3 and 3DNow! extensions and x86-64 (both AMD64 and EM64T) instructions ...
  16. [16]
    On my new assembler
    Mar 23, 2015 · I am preparing to finally release the initial version of my new project, developed under the working title "fasm g". Before I do so, ...386 assembly with fasm g[fasmg] performance and optimisation - flat assemblerMore results from board.flatassembler.netMissing: announced | Show results with:announced
  17. [17]
    flat assembler g Introduction and Overview
    It is an assembly engine designed as a successor of the one used in flat assembler 1, one of the recognized assemblers for x86 processors.Missing: 2019 | Show results with:2019
  18. [18]
    tgrysztar/fasm2: flat assembler 2 - GitHub
    This project combines flat assembler g with a set of headers that implement an x86 assembler. It is largely compatible with fasm 1, except for the ...
  19. [19]
    fasm 2 as a set of scripts and headers for fasmg - flat assembler
    Jul 11, 2023 · Tomasz Grysztar 11 Jul 2023, 22:31. After updating my ... The purpose of this preview is to demonstrate what I envisioned fasm 2 could be.<|control11|><|separator|>
  20. [20]
    Video demonstration of fasm 2 - flat assembler
    Mar 12, 2024 · Tomasz Grysztar Joined: 16 Jun 2003. Posts: 8466. Location: Kraków, Poland. Tomasz Grysztar 12 Mar 2024, 14:00. Today I recorded a video ...Coding in 64bit with FASMWriting the fasm tutorialMore results from board.flatassembler.net
  21. [21]
    Newbie for Fasm - flat assembler
    Apr 26, 2025 · While fasm1 is excellent for direct assembly, fasmg and fasm2 were developed to push the boundaries of what assembly macros can do. Designed as ...fasm 2 as a set of scripts and headers for fasmgHow much big difference between fasm2 and fasmgMore results from board.flatassembler.netMissing: 2023 2024 integration
  22. [22]
    inc workaround - flat assembler
    Feb 6, 2025 · The fasm compatibility package for fasmg is no longer developed ... But my focus moved entirely to fasm 2, which provides even more compatibility ...
  23. [23]
    flat assembler 1.73 Programmer's Manual
    To select ELF output format, use format ELF directive. The default code setting for this format is 32-bit. To create ELF file for the x86-64 architecture ...Missing: 1.70 2012<|separator|>
  24. [24]
  25. [25]
  26. [26]
  27. [27]
  28. [28]
    Smallest fasm hello world - flat assembler
    Mar 7, 2018 · Why so large? A typical MS-DOS “Hello, world” program is around 30 bytes. As for your question, what is your purpose? Just making ...Is there a smaller Hello World?How to write a Hello World! Program in FASM?More results from board.flatassembler.net
  29. [29]
    FASM - OSDev Wiki
    Dec 10, 2020 · The flat assembler (FASM) is a fast and efficient self-assembling x86 assembler for DOS, Windows and *nix (Linux, BSD, MacOS etc.) operating systems.<|control11|><|separator|>
  30. [30]
  31. [31]
  32. [32]
  33. [33]
  34. [34]
  35. [35]
  36. [36]
  37. [37]
  38. [38]
  39. [39]
    Problems with Hello world - flat assembler
    Mar 21, 2008 · The initial "Hello world" program in FASM caused a segmentation fault. The issue was using "section" instead of "segment" and the "entry start" ...
  40. [40]
    Submission: while / break / end while - flat assembler
    Jul 21, 2005 · We have to know in advance the maximum number of repeatitions before we enter the loop, and there is no way to have an early exit with REPEAT.Some basic macros for fasm g - flat assemblerbreak out early of repetition macros: rept, irp, irps, irpv? - flat assemblerMore results from board.flatassembler.netMissing: proc endp jumps
  41. [41]
    Understanding the flat assembler
    This text is of guide for advanced users, that summarizes some of the rules of the flat assembler's language and teaches select advanced techniques.
  42. [42]
    [fasmg] String detect with match directive - flat assembler
    May 6, 2025 · Hello, Can anyone tell me if is it possible to match strings (or not strings) using match directive? I try a lot of different things, (like ="o" ...match and " symbol - flat assemblerComparing Strings - flat assemblerMore results from board.flatassembler.net
  43. [43]
    Windows programming headers - flat assembler
    With the Windows version of flat assembler comes the package of standard includes designed to help in writing the programs for Windows environment.
  44. [44]
    Message Box example - flat assembler
    May 24, 2005 · This is the reason why imported functions should be called using indirect addressing [MessageBox]. See also the macro "invoke", intended to ...PE From scratch, first try.Working Win32 PE exe without an import tableMore results from board.flatassembler.net
  45. [45]
    flat assembler g User Manual
    When a symbol is used before it is defined (this is often called forward-referencing) the assembler tries to correctly predict the value of the symbol by doing ...
  46. [46]
    Windows on ARM64 - simple example with fasmg - flat assembler
    Oct 14, 2022 · I used the existing aarch64 includes for fasmg (made by tthsqe) and the standard PE formatter that comes with fasmg. My first working example, ...aarch64 includes for fasmg - flat assemblerTutorial for FASMARM - flat assemblerMore results from board.flatassembler.net
  47. [47]
    Fresh IDE project - Introduction - flat assembler
    May 18, 2020 · Of course, you can use Fresh not only for Windows programming, but also to create programs for any OS that FASM supports - DOS, Linux, FreeBSD, ...<|separator|>
  48. [48]
    JohnFound home site - Home
    Apr 4, 2025 · My home page, about general assembly programming, assembler and IDE development, web programming in assembly language, asm tutorials and ...
  49. [49]
    Fresh IDE 2.7.0
    Fresh is advanced IDE for assembly programming with built-in FASM compiler and visual programming features. Fresh is designed especially for middle to big ...
  50. [50]
    Fresh IDE - Download - Softpedia
    Jul 9, 2019 · Powerful IDE what comes with a flat assembler for helping you develop applications which can be ported on DOS, Linux, FreeBSD, BeOS and MenuetOS ...
  51. [51]
    Fresh IDE v2.6.0 released (and v2.6.1) - flat assembler
    Oct 27, 2017 · v2.6.0 includes a new GUI, FASM v1.72, updated manual, new help book, and improved code completion. v2.6.1 fixed "manifest.uuid" and "Labels ...Fresh IDE v2.2.4 releasedFresh IDE v2.2.3 released.More results from board.flatassembler.net
  52. [52]
    mrfearless/RadASM2: RadASM v2 - GitHub
    Aug 26, 2022 · It supports a wide variety of programming languages and assemblers such has MASM, NASM, FASM, TASM, Borland C, C++, Bcet Basic, VC6 C/C++ ...
  53. [53]
    tgrysztar/fasmg: flat assembler g - adaptable assembly engine - GitHub
    This is a collection of various macroinstruction sets, scripts and examples for fasmg. The official website of flat assembler: http://flatassembler.net/ ...<|control11|><|separator|>
  54. [54]
    Advanced setup manual - Fresh IDE
    Oct 18, 2016 · Fresh IDE configuration. Run Fresh and open "Options|IDE options" dialog. Select "Debuggers and Emulators" page. Then select following ...Missing: integration | Show results with:integration
  55. [55]
    Does it have a debugger? - flat assembler
    Oct 29, 2017 · I am always using Fresh IDE for developing and only debug in OllyDbg or EDB. "Goto address" feature (Ctrl+G) helps a lot to find the source ...Fasm debuggingFresh IDE v2.2.4 releasedMore results from board.flatassembler.net
  56. [56]
  57. [57]
    fasmg - examples, libraries and applications - flat assembler
    Aug 24, 2016 · This thread is a place to keep links to all the examples, macroinstruction libraries and even complete applications created with fasmg.
  58. [58]
    JamesMenetrey/Fasm.NET: A managed wrapper to use ... - GitHub
    Jul 10, 2013 · A managed wrapper to use FASM compiler from .NET applications. This library is written in C++/CLI and embeds FASM compiler as a linkable Microsoft COFF object.
  59. [59]
    lina-torovoltas/FasmMacroLib: Macro library designed to ... - GitHub
    FasmMacroLib is a macro library designed to simplify FASM programming upon Linux, DOS and BSD. It supports Linux (x86, x64, ARM, ARM64), DOS (x16), and FreeBSD ...Missing: VGA | Show results with:VGA
  60. [60]
    KolibriOS
    - **Language**: Written entirely in FASM assembly language.
  61. [61]
  62. [62]
    Index of /en_US/history/ - KolibriOS
    kolibrios-0.7.7.0+8737-f133c9d-distr.7z, 2024-May-28 15:54:15, 44.1M, application/x-7z-compressed. kolibrios-0.7.7.0+8737-f133c9d-img.7z, 2024-May-28 15:53:47 ...
  63. [63]
    16Bits OS Bootloader and Kernel ? Or Stage 2 here? - flat assembler
    Nov 19, 2023 · Written with fasm, it is capable to load a 64-bit PE/COFF executable with a long mode entry point. - then GPT partitioning table is created, ...How does bootloader call kernel stub? - flat assemblerrewrite linux in asm with fasm - flat assemblerMore results from board.flatassembler.netMissing: compliant | Show results with:compliant
  64. [64]
    MiniDOS - minimalistic DOS clone [DONE] - flat assembler
    May 15, 2006 · This would be a splendid idea to learn DOS OS creation. Pair with something like Links graphical webbrowser, would re-alive some old Intel based ...DOS type and verisons - flat assembler32bit Dos - flat assemblerMore results from board.flatassembler.net
  65. [65]
    Alternative Open-Source Operating Systems - LinuxQuestions.org
    Jun 26, 2018 · NativeOS is an x86 kernel made as a hobby project from scratch. Zicronix is a 32-bit Operating System written in FASM. LuxOS is a new Unix-like ...
  66. [66]
    FASMARM: Freeware ARM cross assembler for FASM
    The FASMARM package is a free ARM cross-assembler add-on for FASM. Runs under Win32 (9x/NT/2K/XP/Vista/7/8/8.1/10/11) and Linux 32/64.
  67. [67]
    Running fasmg on ARM v7 - flat assembler
    Feb 12, 2019 · So you want to port either fasmarm or fasmg (or both?) to run natively on the Android OS (which is using an ARM v7 CPU). Is that correct ...aarch64 includes for fasmgNewbie for FasmMore results from board.flatassembler.netMissing: community | Show results with:community