Category : Modula II Source Code
Archive   : CRC-M2.ZIP
Filename : CRCALC.MOD

 
Output of file : CRCALC.MOD contained in archive : CRC-M2.ZIP
IMPLEMENTATION MODULE CRCalc;

VAR crc16tab: ARRAY [0..255] OF CARDINAL;

PROCEDURE crcme(VAR buf: ARRAY OF CHAR;
count: CARDINAL;
VAR crc16: CARDINAL);
VAR i, inx: CARDINAL;
BEGIN
IF count # 0 THEN
DEC(count);
FOR i := 0 TO count DO
inx := CARDINAL( BITSET(buf[i]) / BITSET(crc16) ) MOD 100H;
crc16 := crc16 DIV 100H;
crc16 := CARDINAL( BITSET(crc16) + BITSET(inx) * {8..15} );
crc16 := CARDINAL( BITSET(crc16) / BITSET(crc16tab[inx]) )
END
END
END crcme;

PROCEDURE MakeCRCTable;
VAR entry, i, inx: CARDINAL;
carry: BOOLEAN;
BEGIN
FOR inx := 0 TO 255 DO
entry := inx;
FOR i := 1 TO 8 DO

carry := ODD(entry);
entry := entry DIV 2;

IF carry THEN
entry := CARDINAL( BITSET(entry) / BITSET(0A001H) );
END

END;
crc16tab[inx] := entry
END
END MakeCRCTable;

BEGIN
MakeCRCTable
END CRCalc.


  3 Responses to “Category : Modula II Source Code
Archive   : CRC-M2.ZIP
Filename : CRCALC.MOD

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/