bfset
Test bit field and set
Sets every bit of a bit field to 1.
Select opt p=68020, or use opt bit with the 68000 or 68010, before any code or data
XNZVC –●●00
- ● set from the result
- 0 always 0
- – not changed
Forms
Operands
<ea>- An operand using one of the addressing modes listed for this form. The list determines whether it can be a register, memory or an immediate value. With
opt p=68020, an allowedd(An,Xn)ord(PC,Xn)mode also permits the corresponding 68020 indexed and memory indirect forms. See 68020 addressing. More {offset:width}- A field of 1 to 32 bits, written immediately after the operand. Literal offsets range from 0 to 31, and literal widths from 1 to 32. Either may be a data register, as in
{d1:d2}. See the linked section for register values, negative memory offsets and wrapping. More
For example, bfset (a0){3:4} sets bits 4 through 1 of the byte at a0. N copies the field’s highest bit before the change, and Z is set if that field was zero. V and C are cleared. X is unchanged.
Write the field as {offset:width} immediately after its operand. It selects 1 to 32 bits, counted from bit 31 of a data register or bit 7 of the byte at the memory address. The offset and width may each be a constant or a data register. See bit fields for their ranges, register values and wrapping rules.
opt p=68020
* --- Mark slots 3 to 6 of a bitmap as taken ---
lea slots, a0
bfset (a0){3:4} ; bits 4 to 1 of the first byte
move.b (a0), d0 ; d0 = 30, which is %00011110
bra END
slots:
dc.b 0, 0
END: