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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Jan Waclawek
08/13/07 13:40
Modified:
  08/13/07 13:41

Read: 665 times
Bratislava
Slovakia


 
#143224 - now it\'s my pencil time...
Responding to: Dan Henry's previous message
... to sit down and figure out how THIS ONE works...

:-)

Thanks, Dan.

JW

PS I tried SDCC just to have a complete picture: 35 cycles (nothing spectacular...)
void CRCNib(unsigned char b)
                            131 ;	crc.c:5: CRCLo ^= b;
   0005 E5 82               134 	mov	a,dpl
   0007 FA                  135 	mov	r2,a
   0008 62*00               136 	xrl	_CRCLo,a
                            137 ;	crc.c:6: b      = CRCHi;
   000A AA*01               139 	mov	r2,_CRCHi
                            140 ;	crc.c:7: CRCHi  = CRCLo ^ (CRCLo << 4);
   000C E5*00               144 	mov	a,_CRCLo
   000E C4                  145 	swap	a
   000F 54 F0               146 	anl	a,#0xf0
   0011 FB                  148 	mov	r3,a
   0012 65*00               150 	xrl	a,_CRCLo
                            151 ;	crc.c:8: CRCLo  = b;
                            153 ;	crc.c:9: CRCLo ^= (b = CRCHi >> 4);
   0014 F5*01               157 	mov	_CRCHi,a
   0016 8A*00               158 	mov	_CRCLo,r2
   0018 C4                  160 	swap	a
   0019 54 0F               161 	anl	a,#0x0f
   001B FB                  164 	mov	r3,a
   001C 8B 02               165 	mov	ar2,r3
   001E 62*00               167 	xrl	_CRCLo,a
                            168 ;	crc.c:10: b      = CRCHi ^ (b >> 1);
   0020 EA                  172 	mov	a,r2
   0021 C3                  173 	clr	c
   0022 13                  174 	rrc	a
   0023 FB                  176 	mov	r3,a
   0024 65*01               178 	xrl	a,_CRCHi
   0026 FA                  179 	mov	r2,a
                            180 ;	crc.c:11: CRCLo ^= CRCHi << 3;
   0027 E5*01               184 	mov	a,_CRCHi
   0029 C4                  185 	swap	a
   002A 03                  186 	rr	a
   002B 54 F8               187 	anl	a,#0xf8
   002D FB                  189 	mov	r3,a
   002E 62*00               191 	xrl	_CRCLo,a
                            192 ;	crc.c:12: CRCHi  = b;
   0030 8A*01               194 	mov	_CRCHi,r2
   0032 22                  196 	ret



List of 32 messages in thread
TopicAuthorDate
CRC16 CCITT - What a challenge!      Jan Waclawek      08/06/07 13:08      
   Have you seen this?      Richard Erlacher      08/06/07 17:40      
      Of course!      Jan Waclawek      08/07/07 02:36      
         Balance      Russ Cooper      08/07/07 07:16      
            I know, Russ,      Jan Waclawek      08/07/07 07:53      
         Code? What code?      Russ Cooper      08/07/07 07:24      
            in the code library - look to the left column      Jan Waclawek      08/07/07 07:37      
               Thanks! I missed that note in the first post.      Russ Cooper      08/07/07 08:37      
   I need a hint      Russ Cooper      08/11/07 00:56      
      write down the bits      Jan Waclawek      08/11/07 01:22      
         Thanks for the hint      Russ Cooper      08/12/07 11:12      
            Your observations plus a comparison in C      Dan Henry      08/12/07 11:58      
               The rest of the story ...      Russ Cooper      08/12/07 16:43      
                  Compilers, but Keil C51 8.09 for the stated 28~      Dan Henry      08/12/07 17:04      
                  and this processes only a nibble, isn't it...      Jan Waclawek      08/12/07 23:27      
                     No, it process the entire byte.      Dan Henry      08/13/07 12:59      
                        now it\'s my pencil time...      Jan Waclawek      08/13/07 13:40      
                           FYFI      Dan Henry      08/13/07 14:40      
                              Clarification re: 8-bit optimized term      Dan Henry      08/13/07 17:46      
                              on optimisation      Jan Waclawek      08/14/07 02:56      
                                 Jan's optimization      Dan Henry      08/14/07 07:16      
                                    Re: on optimization      Dan Henry      08/19/07 09:18      
                                       Can you please be more specific?      Jan Waclawek      08/19/07 13:56      
                                          More specifically ...      Dan Henry      08/25/07 15:10      
            and what      Jan Waclawek      08/12/07 23:27      
               More on checksums        Russ Cooper      08/18/07 09:59      
   No reason to hide the excreted code      Dan Henry      08/12/07 17:41      
      Excreted code needs context like any other code      Dan Henry      08/12/07 19:01      
   One More Comment      Michael Karas      08/13/07 02:45      
      ... and a marginal remark ...      Jan Waclawek      08/13/07 07:02      
         Init all ones frequently specified      Dan Henry      08/13/07 13:06      
   18 cycles      Jan Waclawek      08/16/07 08:16      

Back to Subject List