138 lines
11 KiB
Plaintext
138 lines
11 KiB
Plaintext
|
<!DOCTYPE html>
|
||
|
<html lang="en">
|
||
|
<head>
|
||
|
<meta charset="UTF-8">
|
||
|
<meta name="generator" content="TempleOS V5.03">
|
||
|
<meta name="viewport" content="width=device-width">
|
||
|
<link rel="stylesheet" href="/style/templeos.css">
|
||
|
<script src="/script/templeos.js"></script>
|
||
|
<style type="text/css">
|
||
|
.cF0{color:#000000;background-color:#ffffff;}
|
||
|
.cF1{color:#0000aa;background-color:#ffffff;}
|
||
|
.cF2{color:#00aa00;background-color:#ffffff;}
|
||
|
.cF3{color:#00aaaa;background-color:#ffffff;}
|
||
|
.cF4{color:#aa0000;background-color:#ffffff;}
|
||
|
.cF5{color:#aa00aa;background-color:#ffffff;}
|
||
|
.cF6{color:#aa5500;background-color:#ffffff;}
|
||
|
.cF7{color:#aaaaaa;background-color:#ffffff;}
|
||
|
.cF8{color:#555555;background-color:#ffffff;}
|
||
|
.cF9{color:#5555ff;background-color:#ffffff;}
|
||
|
.cFA{color:#55ff55;background-color:#ffffff;}
|
||
|
.cFB{color:#55ffff;background-color:#ffffff;}
|
||
|
.cFC{color:#ff5555;background-color:#ffffff;}
|
||
|
.cFD{color:#ff55ff;background-color:#ffffff;}
|
||
|
.cFE{color:#ffff55;background-color:#ffffff;}
|
||
|
.cFF{color:#ffffff;background-color:#ffffff;}
|
||
|
</style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<pre id="content">
|
||
|
<a name="l1"></a><span class=cF1>F64</span><span class=cF0> MySin(</span><span class=cF1>F64</span><span class=cF0> d)
|
||
|
<a name="l2"></a>{ </span><span class=cF2>//Sin() does not have an address.</span><span class=cF0>
|
||
|
<a name="l3"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>Sin</span><span class=cF0>(d);
|
||
|
<a name="l4"></a>}
|
||
|
<a name="l5"></a>
|
||
|
<a name="l6"></a></span><span class=cF1>F64</span><span class=cF0> MyCos(</span><span class=cF1>F64</span><span class=cF0> d)
|
||
|
<a name="l7"></a>{ </span><span class=cF2>//Cos() does not have an address.</span><span class=cF0>
|
||
|
<a name="l8"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>Cos</span><span class=cF0>(d);
|
||
|
<a name="l9"></a>}
|
||
|
<a name="l10"></a>
|
||
|
<a name="l11"></a></span><span class=cF1>U0</span><span class=cF0> FunDraw1(</span><span class=cF9>CDC</span><span class=cF0> *dc,</span><span class=cF1>F64</span><span class=cF0> </span><span class=cF7>(</span><span class=cF0>*f</span><span class=cF7>)(</span><span class=cF1>F64</span><span class=cF0> t</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l12"></a>{
|
||
|
<a name="l13"></a> </span><span class=cF9>I64</span><span class=cF0> i,w=</span><span class=cF5>Fs</span><span class=cF0>->pix_width,h=</span><span class=cF5>Fs</span><span class=cF0>->pix_height;
|
||
|
<a name="l14"></a> </span><span class=cF1>F64</span><span class=cF0> scale=h/5.0;
|
||
|
<a name="l15"></a> </span><span class=cF1>for</span><span class=cF0> (i=-w/2;i<=w/2;i++)
|
||
|
<a name="l16"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc,w/2+i,h/2-scale*f</span><span class=cF7>(</span><span class=cF0>i/scale*2*</span><span class=cF3>pi</span><span class=cF7>)</span><span class=cF0>,
|
||
|
<a name="l17"></a> w/2+i+1,h/2-scale*f</span><span class=cF7>(</span><span class=cF0>(i+1)/scale*2*</span><span class=cF3>pi</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l18"></a>}
|
||
|
<a name="l19"></a>
|
||
|
<a name="l20"></a></span><span class=cF1>U0</span><span class=cF0> FunDraw2(</span><span class=cF9>CDC</span><span class=cF0> *dc,</span><span class=cF1>F64</span><span class=cF0> </span><span class=cF7>(</span><span class=cF0>*f</span><span class=cF7>)(</span><span class=cF1>F64</span><span class=cF0> t,</span><span class=cF1>F64</span><span class=cF0> p</span><span class=cF7>)</span><span class=cF0>,</span><span class=cF1>F64</span><span class=cF0> T)
|
||
|
<a name="l21"></a>{
|
||
|
<a name="l22"></a> </span><span class=cF9>I64</span><span class=cF0> i,w=</span><span class=cF5>Fs</span><span class=cF0>->pix_width,h=</span><span class=cF5>Fs</span><span class=cF0>->pix_height;
|
||
|
<a name="l23"></a> </span><span class=cF1>F64</span><span class=cF0> scale=h/5.0;
|
||
|
<a name="l24"></a> </span><span class=cF1>for</span><span class=cF0> (i=-w/2;i<=w/2;i++)
|
||
|
<a name="l25"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc,w/2+i,h/2-scale*f</span><span class=cF7>(</span><span class=cF0>i/scale,T</span><span class=cF7>)</span><span class=cF0>,w/2+i+1,h/2-scale*f</span><span class=cF7>(</span><span class=cF0>(i+1)/scale,T</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l26"></a>}
|
||
|
<a name="l27"></a>
|
||
|
<a name="l28"></a></span><span class=cF1>U0</span><span class=cF0> Init(</span><span class=cF9>CDC</span><span class=cF0> *dc)
|
||
|
<a name="l29"></a>{
|
||
|
<a name="l30"></a> </span><span class=cF9>I64</span><span class=cF0> i,w=</span><span class=cF5>Fs</span><span class=cF0>->pix_width,h=</span><span class=cF5>Fs</span><span class=cF0>->pix_height;
|
||
|
<a name="l31"></a> </span><span class=cF1>F64</span><span class=cF0> scale=h/5.0;
|
||
|
<a name="l32"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
|
||
|
<a name="l33"></a> </span><span class=cF5>DCFill</span><span class=cF0>(dc);
|
||
|
<a name="l34"></a> dc->color=</span><span class=cF3>BLACK</span><span class=cF0>;
|
||
|
<a name="l35"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc,0,h/2,w-1,h/2);
|
||
|
<a name="l36"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc,w/2,0,w/2,h-1);
|
||
|
<a name="l37"></a> </span><span class=cF1>for</span><span class=cF0> (i=-2;i<=2;i++) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l38"></a> dc->color=</span><span class=cF3>BLACK</span><span class=cF0>;
|
||
|
<a name="l39"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc,w/2-3,h/2-scale*i,w/2+3,h/2-scale*i);
|
||
|
<a name="l40"></a> </span><span class=cF1>if</span><span class=cF0> (i) {
|
||
|
<a name="l41"></a> dc->color=</span><span class=cF3>DKGRAY</span><span class=cF0>;
|
||
|
<a name="l42"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,w/2+5,h/2-scale*i-</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>/2,</span><span class=cF6>"%5.1f"</span><span class=cF0>,</span><span class=cF5>ToF64</span><span class=cF7>(</span><span class=cF0>i</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l43"></a> }
|
||
|
<a name="l44"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l45"></a> </span><span class=cF1>for</span><span class=cF0> (i=-4;i<=4;i++) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l46"></a> dc->color=</span><span class=cF3>BLACK</span><span class=cF0>;
|
||
|
<a name="l47"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc,w/2+scale*i,h/2-3,w/2+scale*i,h/2+3);
|
||
|
<a name="l48"></a> </span><span class=cF1>if</span><span class=cF0> (i) {
|
||
|
<a name="l49"></a> dc->color=</span><span class=cF3>DKGRAY</span><span class=cF0>;
|
||
|
<a name="l50"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,
|
||
|
<a name="l51"></a> w/2+scale*i-7*</span><span class=cF3>FONT_WIDTH</span><span class=cF0>/2,h/2+5+</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>,</span><span class=cF6>"%5.1f*T"</span><span class=cF0>,</span><span class=cF5>ToF64</span><span class=cF7>(</span><span class=cF0>i</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l52"></a> }
|
||
|
<a name="l53"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l54"></a>}
|
||
|
<a name="l55"></a>
|
||
|
<a name="l56"></a></span><span class=cF1>U0</span><span class=cF0> SndMathDemo()
|
||
|
<a name="l57"></a>{
|
||
|
<a name="l58"></a> </span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cF5>DCAlias</span><span class=cF0>;
|
||
|
<a name="l59"></a>
|
||
|
<a name="l60"></a> Init(dc);
|
||
|
<a name="l61"></a> dc->color=</span><span class=cF3>RED</span><span class=cF0>;
|
||
|
<a name="l62"></a> FunDraw1(dc,&MySin);
|
||
|
<a name="l63"></a> </span><span class=cF6>"$RED$Sin$FG$\n"</span><span class=cF0>;
|
||
|
<a name="l64"></a> </span><span class=cF5>PressAKey</span><span class=cF0>;
|
||
|
<a name="l65"></a> dc->color=</span><span class=cF3>BLUE</span><span class=cF0>;
|
||
|
<a name="l66"></a> FunDraw2(dc,&</span><span class=cF5>Saw</span><span class=cF0>,1.0);
|
||
|
<a name="l67"></a> </span><span class=cF6>"$BLUE$Saw$FG$\n"</span><span class=cF0>;
|
||
|
<a name="l68"></a> </span><span class=cF5>PressAKey</span><span class=cF0>;
|
||
|
<a name="l69"></a> dc->color=</span><span class=cF3>GREEN</span><span class=cF0>;
|
||
|
<a name="l70"></a> FunDraw2(dc,&</span><span class=cF5>FullSaw</span><span class=cF0>,1.0);
|
||
|
<a name="l71"></a> </span><span class=cF6>"$GREEN$FullSaw$FG$\n"</span><span class=cF0>;
|
||
|
<a name="l72"></a> </span><span class=cF5>PressAKey</span><span class=cF0>;
|
||
|
<a name="l73"></a>
|
||
|
<a name="l74"></a> Init(dc);
|
||
|
<a name="l75"></a> dc->color=</span><span class=cF3>RED</span><span class=cF0>;
|
||
|
<a name="l76"></a> FunDraw1(dc,&MyCos);
|
||
|
<a name="l77"></a> </span><span class=cF6>"$RED$Cos$FG$\n"</span><span class=cF0>;
|
||
|
<a name="l78"></a> </span><span class=cF5>PressAKey</span><span class=cF0>;
|
||
|
<a name="l79"></a> dc->color=</span><span class=cF3>BLUE</span><span class=cF0>;
|
||
|
<a name="l80"></a> FunDraw2(dc,&</span><span class=cF5>Caw</span><span class=cF0>,1.0);
|
||
|
<a name="l81"></a> </span><span class=cF6>"$BLUE$Caw$FG$\n"</span><span class=cF0>;
|
||
|
<a name="l82"></a> </span><span class=cF5>PressAKey</span><span class=cF0>;
|
||
|
<a name="l83"></a> dc->color=</span><span class=cF3>GREEN</span><span class=cF0>;
|
||
|
<a name="l84"></a> FunDraw2(dc,&</span><span class=cF5>FullCaw</span><span class=cF0>,1.0);
|
||
|
<a name="l85"></a> </span><span class=cF6>"$GREEN$FullCaw$FG$\n"</span><span class=cF0>;
|
||
|
<a name="l86"></a> </span><span class=cF5>PressAKey</span><span class=cF0>;
|
||
|
<a name="l87"></a>
|
||
|
<a name="l88"></a> Init(dc);
|
||
|
<a name="l89"></a> dc->color=</span><span class=cF3>RED</span><span class=cF0>;
|
||
|
<a name="l90"></a> FunDraw1(dc,&MySin);
|
||
|
<a name="l91"></a> </span><span class=cF6>"$RED$Sin$FG$\n"</span><span class=cF0>;
|
||
|
<a name="l92"></a> </span><span class=cF5>PressAKey</span><span class=cF0>;
|
||
|
<a name="l93"></a> dc->color=</span><span class=cF3>BLUE</span><span class=cF0>;
|
||
|
<a name="l94"></a> FunDraw2(dc,&</span><span class=cF5>Tri</span><span class=cF0>,1.0);
|
||
|
<a name="l95"></a> </span><span class=cF6>"$BLUE$Tri$FG$\n"</span><span class=cF0>;
|
||
|
<a name="l96"></a> </span><span class=cF5>PressAKey</span><span class=cF0>;
|
||
|
<a name="l97"></a> dc->color=</span><span class=cF3>GREEN</span><span class=cF0>;
|
||
|
<a name="l98"></a> FunDraw2(dc,&</span><span class=cF5>FullTri</span><span class=cF0>,1.0);
|
||
|
<a name="l99"></a> </span><span class=cF6>"$GREEN$FullTri$FG$\n"</span><span class=cF0>;
|
||
|
<a name="l100"></a> </span><span class=cF5>PressAKey</span><span class=cF0>;
|
||
|
<a name="l101"></a>
|
||
|
<a name="l102"></a> </span><span class=cF5>DCFill</span><span class=cF0>(dc);
|
||
|
<a name="l103"></a> </span><span class=cF5>DCDel</span><span class=cF0>(dc);
|
||
|
<a name="l104"></a>}
|
||
|
<a name="l105"></a>
|
||
|
<a name="l106"></a>SndMathDemo;
|
||
|
</span></pre></body>
|
||
|
</html>
|