# `std`

[x86-64 Documentation](https://asm-editor.specy.app/documentation/x86.md) › [Instructions](https://asm-editor.specy.app/documentation/x86/instruction.md)

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

**Set direction flag**

Category: System

Sets the direction flag (DF), so string instructions step downward through memory.

8086 and later

[Intel's reference: STD](https://intel.github.io/SDM/instruction/STD.html)

Used in: [Arrays, strings and the string instructions](https://asm-editor.specy.app/learn/courses/x86/think-in-assembly/arrays-strings-and-the-string-instructions.md) (x86-64 assembly)

## Flags

| Flag | Effect |
| --- | --- |
| CF | not changed |
| PF | not changed |
| AF | not changed |
| ZF | not changed |
| SF | not changed |
| DF | always 1 |
| OF | not changed |

## Forms

- `std`

## Description

[`cld`](https://asm-editor.specy.app/documentation/x86/instruction/cld.md) clears it, which has to happen before the next call or return: the Linux calling convention expects DF to be clear at both.

## Example

```x86
global _start

section .text
_start:
        mov rax, 12
        mov rbx, 5
        mov rcx, 3
        mov rsi, 9

        std

        mov rax, 60         ; syscall 60: exit
        xor rdi, rdi
        syscall
```
