beq
Branch if equal
Branches to the specified address if equal.
Sizes .b .s .w .l
Used in
- Compare and branchM68K assembly
- Loops and dbraM68K assembly
- Arithmetic, logic and bitsM68K assembly
- Arrays, strings and (a0)+M68K assembly
- The screen, keyboard and mouse through trapsM68K assembly
- Exceptions and the vector tableM68K assembly
- Length of a stringM68K assembly
- A subroutine with its arguments in registersM68K assembly
- Binary searchM68K assembly
- Move a square with the keyboardM68K assembly
XNZVC –––––
- Changes no flag
- Reads Z
Forms
beq
Operands
label- A branch target, written as a label or address. The assembler calculates the relative displacement. More
* --- Loop: count down from 10 ---
move.l #10, d0
move.l #0, d1
loop:
addq.l #1, d1
subq.l #1, d0
bne loop ; branch if d0 != 0
* --- Conditional skip ---
move.l #5, d2
move.l #5, d3
cmp.l d3, d2
beq are_equal ; branch if d2 == d3
move.l #0, d4
bra done
are_equal:
move.l #$FF, d4
done: