Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/01/03 18:45
Read: times


 
#47187 - RE: Grabbing a bit from a byte?
Responding to: ???'s previous message
using the bdata aliasing approach I mention before, you get it down to two instructions..

As SDCC is pretty much "you get what you pay for" , I have no idea what it would compile it to..

  14          unsigned char mydata;
  15          bit mybit;
  16          bdata unsigned char flags;
  17          sbit mybit0=flags^0;sbit mybit1=flags^1;
  18          
  19          void main(void) {
  20   1      	
  21   1      mydata=0xff;
  22   1      flags=mydata;
  23   1      
  24   1      mybit=mybit1;
  25   1      
  26   1      
  27   1       while (1) {
  28   2      
  29   2      		
  30   2       }	/* end of while */
  31   1      }	/* end of main() routine */
  32          
  33          
  34          
ASSEMBLY LISTING OF GENERATED OBJECT CODE

            ; FUNCTION main (BEGIN)
                                           ; SOURCE LINE # 21 
0000 7500FF  R      MOV    mydata,#0FFH
                                           ; SOURCE LINE # 22 
0003 850000  R      MOV    flags,mydata
                                           ; SOURCE LINE # 24
 
0006 A200    R      MOV    C,mybit1
0008 9200    R      MOV    mybit,C
 
000A         ?WHILE1:


List of 10 messages in thread
TopicAuthorDate
Grabbing a bit from a byte?            01/01/70 00:00      
   RE: Grabbing a bit from a byte?            01/01/70 00:00      
   RE: Grabbing a bit from a byte?            01/01/70 00:00      
      RE: Grabbing a bit from a byte?            01/01/70 00:00      
         RE: Grabbing a bit from a byte?            01/01/70 00:00      
            RE: Grabbing a bit from a byte?            01/01/70 00:00      
         RE: Grabbing a bit from a byte?            01/01/70 00:00      
            RE: Grabbing a bit from a byte?            01/01/70 00:00      
            RE: Grabbing a bit from a byte?            01/01/70 00:00      
   RE: Grabbing a bit from a byte?            01/01/70 00:00      

Back to Subject List