;
;       NAME:  CMPCRC
;
       OBJNAM  .SBR
;
;       FUNCTION:  This module computes a CRC total for its input
;       argument and returns it.
;
;       CALLING SEQUENCE:
;       XCALL CMPCRC,BUFFER,CRC  where
;       BUFFER is the data on which the CRC is to be computed
;       CRC is the returned total (should be length=1)
;
;       AUTHOR:  Tom Dahlquist
;
;       HISTORY:
;         WHEN   WHO WHAT
;       05/09/85 TAD Written.
;
       SEARCH  SYS
       SEARCH  SYSSYM
;
;       BASIC parameter list
;
       ASECT
ARGCNT: BLKW    1                       ; # of args
TYPE1:  BLKW    1                       ; arg type
ADDR1:  BLKL    1                       ; address
LEN1:   BLKL    1                       ; length
TYPE2:  BLKW    1
ADDR2:  BLKL    1
LEN2:   BLKL    1
       PSECT

CMPCRC: PHDR    -1,0,PH$REU!PH$REE
       CMPW    @A3,#2                  ; must be 2 args...
       BNE     RETURN

       MOV     ADDR1(A3),A0            ; A0 -> data bytes
       MOV     LEN1(A3),D0             ; D0 = length of string
       DEC     D0                      ; decrement for DBF...
       CLR     D1                      ; to accumulate CRC...

LOOP:   ADDB    (A0)+,D1
       DBF     D0,LOOP

       MOV     ADDR2(A3),A0            ; A0 -> return argument
       MOVB    D1,@A0                  ; return CRC...
RETURN: RTN
       END