/* TURBO
   -----
   Improves system speed 
   by turning of bitplane,
   sprite, copper and 
   audio DMA.
   (W) 6/88 by O.Wagner

   V1.0 for MANX Aztec C 3.4a
   CC turbo
   LN turbo.o -lc

   To install, enter "RUN TURBO".
   Pressing the "TURBO!"-gadget
   will turn off screen and all.
   Pressing button outside of the
   "TURBO"-window, pressing RIGHT
   button or the "TURBO"-window
   becoming inactive (by starting
   another application) will turn
   BITPLANE, COPPER and SPRITE.
   AUDIO must be turned on manually.

   This is Public Domain. 
   Please note that some other
   programs of the author are
   shareware and NOT freely 
   distributable. */

#include <hardware/dmabits.h>
#include <hardware/custom.h>
#include <intuition/intuition.h

/* window created with POWERWINDOWS */

SHORT BorderVectors1[] = {0,0,74,0,74,12,0,12,0,0};
struct Border Border1 = {
	-2,-1,
	2,0,JAM1,
	5,
	BorderVectors1,
	NULL
};

struct TextAttr TOPAZ80 = {
	(STRPTR)"topaz.font",
	TOPAZ_EIGHTY,0,0
};
struct IntuiText IText1 = {
	3,0,JAM2,
	11,2,
	&TOPAZ80,
	(STRPTR)"TURBO!",
	NULL
};

struct Gadget gadget = {
	NULL,
	13,12,
	71,11,
	GADGHCOMP,
	RELVERIFY,
	BOOLGADGET,
	(APTR)&Border1,
	NULL,
	&IText1,
	0,
	NULL,
	4,
	NULL
};


struct NewWindow NewWindowStructure = {
	0,0,
	96,26,
	3,2,
	CLOSEWINDOW+GADGETUP+INACTIVEWINDOW+MOUSEBUTTONS,
	WINDOWDRAG+WINDOWDEPTH+WINDOWCLOSE+SIMPLE_REFRESH+RMBTRAP+NOCAREREFRESH,
	&gadget,
	NULL,
	NULL,
	NULL,
	NULL,
	0,0,
	0,0,
	WBENCHSCREEN
};

struct IntuitionBase *IntuitionBase,*OldOpenLibrary();
struct Window *OpenWindow();
struct IntuiMessage *GetMsg();

main()
{
 register int class;
 register struct Window *win;
 register struct IntuiMessage *msg;

 IntuitionBase=OldOpenLibrary("intuition.library");
 if (!(win=OpenWindow(&NewWindowStructure)))
  { DisplayBeep(0); Exit(20); }
 
 for(;;) { /* FOREVER */
  Wait(1L<<win->UserPort->mp_SigBit);
  while(msg=GetMsg(win->UserPort)) {
   class=msg->Class;
   ReplyMsg(msg);
   switch(class) {
    case CLOSEWINDOW:
     CloseWindow(win); /* cleanup */
     Exit(0);
    case GADGETUP:
     custom.dmacon = BITCLR+DMAF_RASTER+DMAF_COPPER+DMAF_SPRITE+DMAF_AUDIO;   
/* nice hint how to use CUSTOM.H to simply access the custom board */
     break;
    default:
     custom.dmacon = BITSET+DMAF_RASTER+DMAF_COPPER+DMAF_SPRITE;
     break;
   }
  }
 }
}    
   








