home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 2 BBS
/
02-BBS.zip
/
MLNK10CS.ZIP
/
CRC_ASM.ASM
< prev
next >
Wrap
Assembly Source File
|
1990-03-08
|
3KB
|
89 lines
; Static Name Aliases
;
TITLE CRC_ASM -- Assembler Routines to do faster CRC's
; NAME CRC_ASM
;
include version.inc
include msdos.inc
include cmacros.inc
.sall
.list
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
sBegin code
assumes cs,code
assumes ds,data
;------------------------------------------------------------------------
; CRC_XMODEM - THIS ROUTINE CALCULATES THE CRC-XMODEM ALGORITHM.
;
; Copyright, Renex Corportion
; 1513 Davis Ford Road
; Woodbridge, Va 22192.
;
; Licensed to Vincent Perriello for use and distribution
; with BinkleyTerm.
;
; ON ENTRY: CX = OLD CRC
; AL = NEW BYTE
; ON EXIT: BX = NEW CRC, AX, DX LOST OTHER REGISTERS UNCHANGED.
;
; POLYNOMIAL: C^16 + C^12 + C^5 + 1
;
; IN THE FOLLOWING:
; C1-C16 ARE THE CRC, D1-D8 ARE THE NEW BYTE, X1-X8 ARE C9-C16 XOR D1-D8.
; R1-R16 ARE THE NEW CRC AND ARE FORMED BY XORING ALL THE VALUES IN
; THE APPROPRIATE COLUMNS
;
; HIGH ORDER BYTE LOW ORDER BYTE
; ORIGINAL CRC
; C16 C15 C14 C13 C12 C11 C10 C9 C8 C7 C6 C5 C4 C3 C2 C1
;
; NEW CRC
; R16 R15 R14 R13 R12 R11 R10 R9 R8 R7 R6 R5 R4 R3 R2 R1
; -----------------------------------------------------------------
; C8 C7 C6 C5 C4 C3 C2 C1 X8 X7 X6 X5 X4 X3 X2 X1
; X4 X3 X2 X1 X8 X7 X6 X5 X8 X7 X6 X5
; X8 X7 X6 X5 X4 X3 X2 X1
; X8 X7 X6 X5
;
;------------------------------------------------------------------------
;
cProc xcrc,<PUBLIC>
parmW CRC
parmB NEWBYTE
cBegin
MOV CX,CRC ;GET THE OLD CRC TO CX
MOV AL,NEWBYTE
XOR AH,AH ;ZERO TOP HALF OF AX
XOR AL,CH ;CREATE X IN AX FROM XOR OF NEW DATA AND HI CRC
MOV BH,CL ;OLD LOW CRC TO HIGH RESULT
MOV BL,AL ;X TO LOW RESULT SETS 8 BITS
MOV DL,AL ;TEMP COPY OF X
AND DL,0F0H ;HI 4 BITS ONLY
XOR BH,DL ;TO HI RESULT
ROL AX,1 ;ROTATE ONE BIT
XOR BH,AH ;X8 TO BIT 9 OF RESULT
MOV DL,AL ;TEMP COPY OF X RIGHT 1
AND DL,0E0H
XOR BL,DL
ROL AX,1 ;X LEFT 3 MORE, TOTAL OF 4
ROL AX,1
ROL AX,1
XOR BL,AH
XOR BH,AL
ROL AX,1 ;X LEFT 5 NOW
XOR AX,BX
cEnd
sEnd
END