gnupic@linuxhacker.org

gnupic@linuxhacker.org


Subject: RE: gpasm: res and equates and bitfields
From: Craig Franklin
Date: 26 Mar 2004 19:41:16 -0600

On Fri, 2004-03-26 at 08:30, Scott Dattalo wrote:
> (ps. you're qmail setup doesn't properly demarcate your replies from the 
> quoted text.)
> 
> On the discussion of an alternative way for abstractly accessing 
> bitfields, scx31114 wrote:
> 
> > 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)
> 
> Yes, This works!
> 
> For SDCC, it makes sense to write code like:
> 
>         BCF     bitfield#v( (_bit4 ) /8 ), (_bit4 & 7)
>         MOVLW   1 << (_bit10 & 7)
>         XORWF   bitfield#v( (_bit10 ) /8 ),F
> 
> For hand written assembly, it'd be nicer to write:
> 
>         BCF     bitfield(_bit4), (_bit4 & 7)
> 
> Where bitfield is defined to be:
> 
> #define bitfield(_bit) bitfield#v( (_bit ) /8 )
> 
> This doesn't work (with gpasm at least). As far as I can tell, gpasm 
> doesn't fully support the #define directive.
> 

Your right it doesn't.  There is a bug report on Sourceforge.

> Scott
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: gnupic-unsubscribe@linuxhacker.org
> For additional commands, e-mail: gnupic-help@linuxhacker.org
> 


gnupic@linuxhacker.org