/*
    Jerry J. Trantow
    1560 A. East Irving Place
    Milwaukee, Wi 53202-1460

  A farmer, a hunter, a soldier, a reporter, even a 
  philosopher, may be daunted;
  but nothing can deter a poet,
  for he is actuated by pure love                  HDT

28 Jan 90 converted beep task code to spinTask
 1 Mar 90 Finished working example of SpinPointer
 9 Jun 90 Finally got past linking error
10 Jul 90 Changed Pointer Hot Spot and used #defines in structure
*/
#ifdef AZTEC_C
  #include <functions.h>
  #define max(x,y) ((x)>(y) ? (x) : (y))
  #define min(x,y) ((x)<(y) ? (x) : (y)) 
#endif
#ifdef LATTICE
  #include <proto/exec.h>
  #include <proto/intuition.h>
  #include <proto/dos.h>
  #include <stdio.h>
#endif

#include <exec/types.h>
#include <exec/errors.h>
#include <exec/memory.h>
#include <devices/timer.h>
#include <libraries/dos.h>
#include <intuition/intuition.h>

#define FAST REGISTER

#define SPRITECOUNT (8)        /* number of sprite images */
#define S_HEIGHT    (12L)      /* pointer height [pixels] */
#define S_WIDTH     (16L)      /* pointer width  [pixels] */
#define S_XOFFSET   (-3L)      /* position of hot spot    */
#define S_Y_OFFSET  (-2L)

#define SIGB_SPIN   (31L)        /* use this bit for signal */
#define SIGF_SPIN   (1L<<SIGB_SPIN)
#define SIGB_STOP   (30L)
#define SIGF_STOP   (1L<<SIGB_STOP)

#define SPINTASK "SpinTask"

#define NOT_DONE (LONG)(FALSE)    /* useful for CheckIO() */
#define DONE     (!NOT_DONE)

extern char stTopaz[];
extern struct TextAttr taPlain,taBI,taB;

/* **************** Function Definitions **************** */
#ifdef AZTEC_C
  VOID spinTask();
  VOID KillSpinTask();
  struct Task *SpawnSpinTask();
  VOID CleanUp();
  VOID about();
  struct timerequest *CreateExtIO();
  VOID DeleteExtIO();
#endif
#ifdef LATTICE
  VOID spinTask(VOID);
  VOID KillSpinTask(struct Task *);
  struct Task *SpawnSpinTask(struct Window *);
  VOID CleanUp(char *);
  VOID about(VOID);
  struct Task *FindTask();
#endif

/* ********************** Global variables ************** */
extern LONG Spin_sec;      /* seconds between images */
extern LONG Spin_usec;     /* useconds between images */

typedef struct userspritedata  /* ROM Kernel Manual p113 */
{
  UWORD posctl[2];   /* position, control */
  UWORD sprdata[2*S_HEIGHT]; /* pixel data */
  UWORD reserved[2];
} Sprite;

extern Sprite spinSprites[];
