📄 mcrc.src
字号:
NAME MCRC
?PR?_m_CRC?MCRC SEGMENT CODE INBLOCK
PUBLIC _m_CRC
RSEG ?PR?_m_CRC?MCRC
_m_CRC:
USING 0
;CRC0 'R7' ----
;InByt'R5' ----
MOV A,R5
PUSH ACC ;save bits to be shifted
MOV B,#8 ;set shift = 8 bits ;
CRC_LOOP:
XRL A,R7 ;calculate CRC
RRC A ;move it to the carry
MOV A,R7 ;get the last CRC value
JNC ZERO ;skip if data = 0
XRL A,#18H ;update the CRC value;
ZERO: RRC A ;position the new CRC
MOV R7,A ;store the new CRC
POP ACC ;get the remaining bits
RR A ;position the next bit
PUSH ACC ;save the remaining bits
DJNZ B,CRC_LOOP ;repeat for eight bits
POP ACC ;clean up the stack
; MOV AR7,R5
RET
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -