Eqqman wrote:
...if I compile
bset #1, 40000000 or
bclr #1, 40000000
I get a compile error 'illegal addressing mode'.
The tables provided with the full documentation of BSET and BCLR show that combination of addressing modes is NOT permitted. A register must be involved, either the bit number in a source register, or the destination in a data register or through an address register.
To atomically set/clear a bit at a byte address, you can put the bit number in a register, e.g.:
moveq #1,r0
bset.b r0,40000000
Or the address in an address register:
lea 40000000,a0
bset.b #1,(a0)
If the target location is 32 bits, you can use "and" and "or" instructions to make atomic changes with the mask/value in a source register. For a 16-bit I/O port, I don't think atomic is possible with coldfire.