gnupic: gpasm: res and equates and bitfields


Previous by date: 25 Mar 2004 10:12:37 +0000 Re: gpasm: res and equates and bitfields, Scott Dattalo
Next by date: 25 Mar 2004 10:12:37 +0000 Re: gpasm: res and equates and bitfields, Scott Dattalo
Previous in thread: 25 Mar 2004 10:12:37 +0000 Re: gpasm: res and equates and bitfields, Scott Dattalo
Next in thread: 25 Mar 2004 10:12:37 +0000 Re: gpasm: res and equates and bitfields, Scott Dattalo

Subject: RE: gpasm: res and equates and bitfields
From: "scx31114" ####@####.####
Date: 25 Mar 2004 10:12:37 +0000
Message-Id: <HV4N02$8DB70525B739521142CDF3346DA1C686@libero.it>

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)




Previous by date: 25 Mar 2004 10:12:37 +0000 Re: gpasm: res and equates and bitfields, Scott Dattalo
Next by date: 25 Mar 2004 10:12:37 +0000 Re: gpasm: res and equates and bitfields, Scott Dattalo
Previous in thread: 25 Mar 2004 10:12:37 +0000 Re: gpasm: res and equates and bitfields, Scott Dattalo
Next in thread: 25 Mar 2004 10:12:37 +0000 Re: gpasm: res and equates and bitfields, Scott Dattalo


Powered by ezmlm-browse 0.20.