#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

#include <msdos.cf>

#include <snd.h>
#include <egb.h>

#include "../concorde/concorde.h"
#include "../tomahawk/tomahawk.h"
#include "../airforce/airforce.h"

#include "MAIN.h"
#include "BGM.h"
#include "EGBCTRL.h"
#include "PAGECTRL.h"

#define SRAND 79154726


void RecognizeCommandParameterInfo(int argc,char *argv[])
{
	int i;
	for(i=1; i<argc; ++i)
	{
		int j;
		char arg[256];
		strncpy(arg,argv[i],255);
		arg[255]=0;
		for(j=0; 0!=arg[j]; ++j)
		{
			if('a'<=arg[j] && arg[j]<='z')
			{
				arg[j]=arg[j]+'A'-'a';
			}
		}
		if(0==strcmp("-VIDEOOUT",arg))
		{
			egbCtrl_videoOut=1;
		}
	}
}

int main(int argc,char *argv[])
{
	RecognizeCommandParameterInfo(argc,argv);

	StartTBIOS();

	SetUpEGB320x240_320x240();
	SetUpPage320x240_320x240();

	{
		const int NY=256,NOBJ=64;
		AL_Init_All(NY,NOBJ);
	}

	srand(SRAND);

	DemoMain(rp);

	printf("End\n");

	YGH_clearPage(&rp[0],0);
	YGH_clearPage(&rp[1],0);

	EndTBIOS();

	return 0;
}
