27-01-2015, 05:04 PM
operandide tähendused leidsin ise ka aga ei funksi.
Minu kood:
Mis on siin valesti ?
Minu kood:
Kood:
;===============================================================================
;#define X25_INIT_CRC 0xffff
;static inline void crc_init(uint16_t* crcAccum)
;{
; *crcAccum = X25_INIT_CRC;
;}
;--------------------
;{
; /*Accumulate one byte of data into the CRC*/
; uint8_t tmp;
;
; tmp=data ^ (uint8_t)(*crcAccum &0xff);
; tmp^= (tmp<<4);
; *crcAccum = (*crcAccum>>8) ^ (tmp<<8) ^ (tmp <<3) ^ (tmp>>4);
;}
; ---- Arvuta CRC -------
; crc_init(&crcTmp);
; for (i = 0; i < length; i++){
; crc_accumulate(*pTmp++, &crcTmp);
; }
;
;FE 09 4E 01 01 00 00 00 00 00 02 03 51 04 03 1C 7F
test: movlw 0xFF ; crc_init(&crcTmp)
movwf TBLPTRLt
movwf TBLPTRHt
movlw .10
movwf t_count
LFSR .0,0x25 ; puhver
; tmp=data ^ (uint8_t)(*crcAccum &0xff);
; tmp^= (tmp<<4);
; *crcAccum = (*crcAccum>>8) ^ (tmp<<8) ^ (tmp <<3) ^ (tmp>>4);
tst1: movf POSTINC0,W ; loe databait puhvrist -> W
xorwf TBLPTRLt,W ; databait XOR CRC LOW -> t1_count (tmp=data ^ (uint8_t)(*crcAccum &0xff);)
movwf t1_count
movwf t2_count
bcf CARRY ; tmp^= (tmp<<4)
rlcf t1_count,F
rlcf t1_count,F
rlcf t1_count,F
rlcf t1_count,W ; = tmp
xorwf t2_count,W
movwf t1_count
;*crcAccum = (*crcAccum>>8) ^ (tmp<<8) ^ (tmp <<3) ^ (tmp>>4);
bcf CARRY
rrcf TBLPTRHt,F
rrcf TBLPTRLt,F
rrcf TBLPTRHt,F
rrcf TBLPTRLt,F
rrcf TBLPTRHt,F
rrcf TBLPTRLt,F
rrcf TBLPTRHt,F
rrcf TBLPTRLt,F
rrcf TBLPTRHt,F
rrcf TBLPTRLt,F
rrcf TBLPTRHt,F
rrcf TBLPTRLt,F
rrcf TBLPTRHt,F
rrcf TBLPTRLt,F
rrcf TBLPTRHt,F
rrcf TBLPTRLt,F
movff t1_count,t2_count
bcf CARRY
rlcf t2_count,F
rlcf t2_count,F
rlcf t2_count,F
rlcf t2_count,F
rlcf t2_count,F
rlcf t2_count,F
rlcf t2_count,F
rlcf t2_count,W
xorwf TBLPTRLt,F
movff t1_count,t2_count
bcf CARRY
rlcf t2_count,F
rlcf t2_count,F
rlcf t2_count,W
xorwf TBLPTRLt,F
movff t1_count,t2_count
bcf CARRY
rrcf t2_count,F
rrcf t2_count,F
rrcf t2_count,F
rrcf t2_count,W
xorwf TBLPTRLt,F
decfsz t_count
goto tst1