      SUBROUTINE STOR16 (KBUF,INDEX,IDATA)
C
C     NAME: STOR16
C
C    LANGUAGE:  FORTRAN
C
C    OPERATING SYSTEM:  UNIVERSAL
C
C    ORDER NUMBER:  5428-SE
C
C    PART NUMBER:  000-026366  NOVEMBER 1985
C
C    PRODUCT:  UNIVERSAL VERSAPLOT COLOR RANDOM 2.0
C
C    VERSATEC, INC., SANTA CLARA, CALIFORNIA 95051
C    A XEROX COMPANY
C
C    Copyright (C) 1985 by Xerox Corporation.  All rights reserved.
C
C    "NOTICE. THIS PROGRAM IS THE EXCLUSIVE PROPERTY OF VERSATEC,
C    INC. AND IS ISSUED IN STRICT CONFIDENCE UNDER A PREARRANGED
C    LICENSE AGREEMENT AND IS NOT TO BE DISCLOSED IN ANY MANNER TO
C    PERSONS OUTSIDE THE LICENSED ORGANIZATION AND SHALL NOT BE
C    REPRODUCED OR DISSEMINATED, IN WHOLE OR PART, TO ANYONE OUTSIDE
C    THE LICENSED ORGANIZATION WITHOUT THE PRIOR WRITTEN APPROVAL OF
C    VERSATEC, INC. UNLESS OTHERWISE PROVIDED FOR BY SUCH LICENSE
C    AGREEMENT.  THIS WORK IS PROTECTED AS AN UNPUBLISHED WORK UNDER
C    THE COPYRIGHT ACT OF 1976."
C
C     STOR16 - STORE A 16-BIT CHUNK INTO OUTPUT BUFFER
C
C
C     LOCAL VARIABLES USED:
C            MSKLO  - MASK USED TO OBTAIN LOWER 16 BITS OF WORD
C            MSKUP  - MASK USED TO OBTAIN UPPER 16 BITS OF WORD
C            NCHUNK  - NUMBER OF 16-BIT CHUNKS PER KBUF WORD
C
C
      DIMENSION KBUF(1)
C
      DATA MSKLO/65535/,MSKUP/-65536/,NCHUNK/2/
C
C
      KWORD = INDEX/NCHUNK + 1
      KCHUNK = MOD (INDEX,NCHUNK) + 1
      ITEMP = KBUF(KWORD)
      GO TO (100,200),KCHUNK
C
  100 ITEMP = AND (ITEMP,MSKLO)
      ITEMP2 = IRAM (IDATA,-16,MSKUP)
      KBUF(KWORD) = OR (ITEMP,ITEMP2)
      RETURN
C
  200 ITEMP = AND (ITEMP,MSKUP)
      ITEMP2 = AND (IDATA,MSKLO)
      KBUF(KWORD) = OR (ITEMP,ITEMP2)
      RETURN
C
      END
