gnupic@linuxhacker.org
gnupic@linuxhacker.org
Well, that does work for the simple case. However, how about this:
; bit add
bcf bit0 >> 3, bit0 & 7
movlw (1 << ( bit0 & 7)
btfsc bit1 >> 3, bit1 & 7
xorwf ( bit0 >> 3),f
btfsc bit2 >> 3, bit2 & 7
xorwf ( bit0 >> 3),f
Here, the bit is being accessed both as a bit and as a 'byte'.
What I really would like is a way of defining a single object to describe
the bit variable. The only solution that I can think of for relocatable
code requires two objects to describe a bit variable. You need to know the
address of the byte containing the bit and the offeset within the byte.
The byte can be relocated, but the offset is static.
Scott
Try this
bitfield0 res 1
bitfield1 res 1
bit0 EQU 0
bit1 EQU 1
bit2 EQU 2
....
bit12 EQU 12
to access the byte
bitfield#v( ( bitN ) /8 )
bitN = bit0 - bit999
to access the bit
( bitN%8)
or
( bitN&7)
gnupic@linuxhacker.org