home *** CD-ROM | disk | FTP | other *** search
- /*------------------------------------------------------------------------
- * filename - clock.cas
- *
- * function(s)
- * clock - ANSI standard; returns number of timer ticks
- * that have elapsed since this program started.
- *-----------------------------------------------------------------------*/
-
- /*[]------------------------------------------------------------[]*/
- /*| |*/
- /*| Turbo C Run Time Library - Version 3.0 |*/
- /*| |*/
- /*| |*/
- /*| Copyright (c) 1987,1988,1990 by Borland International |*/
- /*| All Rights Reserved. |*/
- /*| |*/
- /*[]------------------------------------------------------------[]*/
-
- #pragma inline
- #include <asmrules.h>
- #include <time.h>
-
- extern unsigned long _StartTime; /* beginning of program execution */
- /* initialized in C0.ASM */
-
- static unsigned char DayFlip; /* keeps track */
-
- #pragma inline
-
- #define I asm
-
- clock_t clock(void)
- {
- clock_t NowTime;
-
- I xor ah,ah
- I int 1ah /* call BIOS for timer ticks */
-
- I add BY0(DayFlip), al /* record whether day has changed */
-
- I mov W0 (NowTime), DX /* save return values */
- I mov W1 (NowTime), CX /* which is current time in ticks */
-
-
- if(DayFlip)
- NowTime += 0x1800b0L; /* number of clock ticks in day */
-
- return(NowTime - _StartTime); /* return count of ticks */
- }
-
-