/*********************************
*  POINTER  09/28/90
*  Source file for STV
*  © Copyright 1990 Timm Martin
*  All Rights Reserved Worldwide
**********************************/

#include <exec/memory.h>
#include <exec/types.h>
#include <functions.h>
#include "func.h"
#include "main.h"

#define POINTER_DATA 54
#define POINTER_SIZE (long)(POINTER_DATA*2)

USHORT pointer_data[POINTER_DATA] =
{
  0x0000, 0x0000,

  0x0000, 0x0FE0,
  0x0F60, 0x1090,
  0x1FF0, 0x6008,
  0x3FF0, 0x4008,
  0x7FF8, 0x8F04,
  0x7FFC, 0x8202,
  0x7FFC, 0x8402,
  0x3FFE, 0x4F01,
  0x7FFE, 0x8001,
  0x7FFE, 0x80F1,
  0x3FFC, 0x4022,
  0x7FFE, 0x8041,
  0x7FFE, 0x80F1,
  0x3FFE, 0x4001,
  0x1FFC, 0x2002,
  0x07F8, 0x1804,
  0x00F0, 0x0708,
  0x0780, 0x0870,
  0x0FE0, 0x1010,
  0x07C0, 0x0820,
  0x0000, 0x0FE0,
  0x01C0, 0x0220,
  0x03E0, 0x0410,
  0x00E0, 0x0310,
  0x0000, 0x00E0,

  0x0000, 0x0000
};

USHORT *pointer = NULL;  /* GLOBAL */

/*****************
*  POINTER CLOSE
******************/

/*
This procedure frees the CHIP RAM memory used by the ZZZ pointer.
*/

void pointer_close( void )
{
  if (pointer)
    FreeMem( pointer, POINTER_SIZE );
}

/****************
*  POINTER OPEN
*****************/

/*
This function attempts to copy the ZZZ pointer image data into CHIP RAM.
*/

void pointer_open( void )
{
  /* if could allocate CHIP RAM to hold pointer data */
  if (pointer = AllocMem( POINTER_SIZE, MEMF_CHIP ))
    CopyMemQuick( pointer_data, pointer, POINTER_SIZE );
  else
    program_end( "pointer" );
}
