dbra
Decrement and branch
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 dbraM68K assembly
- Arithmetic, logic and bitsM68K assembly
- Arrays, strings and (a0)+M68K assembly
- trap #15 and its tasksM68K assembly
- Interrupts and cyclesM68K assembly
- Fill an array with the numbers from 1 to 10M68K assembly
- Sum of an arrayM68K assembly
- The largest elementM68K assembly
- Bit tests, shifts, masks and counting set bitsM68K assembly
- Bubble sortM68K assembly
XNZVC –––––
- Leaves every flag unchanged
Forms
dbra ,
Operands
dbra is the same as dbf (will decrement until it reaches -1)
* --- 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)