#include <conio.h>
#include "dosalloc.h"
#include "gusmod.h"
#include "gus.h"

/*
    PLAY - Conversion from Mc.KRiSS's PASCAL verison to WATCOM by Mr.BAGGiNS
*/

void main(int argc, char *argv[])
{
  if (argc != 2)
  {
    printf("þ Gimme da MOD file name...\n");
    exit(1);
  }

  atexit( GUSDeInit );

  GUSFind();
  GUSReset();
  AmpliferVolume = 17;  // 0..18

  printf("þ Loading module %s . . .\n", argv[1]);

  LoadModule(argv[1], 0 , false);
  if (ModError != 0)
  {
    printf("Error %u !\n", ModError);
    exit(ModError);
  }
  StartPlaying();

  printf("þ Free low memory left after loading patterns : %d\n", DOS_maxavail());

  while (inp(0x60) != 1) {}

  while (kbhit()) getch();

  StopPlaying();
  FreeModule();
}
