

; Bliss-32 10.1-416	Monday 21-AUG-1978 22:50:15	DBB3:[F11A.SRC]CHKSUM.B32;9					Page 1

;

;	0001	MODULE CHKSUM (

;	0002			LANGUAGE (BLISS32),

;	0003			IDENT = 'A0002'

;	0004			) =

;	0005	BEGIN

;	0006	

;	0007	!

;	0008	! Copyright (c) 1977

;	0009	! Digital Equipment Corporation, Maynard, Massachusetts 01754

;	0010	!

;	0011	! This software is furnished  under a license for use only on a single

;	0012	! computer  system and  may be  copied only with  the inclusion of the

;	0013	! above copyright notice.  This software, or any other copies thereof,

;	0014	! may not be provided or  otherwise made available to any other person

;	0015	! except for use on such system and to one who agrees to these license

;	0016	! terms.  Title to and  ownership of the  software  shall at all times

;	0017	! remain in DEC.

;	0018	!

;	0019	! The information in this software is subject to change without notice

;	0020	! and should  not be construed  as a commitment  by Digital  Equipment

;	0021	! Corporation.

;	0022	!

;	0023	! DEC assumes  no  responsibility  for  the use or  reliability of its

;	0024	! software on equipment which is not supplied by DEC.

;	0025	

;	0026	!++

;	0027	!

;	0028	! FACILITY:  F11ACP Structure Level 1

;	0029	!

;	0030	! ABSTRACT:

;	0031	!

;	0032	!	This routine computes and checks a file header checksum.

;	0033	!

;	0034	! ENVIRONMENT:

;	0035	!

;	0036	!	STARLET operating system, including privileged system services

;	0037	!	and internal exec routines.

;	0038	!

;	0039	!--

;	0040	!

;	0041	!

;	0042	! AUTHOR:  Andrew C. Goldstein,	 CREATION DATE:  22-Nov-1977  22:25

;	0043	!

;	0044	! REVISION HISTORY:

;	0045	!

;	0046	!   Andrew C. Goldstein, 15-May-78  14:28

;	0047	!   A0002 - Modify for faster code

;	0048	!

;	0049	!**

;	0050	

;	0051	

;	0052	LIBRARY 'SYS$LIBRARY:LIB.L32';

;	0053	REQUIRE 'SRC$:FCPDEF.B32';



; Bliss-32 10.1-416	Monday 21-AUG-1978 22:50:15	DBB3:[F11A.SRC]CHKSUM.B32;9					Page 2

;

;	0372	GLOBAL ROUTINE CHECKSUM (HEADER) =

;	0373	

;	0374	!++

;	0375	!

;	0376	! FUNCTIONAL DESCRIPTION:

;	0377	!

;	0378	!	This routine computes, checks, and stores the checksum of a file header.

;	0379	!

;	0380	! CALLING SEQUENCE:

;	0381	!	CHECKSUM (ARG1)

;	0382	!

;	0383	! INPUT PARAMETERS:

;	0384	!	ARG1: address of file header buffer

;	0385	!

;	0386	! IMPLICIT INPUTS:

;	0387	!	NONE

;	0388	!

;	0389	! OUTPUT PARAMETERS:

;	0390	!	NONE

;	0391	!

;	0392	! IMPLICIT OUTPUTS:

;	0393	!	NONE

;	0394	!

;	0395	! ROUTINE VALUE:

;	0396	!	1 if checksum was correct

;	0397	!	0 if checksum was wrong

;	0398	!

;	0399	! SIDE EFFECTS:

;	0400	!	Correct checksum stored in header

;	0401	!

;	0402	!--

;	0403	

;	0404	BEGIN

;	0405	

;	0406	MAP

;	0407		HEADER		: REF VECTOR [,WORD];

;	0408	

;	0409	LOCAL

;	0410		P		: REF VECTOR [,WORD], ! pointer to scan header

;	0411		SUM		: WORD,		! checksum value

;	0412		MATCH;				! success flag

;	0413	

;	0414	

;	0415	! We simply sum the first 255 words of the file header. Then we compare the

;	0416	! checksum in the header with the one computed, and store the new one.

;	0417	!

;	0418	

;	0419	SUM = 0;

;	0420	P = .HEADER;

;	0421	DECR I FROM 255 TO 1

;	0422	DO

;	0423	    BEGIN

;	0424	    SUM = .SUM + .P[0];

;	0425	    P = .P + 2;

;	0426	    END;



; Bliss-32 10.1-416	Monday 21-AUG-1978 22:50:15	DBB3:[F11A.SRC]CHKSUM.B32;9					Page 2-1

;

;	0427	

;	0428	MATCH = .SUM EQL .P[0];

;	0429	P[0] = .SUM;

;	0430	

;	0431	RETURN .MATCH;

;	0432	

;	0433	END;					! end of routine CHECKSUM





							    .TITLE  CHKSUM

							    .IDENT  \A0002\







							    .PSECT  $CODE$,NOWRT,2



					 0004 00000 	    .ENTRY  CHECKSUM, Save R2					      ; 0372

				       52  B4 00002 	    CLRW    SUM							      ; 0419

		         51 	  04   AC  D0 00004 	    MOVL    HEADER, P						      ; 0420

		         50 	  FF   8F  9A 00008 	    MOVZBL  #255, I						      ; 0421

		         52 	       81  A0 0000C 1$:     ADDW2   (P)+, SUM						      ; 0424

		         FA 	       50  F5 0000F 	    SOBGTR  I, 1$						      ; 0421

				       50  D4 00012 	    CLRL    R0							      ; 0428

		         61 	       52  B1 00014 	    CMPW    SUM, (P)						      ;

				       02  12 00017 	    BNEQ    2$							      ;

				       50  D6 00019 	    INCL    R0							      ;

		         61 	       52  B0 0001B 2$:     MOVW    SUM, (P)						      ; 0429

					   04 0001E 	    RET     							      ; 0372



; Routine Size:  31 bytes





;	0434	

;	0435	END

;	0436	ELUDOM













;				       PSECT SUMMARY

;

;	Name		 Bytes			       Attributes

;

;  $CODE$         	    31  NOWRT,  RD ,  EXE,NOSHR,  LCL,  REL,  CON,NOPIC,ALIGN(2)









;				LIBRARY STATISTICS

;

;					     -------- Symbols --------    Blocks

;	File				     Total    Loaded   Percent      Read

;



; Bliss-32 10.1-416	Monday 21-AUG-1978 22:50:15	DBB3:[F11A.SRC]CHKSUM.B32;9					Page 2-2

;

;  DBA4:[SYSLIB]LIB.L32;1		      5582         1         0       222











; Size:		31 code + 0 data bytes

; Run Time:	00:03.6

; Elapsed Time:	00:08.6

; Memory Used:	250 pages

; Compilation Complete

