ArticleslgStudy

computer science

Flat Assembler

Flat Assembler is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Flat Assembler rather than just read about it. In short: Flat Assembler (stylized as flat assembler and sometimes referred to by the executable name FASM) is an assembler for x86 processors. It supports Intel-style assembly language on the IA-32 and x86-64 architectures.

Flat Assembler — main illustration
Flat Assembler — illustration

Key takeaways

  • Flat Assembler belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Flat Assembler to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Flat Assembler from memory before moving on to harder problems.

Reference excerpt

Flat Assembler (stylized as flat assembler and sometimes referred to by the executable name FASM) is an assembler for x86 processors. It supports Intel-style assembly language on the IA-32 and x86-64 architectures. It claims high speed, size optimizations, operating system 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. All versions of Flat Assembler 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 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). Flat Assembler 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 Flat Assembler does not support as many high-level statements as Microsoft Macro Assembler or Turbo Assembler. It provides syntax features and macros, which make it possible to customize or create missing statements. Its memory-addressing syntax is similar to Turbo Assembler's ideal mode and Netwide Assembler. Brackets are used to denote memory operands as in both assemblers, but their size is placed outside the brackets, like in Netwide Assembler. Flat Assembler is multi-pass. It does extensive code-size optimization and allows unconstrained forward referencing. An unusual Flat Assembler 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. Flat Assembler 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 Flat Assembler 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. Flat Assembler projects can be built from one source file directly into an executable file without a linking stage.

IDE Fresh, a project started by John Found, is an integrated development environment for Flat Assembler under Windows and Linux.

Use Operating systems written with FASM:

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

PureBasic High Level Assembly (HLA) BlitzMax

See also Comparison of assemblers List of assembly software and tools

References

External links FASM project: Official website FASMLIB 0.8.0 – portable 32-bit x86 asm lib for FASM/MASM/YASM/NASM/GASM FASMARM – FASM for ARM processors, v1.27, June 9, 2012 (2012-06-09) The Fresh IDE

Illustrations

Flat Assembler illustration

Worked examples

Example 1 — a first encounter with Flat Assembler

Start with the simplest possible case. Write down what Flat Assembler claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Flat Assembler before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Flat Assembler ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Flat Assembler

In research
Flat Assembler appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Flat Assembler in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Flat Assembler is common in secondary-school and first-year university syllabi. It links to neighbouring topics 2000 software, Assemblers, DOS software, so understanding it makes those chapters shorter.
In everyday life
Look for Flat Assembler outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Flat Assembler” →

How to study Flat Assembler in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Flat Assembler means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Flat Assembler out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Flat Assembler in simple terms?

Flat Assembler (stylized as flat assembler and sometimes referred to by the executable name FASM) is an assembler for x86 processors. It supports Intel-style assembly language on the IA-32 and x86-64 architectures.

Why does Flat Assembler matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Flat Assembler?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Flat Assembler.

Tags

  • 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

Keep exploring