예제 #1
0
void handle_evbl(void){
	static long last=0;
	static int rest_cnt=0;
	int i;

	#ifndef ALLEGRO_DOS
	yield_timeslice();
	#endif
	i = (15*app_data.speed/100);
	rest_cnt = (rest_cnt+1)%(i<5?5:i);
	#ifdef ALLEGRO_WINDOWS
	if (rest_cnt==0) rest(1);
	#endif
	last_line=0;
	master_clk -= evblclk;
	frame++;
	if (!app_data.debug) {
		finish_display();
	}

    if (app_data.crc == 0xA7344D1F)
                      {for (i=0; i<140; i++)
                           {
		                   ColorVector[i] = (VDCwrite[0xA3] & 0x7f) | (p1 & 0x80);
		                   AudioVector[i] = VDCwrite[0xAA];
                           }      
                      }/*Atlantis*/
                      else
                      for (i=0; i<MAXLINES; i++)  {
                      ColorVector[i] = (VDCwrite[0xA3] & 0x7f) | (p1 & 0x80);
	                  AudioVector[i] = VDCwrite[0xAA];
                      }

                      
    if (key2vcnt++ > 10) {
		key2vcnt=0;
		for (i=0; i<128; i++) key2[i] = 0;
		dbstick1 = dbstick2 = 0;
	}
	if (app_data.limit) {
		long d,f;
		d = (TICKSPERSEC*100)/(app_data.speed*fps);
		f = ((d-gettimeticks()+last)*1000)/TICKSPERSEC;
		if (f>0) {
			#ifdef ALLEGRO_WINDOWS
				f = f-(f%10);					
				if (f>5) rest(f-5);
			#else
				#ifndef ALLEGRO_DOS
					yield_timeslice();
				#endif
			#endif
		}
		while (gettimeticks() - last < d);
		last = gettimeticks();
	}
	mstate=0;
    
}
예제 #2
0
파일: vmachine.c 프로젝트: montjoie/o2em2
/*============================================================================*/
void handle_evbll()
{
	static unsigned long last = 0;
	static int rest_cnt = 0;
	int i;
	unsigned long d, f;
	int antiloop = 0;
	/*#ifndef ALLEGRO_DOS
	yield_timeslice();
	#endif*/
	i = (15*app_data.speed/100);
	rest_cnt = (rest_cnt+1)%(i<5?5:i);
	/* why this ???
	#ifdef ALLEGRO_WINDOWS
	if (rest_cnt == 0)
		rest(1);
	#endif
	*/

	/******************* 150 */

	for (i = 150; i < MAXLINES; i++) {
		ColorVector[i] = (VDCwrite[0xA3] & 0x7f) | (p1 & 0x80);
		AudioVector[i] = VDCwrite[0xAA];
	}

	if (key2vcnt++ > 10) {
		key2vcnt = 0;
		for (i = 0; i < KEY_MAX; i++)
			key2[i] = 0;
		dbstick1 = dbstick2 = 0;
	}
	if (app_data.limit) {
		d = (TICKSPERSEC * 100) / (app_data.speed * fps);
		f = ((d + last - gettimeticks()) * 1000) / TICKSPERSEC;
		if (f > 0) {
			#ifdef ALLEGRO_WINDOWS
				/*
				f = f-(f%10);
				if (f>5) rest(f-5);*/
			#else
				/*#ifndef ALLEGRO_DOS
					yield_timeslice();
				#endif*/
			#endif
		}
		antiloop = 0;
		while (gettimeticks() - last < d && antiloop < 1000000) {
			antiloop++;
		}
		if (antiloop >= 1000000) {
			printf("antiloop %d\n", antiloop);
		}
		last = gettimeticks();
	}
	mstate = 0;
}
예제 #3
0
void handle_evbll(void){
	static long last=0;
	static int rest_cnt=0;
	int i;

	#ifndef ALLEGRO_DOS
	yield_timeslice();
	#endif
	i = (15*app_data.speed/100);
	rest_cnt = (rest_cnt+1)%(i<5?5:i);
	#ifdef ALLEGRO_WINDOWS
	if (rest_cnt==0) rest(1);
	#endif

/******************* 150 */

    for (i=150; i<MAXLINES; i++)  {
		ColorVector[i] = (VDCwrite[0xA3] & 0x7f) | (p1 & 0x80);
		AudioVector[i] = VDCwrite[0xAA];
	}

	if (key2vcnt++ > 10) {
		key2vcnt=0;
		for (i=0; i<128; i++) key2[i] = 0;
		dbstick1 = dbstick2 = 0;
	}
	if (app_data.limit) {
		long d,f;
		d = (TICKSPERSEC*100)/(app_data.speed*fps);
		f = ((d-gettimeticks()+last)*1000)/TICKSPERSEC;
		if (f>0) {
			#ifdef ALLEGRO_WINDOWS
				f = f-(f%10);					
				if (f>5) rest(f-5);
			#else
				#ifndef ALLEGRO_DOS
					yield_timeslice();
				#endif
			#endif
		}
		while (gettimeticks() - last < d);
		last = gettimeticks();
	}
	mstate=0;	
}
예제 #4
0
파일: vmachine.c 프로젝트: montjoie/o2em2
/*============================================================================*/
void handle_evbl()
{
	static unsigned long last = 0;
	static unsigned long idx = 0;
	static unsigned long first = 0;
	int i;
	unsigned long d, f, tick_tmp;
	int antiloop;

	i = (15 * app_data.speed / 100);
	last_line = 0;
	master_clk -= evblclk;
	frame++;
	if (!app_data.debug) {
		finish_display();
	}

	if (app_data.handleevbl == 1) { /* Atlantis */
		for (i = 0; i < 140; i++) {
			ColorVector[i] = (VDCwrite[0xA3] & 0x7f) | (p1 & 0x80);
			AudioVector[i] = VDCwrite[0xAA];
		}
	} else
		for (i = 0; i < MAXLINES; i++) {
			ColorVector[i] = (VDCwrite[0xA3] & 0x7f) | (p1 & 0x80);
			AudioVector[i] = VDCwrite[0xAA];
		}

	if (key2vcnt++ > 10) {
		key2vcnt = 0;
		for (i = 0; i < KEY_MAX; i++)
			key2[i] = 0;
		dbstick1 = dbstick2 = 0;
	}
	if (app_data.limit) {
		d = (TICKSPERSEC * 100) / (app_data.speed * fps);
		f = ((d + last - gettimeticks()) * 1000) / TICKSPERSEC;
		antiloop = 0;
		idx++;
		if (first == 0)
			first = gettimeticks();
		tick_tmp = gettimeticks();
		if (tick_tmp == first)
			tick_tmp++;
		/*printf("%ld %ld %ld %ld\n", idx, d, tick_tmp - first, idx * TICKSPERSEC / (tick_tmp - first));*/
		/* need this on my windows because the "d" sleep time is incorect
		 * Certainly because it dont test current fps
		 * */
		#ifdef ALLEGRO_WINDOWS
		if (idx * TICKSPERSEC / (tick_tmp - first) < fps)
			d = 0;
		#endif
		if (f > 0) {
			#ifdef ALLEGRO_WINDOWS
			/*
				f = f - (f%10);
				printf("%ld\n", f);
				if (f > 5)
					rest(f - 5);*/
			#else
				/*#ifndef ALLEGRO_DOS
					yield_timeslice();
				#endif*/
			#endif
		}
		while (gettimeticks() - last < d && antiloop < 1000000) {
			antiloop++;
			usleep(100);
		}
		if (antiloop >= 1000000) {
			printf("antiloop %d\n", antiloop);
		}
		last = gettimeticks();
	}
	mstate = 0;

}