::: Area #68 (Comms............ [Acorn]) Message: #2561 (Read 17 times, has 0 replies, 1500 bytes) Date : Tue Nov 11 08:27:50 1997 From : Matthew Page of fidonet#2:2504/112 To : Jonathan Harston Subject: Re: XModem-CRC Calculation Hi, As it happens I have just finished writing some Xmodem code for a project I'm working on. So here is the snippet of CRC checking code. You will need to call the PROCass first. You then pass the whole of the block to FNcrc giving it's length. DEF FNcrc(block%,length%) B%=block%:C%=length% =USR(crc) DEF PROCass LOCAL pass% DIM code% 1024 FOR pass%=8 TO 10 STEP 2 P%=code% L%=code%+1024 [OPT pass% .crc MOV R3,#0 MOV R4,R1 MOV R5,R2 .crcl1 LDRB R2,[R4],#1 EOR R3,R3,R2,LSL #8 MOV R1,#8 .crcl2 TST R3,#&8000 MOV R3,R3,LSL#1 EORNE R3,R3,#&1000 EORNE R3,R3,#&0021 SUBS R1,R1,#1 BNE crcl2 SUBS R5,R5,#1 BNE crcl1 MOV R1,#&FF ORR R1,R1,#&FF00 AND R0,R3,R1 MOV PC,R14 ] NEXT ENDPROC I hope this helps. See Ya Round (Y)atthew --- ArmBBS 0.68 * Origin: ARM Pit BBS * 24 Hours * 01733 445800 * (2:2504/112.0)