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

#include "../concorde.h"

char EGB_work[EgbWorkSize];
short virt[320*240];

void main()
{
	PAGE rp,vp;
	int i,j,c,pad;

	EGB_init(EGB_work,EgbWorkSize);
	EGB_resolution(EGB_work,0,10);
	EGB_resolution(EGB_work,1,10);

	EGB_writePage(EGB_work,1);
	EGB_displayStart(EGB_work,0,0,0);
	EGB_displayStart(EGB_work,2,2,2);
	EGB_displayStart(EGB_work,3,320,240);
	EGB_displayPage(EGB_work,1,2);

	YGH_initPage(&rp,SEG_VRAMP,0x40000  ,512,256);
	YGH_initPage(&vp,SEG_VIRTU,ADR(virt),320,240);
	YGH_clearPage(&vp,15);

	pad=255;
	i=0;
	while(pad==255)
	{
		for(j=0; j<40; j++)
		{
			c=((j+i)%40);
			if(c<20)c=31*    c /20;
			   else c=31*(40-c)/20;
			YGH_color(&vp,c*1024);
			YGH_line(&vp,j*8    ,0      ,319    ,j*6    );
			YGH_line(&vp,    319,j*6    ,319-j*8,239    );
			YGH_line(&vp,319-j*8,239    ,0      ,239-j*6);
			YGH_line(&vp,0      ,239-j*6,j*8    ,0      );
		}
		YGH_pageCopy(&rp,&vp);
		i=(i+1)%40;
		SND_joy_in_2(0,&pad);
	}
}
