⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dos.c

📁 十七种模拟器源代码 非常有用的作课程设计不可缺少的
💻 C
字号:
/* * dos.c * * System interface for DOS. */#include <stdio.h>#include <stdlib.h>#include <string.h>#include <stdarg.h>#include <sys/time.h>#include <unistd.h>#include <signal.h>#include <time.h>#define US(n) ( ((long long)(n)) * 1000000 / UCLOCKS_PER_SEC )void *sys_timer(){	uclock_t *cl;		cl = malloc(sizeof *cl);	*cl = uclock();	return cl;}int sys_elapsed(uclock_t *cl){	uclock_t now;	int usecs;	now = uclock();	usecs = US(now - *cl);	*cl = now;	return usecs;}void sys_sleep(int us){	uclock_t start;	if (us <= 0) return;	start = uclock();	while(US(uclock()-start) < us);}void sys_checkdir(char *path, int wr){}void sys_initpath(char *exe){	char *buf, *home, *p;	home = strdup(exe);	p = strrchr(home, '/');	if (p) *p = 0;	else	{		rc_setvar("rcpath", ".");		rc_setvar("savedir", ".");		return;	}	buf = malloc(strlen(home) + 8);	sprintf(buf, ".:%s/", home);	rc_setvar("rcpath", 1, &buf);	sprintf(buf, ".", home);	rc_setvar("savedir", 1, &buf);	free(buf);}void sys_sanitize(char *s){	int i;	for (i = 0; s[i]; i++)		if (s[i] == '\\') s[i] = '/';}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -