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

📄 sinewave.c

📁 mips架构的bootloader,99左右的版本 但源代码现在没人更新了
💻 C
字号:
#include <math.h>/**************************************************************  sinewave.c*	Displays a number of overlapping sinewaves on the screen,*	doesn't not require PMON to know about terminal type.**	This also serves as an example of how to select RAM*	resident FP emulation, instead of the usual FP emulation*	in the PMON PROM.**       This program requires floating-point, and so it will only *	run correctly if the execution environment includes *	floating-point support in hardware, or via software emulation.*/#define STEPSZ 10		/* degrees per step */#define WAVES 3			/* number of sine waves */#define DEGS_TO_RADS(x)		((2*3.142)/(360/(double)(x)))#define SCALE(x)		((int)(((x)*40)+40))#ifdef RAMFPtypedef int iFunc();int cop1();iFunc *c1dat[] = {0,cop1};#endifmain(){int n,i;double rads;char t1[100],t2[100];#ifdef RAMFPonintr(11,c1dat);#endiffor (;;) 	for (n=0;n<360;n+=STEPSZ) { 		sprintf(t1,"%*c",SCALE(sin(DEGS_TO_RADS(n))),'x');		for (i=1;i<WAVES;i++) {			rads = DEGS_TO_RADS((n+((360/WAVES)*i)%360));			sprintf(t2,"%*c",SCALE(sin(rads)),'x');			strmerge(t1,t2);			}		printf("%s\n",t1);		}}

⌨️ 快捷键说明

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