# `dbra`

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

Web page: https://asm-editor.specy.app/documentation/m68k/instruction/dbra

**Decrement and branch**

Category: Control flow

Decrements the first operand by 1 and branches to the specified address if the first operand is not -1.

Size .w

Used in: [Loops and dbra](https://asm-editor.specy.app/learn/courses/m68k/think-in-assembly/loops-and-dbra.md) (M68K assembly), [Arithmetic, logic and bits](https://asm-editor.specy.app/learn/courses/m68k/think-in-assembly/arithmetic-logic-and-bits.md) (M68K assembly), [Arrays, strings and (a0)+](https://asm-editor.specy.app/learn/courses/m68k/think-in-assembly/arrays-strings-and-postincrement.md) (M68K assembly), [trap #15 and its tasks](https://asm-editor.specy.app/learn/courses/m68k/talking-to-the-outside-world/trap-15-and-its-tasks.md) (M68K assembly), [Interrupts and cycles](https://asm-editor.specy.app/learn/courses/m68k/talking-to-the-outside-world/interrupts-and-cycles.md) (M68K assembly), [Fill an array with the numbers from 1 to 10](https://asm-editor.specy.app/learn/courses/m68k/examples/counting-loop.md) (M68K assembly), [Sum of an array](https://asm-editor.specy.app/learn/courses/m68k/examples/sum-of-an-array.md) (M68K assembly), [The largest element](https://asm-editor.specy.app/learn/courses/m68k/examples/max-of-an-array.md) (M68K assembly), [Bit tests, shifts, masks and counting set bits](https://asm-editor.specy.app/learn/courses/m68k/examples/bit-tricks.md) (M68K assembly), [Bubble sort](https://asm-editor.specy.app/learn/courses/m68k/examples/bubble-sort.md) (M68K assembly)

## Flags

| Flag | Effect |
| --- | --- |
| X | not changed |
| N | not changed |
| Z | not changed |
| V | not changed |
| C | not changed |

## Forms

- `dbra Dn, label`

## Operands

- [`Dn`](https://asm-editor.specy.app/documentation/m68k/addressing-mode/direct.md): A data register, `d0` to `d7`.
- [`label`](https://asm-editor.specy.app/documentation/m68k/addressing-mode/effective-address.md): A branch target, written as a label or address. The assembler calculates the relative displacement.

## Description

dbra is the same as dbf (will decrement until it reaches -1)

## Example

```m68k
* --- Loops d0+1 times (counter goes 5,4,3,2,1,0,-1 then stops) ---
move.l #5, d0
move.l #0, d1
loop:
    addq.l #1, d1
    dbra d0, loop
; d1 = 6 (looped 6 times)
```
