/*
 * 5799-WZQ (C) COPYRIGHT IBM CORPORATION 1986
 * LICENSED MATERIALS - PROPERTY OF IBM
 * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
 */
/* $Header:vikio.c 12.0$ */
/* $ACIS:vikio.c 12.0$ */
/* $Source: /ibm/acis/usr/src/ibm/aedtest/RCS/vikio.c,v $ */

#ifndef lint
static char *rcsid = "$Header:vikio.c 12.0$";
#endif

#include "vikst.h"
 
static char *vikbase;
static INT16 vikiof=1;
vinit()
 
  {
    /* get a pointer to the A0000 segment of memory, where Viking
       lives */
#ifndef BSD
    vikptr(&vikbase);
#else
    vikbase = (char *) 0xf40a0000;
#endif
    vikiof=0;
  }
 
#ifndef BSD
vwrite(buffer,nwords,offset)
  short *buffer;
  INT16 nwords;
  INT16 offset;
 
  {
    short *viking;
 
	if (vikiof) vinit();
    /* copy the buffer into viking */
    viking = (short *) (vikbase+offset);
    for (; nwords > 0; nwords--) {
      *viking++ = *buffer++;
    }
  }
 
vread(buffer,nwords,offset)
  short *buffer;
  INT16 nwords;
  INT16 offset;
 
  {
    short *viking;
	if (vikiof) vinit();
 
    /* copy the buffer into viking */
    viking = (short *) (vikbase+offset);
    for (; nwords > 0; nwords--) {
      *buffer++ = *viking++;
    }
  }
#endif
