; -------------- CRC8, 51汇编 --------------- ;入口: R0=数据起始地址, B=数据长度 ;出口: A ;资源: R1,R6,R7,C crc: mov r1,#0 dscrc8_2: mov a,@r0 mov r6,a mov r7,#8
dscrc8_1: xrl a,r1 ;crc_vault mov c,acc.0 mov a,r1 ;crc_vault jnc dscrc8_0 xrl a,#18h
dscrc8_0: rrc a mov r1,a mov a,r6 rr a mov r6,a djnz r7,dscrc8_1 inc r0 djnz b,dscrc8_2 mov a,r1 ret |