bchg
Test a bit and change
Inverts the bit in the second operand numbered by the first operand, setting Z to the inverse of its old value.
Sizes .b .l
Used in
- Arithmetic, logic and bitsM68K assembly
XNZVC ––●––
- ● set from the result
- – not changed
Forms
Operands
* --- Toggles the specified bit ---
move.l #%0001, d0
bchg #0, d0 ; bit 0 was 1, now 0. Z flag clear (old value)
bchg #0, d0 ; bit 0 was 0, now 1. Z flag set (old value)
move.l #%0000, d1
bchg #3, d1 ; bit 3 was 0, now 1. Z flag set