# x86-64 Documentation

> x86-64 assembly in NASM syntax, running as a Linux program. Covers instructions, vector extensions, directives, registers and flags, Linux syscalls, and using C and C++.

Web page: https://asm-editor.specy.app/documentation/x86

x86-64 is the instruction set most desktop and server processors run. It has sixteen 64 bit general purpose registers, memory addressed as one flat space, and an instruction for almost everything of around 2600 mnemonics.

Programs in asm-editor are written in [NASM](https://www.nasm.us/) syntax, assembled by the NASM assembler, and run by [blink](https://github.com/jart/blink), which emulates a Linux program. So a program starts at `_start`, its code goes in `section .text` and its data in `section .data`, and it reaches the outside world through the `syscall` instruction. It ends by calling syscall 60. A program that runs off the end of its own code executes whatever bytes follow in memory.

## Chapters

- [Instructions](https://asm-editor.specy.app/documentation/x86/instruction.md): The integer instruction set, with the operand forms NASM accepts. (273 entries)
- [Extensions](https://asm-editor.specy.app/documentation/x86/extensions.md): Extension mnemonics grouped under NASM’s headings, with a short summary. (89 entries)
- [Directives](https://asm-editor.specy.app/documentation/x86/directive.md): Sections, data, constants, macros and prefixes: what NASM reads besides instructions. (32 entries)
- [Registers & flags](https://asm-editor.specy.app/documentation/x86/registers.md): The general purpose registers, the flags, the SSE and x87 registers and the condition codes. (47 entries)
- [Vector instructions](https://asm-editor.specy.app/documentation/x86/vector-instructions.md): The ymm registers and the AVX, AVX2, FMA and BMI instructions: which run here, how they treat the upper half of a register, which cross between 128-bit lanes, and how memory operands are sized and aligned. (13 entries)
- [Syscalls](https://asm-editor.specy.app/documentation/x86/syscall.md): The Linux calls this emulator implements, with register inputs, results, C wrapper names, and program arguments. Errors return as negative values in `rax`. (147 entries)
- [The Screen](https://asm-editor.specy.app/documentation/x86/screen.md): Draw pixels and switch framebuffer pages through /dev/fb0. Configure the Screen size with Display or @screen. (8 entries)
- [Keys and the pointer](https://asm-editor.specy.app/documentation/x86/input.md): Read Screen keys, pointer positions and buttons through /dev/input, or read Terminal characters through standard input. (10 entries)
- [Sound](https://asm-editor.specy.app/documentation/x86/sound.md): Play PC speaker tones, MIDI notes or audio samples. Configure playback buffering and volume through /dev/dsp and /dev/mixer. (8 entries)
- [Using C and C++](https://asm-editor.specy.app/documentation/x86/using-c.md): Compile C or C++, supply program arguments, use Runtime functions and Linux services, and debug the generated NASM assembly. (6 entries)
- [Runtime library](https://asm-editor.specy.app/documentation/x86/runtime-library.md): The editor Runtime functions for compiled C/C++ and assembly programs that link Runtime ABI v1. (175 entries)
- [Executables](https://asm-editor.specy.app/documentation/x86/executables.md): Import and debug an x86-64 Linux executable, read and edit its bytes, inspect its Listing, patch instructions during a paused run, and open the program a Build links. (31 entries)

## Optional

- [The whole x86-64 Documentation](https://asm-editor.specy.app/documentation/x86/llms-full.txt): every entry of every Chapter in one file, to search through
