        .TITLE SETBIT SET BIT SUBROUTINE                                        
	.IDENT	/11FE87/
;                                                                               
; SETBIT    PROGRAM NO:                                                         
;                                                                               
;   THIS PROGRAM SETS A BIT IN A SPECIFIED ARRAY.                               
;                                                                               
;   FORTRAN CALL:                                                               
;                                                                               
;       CALL SETBIT(BITARY,NBIT)                                                
;         BITARY=INTEGER OR REAL ARRAY CONTAINING BIT WORDS                     
;         NBIT=SPECIFIED BIT TO BE SET TO ONE(RIGHTMOST BIT WORD 1 IS 0)        
;                                                                               
        .PAGE                                                                   
	.PSECT	$SBIT,RW,CON,LCL,I
        .GLOBL  SETBIT                                                          
SETBIT: MOV     (R5)+,R0      ; NUMBER OF ARGUMENTS                             
        MOV     (R5)+,R1        ; ADDRESS OF BIT ARRAY                          
        MOV     @(R5)+,R2       ; BIT COUND                                     
        MOV     R2,R3                                                           
        ASH     #-4,R3          ; DIVIDE BY 16 TO GET WORD IN BIT ARRAY         
        ASH     #1,R3         ; MULT BY 2 TO GET WORD                           
        ADD     R3,R1           ; ADD TO BIT ARRAY ADDRESS                      
        BIC     #177760,R2    ; R2 CONTAINS BIT POSITION (0-15)                 
        MOV     #1,R4           ; 1 BIT MASK                                    
        ASH     R2,R4           ; SHIFT TO CORRECT POSITION                     
        BIS     R4,(R1)         ; SET THE BIT                                   
        RTS     PC            ; RETURN                                          
        .END                                                                    
