191 lines
19 KiB
HTML
Executable File
191 lines
19 KiB
HTML
Executable File
<!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=cF0>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>"God"</span><span class=cF0>
|
|
<a name="l2"></a></span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>TimeStampCB</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *,</span><span class=cF9>CDocEntry</span><span class=cF0> *,</span><span class=cF9>CTask</span><span class=cF0> *mem_task)
|
|
<a name="l3"></a>{
|
|
<a name="l4"></a> </span><span class=cF1>U8</span><span class=cF0> *st=</span><span class=cF5>MAlloc</span><span class=cF0>(64,mem_task);
|
|
<a name="l5"></a> </span><span class=cF5>StrPrint</span><span class=cF0>(st,</span><span class=cF6>"%X"</span><span class=cF0>,</span><span class=cF5>GetTSC</span><span class=cF0>>></span><span class=cF3>GOD_BAD_BITS</span><span class=cF0>);
|
|
<a name="l6"></a> </span><span class=cF1>return</span><span class=cF0> st;
|
|
<a name="l7"></a>}
|
|
<a name="l8"></a>
|
|
<a name="l9"></a></span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>KbdMsTimeCB</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *,</span><span class=cF9>CDocEntry</span><span class=cF0> *,</span><span class=cF9>CTask</span><span class=cF0> *mem_task)
|
|
<a name="l10"></a>{
|
|
<a name="l11"></a> </span><span class=cF1>U8</span><span class=cF0> *st=</span><span class=cF5>MAlloc</span><span class=cF0>(64,mem_task);
|
|
<a name="l12"></a> </span><span class=cF5>StrPrint</span><span class=cF0>(st,</span><span class=cF6>"%X"</span><span class=cF0>,</span><span class=cF5>KbdMsEvtTime</span><span class=cF0>>></span><span class=cF3>GOD_BAD_BITS</span><span class=cF0>);
|
|
<a name="l13"></a> </span><span class=cF1>return</span><span class=cF0> st;
|
|
<a name="l14"></a>}
|
|
<a name="l15"></a>
|
|
<a name="l16"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>PopUpTimerOk</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *header=</span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF1>U8</span><span class=cF0> *footer=</span><span class=cF3>NULL</span><span class=cF0>)
|
|
<a name="l17"></a>{
|
|
<a name="l18"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l19"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e;
|
|
<a name="l20"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc=</span><span class=cF5>DocNew</span><span class=cF0>;
|
|
<a name="l21"></a> </span><span class=cF1>if</span><span class=cF0> (header) </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>"%s"</span><span class=cF0>,header);
|
|
<a name="l22"></a> doc_e=</span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>"\nTimer:$TX+TC,\" \"$"</span><span class=cF0>);
|
|
<a name="l23"></a> doc_e->tag_cb=&</span><span class=cF5>TimeStampCB</span><span class=cF0>;
|
|
<a name="l24"></a> doc_e=</span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>"\nLatch:$TX+TC,\" \"$"</span><span class=cF0>);
|
|
<a name="l25"></a> doc_e->tag_cb=&</span><span class=cF5>KbdMsTimeCB</span><span class=cF0>;
|
|
<a name="l26"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>"\n$CM+CX,0,4$$BT,\"OKAY\",LE=1$\n"</span><span class=cF0>);
|
|
<a name="l27"></a> </span><span class=cF1>if</span><span class=cF0> (footer) </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>"%s"</span><span class=cF0>,footer);
|
|
<a name="l28"></a> i=</span><span class=cF5>PopUpMenu</span><span class=cF0>(doc);
|
|
<a name="l29"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
|
|
<a name="l30"></a> </span><span class=cF1>return</span><span class=cF0> i;
|
|
<a name="l31"></a>}
|
|
<a name="l32"></a>
|
|
<a name="l33"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>GodPick</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *msg=</span><span class=cF3>NULL</span><span class=cF0>)
|
|
<a name="l34"></a>{</span><span class=cF2>//GOD_GOOD_BITS</span><span class=cF0>
|
|
<a name="l35"></a> </span><span class=cF1>U8</span><span class=cF0> *st=</span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>"%s\n\nPress $GREEN$OKAY$FG$ to generate \n"</span><span class=cF0>
|
|
<a name="l36"></a> </span><span class=cF6>"a random num from a timer.\n"</span><span class=cF0>,msg);
|
|
<a name="l37"></a> </span><span class=cF5>PopUpTimerOk</span><span class=cF0>(st,</span><span class=cF6>"\n\nThe </span><a href="/Wb/Adam/God/HSNotes.DD.HTML#l1"><span class=cF4>Holy Spirit</span></a><span class=cF6> can puppet you.\n\n"</span><span class=cF0>);
|
|
<a name="l38"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
|
|
<a name="l39"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>KbdMsEvtTime</span><span class=cF0>>></span><span class=cF3>GOD_BAD_BITS</span><span class=cF0>;
|
|
<a name="l40"></a>}
|
|
<a name="l41"></a>
|
|
<a name="l42"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>GodBitsIns</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> num_bits,</span><span class=cF9>I64</span><span class=cF0> n)
|
|
<a name="l43"></a>{</span><span class=cF2>//Insert bits into God bit fifo.</span><span class=cF0>
|
|
<a name="l44"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l45"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<num_bits;i++) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l46"></a> </span><span class=cF5>FifoU8Ins</span><span class=cF0>(</span><span class=cFB>god</span><span class=cF0>.fifo,n&1);
|
|
<a name="l47"></a> n>>=1;
|
|
<a name="l48"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l49"></a>}
|
|
<a name="l50"></a>
|
|
<a name="l51"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>GodHexIns</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *st)
|
|
<a name="l52"></a>{</span><span class=cF2>//Insert hex record into God bit fifo.</span><span class=cF0>
|
|
<a name="l53"></a> </span><span class=cF1>U8</span><span class=cF0> buf[2];
|
|
<a name="l54"></a> </span><span class=cF1>if</span><span class=cF0> (st) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l55"></a> buf[1]=0;
|
|
<a name="l56"></a> </span><span class=cF1>while</span><span class=cF0> (*buf=*st++)
|
|
<a name="l57"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>char_bmp_hex_numeric</span><span class=cF0>,*buf</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l58"></a> </span><span class=cF5>GodBitsIns</span><span class=cF0>(4,</span><span class=cFB>rev_bits_table</span><span class=cF0>[</span><span class=cF5>Str2I64</span><span class=cF7>(</span><span class=cF0>buf,16</span><span class=cF7>)</span><span class=cF0>]>>4);
|
|
<a name="l59"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l60"></a>}
|
|
<a name="l61"></a>
|
|
<a name="l62"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>GodBits</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> num_bits,</span><span class=cF1>U8</span><span class=cF0> *msg=</span><span class=cF3>NULL</span><span class=cF0>)
|
|
<a name="l63"></a>{</span><span class=cF2>//Return N bits. If low on entropy pop-up okay.</span><span class=cF0>
|
|
<a name="l64"></a> </span><span class=cF1>U8</span><span class=cF0> b;
|
|
<a name="l65"></a> </span><span class=cF9>I64</span><span class=cF0> res=0;
|
|
<a name="l66"></a> </span><span class=cF1>while</span><span class=cF0> (num_bits) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l67"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>FifoU8Rem</span><span class=cF7>(</span><span class=cFB>god</span><span class=cF0>.fifo,&b</span><span class=cF7>)</span><span class=cF0>) {
|
|
<a name="l68"></a> res=res<<1+b;
|
|
<a name="l69"></a> num_bits--;
|
|
<a name="l70"></a> } </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l71"></a> </span><span class=cF5>GodBitsIns</span><span class=cF0>(</span><span class=cF3>GOD_GOOD_BITS</span><span class=cF0>,</span><span class=cF5>GodPick</span><span class=cF7>(</span><span class=cF0>msg</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l72"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l73"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l74"></a>}
|
|
<a name="l75"></a>
|
|
<a name="l76"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>GodInit</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *files_find_mask=</span><span class=cF6>"/Adam/God/Vocab.DD*"</span><span class=cF0>,</span><span class=cF1>U8</span><span class=cF0> *fu_flags=</span><span class=cF3>NULL</span><span class=cF0>)
|
|
<a name="l77"></a>{</span><span class=cF2>//Read God's vocab file for picking words.</span><span class=cF0>
|
|
<a name="l78"></a> </span><span class=cF9>I64</span><span class=cF0> i,ch,fuf_flags=0;
|
|
<a name="l79"></a> </span><span class=cF1>U8</span><span class=cF0> *buf,*ptr,*ptr2;
|
|
<a name="l80"></a> </span><span class=cF9>CDirEntry</span><span class=cF0> *tmpde,*tmpde1;
|
|
<a name="l81"></a> </span><span class=cF5>ScanFlags</span><span class=cF0>(&fuf_flags,</span><span class=cF5>Define</span><span class=cF7>(</span><span class=cF6>"ST_FILE_UTIL_FLAGS"</span><span class=cF7>)</span><span class=cF0>,</span><span class=cF6>"+r+f+F+T+O"</span><span class=cF0>);
|
|
<a name="l82"></a> </span><span class=cF5>ScanFlags</span><span class=cF0>(&fuf_flags,</span><span class=cF5>Define</span><span class=cF7>(</span><span class=cF6>"ST_FILE_UTIL_FLAGS"</span><span class=cF7>)</span><span class=cF0>,fu_flags);
|
|
<a name="l83"></a> </span><span class=cF1>if</span><span class=cF0> (fuf_flags&~</span><span class=cF3>FUG_FILES_FIND</span><span class=cF0>)
|
|
<a name="l84"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'FUF'</span><span class=cF0>);
|
|
<a name="l85"></a>
|
|
<a name="l86"></a> </span><span class=cF5>Free</span><span class=cF0>(</span><span class=cFB>god</span><span class=cF0>.word_file_mask);
|
|
<a name="l87"></a> </span><span class=cFB>god</span><span class=cF0>.word_file_mask=</span><span class=cF5>StrNew</span><span class=cF0>(files_find_mask);
|
|
<a name="l88"></a> </span><span class=cFB>god</span><span class=cF0>.word_fuf_flags=fuf_flags;
|
|
<a name="l89"></a>
|
|
<a name="l90"></a> tmpde=tmpde1=</span><span class=cF5>FilesFind</span><span class=cF0>(files_find_mask,fuf_flags);
|
|
<a name="l91"></a> i=0;
|
|
<a name="l92"></a> </span><span class=cF1>while</span><span class=cF0> (tmpde) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l93"></a> </span><span class=cF1>if</span><span class=cF0> (buf=ptr=</span><span class=cF5>FileRead</span><span class=cF7>(</span><span class=cF0>tmpde->full_name</span><span class=cF7>)</span><span class=cF0>) {
|
|
<a name="l94"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l95"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr && !</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>char_bmp_word</span><span class=cF0>,*ptr</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l96"></a> ptr++;
|
|
<a name="l97"></a> </span><span class=cF1>if</span><span class=cF0> (*ptr) {
|
|
<a name="l98"></a> ptr2=ptr;
|
|
<a name="l99"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr && </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>char_bmp_word</span><span class=cF0>,*ptr</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l100"></a> ptr++;
|
|
<a name="l101"></a> i++;
|
|
<a name="l102"></a> }
|
|
<a name="l103"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l104"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
|
|
<a name="l105"></a> }
|
|
<a name="l106"></a> tmpde=tmpde->next;
|
|
<a name="l107"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l108"></a>
|
|
<a name="l109"></a> </span><span class=cF5>Free</span><span class=cF0>(</span><span class=cFB>god</span><span class=cF0>.words);
|
|
<a name="l110"></a> </span><span class=cFB>god</span><span class=cF0>.num_words=i;
|
|
<a name="l111"></a> </span><span class=cFB>god</span><span class=cF0>.words=</span><span class=cF5>MAlloc</span><span class=cF0>(i*</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l112"></a>
|
|
<a name="l113"></a> tmpde=tmpde1;
|
|
<a name="l114"></a> i=0;
|
|
<a name="l115"></a> </span><span class=cF1>while</span><span class=cF0> (tmpde) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l116"></a> </span><span class=cF1>if</span><span class=cF0> (buf=ptr=</span><span class=cF5>FileRead</span><span class=cF7>(</span><span class=cF0>tmpde->full_name</span><span class=cF7>)</span><span class=cF0>) {
|
|
<a name="l117"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l118"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr && !</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>char_bmp_word</span><span class=cF0>,*ptr</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l119"></a> ptr++;
|
|
<a name="l120"></a> </span><span class=cF1>if</span><span class=cF0> (*ptr) {
|
|
<a name="l121"></a> ptr2=ptr;
|
|
<a name="l122"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr && </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>char_bmp_word</span><span class=cF0>,*ptr</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l123"></a> ptr++;
|
|
<a name="l124"></a> ch=*ptr;
|
|
<a name="l125"></a> *ptr=0;
|
|
<a name="l126"></a> </span><span class=cFB>god</span><span class=cF0>.words[i++]=</span><span class=cF5>StrNew</span><span class=cF0>(ptr2);
|
|
<a name="l127"></a> *ptr=ch;
|
|
<a name="l128"></a> }
|
|
<a name="l129"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l130"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
|
|
<a name="l131"></a> }
|
|
<a name="l132"></a> tmpde=tmpde->next;
|
|
<a name="l133"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l134"></a> </span><span class=cF5>DirTreeDel</span><span class=cF0>(tmpde1);
|
|
<a name="l135"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFB>god</span><span class=cF0>.num_words;
|
|
<a name="l136"></a>} </span><span class=cF5>GodInit</span><span class=cF0>;
|
|
<a name="l137"></a>
|
|
<a name="l138"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>GodWordStr</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> bits=17)
|
|
<a name="l139"></a>{</span><span class=cF2>//Make God pick a word. </span><a href="/Wb/Adam/God/HSNotes.DD.HTML#l1"><span class=cF4>Holy Spirit Instructions</span></a><span class=cF0>
|
|
<a name="l140"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>god</span><span class=cF0>.num_words)
|
|
<a name="l141"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFB>god</span><span class=cF0>.words[</span><span class=cF5>GodBits</span><span class=cF0>(bits)%</span><span class=cFB>god</span><span class=cF0>.num_words];
|
|
<a name="l142"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l143"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l144"></a>}
|
|
<a name="l145"></a>
|
|
<a name="l146"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>GodWord</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> bits=17)
|
|
<a name="l147"></a>{</span><span class=cF2>//Make God pick a word. </span><a href="/Wb/Adam/God/HSNotes.DD.HTML#l1"><span class=cF4>Holy Spirit Instructions</span></a><span class=cF0>
|
|
<a name="l148"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>god</span><span class=cF0>.num_words)
|
|
<a name="l149"></a> </span><span class=cF6>"%s "</span><span class=cF0>,</span><span class=cFB>god</span><span class=cF0>.words[</span><span class=cF5>GodBits</span><span class=cF0>(bits)%</span><span class=cFB>god</span><span class=cF0>.num_words];
|
|
<a name="l150"></a>}
|
|
<a name="l151"></a>
|
|
<a name="l152"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>GodBiblePassage</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> num_lines=20)
|
|
<a name="l153"></a>{</span><span class=cF2>//Make God pick a Bible passage. </span><a href="/Wb/Adam/God/HSNotes.DD.HTML#l1"><span class=cF4>Holy Spirit Instructions</span></a><span class=cF0>
|
|
<a name="l154"></a> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF1>start</span><span class=cF0>=</span><span class=cF5>GodBits</span><span class=cF0>(21)%(</span><span class=cF3>ST_BIBLE_LINES</span><span class=cF0>-</span><span class=cF7>(</span><span class=cF0>num_lines-1</span><span class=cF7>)</span><span class=cF0>)+1;
|
|
<a name="l155"></a> </span><span class=cF1>U8</span><span class=cF0> *verse=</span><span class=cF5>BibleLine2Verse</span><span class=cF0>(</span><span class=cF1>start</span><span class=cF0>);
|
|
<a name="l156"></a> </span><span class=cF6>"%s\n\n"</span><span class=cF0>,verse;
|
|
<a name="l157"></a> </span><span class=cF5>Free</span><span class=cF0>(verse);
|
|
<a name="l158"></a> </span><span class=cF5>BookLines</span><span class=cF0>(,</span><span class=cF1>start</span><span class=cF0>,num_lines);
|
|
<a name="l159"></a>}
|
|
</span></pre></body>
|
|
</html>
|