	.TITLE NSET RETURN NUMBER OF BITS SET
	.IDENT /1.0/
	.PSECT	NSET,RO,I,CON,LCL
;
; THIS SUBROUTINE SIMPLY RETURNS THE NUMBER OF BITS
; SET IN AN INTEGER WORD.
;
; FORTRAN CALLING SEQUENCE:
;
;  I=NSET(KWORD)
;  
	.GLOBL	NSET
NSET:
	CMP	#1,(R5)+	; AT LEAST ONE ARGUMENT?
	BEQ	5$		; YES
	TRAP	<128.+80.>	; NO
	RETURN
;
5$:
	MOV	@(R5),R3
	MOV	#16.,R2
	CLR	R0		; COUNT OF BITS SET
10$:
	ASH	#-1,R3
	ADC	R0		; ADD THE BIT TO COUNTER
	SOB	R2,10$		; LOOP UNTIL ALL ARE TESTED
	RETURN
	.END
