基于匯編語(yǔ)言的BCH解碼校驗(yàn)算法
XRLA,70H;(s31+s3)的矢量值
MOV73H,A
CJNEA,#00H,L2;s31+s3≠0
LJMP CORRECT;s31+s3=0,糾1位錯(cuò)
LJMPRIGHT;送至解碼輸出程序
L2:MOVA,73H
LCALL TAB2
MOV74H,A;(s31+s3)的指數(shù)
MOVA,71H
LCALL TAB2
MOV76H,A;76H中放s1的指數(shù)
MOVA,74H
SUBA,76H
JCL3
L4:MOV75H,A
LJMPL5
L3:ADD74H,#0FH;進(jìn)行求逆
MOVA,74H
SUBA,76H
LJMPL4
L5:MOVA,R0
LCALL TAB2
MOV7CH,A;7CH中放αi的指數(shù)
ADDA,76H;s1αi的指數(shù)
LCALLTAB1;s1αi的矢量值
MOV77H,A
MOVA,7CH
RLA
MOV79H,A;79H中放α2i的指數(shù)
ADDA,75H;σ2α2i的指數(shù)
LCALL TAB1;σ2σ2i的矢量值
XRLA,77H;(σ1αi+σ2α2i)的矢量值
CJNEA,#01H,L6
MOVR1,#60H
MOVA,R0
MOV @R1,A;將錯(cuò)誤位置放入60H單元中
INCR1
INCR7
L6:INCR0
CJNER0,#0FH,L5;判斷搜索完否
CJNER7,#02H,L7;錯(cuò)誤個(gè)數(shù)是否為2
MOVA,60H;將第1個(gè)錯(cuò)誤位置放入60H單元中
MOV78H,A
評(píng)論