mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-29 16:56:30 +00:00
121 lines
10 KiB
HTML
Executable file
121 lines
10 KiB
HTML
Executable file
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
|
|
<meta name="generator" content="ZealOS V0.05">
|
|
<style type="text/css">
|
|
body {background-color:#000000;}
|
|
.cF0{color:#ffffff;background-color:#000000;}
|
|
.cF1{color:#3465a4;background-color:#000000;}
|
|
.cF2{color:#4e9a06;background-color:#000000;}
|
|
.cF3{color:#06989a;background-color:#000000;}
|
|
.cF4{color:#a24444;background-color:#000000;}
|
|
.cF5{color:#75507b;background-color:#000000;}
|
|
.cF6{color:#ce982f;background-color:#000000;}
|
|
.cF7{color:#bcc0b9;background-color:#000000;}
|
|
.cF8{color:#555753;background-color:#000000;}
|
|
.cF9{color:#729fcf;background-color:#000000;}
|
|
.cFA{color:#82bc49;background-color:#000000;}
|
|
.cFB{color:#34e2e2;background-color:#000000;}
|
|
.cFC{color:#ac3535;background-color:#000000;}
|
|
.cFD{color:#ad7fa8;background-color:#000000;}
|
|
.cFE{color:#fce94f;background-color:#000000;}
|
|
.cFF{color:#000000;background-color:#000000;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre style="font-family:courier;font-size:10pt">
|
|
<a name="l1"></a><span class=cF2>//This loads a list of zero terminated</span><span class=cF0>
|
|
<a name="l2"></a></span><span class=cF2>//strings into the sym table and</span><span class=cF0>
|
|
<a name="l3"></a></span><span class=cF2>//gives a name to it. Strings like</span><span class=cF0>
|
|
<a name="l4"></a></span><span class=cF2>//this are known as Define entries.</span><span class=cF0>
|
|
<a name="l5"></a>
|
|
<a name="l6"></a></span><span class=cF2>//See </span><a href="https://tomawezome.github.io/ZealOS/System/Gr/GrPalette.html#l4"><span class=cF4>ST_RAINBOW_10</span></a><span class=cF0>
|
|
<a name="l7"></a>
|
|
<a name="l8"></a></span><span class=cF1>U0</span><span class=cF0> PrintDigit(</span><span class=cF1>U8</span><span class=cF0> ch)
|
|
<a name="l9"></a>{
|
|
<a name="l10"></a></span><span class=cF2>//The %Z code displays a Define subentry</span><span class=cF0>
|
|
<a name="l11"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF6>'0'</span><span class=cF0> <= ch <= </span><span class=cF6>'9'</span><span class=cF0>)
|
|
<a name="l12"></a> </span><span class=cF6>"$FG,%Z$%d$FG$"</span><span class=cF0>, ch - </span><span class=cF6>'0'</span><span class=cF0>, </span><span class=cF6>"ST_RAINBOW_10"</span><span class=cF0>, ch - </span><span class=cF6>'0'</span><span class=cF0>;
|
|
<a name="l13"></a>}
|
|
<a name="l14"></a>
|
|
<a name="l15"></a></span><span class=cF1>U0</span><span class=cF0> PrintPattern(</span><span class=cF1>U8</span><span class=cF0> *st)
|
|
<a name="l16"></a>{
|
|
<a name="l17"></a> </span><span class=cF9>I64</span><span class=cF0> ch;
|
|
<a name="l18"></a>
|
|
<a name="l19"></a> </span><span class=cF1>while</span><span class=cF0> (ch = *st++)
|
|
<a name="l20"></a> PrintDigit(ch);
|
|
<a name="l21"></a> </span><span class=cF6>'\n'</span><span class=cF0>;
|
|
<a name="l22"></a>}
|
|
<a name="l23"></a>
|
|
<a name="l24"></a></span><span class=cF1>U0</span><span class=cF0> Digits()
|
|
<a name="l25"></a>{
|
|
<a name="l26"></a> </span><span class=cF9>I64</span><span class=cF0> num, ch, i;
|
|
<a name="l27"></a> </span><span class=cF1>U8</span><span class=cF0> answer[</span><span class=cFE>1024</span><span class=cF0>];
|
|
<a name="l28"></a>
|
|
<a name="l29"></a> </span><span class=cF5>SettingsPush</span><span class=cF0>; </span><span class=cF2>//See </span><a href="https://tomawezome.github.io/ZealOS/System/TaskSettings.html#l3"><span class=cF4>SettingsPush</span></a><span class=cF0>
|
|
<a name="l30"></a> </span><span class=cF5>Fs</span><span class=cF0>->text_attr = </span><span class=cF3>DKGRAY</span><span class=cF0> << </span><span class=cFE>4</span><span class=cF0> + </span><span class=cF3>WHITE</span><span class=cF0>;
|
|
<a name="l31"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
|
|
<a name="l32"></a>
|
|
<a name="l33"></a> </span><span class=cF2>//Set default background and foreground</span><span class=cF0>
|
|
<a name="l34"></a> </span><span class=cF6>"$WW,1$$BG,DKGRAY$$FD,WHITE$"</span><span class=cF0>
|
|
<a name="l35"></a> </span><span class=cF6>"\nThis is a memory game. "</span><span class=cF0>
|
|
<a name="l36"></a> </span><span class=cF6>"Try to remember the digits and enter them. "</span><span class=cF0>
|
|
<a name="l37"></a> </span><span class=cF6>"They are colored based on electrical "</span><span class=cF0>
|
|
<a name="l38"></a> </span><span class=cF6>"engineering color codes.\n"</span><span class=cF0>;
|
|
<a name="l39"></a>
|
|
<a name="l40"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cFE>10</span><span class=cF0>; i++)
|
|
<a name="l41"></a> </span><span class=cF6>"$FG,%Z$%d: %Z\n"</span><span class=cF0>, i, </span><span class=cF6>"ST_RAINBOW_10"</span><span class=cF0>, i, i, </span><span class=cF6>"ST_RAINBOW_10"</span><span class=cF0>;
|
|
<a name="l42"></a> </span><span class=cF6>"$FG$\n"</span><span class=cF0>; </span><span class=cF2>//set to default background</span><span class=cF0>
|
|
<a name="l43"></a> ch = </span><span class=cF5>PressAKey</span><span class=cF0>;
|
|
<a name="l44"></a> </span><span class=cF1>if</span><span class=cF0> (ch == </span><span class=cF3>CH_ESC</span><span class=cF0> || ch == </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>)
|
|
<a name="l45"></a> </span><span class=cF1>goto</span><span class=cF0> dg_done;
|
|
<a name="l46"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
<a name="l47"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l48"></a>restart:
|
|
<a name="l49"></a> num = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l50"></a></span><span class=cF2>//Set to zeros so we have terminators</span><span class=cF0>
|
|
<a name="l51"></a> </span><span class=cF5>MemSet</span><span class=cF0>(answer, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>answer</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l52"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
<a name="l53"></a> {
|
|
<a name="l54"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
|
|
<a name="l55"></a> </span><span class=cF6>"$WW,1$$BG,DKGRAY$$FD,WHITE$\n"</span><span class=cF0>;
|
|
<a name="l56"></a> </span><span class=cF6>"Pattern\nLength:%d\n\n"</span><span class=cF0>, num + </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l57"></a> answer[num++] = </span><span class=cF5>RandU32</span><span class=cF0> % </span><span class=cFE>10</span><span class=cF0> + </span><span class=cF6>'0'</span><span class=cF0>;
|
|
<a name="l58"></a> PrintPattern(answer);
|
|
<a name="l59"></a> ch = </span><span class=cF5>PressAKey</span><span class=cF0>;
|
|
<a name="l60"></a> </span><span class=cF1>if</span><span class=cF0> (ch == </span><span class=cF3>CH_ESC</span><span class=cF0> || ch == </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>)
|
|
<a name="l61"></a> </span><span class=cF1>goto</span><span class=cF0> dg_done;
|
|
<a name="l62"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
|
|
<a name="l63"></a>
|
|
<a name="l64"></a> </span><span class=cF6>"$WW,1$$BG,DKGRAY$$FD,WHITE$\n"</span><span class=cF0>;
|
|
<a name="l65"></a> </span><span class=cF6>"Guess\nLength:%d\n\n"</span><span class=cF0>, num;
|
|
<a name="l66"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < num; i++)
|
|
<a name="l67"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l68"></a> ch = </span><span class=cF5>CharGet</span><span class=cF0>(, </span><span class=cF3>FALSE</span><span class=cF0>);
|
|
<a name="l69"></a> </span><span class=cF1>if</span><span class=cF0> (ch == </span><span class=cF3>CH_ESC</span><span class=cF0> || ch == </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>)
|
|
<a name="l70"></a> </span><span class=cF1>goto</span><span class=cF0> dg_done;
|
|
<a name="l71"></a> PrintDigit(ch);
|
|
<a name="l72"></a> </span><span class=cF1>if</span><span class=cF0> (ch != answer[i])
|
|
<a name="l73"></a> {
|
|
<a name="l74"></a> </span><span class=cF6>"\nScore:%d\n"</span><span class=cF0>, num;
|
|
<a name="l75"></a> PrintPattern(answer);
|
|
<a name="l76"></a> </span><span class=cF5>Beep</span><span class=cF0>;
|
|
<a name="l77"></a> </span><span class=cF5>Beep</span><span class=cF0>;
|
|
<a name="l78"></a> ch = </span><span class=cF5>PressAKey</span><span class=cF0>;
|
|
<a name="l79"></a> </span><span class=cF1>if</span><span class=cF0> (ch == </span><span class=cF3>CH_ESC</span><span class=cF0> || ch == </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>)
|
|
<a name="l80"></a> </span><span class=cF1>goto</span><span class=cF0> dg_done;
|
|
<a name="l81"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l82"></a> </span><span class=cF1>goto</span><span class=cF0> restart;
|
|
<a name="l83"></a> }
|
|
<a name="l84"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l85"></a> }
|
|
<a name="l86"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l87"></a>dg_done:
|
|
<a name="l88"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
|
|
<a name="l89"></a> </span><span class=cF5>SettingsPop</span><span class=cF0>;
|
|
<a name="l90"></a>}
|
|
<a name="l91"></a>
|
|
<a name="l92"></a>Digits;
|
|
</span></pre></body>
|
|
</html>
|