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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/15/09 22:42
Modified:
  02/15/09 22:55

Read: times


 
#162446 - use a compiler first
Responding to: ???'s previous message
if in doubt, maybe use a compiler first.

This C-snippet:
#include <8052.h>

void main(void)
{
    while(1)
    {
       P2_0 = P1_0 ^ P1_1;
    }
}

 

might be what you want to do.


F.e. SDCC compiles this to:

   001C                     356 _main:
                            365 ;       xor2.c:5: while(1)
   001C                     366 00102$:
                            367 ;       xor2.c:7: P2_0 = P1_0 ^ P1_1;
   001C A2 91               368         mov     c,_P1_1
   001E 30 90 01            369         jnb     _P1_0,00107$
   0021 B3                  370         cpl     c
   0022                     371 00107$:
   0022 92 A0               372         mov     _P2_0,c
   0024 80 F6               373         sjmp    00102$

 



List of 12 messages in thread
TopicAuthorDate
How to XOR a single bit (N00B)            01/01/70 00:00      
   Instruction set tells what is available            01/01/70 00:00      
      Code            01/01/70 00:00      
         Think about it a little bit!            01/01/70 00:00      
   CPL bit if XOR with 1; otherwise, don't            01/01/70 00:00      
      wrote this code still not working            01/01/70 00:00      
         Jumping where? And not jumping where?            01/01/70 00:00      
         this might be it            01/01/70 00:00      
         use a compiler first            01/01/70 00:00      
         XOR a bit, quite literally            01/01/70 00:00      
            ... and now, we've done his homework for him ...            01/01/70 00:00      
   schematic            01/01/70 00:00      

Back to Subject List