File:  [RetroPC.NET] / np2 / timing.c
Revision 1.3: download - view: text, annotated - select for diffs
Thu Oct 23 21:58:44 2003 JST (22 years ago) by yui
Branches: MAIN
CVS tags: HEAD
fix MacOS9 (T.Yui)

#include	"compiler.h"
#include	"pccore.h"
#include	"diskdrv.h"
#include	"fdd_mtr.h"
#include	"timing.h"


static	UINT	timercnt = 0;
static	UINT32	tick = 0;
static	UINT32	cnt = 0;


void timing_reset(void) {

	cnt = 0;
	timercnt = 0;
	tick = GETTICK();
}

void timing_setcount(UINT value) {

	timercnt = value;
}

UINT timing_getcount(void) {			// ver0.12 60.0Hz  56.4Hz

	UINT32	ticknow;
	UINT32	span;
	UINT	steps;

	ticknow = GETTICK();
	span = ticknow - tick;
	if (span) {
		fddmtr_callback(ticknow);

		tick = ticknow;
		if (span < 1000) {
			cnt += (span * 388);
			steps = cnt / 6875;
			timercnt += steps;
			cnt -= (steps * 6875);
		}
		else {
			cnt = 0;
			timercnt += 56;
		}
	}
	return(timercnt);
}

void timing_term(void) {
}


RetroPC.NET-CVS <cvs@retropc.net>