From: FEM@tokaigw.cc.u-tokai.ac.jp (Teruhisa Ootsuka)
Newsgroups: fj.sys.pc98
Subject: Re: How to time on pc98
Date: 15 Dec 92 02:58:30 GMT
Distribution: fj
Organization: Tokai University, Computing Center(shonan), Hiratsuka, Japan

In article <T20553.92Dec11150539@maxwell.ee.t.u-tokyo.ac.jp> t20553@ee.t.u-tokyo.ac.jp (Hiroaki Morino) writes:
>$@$O$8$a$F$NEj9F$G$9!#$h$m$7$/!#(J
>$@$H$3$m$G!"(J98$@$G%3%^%s%I$N<B9T;~4V$r$O$+$k%W%m%0%i%`$r:n$j$?$$$N$G$9$,!"(J
>clock()$@$J$I$N4X?t$G$O0lICC10L$G$7$+!"$O$+$C$F$/$l$^$;$s!#0lIC0J2<$N;~4V(J
>$@$r$O$+$k$K$O!"$I$&$7$?$iNI$$$N$G$7$g$&$+!#$I$&$7$h$&$b$J$$$N$G$7$g$&$+!#(J
>(time.h $@$K$O!"(JIBM-PC$@$G$O(J0.05$@ICC10L$GB,$l$k$H=q$$$F$"$k!#(J)
>
>$@$A$J$_$K!";d$N%^%7%s$O!"(Jpc9801 NS/E $@$G$9!#(J
>
$@;d$b!"$D$$$3$N4V!"I,MW$K$J$C$?$N$G:n@.$7$F$_$^$7$?!#C;$$$N$G!"$3$N5-;v$N(J
$@:G8e$KIU$1$^$9!#;29M$K$7$F2<$5$$!#(J
$@B>$K$b!"%U%)%m!<$,$"$j$^$7$?$,!"$3$l$O!"(JBIOS$@$N%$%s%?!<%P%k%?%$%^$r;H$$!"(J
BIOS$@$,MQ$$$F$$$k%F!<%V%k$r;2>H$7$F;~4V$r;;=P$7$F$$$^$9!#(J
$@;d$,$3$N%W%m%0%i%`$r:n$i$J$1$l$P$J$i$J$+$C$?$$$-$5$D$h$j!"$;$$$<$$(J10$@J,DxEY(J
$@$O$+$l$l$P$h$+$C$?$N$G!"$3$N%W%m%0%i%`$O!"#6#5#5!%#3#6IC$7$+7WB,=PMh$^$;$s!#(J
$@$3$l0J>eB,$k$K$O!"%$%s%?!<%P%k%?%$%^3d$j9~$_$,H/@8$7$?$H$-$K!"JL$N%+%&%s%H$r(J
$@%+%&%s%H%"%C%W$9$k$J$I$NBP=h$,I,MW$G$9!#(J
$@0l1~!"$3$N%W%m%0%i%`$NG[I[$J$I$O<+M3$H$7$^$9$,!"1?MQ$N7k2L@8$8$?$$$+$J$kB;32(J
$@$K$?$$$7$F$b!":n<T$O!"Ge=~$9$k5AL3$,$J$$$H$7$^$9!#(J
$@0l1~!"(JTurbo C++$@$G=q$-$^$7$?!#(J

- $@$3$3$+$i(J
/*	$@%W%m%0%i%`$N<B9T;~4VB,Dj4o(J	*/
/*	Coryright(C)1992 by Teruteru*/

#define	ITIMER	058ah	//	$@%$%s%?!<%P%k%?%$%^$N%+%&%s%H%P%C%U%!0LCV(J

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

main(int argc, char *argv[])
{
	char	**arg;
	unsigned	int	sc,ec,er;

	if(argc < 2) {
		fputs("$@%W%m%0%i%`<B9T;~4VB,Dj4o(J $@Bh(J1.00$@HG(J\n$@@=:n!&Cx:n(J $@BgDM(J $@>H5W(J $@J?@.;MG/0m=&(J
$@Fu7n6eF|(J\n\n	$@<B9T$O!"B,DjBP>N%W%m%0%i%`$H!"$=$N%*%W%7%g%s$r<!$N$h$&$K;XDj$7$F(J
$@2<$5$$!#(J\n\n	timer cmd arg0 arg1 $@%%%%(J\n", stderr);
		exit(0);
	}
	
	//	$@%$%s%?!<%P%k%?%$%^$N5/F0(J
	asm	{
		mov	ax,3506h	//	STOP$@%-!<3d$j9~$_%Y%/%H%k$N<hF@(J
		int	21h	//	ES:BX$@"+La$jCM(J
		mov	ah,02h	//	$@%$%s%?!<%P%k%?%$%^$N5/F0(J
		xor	cx,cx	//	655360$@%_%jIC4V%+%&%s%H$rB3$1$k!#(J
		int	1ch
		mov	es,cx
		mov	ax,es:[ITIMER]
		jmp	lb0
lb1:	iret
	}

lb0:sc = _AX;
	arg = argv;
	arg++;
	
	strcpy(argv[argc], "");
	
	if((int)(er = spawnvp(P_WAIT, argv[1], arg)) == -1) {
		char	*e,tmp[64],_tmp[64];
		
		strcpy(_tmp, "/C");
		strcat(_tmp, argv[1]);
		argv[1] = _tmp;
		
		if((int)(e = getenv("COMSPEC"))) strcpy(tmp, e);
		else strcpy(tmp, "command");
		er = spawnvp(P_WAIT, tmp, --arg);
	}
	asm	{
		xor	ax,ax
		mov	es,ax
		mov	dx,es:[ITIMER]
		mov	bx,cs
		mov	es,bx
		mov	bx,offset lb1
		mov	ah,02h	//	$@%$%s%?!<%P%k%?%$%^$N5/F0(J
		mov	cx,1	//	10$@%_%jIC4V%+%&%s%H$rB3$1$k!#(J
		int	1ch
	}
	
	ec = _DX;
	ec = sc - ec;
	sc = ec % 100;
	ec /= 100;

	printf("$@;R%W%m%;%9$+$i$N%j%?!<%s%3!<%I(J = %02XH\n", er);
	
	printf("$@7P2a;~4V(J %u $@J,(J %u $@IC(J %02u (%u.%02u sec)\n", ec/60, ec%60, sc, ec, sc);
}
>-$@$3$3$^$G(J


-- 
--------------------------------------------------
    FEM@cc.u-tokai.ac.jp     $BBgDM(J $B>H5W(J
    $B",$3$l$O!"(J`$BM-8BMWAGK!(J'$B$N0UL#$G$O$"$j$^$;$s!#(J
--------------------------------------------------
Newsgroups: fj.sys.pc98