#include "clip.h"

int
main(int argc, char* argv[])
{
	static unsigned char buf[0x10000];
	static AYDRIVER ay;
	FILE* fp;
	short wbuff[AY38910BUFLEN];

	//if(argc != 1 + 1) abort();
	fp = fopen(/*argv[1]*/"c:/SpaceHarrier2.ay", "rb");
	if(!fp) abort();
	fread(buf, 1, sizeof buf, fp);
	fclose(fp);

	if(ay_init(&ay, buf, 1) != 0) abort();
	for(;;) {
		z80_run(&ay.z80, AY_ZX_Z80_CLOCK / 50);
		z80_int(&ay.z80, 0);
		ay38910_mix(&ay.ay38910, wbuff, AY38910BUFLEN);
	}

	printf("OK\n");
	getchar();
	return 0;
}
