dbge

Sizes

word

Affected Flags

X
N
Z
V
C
-
-
-
-
-

Operands

Op 1
Dn
Op 2
Ea/<label>

Decrements the first operand by 1 and branches to the specified address if "Greater or equal" is false and the first operand is not -1. dbra is the same as dbf (will decrement untill it reaches -1). It reads the operand as a word, so it can run at maximum 64k times

* --- Loops d0+1 times (decrements THEN tests) ---
move.l #3, d0
move.l #0, d1
loop:
    addq.l #1, d1
    dbra d0, loop ; loop runs 4 times (3, 2, 1, 0)

* --- With condition: dbne stops early if condition is true ---
move.l #10, d2
move.l #$FF, d3
loop2:
    subq.l #1, d3
    tst d3
    dbne d2, loop2 ; stops when d3 = 0 OR d2 exhausted