home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GEMini Atari
/
GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso
/
files
/
bbs
/
pibterm
/
pibt3sp1
/
kermcrc.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1985-10-04
|
2KB
|
49 lines
(*----------------------------------------------------------------------*)
(* Kermit_CRC --- Update cyclic redundancy check for Kermit *)
(*----------------------------------------------------------------------*)
FUNCTION Kermit_CRC( Old_CRC: INTEGER; B: BYTE ) : INTEGER;
(*----------------------------------------------------------------------*)
(* *)
(* Function: Kermit_CRC *)
(* *)
(* Purpose: Computes cyclic redundancy check for 1 character *)
(* for Kermit protocol. *)
(* *)
(* Calling Sequence: *)
(* *)
(* New_CRC := Kermit_CRC( Old_CRC : INTEGER; *)
(* B : BYTE ) : INTEGER; *)
(* *)
(* Old_CRC --- previous CRC value. *)
(* B --- character for which CRC is computed. *)
(* New_CRC --- updated CRC. *)
(* *)
(* Calls: None *)
(* *)
(*----------------------------------------------------------------------*)
VAR
C : BYTE;
CSave : BYTE;
CONST
CrcTab: ARRAY[0..15] OF INTEGER
= ( $0000, $1081, $2102, $3183, $4204, $5285, $6306, $7387,
$8408, $9489, $A50A, $B58B, $C60C, $D68D, $E70E, $F78F );
CrcTab2: ARRAY[0..15] OF INTEGER
= ( $0000, $1189, $2312, $329B, $4624, $57AD, $6536, $74BF,
$8C48, $9DC1, $AF5A, $BED3, $CA6C, $DBE5, $E97E, $F8F7 );
BEGIN (* Kermit_CRC *)
C := B XOR LO( Old_CRC );
CSave := ( C AND $F0 ) SHR 4;
C := C AND $0F;
Kermit_CRC := ( Old_CRC SHR 8 ) XOR ( CrcTab[ CSave ] XOR CrcTab2[ C ] );
END (* Kermit_CRC *);
ə