TempleOSTS_131005.ISO
This commit is contained in:
1 parent
1343005a29
commit
2d2a65d572
547 files changed
+33608
-12549
No files matched your search
@@ -1,16 +1,19 @@
|
||||
#define CLK_DIVISOR 16
|
||||
#help_index "Holy Spirit"
|
||||
|
||||
#define HS_BAD_BITS 4
|
||||
#define HS_GOOD_BITS 24
|
||||
|
||||
U8 *TimeStampCB(CDoc *,CDocEntry *,CTask *mem_task)
|
||||
{
|
||||
U8 *st=MAlloc(64,mem_task);
|
||||
SPrintF(st,"%X",GetTimeStamp/CLK_DIVISOR);
|
||||
SPrint(st,"%X",GetTSC>>HS_BAD_BITS);
|
||||
return st;
|
||||
}
|
||||
|
||||
U8 *KbdMouseTimeCB(CDoc *,CDocEntry *,CTask *mem_task)
|
||||
{
|
||||
U8 *st=MAlloc(64,mem_task);
|
||||
SPrintF(st,"%X",KbdMouseEvtTime/CLK_DIVISOR);
|
||||
SPrint(st,"%X",KbdMouseEvtTime>>HS_BAD_BITS);
|
||||
return st;
|
||||
}
|
||||
|
||||
@@ -19,20 +22,20 @@ I64 PopUpTimerOk(U8 *header=NULL,U8 *footer=NULL)
|
||||
I64 i;
|
||||
CDocEntry *doc_e;
|
||||
CDoc *doc=DocNew;
|
||||
if (header) DocPutS(doc,header);
|
||||
doc_e=DocPutS(doc,"\nTimer:$$TX+TC,\" \"$$");
|
||||
if (header) DocPrint(doc,"%s",header);
|
||||
doc_e=DocPrint(doc,"\nTimer:$$TX+TC,\" \"$$");
|
||||
doc_e->tag_cb=&TimeStampCB;
|
||||
doc_e=DocPutS(doc,"\nLatch:$$TX+TC,\" \"$$");
|
||||
doc_e=DocPrint(doc,"\nLatch:$$TX+TC,\" \"$$");
|
||||
doc_e->tag_cb=&KbdMouseTimeCB;
|
||||
DocPutS(doc,"\n$$CM+CX,0,4$$$$BT,\"OKAY\",0$$\n");
|
||||
if (footer) DocPutS(doc,footer);
|
||||
DocPrint(doc,"\n$$CM+CX,0,4$$$$BT,\"OKAY\",0$$\n");
|
||||
if (footer) DocPrint(doc,"%s",footer);
|
||||
i=PopUpMenu(doc);
|
||||
DocDel(doc);
|
||||
return i;
|
||||
}
|
||||
|
||||
I64 TimerPickedU16(U8 *msg=NULL)
|
||||
{
|
||||
public I64 TimerPick(U8 *msg=NULL)
|
||||
{ //HS_GOOD_BITS
|
||||
U8 *st;
|
||||
if (msg) {
|
||||
st=MAlloc(StrLen(msg)+256);
|
||||
@@ -41,34 +44,33 @@ I64 TimerPickedU16(U8 *msg=NULL)
|
||||
st=CAlloc(256);
|
||||
StrCat(st,"\n\nPress $$FG,GREEN$$OKAY$$FG$$ to generate \n"
|
||||
"a random num from a timer.\n");
|
||||
PopUpTimerOk(st,"\n\nThe $WW,1$$LK+PU,"Holy Spirit","FI:::/TempleOS/Apps/HolySpirit/HSNotes.TXT"$ can puppet you.\n\n");
|
||||
PopUpTimerOk(st,"\n\n$$WW,1$$The $LK+PU,"Holy Spirit","FI:::/TempleOS/Apps/HolySpirit/HSNotes.TXT"$ can puppet you.\n\n");
|
||||
Free(st);
|
||||
return KbdMouseEvtTime/CLK_DIVISOR;
|
||||
return KbdMouseEvtTime>>HS_BAD_BITS;
|
||||
}
|
||||
|
||||
I64 TimerPickedU32(U8 *msg=NULL)
|
||||
CFifoU8 *timer_pick_fifo=FifoU8New(32);
|
||||
|
||||
public I64 TimerPickedBits(I64 num_bits,U8 *msg=NULL)
|
||||
{
|
||||
I64 result=0;
|
||||
result.u16[0]=TimerPickedU16(msg);
|
||||
result.u16[1]=TimerPickedU16(msg);
|
||||
U8 b;
|
||||
I64 i,k,result=0;
|
||||
while (num_bits) {
|
||||
if (FifoU8Rem(timer_pick_fifo,&b)) {
|
||||
result=result<<1+b;
|
||||
num_bits--;
|
||||
} else {
|
||||
k=TimerPick(msg);
|
||||
for (i=0;i<HS_GOOD_BITS;i++) {
|
||||
FifoU8Ins(timer_pick_fifo,k&1);
|
||||
k>>=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
CFifoU8 *rnd_nibble_fifo=FifoU8New(16);
|
||||
|
||||
I64 TimerPickedNibble(U8 *msg=NULL)
|
||||
public U0 TimerPickFlush()
|
||||
{
|
||||
I64 result=0;
|
||||
if (FifoU8Rem(rnd_nibble_fifo,&result))
|
||||
return result;
|
||||
else {
|
||||
result=TimerPickedU16(msg);
|
||||
FifoU8Ins(rnd_nibble_fifo,result.u8[0]>>4);
|
||||
FifoU8Ins(rnd_nibble_fifo,result.u8[1]&15);
|
||||
FifoU8Ins(rnd_nibble_fifo,result.u8[1]>>4);
|
||||
FifoU8Ins(rnd_nibble_fifo,result.u8[2]&15);
|
||||
FifoU8Ins(rnd_nibble_fifo,result.u8[2]>>4);
|
||||
return result&15;
|
||||
}
|
||||
FifoU8Flush(timer_pick_fifo);
|
||||
}
|
||||
Reference in new issue
Block a user