#help_index "Time/Jiffies" //18.33333*65536Hz (SYS_TIMER_FREQ) public extern I64 SysTimerRead(); #help_index "Task" extern CTask *sys_winmgr_task,*sys_task_being_screen_updated; public extern CTask *adam_task; public extern I64 sys_num_spawned_users,sys_num_task_inits; extern U0 TaskFinishOffDying(); public _extern SYS_YIELD U0 Yield(); public extern U0 TSSBusy(I64 tr,Bool val=OFF); _extern SYS_CONTEXT_RESTORE U0 TaskContextRestore(); _extern SYS_TASK_END_NOW U0 TaskEndNow(); #help_index "Time/CPU Cycles" #help_file "::/TempleOS/Doc/TimeCycles" public extern I64 time_stamp_freq,time_stamp_kHz_freq; public extern I64 TaskTotalTime(); //This is sampled once at boot time public extern I64 time_stamp_freq_initial; #help_index "Time/HPET" #help_file "::/TempleOS/Doc/TimeHPET" public extern I64 HPET_freq,HPET_kHz_freq; #help_index "Time/Seconds" public extern F64 tT(); //High freq public extern F64 tJ(); //From Jiffies. public extern F64 tS(); //From SysTimerFreq. public extern Bool Blink(F64 Hz=2.5); #help_index "Snd" public extern U0 Snd(F64 freq); public extern Bool Mute(Bool val); public extern Bool IsMute(); public extern F64 snd_freq; public extern U0 Beep(I64 freq=500,Bool busy=FALSE); public extern Bool IOSnd(Bool val); public extern Bool snd_record; extern CSndData snd_record_root; #help_index "Processor" extern U8 *sys_fault_handlers_code; extern I64 *sys_idt; public extern U8 *IntEntryGet(I64 irq); public extern U8 *IntEntrySet(I64 irq,U0 (*fp_new_handler)(),I64 type=IDTET_IRQ,I64 dpl=0); extern CPCIDev sys_pci_dev_root; extern CMemRange sys_mem32_dev_root; #help_index "Task/Delay;Time/CPU Cycles" public extern I64 TimeStampFreqCal(); public extern U0 BusyWait(I64 ęS); //Loosely timed public extern U0 SleepUntil(I64 wake_jiffy); public extern U0 Sleep(I64 mS); public extern U0 PortNop(); //On the order of 1uS #help_index "Task" public extern Bool IsPreempt(); #help_index "Debugging" #help_file "::/TempleOS/Doc/Dbg" extern CTask *sys_dbg_focus_task; extern U8 *sys_dbg_msg; extern I64 sys_dbg_msg_num; public extern Bool IsDbgTask(); public extern Bool IsSysDbg(); public extern Bool IsSysDeterministic(); public extern Bool SysDbg(Bool val); public extern Bool SysDeterministic(Bool val); public extern Bool ChkPtr(U8 *ptr); public extern Bool ChkCodePtr(U8 *ptr); public extern Bool ChkOnStk(U8 *ptr,CTask *task=NULL); public extern I64 UnusedStk(CTask *task=NULL); public extern U8 *Caller(I64 num=1); public extern U8 *TaskCaller(CTask *task=NULL,I64 num=0,Bool saved_context=FALSE); public extern Bool SingleUser(Bool val); public extern Bool IsSingleUser(); #help_index "Debugging/Dump" public extern U0 D(U8 *add,I64 cnt=0x80,Bool show_offset=TRUE); public extern U0 Dm(U8 *add,I64 cnt=0x80); public extern U0 Da(U8 **add,I64 cnt=0x10); extern I64 *TaskRegAdd(CTask *task,I64 reg_num); public extern U0 Dr(CTask *task=NULL); public extern U0 StkRep(CTask *task=NULL); public extern U0 CallerRep(U8 **rbp=NULL,CTask *task=NULL); #help_index "Debugging;Debugging/Debugger" public extern U0 Dbg(U8 *msg=NULL,I64 msg_num=0); #help_index "Debugging/Debugger" public extern Bool InDbg(Bool val); public extern Bool IsInDbg(); public extern U0 G(U8 *ip=INVALID_PTR,CTask *task=NULL); public extern U0 G2(U8 *ip=INVALID_PTR,CTask *task=NULL); public extern U0 S(U8 *ip=INVALID_PTR,CTask *task=NULL); public extern U0 E(U8 *add,I64 cnt=512,I64 ed_flags=0); extern CBpt *BptFind(U8 *add,CTask *task=NULL,Bool rem=FALSE); public extern Bool BptS(U8 *add,CTask *task=NULL,Bool live=TRUE); public extern Bool BptR(U8 *add,CTask *task=NULL,Bool live=TRUE,Bool rem=TRUE); public extern Bool B(U8 *add,CTask *task=NULL,Bool live=TRUE) //Toggle breakpoint public extern I64 B2(CTask *task=NULL,Bool live=TRUE); #help_index "Debugging/Raw Output" extern U0 RawDr(CTask *task=NULL); public extern U0 RawPutChar(I64 ch); public extern U0 VGAFlush(); public extern Bool Raw(Bool val); public extern Bool IsRaw(); public extern U0 DbgStr(U8 *st,I64 mS=100); public extern U0 DbgI64(I64 num,I64 mS=100); public extern U0 DbgF64(F64 d,I64 mS=100); public extern U0 DbgAdd(U8 *add,I64 mS=100); public extern U0 DbgD(U8 *add,I64 cnt=0x80,I64 mS=100); public extern U0 DbgDm(U8 *add,I64 cnt=0x80,I64 mS=100); #help_index "Graphics/Color" extern U0 (*fp_set_std_palette)(); public extern U8 *Color2Text(U8 *buf,CColorROPU32 c); #help_index "Char" #help_file "::/TempleOS/Doc/Char" extern U0 (**fp_ctrl_alt_let_cbs)(I64 sc); extern I64 ctrl_alt_let_in_irq_flags; extern U8 **ctrl_alt_let_descs; extern I64 **ctrl_alt_let_ret_addr; //addr of ret add on stack in kbd irq extern CSrvCmd sys_macro_root; extern CKeyDev sys_put_key_root; extern CTask *sys_macro_util_task; extern I64 sys_raw_dc_col,sys_raw_dc_flags; extern U8 *sys_dc_screen_image; public extern Bool text_mode; //Constants are defined for these to //optimize. See $LK-A,"::/TempleOS/Adam/Gr/GrCfg.CPP"$. public extern I64 text_rows,text_cols,gr_width,gr_height; public extern U8 *gr_font; public extern CKeyDev *KeyDevAdd(Bool (*fp_put_key)(I64 ch,I64 sc),Bool (*fp_puts)(U8 *st),I64 priority,Bool key_descs=FALSE); public extern U0 KeyDevRem(CKeyDev *tempp); public extern U0 SetKeyDesc(U8 *fmt,...); public extern U0 SetCtrlAltLetCB(U8 ch,U0 (*fp_handler)(I64 sc),U8 *desc,Bool in_irq=FALSE); extern U8 key_desc[128]; extern U8 *key_handler; #help_index "Char/Output;Char/Define" public extern U0 PutDefineErr(U8 *st); public extern U0 PutDefineWarn(U8 *st); #help_index "Char/Output" public extern U0 PrintF(U8 *fmt,...); public extern U0 PrintFErr(U8 *fmt,...); public extern U0 PrintFWarn(U8 *fmt,...); public extern U0 NewLine(I64 cnt=1); public extern U0 Spaces(I64 cnt=1); public extern U0 PutErr(U8 *st=NULL); public extern U0 PutWarn(U8 *st=NULL); public extern U0 PutKey(I64 ch,I64 scancode); public extern U0 PutChar(U64 ch); public extern U0 PutS(U8 *st); public extern U8 *Bin2Hex(U8 *dst,I64 n;I64 width); public extern U0 PutHex(I64 n,I64 width); public extern Bool Silent(Bool val); public extern Bool IsSilent(); public extern U0 GetOutOfDollar(); #help_index "Char/Conversion" public extern I64 A2I(U8 *st,I64 radix=10,U8 **_end_ptr=NULL); #help_index "Input Pointer/Mouse" public extern I64 mouse_evt_time; extern I64 mouse_pkt_size; #help_index "Char/Input" public extern I64 kbd_evt_time; extern Bool kbd_irqs_working; public extern Bool PressAKey(); public extern Bool AreYouSure(); public extern I64 GetKey(I64 *_scancode=NULL,Bool echo=FALSE,Bool raw_cursor=FALSE); public extern I64 GetChar(I64 *_scancode=NULL,Bool echo=TRUE,Bool raw_cursor=FALSE); public extern Bool ScanKey(I64 *_ch=NULL,I64 *_scancode=NULL,Bool echo=FALSE); public extern Bool YorN(); public extern I64 GetS(U8 *buf,I64 size,Bool allow_ext=TRUE); public extern I64 KbdMouseEvtTime(); //Gets $LK,"Flags","MN:GETSF_SHIFT_ESC_EXIT"$ public extern U8 *MGetS(I64 flags=0); extern U8 *(*fp_mgets)(I64 flags=0); extern U8 *GetFJoin(U8 *src,U8 *fmt,I64 argc,I64 *argv); public extern U8 *GetF(U8 *src,U8 *fmt,...); #help_index "Char/Lists" public extern U8 *LstEntryPt(I64 entry_num, U8 *lst); public extern I64 LstEntryMatch(U8 *src, U8 *lst,I64 flags=0,I64 *_ambiguity_overkill=NULL); #help_index "Char/Operations" public extern I64 StrOcc(U8 *src, U8 ch); public extern U8 *StrFirstOcc(U8 *src,U8 *marker); public extern U8 *StrLastOcc(U8 *src,U8 *marker); public extern I64 Spaces2Tabs(U8 *dst,U8 *src); public extern U8 *Tabs2Spaces(U8 *src); public extern U8 *ScaleIndent(U8 *src,F64 indent_scale_factor); public extern U8 *StrUtil(U8 *_src,I64 flags); public extern U8 *MStrUtil(U8 *src,I64 flags,F64 indent_scale_factor=0); public extern U8 *StrFirstRem(U8 *src,U8 *marker,U8 *dst=NULL); public extern U8 *StrLastRem(U8 *src,U8 *marker,U8 *dst=NULL); public extern Bool WildCardMatch(U8 *wild_st,U8 *src_st); public extern U8 *StrAdd(U8 *base,U8 *addition); //frees base arg public extern U8 *SearchStr(U8 *src,U8 *pattern,I64 flags=0); extern U8 *SPrintFJoin(U8 *dst,U8 *fmt,I64 argc,I64 *argv); public extern U8 *SPrintF(U8 *dst,U8 *fmt,...); public extern U8 *MSPrintF(U8 *fmt,...); #help_index "Char/Define" #help_file "::/TempleOS/Doc/Define" public extern CHashDefineStr *DefineLoad(U8 *name,U8 *st,Bool replace=FALSE); public extern U0 DefinePrintF(U8 *name,U8 *src,...); public extern U8 *Define(U8 *name); public extern U0 PutDefine(U8 *name); #help_index "Char/Define;Char/Lists" public extern CHashDefineStr *DefineLstLoad(U8 *name,U8 *st,Bool replace=FALSE); public extern U8 *DefineSub(I64 sub,U8 *name); public extern I64 DefineSubCnt(U8 *name); public extern I64 DefineMatch(U8 *src,U8 *lst_name,I64 flags=0,I64 *_ambiguity_overkill=NULL); #help_index "Memory" #help_file "::/TempleOS/Doc/Mem" public extern I64 MemPageSize(U8 *a) public extern Bool MemPagePresentMark(U8 *a,Bool val); public extern Bool MemLowPagesProtect(Bool val); public extern U8 *MemBlks2MegAlloc(I64 *_pages2Meg,CBlkPool *bp=NULL); public extern U8 *MemBlksUncachedAlloc(I64 *_pages2Meg,CBlkPool *bp=NULL); public extern U8 *MemBlksWriteThroughAlloc(I64 *_pages2Meg,CBlkPool *bp=NULL); public extern U0 MemBlks2MegFree(CMemBlk *m,I64 pages2Meg,CBlkPool *bp=NULL); public extern U8 *MemBlksNonTaskAlloc(I64 *_pages512,CBlkPool *bp=NULL); public extern I64 *MemPageTable(U8 *a); public extern U0 MemBlksNonTaskFree(CMemBlk *m,I64 pages512,CBlkPool *bp=NULL); public _extern _MALLOC U8 *MAlloc(I64 size,CTask *mem_task=NULL); public _extern _FREE U0 Free(U8 *add); public _extern _MSIZE I64 MSize(U8 *src); //size of heap object public _extern _MSIZE2 I64 MSize2(U8 *src); //Internal size public _extern _MHEAP_CTRL CHeapCtrl *MHeapCtrl(U8 *src); public extern U8 *CAlloc(I64 size,CTask *mem_task=NULL); public extern U8 *MAllocIdentical(U8 *src,CTask *mem_task=NULL); public extern U8 *MAllocAligned(I64 size,I64 alignment,CTask *mem_task=NULL,I64 misalignment=0); public extern U8 *CAllocAligned(I64 size,I64 alignment,CTask *mem_task=NULL,I64 misalignment=0); public extern I64 Scale2Mem(I64 min,I64 max,I64 limit=2*1024*1024*1024); #help_index "Memory/Heap Ctrl" public extern U0 BlkPoolAdd(CBlkPool *bp,CMemBlk *m,I64 pages512); public extern U0 BlkPoolInit(CBlkPool *bp,I64 pages512); extern CHeapCtrl *TaskHeapCtrlNew(CTask *task,CBlkPool *bp); extern U0 TaskHeapCtrlDel(CHeapCtrl *hc); public extern CHeapCtrl *HeapCtrlIndependentInit(CBlkPool *bp,I64 pages512); #help_index "Memory/Adam Heap" public extern U8 *AMAlloc(I64 size); public extern U8 *AMAllocIdentical(U8 *src); public extern U8 *ACAlloc(I64 size); #help_index "Char/Operations;Memory" public extern U8 *StrNew(U8 *buf,CTask *mem_task=NULL); #help_index "Char/Operations;Memory/Adam Heap" public extern U8 *AStrNew(U8 *buf); #help_index "Device" public extern U8 *Mem32DevAlloc(I64 size,I64 alignment); public extern U8 *Mem64DevAlloc(I64 *_pages2Meg); public extern U0 Mem32DevFree(U8 *base); public extern U0 Mem64DevFree(U8 *base,I64 pages2Meg); public extern CHeapCtrl *sys_uncached_heap; #help_index "Task" public extern U0 Exit(); public extern U0 Kill(CTask *task,Bool wait=TRUE); public extern Bool Suspend(CTask *task=NULL,Bool state=TRUE); public extern Bool IsSuspended(CTask *task=NULL); public extern Bool TaskValidate(CTask *task); public extern U0 TaskQueIns(CTask *task,CTask *pred=NULL); public extern U0 TaskQueRem(CTask *task); public extern U0 TaskWait(CTask *task=NULL); public extern U0 TaskInitExt(Bool from_dbg=FALSE); public extern U0 UserCmdLine(); public extern U0 WinDerivedValsUpdate(CTask *task=NULL); public extern U0 TaskDerivedValsUpdate(CTask *task=NULL,Bool update_z_buf=TRUE); extern U0 (*fp_update_ctrls)(CTask *task); public extern CTask *SpawnUser(U8 *fmt=NULL,...); extern U0 TaskFinishOff(CTask *task); public extern U0 OverRideSingleUserSwap(); #help_index "Task;MultiCore" public extern CTask *Spawn(U0 (*fp_add)(U8 *data),U8 *data=NULL, U8 *task_name=NULL, I64 target_cpu=-1, //-1 means current CPU CTask *parent=NULL, //NULL means adam I64 stk_size=0,I64 flags=1<