├── Adam ├── ABlkDev │ ├── ADskA.HC │ ├── ADskB.HC │ ├── DskChk.HC │ ├── DskPrt.HC │ ├── FileMgr.HC │ ├── MakeABlkDev.HC │ └── Mount.HC ├── ADbg.HC ├── ADefine.HC ├── AExts.HC ├── AHash.HC ├── AMath.HC ├── AMathODE.HC ├── AMem.HC ├── AMouse.HC ├── ARegistry.HC ├── ASnd.HC ├── AutoComplete │ ├── ACDefs.DATA │ ├── ACDictGen.HC │ ├── ACFill.HC │ ├── ACInit.HC │ ├── ACTask.HC │ ├── ACWords.DATA │ └── MakeAC.HC ├── CPURep.HC ├── Ctrls │ ├── CtrlsA.HC │ ├── CtrlsBttn.HC │ ├── CtrlsSlider.HC │ └── MakeCtrls.HC ├── DevInfo.HC ├── DolDoc │ ├── DocBin.HC │ ├── DocChar.HC │ ├── DocClipBoard.HC │ ├── DocCodeTools.HC │ ├── DocDblBuf.HC │ ├── DocEd.HC │ ├── DocExt.HC │ ├── DocFile.HC │ ├── DocFind.HC │ ├── DocForm.HC │ ├── DocGet.HC │ ├── DocGr.HC │ ├── DocHighlight.HC │ ├── DocInit.HC │ ├── DocLink.HC │ ├── DocMacro.HC │ ├── DocNew.HC │ ├── DocPlain.HC │ ├── DocPopUp.HC │ ├── DocPutKey.HC │ ├── DocPutS.HC │ ├── DocRecalc.HC │ ├── DocRecalcLib.HC │ ├── DocRun.HC │ ├── DocTerm.HC │ ├── DocTree.HC │ ├── DocWidgetWiz.HC │ └── MakeDoc.HC ├── God │ ├── GodBible.HC │ ├── GodDoodle.HC │ ├── GodExt.HC │ ├── GodSong.HC │ ├── HSNotes.DD │ ├── HolySpirit.HC │ ├── MakeGod.HC │ └── Vocab.DD ├── Gr │ ├── Gr.HH │ ├── GrAsm.HC │ ├── GrBitMap.HC │ ├── GrComposites.HC │ ├── GrDC.HC │ ├── GrEnd.HC │ ├── GrExt.HC │ ├── GrGlbls.HC │ ├── GrInitA.HC │ ├── GrInitB.HC │ ├── GrMath.HC │ ├── GrPalette.HC │ ├── GrPrimatives.HC │ ├── GrScrn.HC │ ├── GrSpritePlot.HC │ ├── GrTextBase.HC │ ├── MakeGr.HC │ ├── ScrnCast.HC │ ├── SpriteBitMap.HC │ ├── SpriteCode.HC │ ├── SpriteEd.HC │ ├── SpriteMain.HC │ ├── SpriteMesh.HC │ ├── SpriteNew.HC │ └── SpriteSideBar.HC ├── Host.HC ├── InFile.HC ├── InsReg.HC ├── MakeAdam.HC ├── Menu.HC ├── Opt │ ├── Boot │ │ ├── BootDVD.HC │ │ ├── BootDVDIns.HC │ │ ├── BootHD.HC │ │ ├── BootHDIns.HC │ │ ├── BootMHD.HC │ │ ├── BootMHD2.HC │ │ ├── BootMHDIns.HC │ │ ├── BootRAM.HC │ │ ├── DskISORedSea.HC │ │ └── MakeBoot.HC │ └── Utils │ │ ├── Diff.HC │ │ ├── DocUtils.HC │ │ ├── Find.HC │ │ ├── HeapLog.HC │ │ ├── LineRep.HC │ │ ├── LinkChk.HC │ │ ├── MakeUtils.HC │ │ ├── MemRep.HC │ │ ├── Merge.HC │ │ ├── Profiler.HC │ │ ├── StrUtils.HC │ │ ├── TOS.HC │ │ ├── ToDolDoc.HC │ │ └── ToTXT.HC ├── TaskRep.HC ├── TaskSettings.HC ├── Training.HC ├── WallPaper.HC ├── Win.HC └── WinMgr.HC ├── Apps ├── Budget │ ├── Accts.DD │ ├── BgtAccts.HC │ ├── BgtEntry.HC │ ├── BgtFile.HC │ ├── BgtMain.HC │ ├── BgtStrs.HC │ ├── BgtTemplate.HC │ ├── Budget.HC │ ├── Install.HC │ ├── Load.HC │ └── Run.HC ├── GrModels │ ├── BallGen.HC │ ├── Load.HC │ ├── ManGen.HC │ ├── Models.HC │ └── Run.HC ├── KeepAway │ ├── KeepAway.HC │ ├── Load.HC │ └── Run.HC ├── Logic │ ├── Load.HC │ ├── Logic.HC │ └── Run.HC ├── Psalmody │ ├── Examples │ │ ├── childish.HC │ │ ├── night.HC │ │ └── prosper.HC │ ├── Help.DD │ ├── Install.HC │ ├── JukeBox.HC │ ├── JukePuppet.HC │ ├── Load.HC │ ├── Psalmody.HC │ ├── PsalmodyCtrls.HC │ ├── PsalmodyDraw.HC │ ├── PsalmodyFile.HC │ ├── PsalmodyMain.HC │ └── Run.HC ├── Span │ ├── Install.HC │ ├── Load.HC │ ├── Run.HC │ ├── Span.HH │ ├── SpanBridge.HC │ ├── SpanDerive.HC │ ├── SpanMain.HC │ └── SpanNew.HC ├── Strut │ ├── Load.HC │ ├── Run.HC │ └── Strut.HC ├── TimeClock │ ├── Install.HC │ ├── Load.HC │ └── TimeClk.HC ├── Titanium │ ├── Load.HC │ ├── Run.HC │ └── Titanium.HC ├── ToTheFront │ ├── AIs │ │ ├── Human.HC │ │ └── SimpleAI.HC │ ├── Install.HC │ ├── Load.HC │ ├── Run.HC │ ├── TTFDraw.HC │ ├── TTFFire.HC │ ├── TTFGlbls.HC │ ├── TTFInit.HC │ ├── TTFLib.HC │ ├── TTFMove.HC │ ├── TTFVis.HC │ └── ToTheFront.HC ├── Vocabulary │ ├── Load.HC │ ├── Run.HC │ └── VocabQuiz.HC └── X-Caliber │ ├── Load.HC │ ├── Run.HC │ ├── X-Caliber.HC │ └── XCCtrls.HC ├── Compiler ├── Asm.HC ├── AsmInit.HC ├── AsmLib.HC ├── AsmResolve.HC ├── BackA.HC ├── BackB.HC ├── BackC.HC ├── BackFA.HC ├── BackFB.HC ├── BackLib.HC ├── CExcept.HC ├── CExts.HC ├── CHash.HC ├── CInit.HC ├── CMain.HC ├── CMisc.HC ├── Compiler.PRJ ├── CompilerA.HH ├── CompilerB.HH ├── Lex.HC ├── LexLib.HC ├── OpCodes.DD ├── OptLib.HC ├── OptPass012.HC ├── OptPass3.HC ├── OptPass4.HC ├── OptPass5.HC ├── OptPass6.HC ├── OptPass789A.HC ├── PrsExp.HC ├── PrsLib.HC ├── PrsStmt.HC ├── PrsVar.HC ├── Templates.HC └── UAsm.HC ├── Demo ├── AcctExample │ ├── HomeKeyPlugIns.HC │ ├── HomeLocalize.HC │ ├── HomeSys.HC │ ├── HomeWrappers.HC │ ├── MakeHome.HC │ ├── Once.HC │ ├── PersonalMenu.DD │ ├── PersonalNotes.DD │ ├── Registry.HC │ └── TOS │ │ ├── MakeTOS.HC │ │ ├── TOSCfg.HC │ │ ├── TOSDistro.HC │ │ ├── TOSExt.HC │ │ ├── TOSMisc.HC │ │ └── TOSTheme.HC ├── Asm │ ├── AsmAndC1.HC │ ├── AsmAndC2.HC │ ├── AsmAndC3.HC │ ├── AsmHelloWorld.HC │ ├── BuzzFizz.HC │ ├── DivByHand.HC │ ├── MulByHand.HC │ └── PutDec.HC ├── Carry.HC ├── ClassMeta.HC ├── CompileDemo.HC ├── DateTime.HC ├── DbgDemo.HC ├── Define.HC ├── Directives.HC ├── DolDoc │ ├── CallBack.HC │ ├── ClickCallBack.HC │ ├── CursorMove.HC │ ├── Data.HC │ ├── DefineStr.HC │ ├── DemoDoc.DD │ ├── FileRead.HC │ ├── Form.HC │ ├── MenuBttn.HC │ ├── MenuSprite.HC │ ├── NumBible.HC │ ├── TextDemo.HC │ ├── TreeDemo.HC │ └── UnusedDefine.HC ├── Dsk │ ├── BlkDevRep.HC │ ├── DataBase.HC │ ├── DskRaw.HC │ ├── FPrintF.HC │ ├── SerializeTree.HC │ └── UnusedSpaceRep.HC ├── Exceptions.HC ├── ExtChars.HC ├── Games │ ├── BattleLines.HC │ ├── BigGuns.HC │ ├── BlackDiamond.HC │ ├── BomberGolf.HC │ ├── CastleFrankenstein.HC │ ├── CharDemo.HC │ ├── CircleTrace.HC │ ├── Collision.HC │ ├── Digits.HC │ ├── DunGen.HC │ ├── ElephantWalk.HC │ ├── FlapBat.HC │ ├── FlatTops.HC │ ├── Halogen.HC │ ├── MassSpring.HC │ ├── Maze.HC │ ├── RainDrops.HC │ ├── RawHide.HC │ ├── Rocket.HC │ ├── RocketScience.HC │ ├── Squirt.HC │ ├── Stadium │ │ ├── Stadium.HC │ │ ├── StadiumBG.DD │ │ ├── StadiumBG.GR │ │ └── StadiumGen.HC │ ├── Talons.HC │ ├── TheDead.HC │ ├── TicTacToe.HC │ ├── TreeCheckers.HC │ ├── Varoom.HC │ ├── Wenceslas.HC │ ├── Whap.HC │ ├── Zing.HC │ └── ZoneOut.HC ├── GlblVars.HC ├── Graphics │ ├── 3DPoly.HC │ ├── BSpline.HC │ ├── Balloon.HC │ ├── Blot.HC │ ├── Bounce.HC │ ├── Box.HC │ ├── Cartesian.HC │ ├── CharAnimation.HC │ ├── Collision.HC │ ├── CommonAncestor.HC │ ├── Doodle.HC │ ├── EdSprite.HC │ ├── Elephant.HC │ ├── Extents.HC │ ├── FontEd.HC │ ├── Grid.HC │ ├── Hanoi.HC │ ├── Lattice.HC │ ├── Life.HC │ ├── LightTable.HC │ ├── Lines.HC │ ├── LowPassFilter.HC │ ├── MathAudioDemo.HC │ ├── MouseDemo.HC │ ├── NetOfDots.HC │ ├── Palette.HC │ ├── PanText.HC │ ├── Pick.HC │ ├── Pick3D.HC │ ├── PoleZeros.HC │ ├── PredatorPrey.HC │ ├── RotateTank.HC │ ├── ScrnCapture.HC │ ├── ScrollBars.HC │ ├── Shading.HC │ ├── Shadow.HC │ ├── Slider.HC │ ├── Speedline.HC │ ├── SpritePlot.HC │ ├── SpritePlot3D.HC │ ├── SpritePut.HC │ ├── SpritePutExt.HC │ ├── SpriteRaw.HC │ ├── SpriteText.HC │ ├── SunMoon.HC │ ├── Symmetry.HC │ ├── Transform.HC │ ├── WallPaperCtrl.HC │ ├── WallPaperFish.HC │ └── WinZBuf.HC ├── InFile │ ├── InDir.IN │ ├── InEd.DD │ ├── InEd.IN │ ├── InPopUp.HC │ ├── InPopUpWait.IN │ ├── InProfile.IN │ └── InSetIP.HC ├── KeyBitMap.HC ├── LastClass.HC ├── Lectures │ ├── 64BitAsmQuiz.DD │ ├── AndNotMod.HC │ ├── FixedPoint.HC │ ├── FixedPointAdvanced.HC │ ├── GraphicsCPULoad.HC │ ├── InterruptDemo.HC │ ├── MiniCompiler.HC │ ├── MiniGrLib.HC │ ├── NegDisp.HC │ ├── Optimization.HC │ ├── PCIInterrupts.HC │ ├── Ring3.HC │ └── ScrnMemory.HC ├── MagicPairs.HC ├── MemDemo.HC ├── MsgLoop.HC ├── MultiCore │ ├── Interrupts.HC │ ├── LoadTest.HC │ ├── Lock.HC │ ├── MPAdd.HC │ ├── MPPrint.HC │ ├── MPRadix.HC │ ├── Palindrome.HC │ └── Primes.HC ├── NullCase.HC ├── OnceDemo.HC ├── ParenWarn.HC ├── PhoneNumWords.HC ├── Print.HC ├── Progress.HC ├── Prompt.HC ├── PullDownMenu.HC ├── RadixSort.HC ├── RandDemo.HC ├── RegistryDemo.HC ├── RevFileDemo │ ├── DemoPoemBwd.DD │ └── Rev.HC ├── ScrnCodes.HC ├── Snd │ ├── ASCIIOrgan.HC │ ├── MorseCode.HC │ ├── OhGreat.HC │ └── WaterFowl.HC ├── SortFileDemo │ ├── F64FileGen.HC │ └── F64FileSort.HC ├── Spy.HC ├── StkGrow.HC ├── SubIntAccess.HC ├── SubSwitch.HC ├── SuggestSpelling.HC ├── Templates │ ├── Game1.HC │ ├── InEdUtil.IN │ ├── Lex1.HC │ ├── MultiCore1.HC │ ├── ODE1.HC │ ├── Registry1.HC │ ├── Util1.HC │ └── Util2.HC ├── TimeIns.HC ├── ToHtmlToTXTDemo │ ├── DemoInPage.DD │ ├── HtmlGen.HC │ ├── TXTGen.HC │ └── ToHtml.HC ├── WebLogDemo │ ├── WebLogRep.HC │ ├── WebLogScramble.HC │ └── access_170622.log └── WordSearch.HC ├── Doc ├── AboutTempleOS.DD ├── Asm.DD ├── AutoComplete.DD ├── Bit.DD ├── BlkChain.DD ├── Boot.DD ├── CharOverview.DD ├── Charter.DD ├── CmdLineOverview.DD ├── Comm.HC ├── CompilerOverview.DD ├── Credits.DD ├── Ctrls.DD ├── Customize.DD ├── CutCorners.DD ├── D3.DD ├── Date.DD ├── DbgFunSeg.DD ├── DbgOverview.DD ├── Define.DD ├── Demands.DD ├── DemoIndex.DD ├── Directives.DD ├── DolDoc.DD ├── DolDocOverview.DD ├── EdPullDown.DD ├── FAQ.DD ├── Features.DD ├── FileLowLevel.DD ├── FileMgr.DD ├── FileMgrPullDown.DD ├── FileUtils.DD ├── Frame.DD ├── GRFiles.DD ├── Glossary.DD ├── God.DD ├── GraphicsOverview.DD ├── GuideLines.DD ├── Hash.DD ├── HeapDbg.DD ├── HelloWorld.DD ├── HelpIndex.DD ├── HelpSystem.DD ├── HolyC.DD ├── InFile.DD ├── Install.DD ├── Job.DD ├── KeyAlloc.DD ├── KeyDev.DD ├── Lex.DD ├── MemOverview.DD ├── Menus.DD ├── Mouse.DD ├── Msgs.DD ├── MultiCore.DD ├── NewASCII.DD ├── ODE.DD ├── Once.DD ├── Options.DD ├── Pags.DD ├── PreProcessor.DD ├── Print.DD ├── Profiler.DD ├── Que.DD ├── Quirks.DD ├── RedSea.DD ├── Reliability.DD ├── Requirements.DD ├── Resource.DD ├── ScopingLinkage.DD ├── Snd.DD ├── Sprite.DD ├── SpriteBitMap.DD ├── SpriteEd.DD ├── SpriteEdText.DD ├── SpriteMain.DD ├── SpriteSideBar.DD ├── StandBy.DD ├── Start.DD ├── StdOutTask.DD ├── StdTempleOSPC.DD ├── Strategy.DD ├── Streams.DD ├── TOSZ.DD ├── TextBase.DD ├── TimeCycles.DD ├── TimeDate.DD ├── TimeHPET.DD ├── TimeJiffy.DD ├── Tips.DD ├── Transform.DD ├── Welcome.DD ├── WhyNotMore.DD ├── Widget.DD └── Windows.DD ├── Downloads ├── Linux │ ├── TOSZ.CPP │ ├── gw │ └── make_tosz └── ReadMe.TXT ├── HomeKeyPlugIns.HC ├── HomeLocalize.HC ├── HomeSys.HC ├── HomeWrappers.HC ├── Kernel ├── BlkDev │ ├── DskATA.HC │ ├── DskATAId.HC │ ├── DskAddDev.HC │ ├── DskBlk.HC │ ├── DskBlkDev.HC │ ├── DskCDDVD.HC │ ├── DskCFile.HC │ ├── DskCache.HC │ ├── DskClus.HC │ ├── DskCopy.HC │ ├── DskDirA.HC │ ├── DskDirB.HC │ ├── DskDirContext.HC │ ├── DskDrv.HC │ ├── DskFile.HC │ ├── DskFind.HC │ ├── DskFmt.HC │ ├── DskStrA.HC │ ├── DskStrB.HC │ ├── FileSysFAT.HC │ ├── FileSysRedSea.HC │ └── MakeBlkDev.HC ├── Compress.HC ├── Display.HC ├── EdLite.HC ├── FontCyrillic.HC ├── FontStd.HC ├── FunSeg.HC ├── Job.HC ├── KCfg.HC ├── KDataTypes.HC ├── KDate.HC ├── KDbg.HC ├── KDefine.HC ├── KExcept.HC ├── KExts.HC ├── KGlbls.HC ├── KHashA.HC ├── KHashB.HC ├── KInts.HC ├── KLoad.HC ├── KMain.HC ├── KMathA.HC ├── KMathB.HC ├── KMisc.HC ├── KStart16.HC ├── KStart32.HC ├── KStart64.HC ├── KTask.HC ├── KUtils.HC ├── Kernel.PRJ ├── KernelA.HH ├── KernelB.HH ├── KernelC.HH ├── KeyDev.HC ├── Mem │ ├── BlkPool.HC │ ├── HeapCtrl.HC │ ├── MAllocFree.HC │ ├── MakeMem.HC │ ├── MemPag.HC │ ├── MemPhysical.HC │ └── PageTables.HC ├── MultiProc.HC ├── PCIBIOS.HC ├── QSort.HC ├── Sched.HC ├── SerialDev │ ├── Keyboard.HC │ ├── MakeSerialDev.HC │ ├── Message.HC │ └── Mouse.HC ├── StrA.HC ├── StrB.HC ├── StrPrint.HC └── StrScan.HC ├── MakeHome.HC ├── Misc ├── Bible.TXT ├── DoDistro.HC ├── OSInstall.HC ├── OSTestSuite.HC ├── PCIDevices.DD └── Tour │ ├── Tour.IN │ ├── Tour1.IN │ ├── Tour2.IN │ ├── Tour3.IN │ ├── Tour4.IN │ ├── Tour5.IN │ ├── Tour6.IN │ ├── Tour7.IN │ ├── Tour8.IN │ ├── Tour9.IN │ ├── TourA.IN │ ├── TourB.IN │ └── TourC.IN ├── Once.HC ├── PersonalMenu.DD ├── PersonalNotes.DD └── StartOS.HC /Adam/ABlkDev/DskChk.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Adam/ABlkDev/DskChk.HC -------------------------------------------------------------------------------- /Adam/ABlkDev/MakeABlkDev.HC: -------------------------------------------------------------------------------- 1 | Cd(__DIR__);; 2 | #include "ADskA" 3 | #include "ADskB" 4 | #include "DskPrt" 5 | #include "Mount" 6 | #include "DskChk" 7 | #include "FileMgr" 8 | Cd("..");; 9 | -------------------------------------------------------------------------------- /Adam/ADefine.HC: -------------------------------------------------------------------------------- 1 | #help_index "Define;Char/Define" 2 | 3 | U0 LoadDocDefines() 4 | { 5 | CBinFile *bfh=mem_boot_base-sizeof(CBinFile); 6 | 7 | DefinePrint("DD_OS_NAME_VERSION","TempleOS V%0.2f",sys_os_version); 8 | DefinePrint("DD_TEMPLEOS_AGE","%0.1f", 9 | (Now-Str2Date("8/1/2003"))/ToF64(1<<32)/CDATE_YEAR_DAYS); 10 | 11 | DefinePrint("DD_KERNEL","%08X",bfh); 12 | bfh(I64)+=bfh->file_size-1; 13 | DefinePrint("DD_KERNEL_END","%08X",bfh); 14 | 15 | //$LK,"DD_BOOT_HIGH_LOC_DVD",A="FF:::/Adam/Opt/Boot/BootDVD.HC,DD_BOOT_HIGH_LOC_DVD"$ 16 | 17 | $TR,"LineRep"$ 18 | $ID,2$DefinePrint("DD_TEMPLEOS_LOC","80,849"); 19 | $ID,-2$ 20 | DefinePrint("DD_MP_VECT","%08X",MP_VECT_ADDR); 21 | DefinePrint("DD_MP_VECT_END","%08X", 22 | MP_VECT_ADDR+COREAP_16BIT_INIT_END-COREAP_16BIT_INIT-1); 23 | 24 | DefinePrint("DD_SYS_FIXED_AREA_BASE","%08X",SYS_FIXED_AREA); 25 | DefinePrint("DD_SYS_FIXED_AREA_END","%08X", 26 | SYS_FIXED_AREA+sizeof(CSysFixedArea)-1); 27 | DefinePrint("DD_MEM_HEAP_BASE","%08X",mem_heap_base); 28 | DefinePrint("DD_MEM_HEAP_LIMIT","%08X",mem_heap_limit); 29 | DefinePrint("DD_MEM_MIN_MEG","%dMeg",MEM_MIN_MEG); 30 | DefinePrint("DD_UNCACHED_ALIAS","%010X",dev.uncached_alias); 31 | DefinePrint("DD_PHYSICAL_SPACE_END","%010X", 32 | mem_physical_space-1); 33 | DefinePrint("DD_MAPPED_SPACE_END","%010X", 34 | mem_mapped_space-1); 35 | DefinePrint("DD_JIFFY_HZ","%dHz",JIFFY_FREQ); 36 | } 37 | 38 | LoadDocDefines; 39 | -------------------------------------------------------------------------------- /Adam/AMath.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Adam/AMath.HC -------------------------------------------------------------------------------- /Adam/AMouse.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Adam/AMouse.HC -------------------------------------------------------------------------------- /Adam/AutoComplete/ACDefs.DATA: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Adam/AutoComplete/ACDefs.DATA -------------------------------------------------------------------------------- /Adam/AutoComplete/ACDictGen.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Adam/AutoComplete/ACDictGen.HC -------------------------------------------------------------------------------- /Adam/AutoComplete/ACWords.DATA: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Adam/AutoComplete/ACWords.DATA -------------------------------------------------------------------------------- /Adam/AutoComplete/MakeAC.HC: -------------------------------------------------------------------------------- 1 | //See $LK,"::/Doc/AutoComplete.DD"$ 2 | Cd(__DIR__);; 3 | #include "ACFill" 4 | #include "ACTask" 5 | #include "ACInit" 6 | Cd("..");; 7 | -------------------------------------------------------------------------------- /Adam/Ctrls/CtrlsA.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Adam/Ctrls/CtrlsA.HC -------------------------------------------------------------------------------- /Adam/Ctrls/MakeCtrls.HC: -------------------------------------------------------------------------------- 1 | Cd(__DIR__);; 2 | 3 | #help_index "Ctrls" 4 | #help_file "::/Doc/Ctrls" 5 | #include "CtrlsA" 6 | #include "CtrlsBttn" 7 | #include "CtrlsSlider" 8 | Cd("..");; 9 | -------------------------------------------------------------------------------- /Adam/DolDoc/DocEd.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Adam/DolDoc/DocEd.HC -------------------------------------------------------------------------------- /Adam/DolDoc/DocExt.HC: -------------------------------------------------------------------------------- 1 | #help_index "DolDoc" 2 | extern Bool DocEd(CDoc *doc,I64 dof_flags=0); 3 | extern I64 DocEntryRun(CDoc *doc,CDocEntry *doc_e, 4 | Bool exited,I64 *_has_action=NULL); 5 | extern U0 DocFormBwd(CDoc *doc,Bool giveup=FALSE); 6 | extern Bool DocGoToLine(CDoc *doc,I64 line_num); 7 | extern U0 DocLoad(CDoc *doc,U8 *src2,I64 size); 8 | extern U0 DocPrintAtomic(CDoc *doc=NULL,U8 *fmt,...); 9 | extern U0 DocPrintPartial(CDoc *doc=NULL,U8 *fmt,...); 10 | extern CDocEntry *DocPutS(CDoc *doc,U8 *st); 11 | extern U8 *DocSave(CDoc *doc,I64 *_size=NULL); 12 | extern I64 EdLeftClickLink(CDoc *doc,CDocEntry *doc_e); 13 | extern I64 PopUpPickLst(U8 *lst); 14 | extern I64 TermRightClickLink(CDoc *doc,CDocEntry *doc_e); 15 | -------------------------------------------------------------------------------- /Adam/DolDoc/DocGr.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Adam/DolDoc/DocGr.HC -------------------------------------------------------------------------------- /Adam/God/GodExt.HC: -------------------------------------------------------------------------------- 1 | #help_index "God" 2 | 3 | #define GOD_BAD_BITS 4 4 | #define GOD_GOOD_BITS 24 5 | 6 | public class CGodGlbls 7 | { 8 | U8 **words, 9 | *word_file_mask; 10 | I64 word_fuf_flags, 11 | num_words; 12 | CFifoU8 *fifo; 13 | CDC *doodle_dc; 14 | I64 doodle_ch; 15 | CFifoU8 *doodle_fifo; 16 | Bool doodle_done; 17 | } god; 18 | MemSet(&god,0,sizeof(CGodGlbls)); 19 | god.doodle_fifo =FifoU8New(2048*8); 20 | god.fifo =FifoU8New(2048*8); 21 | 22 | extern U0 GodBiblePassage(I64 num_lines=20); 23 | extern U0 GodBitsIns(I64 num_bits,I64 n); 24 | extern U0 GodDoodle(U8 *hex=NULL); 25 | extern U0 GodSong(); 26 | extern U0 GodWord(I64 bits=17); 27 | -------------------------------------------------------------------------------- /Adam/God/MakeGod.HC: -------------------------------------------------------------------------------- 1 | Cd(__DIR__);; 2 | 3 | #help_index "God" 4 | #help_file "::/Doc/God" 5 | #include "GodBible" 6 | #include "HolySpirit" 7 | #include "GodSong" 8 | #include "GodDoodle" 9 | Cd("..");; 10 | -------------------------------------------------------------------------------- /Adam/Gr/GrEnd.HC: -------------------------------------------------------------------------------- 1 | #help_index "Graphics/Scrn" 2 | 3 | U0 CtrlAltZ(I64 sc) 4 | { 5 | if (sc&SCF_SHIFT) 6 | GrScaleZoom(0.5); 7 | else 8 | GrScaleZoom(2.0); 9 | } 10 | CtrlAltCBSet('Z',&CtrlAltZ,"Cmd /Zoom In", 11 | "Cmd /Zoom Out"); 12 | 13 | U0 Scrn2Clip(I64) 14 | { 15 | CDC *dc=DCScrnCapture; 16 | U8 *elems=DC2Sprite(dc); 17 | Bool unlock_doc=DocLock(sys_clip_doc); 18 | ClipDel; 19 | DocSprite(sys_clip_doc,elems); 20 | if (unlock_doc) 21 | DocUnlock(sys_clip_doc); 22 | Free(elems); 23 | DCDel(dc); 24 | } 25 | U0 CtrlAltS(I64) 26 | { 27 | Spawn(&Scrn2Clip); 28 | } 29 | CtrlAltCBSet('S',&CtrlAltS,"Cmd /Scrn Shot to Clip"); 30 | -------------------------------------------------------------------------------- /Adam/Gr/GrExt.HC: -------------------------------------------------------------------------------- 1 | #help_index "Graphics" 2 | extern U8 *GrBitMap4ToBitMap8(U8 *dst,U8 *src,I64 src_size,I64 bkcolor); 3 | extern I64 GrBlot3(CDC *dc,I64 x1,I64 y1,I64 z1,CDC *img); 4 | extern I64 *Mat4x4New(I64 *src,CTask *mem_task=NULL); 5 | extern U8 *SpriteQue2Sprite(CSprite *head,I64 *_size=NULL); 6 | extern CSprite *SpriteSetSettings(CDC *dc=NULL,CSprite *head,I64 elem_num, 7 | I64 x=0,I64 y=0,CColorROPU32 *_color=NULL,I64 *_thick=NULL, 8 | I64 *_xx=NULL,I64 *_yy=NULL); 9 | -------------------------------------------------------------------------------- /Adam/Gr/GrInitA.HC: -------------------------------------------------------------------------------- 1 | #help_index "Graphics" 2 | 3 | U0 GrInit1() 4 | { 5 | DefineLstLoad("ST_SPRITE_ELEM_TYPES", 6 | "End\0Color\0Dither Color\0" 7 | "Thick\0Planar Symmetry\0Transform On\0Transform Off\0Shift\0" 8 | "Point\0PolyPoint\0Line\0PolyLine\0Rect\0Rotated Rect\0" 9 | "Circle\0Ellipse\0Polygon\0BSpline2\0BSpline2 Closed\0" 10 | "BSpline3\0BSpline3 Closed\0" 11 | "Flood Fill\0Flood Fill Not Color\0BitMap\0Mesh\0Shiftable Mesh\0" 12 | "Arrow\0Text\0Text Box\0Text Diamond\0"); 13 | DefineLstLoad("ST_SPRITE_ELEM_CODES", 14 | "End\0Color\0Color\0" 15 | "Thick\0PlanarSymmetry\0Transform\0Transform\0Shift\0" 16 | "Pt\0PolyPt\0Line\0PolyLine\0Rect\0Rect\0" 17 | "Circle\0Ellipse\0Polygon\0BSpline2\0BSpline2\0BSpline3\0BSpline3\0" 18 | "FloodFill\0FloodFill\0BitMap\0Mesh\0Mesh\0" 19 | "Arrow\0Text\0TextBox\0TextDiamond\0"); 20 | } 21 | GrInit1; 22 | -------------------------------------------------------------------------------- /Adam/Gr/GrMath.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Adam/Gr/GrMath.HC -------------------------------------------------------------------------------- /Adam/Gr/GrPrimatives.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Adam/Gr/GrPrimatives.HC -------------------------------------------------------------------------------- /Adam/Gr/GrSpritePlot.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Adam/Gr/GrSpritePlot.HC -------------------------------------------------------------------------------- /Adam/Gr/MakeGr.HC: -------------------------------------------------------------------------------- 1 | Cd(__DIR__);; 2 | 3 | #include "GrInitA" 4 | #include "Gr.HH" 5 | #include "GrExt" 6 | #include "GrGlbls" 7 | #include "GrTextBase" 8 | #include "GrAsm" 9 | #include "GrPalette" 10 | #include "GrDC" 11 | #include "GrInitB" 12 | #include "GrMath" 13 | #include "GrScrn" 14 | #include "GrBitMap" 15 | #include "GrPrimatives" 16 | #include "GrComposites" 17 | #include "ScrnCast" 18 | 19 | #define SPE_ABORT (-1) 20 | #define SPE_EXIT 0 21 | #define SPE_CONT 1 22 | #include "SpriteNew" 23 | #include "GrSpritePlot" 24 | #include "SpriteMesh" 25 | #include "SpriteBitMap" 26 | #include "SpriteCode" 27 | #include "SpriteSideBar" 28 | #include "SpriteEd" 29 | #include "SpriteMain" 30 | 31 | #include "GrEnd" 32 | 33 | Cd("..");; 34 | -------------------------------------------------------------------------------- /Adam/Gr/SpriteCode.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Adam/Gr/SpriteCode.HC -------------------------------------------------------------------------------- /Adam/Gr/SpriteEd.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Adam/Gr/SpriteEd.HC -------------------------------------------------------------------------------- /Adam/Gr/SpriteMain.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Adam/Gr/SpriteMain.HC -------------------------------------------------------------------------------- /Adam/Gr/SpriteMesh.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Adam/Gr/SpriteMesh.HC -------------------------------------------------------------------------------- /Adam/Host.HC: -------------------------------------------------------------------------------- 1 | #help_index "Misc/Host" 2 | 3 | public Bool HostChgDsk(U8 *iso_filename) 4 | {//Help user change CD/DVD or ISO_file. 5 | Bool res=FALSE; 6 | SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$ 7 | try { 8 | AutoComplete; 9 | WinBorder; 10 | WinMax; 11 | DocClear; 12 | "$$PURPLE$$$$TX+CX,\"Set to %s\"$$$$FG$$\n\n\n\n",iso_filename; 13 | switch (ins_reg.host_vm) { 14 | case VM_VMWARE: 15 | if (IsDotC(iso_filename)) 16 | " 17 | Click CDROM Icon in bottom-right border of VMware window. 18 | 19 | Click \"Settings\". 20 | 21 | Set ISO image to \"%s\"$FG$. 22 | When browsing, change the file mask from \"*.iso\" to \"All Files\". 23 | 24 | ",iso_filename; 25 | else 26 | " 27 | Click CDROM Icon in bottom-right border of VMware window. 28 | 29 | Click \"Settings\". 30 | 31 | Set ISO image to \"$FG,2$%s$FG$\"$FG$. 32 | 33 | ",iso_filename; 34 | break; 35 | case VM_QEMU: 36 | " 37 | Change to QEMU monitor using $FG,2$$FG$ 38 | 39 | Get the CDROM designation. 40 | 41 | >$FG,2$info block$FG$ 42 | 43 | Use the designation. 44 | 45 | >$FG,2$eject ide1-cd0$FG$ 46 | 47 | Use the designation. 48 | 49 | >$FG,2$change ide1-cd0 %s$FG$ 50 | 51 | Change back to QEMU using $FG,2$$FG$ 52 | 53 | ",iso_filename; 54 | break; 55 | default: 56 | " 57 | Place the CDDVD %s in the drive. 58 | 59 | ",iso_filename; 60 | } 61 | if (PressAKey!=CH_SHIFT_ESC) { 62 | ">$FG,2$DskChg('T');$FG$\n\n"; 63 | DskChg('T'); 64 | res=TRUE; 65 | } 66 | } catch 67 | PutExcept; 68 | SettingsPop; 69 | return res; 70 | } 71 | -------------------------------------------------------------------------------- /Adam/MakeAdam.HC: -------------------------------------------------------------------------------- 1 | Cd(__DIR__);; 2 | #include "AExts" 3 | #include "AMath" 4 | #include "Training" 5 | #include "AMem" 6 | #include "TaskRep" 7 | #include "AMathODE" 8 | #include "Gr/MakeGr" 9 | #include "ASnd" 10 | #include "ABlkDev/MakeABlkDev" 11 | #include "Menu" 12 | #include "Win" 13 | #include "WinMgr" 14 | #include "ADbg" 15 | #include "::/Adam/God/GodExt" 16 | #include "DolDoc/MakeDoc" 17 | LBts(&sys_run_level,RLf_DOC); 18 | #include "Ctrls/MakeCtrls" 19 | #include "InFile" 20 | #include "ARegistry" 21 | #include "InsReg" 22 | #include "AutoComplete/MakeAC" 23 | #include "God/MakeGod" 24 | #include "AHash" 25 | #include "TaskSettings" 26 | #include "CPURep" 27 | #include "DevInfo" 28 | #include "ADefine" 29 | #include "WallPaper" 30 | #include "AMouse" 31 | #include "Host" 32 | Cd("..");; 33 | -------------------------------------------------------------------------------- /Adam/Opt/Boot/BootDVDIns.HC: -------------------------------------------------------------------------------- 1 | //See $LK,"Install Documentation",A="FI:::/Doc/Install.DD"$. 2 | //Study my account examples: $LK,"Cfg Strs",A="FL:::/Demo/AcctExample/TOS/TOSCfg.HC,1"$, $LK,"Update Funs",A="FL:::/Demo/AcctExample/TOS/TOSDistro.HC,1"$ 3 | 4 | #include "BootDVD" 5 | #include "DskISORedSea" 6 | 7 | #help_index "Install" 8 | 9 | #define KERNEL_BIN_C "Kernel.BIN.C" 10 | #define BOOT_DIR "/0000Boot" 11 | #define BOOT_DIR_KERNEL_BIN_C BOOT_DIR "/0000" KERNEL_BIN_C 12 | 13 | U0 MakeAll() 14 | { 15 | if (Cmp("/Compiler/Compiler","Compiler",,':')) 16 | throw; 17 | if (Cmp("/Kernel/Kernel","Kernel",,':')) 18 | throw; 19 | } 20 | 21 | public U0 BootDVDIns(U8 drv_let=0) 22 | {//See $LK,"::/Misc/DoDistro.HC"$. 23 | try { 24 | if (!Drv(drv_let)) 25 | throw; 26 | MakeAll; 27 | Move("/Kernel/Kernel.BIN.Z",BOOT_DIR_KERNEL_BIN_C); 28 | } catch { 29 | PutExcept; 30 | Beep; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Adam/Opt/Boot/BootRAM.HC: -------------------------------------------------------------------------------- 1 | #help_index "Call" 2 | asm { 3 | _HI_CALL:: 4 | PUSH RBP 5 | MOV RBP,RSP 6 | MOV RAX,U64 16[RBP] 7 | TEST RAX,RAX 8 | JZ @@05 9 | CALL RAX 10 | @@05: POP RBP 11 | RET1 8 12 | //************************************ 13 | _HI_MEMCPY:: 14 | PUSH RBP 15 | MOV RBP,RSP 16 | PUSH RSI 17 | PUSH RDI 18 | CLD 19 | MOV RDI,U64 SF_ARG1[RBP] 20 | MOV RSI,U64 SF_ARG2[RBP] 21 | MOV RCX,U64 SF_ARG3[RBP] 22 | REP_MOVSB 23 | MOV RAX,RDI 24 | POP RDI 25 | POP RSI 26 | POP RBP 27 | RET1 24 28 | } 29 | _extern _HI_CALL I64 HiCall(U8 *machine_code); 30 | _extern _HI_MEMCPY U8 *HiMemCpy(U8 *dst,U8 *src,I64 cnt); 31 | 32 | #help_index "Boot" 33 | public U0 BootRAM(U8 *filename=NULL) 34 | {//Softboot Kernel.BIN file. No hardware reset. 35 | I64 size; 36 | CKernel *hi_image,*lo_image=mem_boot_base-sizeof(CBinFile), 37 | reg *sys_ram_reboot; 38 | if (!filename) 39 | filename="::/" KERNEL_BIN_C; 40 | do if (!(hi_image=FileRead(filename,&size))) return; 41 | while (hi_image<0x100000); //If alloc from low 640K, just get another copy. 42 | 43 | do sys_ram_reboot=MAlloc(SYS_RAM_REBOOT_END-SYS_RAM_REBOOT,Fs->code_heap); 44 | while (sys_ram_reboot<0x100000); 45 | 46 | hi_image->boot_src=BOOT_SRC_RAM; 47 | hi_image->boot_blk=0; 48 | hi_image->boot_patch_table_base=lo_image(U8 *)+hi_image->h.patch_table_offset; 49 | hi_image->sys_run_level =lo_image->sys_run_level&(RLF_VGA|RLF_16BIT); 50 | MemCpy(&hi_image->start,&lo_image->start, 51 | sizeof(CKernel)-offset(CKernel.start)); 52 | 53 | CLI 54 | if (mp_cnt>1) 55 | MPHalt; 56 | 57 | HiMemCpy(sys_ram_reboot,SYS_RAM_REBOOT,SYS_RAM_REBOOT_END-SYS_RAM_REBOOT); 58 | HiMemCpy(lo_image,hi_image,size); 59 | HiCall(sys_ram_reboot); 60 | } 61 | -------------------------------------------------------------------------------- /Adam/Opt/Boot/MakeBoot.HC: -------------------------------------------------------------------------------- 1 | Cd(__DIR__);; 2 | #include "BootDVDIns" 3 | #include "BootHDIns" 4 | #include "BootMHDIns" 5 | #include "BootRAM" 6 | Cd("..");; 7 | -------------------------------------------------------------------------------- /Adam/Opt/Utils/MakeUtils.HC: -------------------------------------------------------------------------------- 1 | Cd(__DIR__);; 2 | #include "Diff" 3 | #include "Find" 4 | #include "HeapLog" 5 | #include "LineRep" 6 | #include "LinkChk" 7 | #include "MemRep" 8 | #include "Merge" 9 | #include "Profiler" 10 | #include "StrUtils" 11 | #include "DocUtils" 12 | #include "ToDolDoc" 13 | #include "ToTXT" 14 | #include "TOS" 15 | Cd("..");; 16 | -------------------------------------------------------------------------------- /Adam/Opt/Utils/ToDolDoc.HC: -------------------------------------------------------------------------------- 1 | #help_index "Cmd Line (Typically);DolDoc/Conversion;DolDoc/Cmd Line (Typically)" 2 | 3 | public U0 ToDolDoc(U8 *files_find_mask,U8 *fu_flags=NULL) 4 | {//Convert text file to $LK,"DolDoc",A="FI:::/Doc/DolDocOverview.DD"$ by making double $$'s. 5 | CDoc *doc; 6 | I64 fuf_flags=0; 7 | CDirEntry *tmpde,*tmpde1; 8 | ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F"); 9 | ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags); 10 | tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags); 11 | while (tmpde) { 12 | "%s\n",tmpde->full_name; 13 | doc=DocRead(tmpde->full_name,DOCF_PLAIN_TEXT|DOCF_DBL_DOLLARS); 14 | DocWrite(doc); 15 | DocDel(doc); 16 | tmpde=tmpde->next; 17 | } 18 | DirTreeDel(tmpde1); 19 | } 20 | -------------------------------------------------------------------------------- /Adam/Opt/Utils/ToTXT.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Adam/Opt/Utils/ToTXT.HC -------------------------------------------------------------------------------- /Adam/TaskRep.HC: -------------------------------------------------------------------------------- 1 | #help_index "Info;Task" 2 | U0 TaskRepTask(CTask *task,I64 indent) 3 | { 4 | CTask *task1; 5 | "%h*c$$MA,T=\"%08X\",LM=\"Kill(0x%X);\n\",$$ $$BLACK$$#%d$$FG$$ " 6 | "$$TX,\"%$$Q...\",SCX=16$$\n",indent,CH_SPACE,task,task,task->task_num, 7 | task->task_title; 8 | "%h*c%08X %04X:%04X:%08X\n",indent+2,CH_SPACE,TaskMemAlloced(task), 9 | task->task_flags,task->display_flags,task->win_inhibit; 10 | task1=task->next_child_task; 11 | while (task1!=(&task->next_child_task)(U8 *) 12 | -offset(CTask.next_sibling_task)) { 13 | TaskRepTask(task1,indent+2); 14 | task1=task1->next_sibling_task; 15 | } 16 | } 17 | 18 | public U0 TaskRep() 19 | {//Report current tasks on all cores. 20 | I64 i; 21 | CCPU *c; 22 | PUSHFD 23 | CLI 24 | for (i=0;iseth_task,2); 28 | } 29 | POPFD 30 | } 31 | -------------------------------------------------------------------------------- /Apps/Budget/Accts.DD: -------------------------------------------------------------------------------- 1 | $FG,6$JOB 2 | $FG,1$BANK 3 | $FG,4$CREDIT 4 | $FG,2$CASH 5 | $FG,0$RENT 6 | CAR 7 | UTILITIES 8 | MISC 9 | CLOTHS 10 | HEALTH 11 | CHARITY 12 | -------------------------------------------------------------------------------- /Apps/Budget/Install.HC: -------------------------------------------------------------------------------- 1 | Cd(__DIR__);; 2 | if (!FileFind("~/Budget",,FUF_JUST_DIRS)) { 3 | DirMk("~/Budget"); 4 | Copy("Accts.DD.Z","~/Budget"); 5 | } 6 | -------------------------------------------------------------------------------- /Apps/Budget/Load.HC: -------------------------------------------------------------------------------- 1 | #help_index "Finance" 2 | 3 | Cd(__DIR__);; 4 | #include "BgtStrs" 5 | #include "Budget" 6 | #include "BgtAccts" 7 | #include "BgtEntry" 8 | #include "BgtTemplate" 9 | #include "BgtFile" 10 | #include "BgtMain" 11 | 12 | #help_index "" 13 | -------------------------------------------------------------------------------- /Apps/Budget/Run.HC: -------------------------------------------------------------------------------- 1 | Cd(__DIR__);; 2 | #include "Load" 3 | #include "Install" //Might as well always install 4 | Budget; 5 | -------------------------------------------------------------------------------- /Apps/GrModels/BallGen.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Apps/GrModels/BallGen.HC -------------------------------------------------------------------------------- /Apps/GrModels/Load.HC: -------------------------------------------------------------------------------- 1 | #help_index "Misc" 2 | 3 | Cd(__DIR__);; 4 | #include "ManGen" 5 | #include "BallGen" 6 | #include "Models" 7 | 8 | #help_index "" 9 | -------------------------------------------------------------------------------- /Apps/GrModels/ManGen.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Apps/GrModels/ManGen.HC -------------------------------------------------------------------------------- /Apps/GrModels/Models.HC: -------------------------------------------------------------------------------- 1 | #define T_MAN 0 2 | #define T_BALL 1 3 | 4 | U0 Models() 5 | { 6 | I64 i; 7 | Bool old_form=LBts(&(DocPut)->flags,DOCf_FORM); 8 | DocClear; 9 | "Make a CSprite model. Then, cut-and-Paste it.\n\n"; 10 | "$$LM,4$$"; 11 | "\n\n$$BT,\"Man\",LE=T_MAN$$\n\n"; 12 | "\n\n$$BT,\"Ball\",LE=T_BALL$$\n\n"; 13 | "$$LM,0$$"; 14 | i=DocMenu(DocPut); 15 | LBEqu(&(DocPut)->flags,DOCf_FORM,old_form); 16 | DocBottom; 17 | switch (i) { 18 | case T_MAN: 19 | ManGen; 20 | break; 21 | case T_BALL: 22 | BallGen; 23 | break; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Apps/GrModels/Run.HC: -------------------------------------------------------------------------------- 1 | Cd(__DIR__);; 2 | #include "Load" 3 | Models; -------------------------------------------------------------------------------- /Apps/KeepAway/KeepAway.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Apps/KeepAway/KeepAway.HC -------------------------------------------------------------------------------- /Apps/KeepAway/Load.HC: -------------------------------------------------------------------------------- 1 | #help_index "Games" 2 | 3 | Cd(__DIR__);; 4 | #include "KeepAway" 5 | 6 | #help_index "" 7 | -------------------------------------------------------------------------------- /Apps/KeepAway/Run.HC: -------------------------------------------------------------------------------- 1 | Cd(__DIR__);; 2 | #include "Load" 3 | KeepAway; -------------------------------------------------------------------------------- /Apps/Logic/Load.HC: -------------------------------------------------------------------------------- 1 | #help_index "Misc" 2 | 3 | Cd(__DIR__);; 4 | #include "Logic" 5 | 6 | #help_index "" 7 | -------------------------------------------------------------------------------- /Apps/Logic/Logic.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Apps/Logic/Logic.HC -------------------------------------------------------------------------------- /Apps/Logic/Run.HC: -------------------------------------------------------------------------------- 1 | Cd(__DIR__);; 2 | #include "Load" 3 | DigitalLogic; -------------------------------------------------------------------------------- /Apps/Psalmody/Examples/childish.HC: -------------------------------------------------------------------------------- 1 | //9 has words 2 | U0 Song() 3 | { 4 | Fs->task_end_cb=&SndTaskEndCB; 5 | MusicSettingsRst; 6 | music.tempo= 2.480; 7 | music.stacatto_factor= 0.902; 8 | try { 9 | while (!ScanKey) { 10 | Play("5qEsCDCDqCDeEGsE4B5E4B5eC4B5sD4A5D4A", 11 | "Be \0like \0 \0a \0 \0child \0 \0 \0 \0" 12 | "some \0 \0re\0 \0spect.\n\0 \0 \0 \0 \0 \0"); 13 | Play("5qEsCDCDqCDeEGsE4B5E4B5eC4B5sD4A5D4A", 14 | "Ma\0tur\0 \0i\0 \0ty \0 \0 \0 \0don't \0 \0" 15 | "ne\0 \0glect.\n\0 \0 \0 \0 \0 \0"); 16 | Play("4eB5DqF4sGAGAqAAA5etD4AA5sD4B5D4B"); 17 | Play("4eB5DqF4sGAGAqAAA5etD4AA5sD4B5D4B"); 18 | } 19 | } catch 20 | PutExcept; 21 | Snd; 22 | } 23 | 24 | Song; 25 | -------------------------------------------------------------------------------- /Apps/Psalmody/Examples/night.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Apps/Psalmody/Examples/night.HC -------------------------------------------------------------------------------- /Apps/Psalmody/Examples/prosper.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Apps/Psalmody/Examples/prosper.HC -------------------------------------------------------------------------------- /Apps/Psalmody/Install.HC: -------------------------------------------------------------------------------- 1 | if (!FileFind("~/Psalmody",,FUF_JUST_DIRS)) 2 | DirMk("~/Psalmody"); 3 | -------------------------------------------------------------------------------- /Apps/Psalmody/Load.HC: -------------------------------------------------------------------------------- 1 | #help_index "Snd/Music/Apps" 2 | 3 | Cd(__DIR__);; 4 | #include "JukeBox" 5 | #include "JukePuppet" 6 | #include "Psalmody" 7 | #include "PsalmodyCtrls" 8 | #include "PsalmodyDraw" 9 | #include "PsalmodyFile" 10 | #include "PsalmodyMain" 11 | 12 | #help_index "" 13 | -------------------------------------------------------------------------------- /Apps/Psalmody/PsalmodyDraw.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Apps/Psalmody/PsalmodyDraw.HC -------------------------------------------------------------------------------- /Apps/Psalmody/Run.HC: -------------------------------------------------------------------------------- 1 | Cd(__DIR__);; 2 | #include "Load" 3 | Psalmody; 4 | -------------------------------------------------------------------------------- /Apps/Span/Install.HC: -------------------------------------------------------------------------------- 1 | DirMk("~/Span"); 2 | -------------------------------------------------------------------------------- /Apps/Span/Load.HC: -------------------------------------------------------------------------------- 1 | #help_index "Games" 2 | 3 | Cd(__DIR__);; 4 | #include "Span.HH" 5 | #include "SpanDerive" 6 | #include "SpanBridge" 7 | #include "SpanNew" 8 | #include "SpanMain" 9 | 10 | #help_index "" 11 | -------------------------------------------------------------------------------- /Apps/Span/Run.HC: -------------------------------------------------------------------------------- 1 | Cd(__DIR__);; 2 | #include "Load" 3 | Span; 4 | -------------------------------------------------------------------------------- /Apps/Span/Span.HH: -------------------------------------------------------------------------------- 1 | #define SPAN_VERSION 1.0 2 | 3 | class SpanHeader 4 | { 5 | F64 version; 6 | I32 num_masses,num_springs; 7 | }; 8 | 9 | class MyMass:CMass 10 | { 11 | F64 radius,cost,load_t; 12 | CColorROPU32 color; 13 | } *cursor_mass; 14 | 15 | class MySpring:CSpring 16 | { 17 | F64 compression_strength,tensile_strength,cost; 18 | F64 base_compression_strength,base_tensile_strength, 19 | base_const,base_cost; 20 | 21 | CColorROPU32 color; 22 | I32 thick; 23 | }; 24 | 25 | CMathODE *ode=NULL; 26 | 27 | CCtrlBttnState run_bttn,mode_bttn; 28 | 29 | CColorROPU32 run_colors[2]={RED,GREEN}; 30 | 31 | #define MD_MASS 0 32 | #define MD_CONCRETE 1 33 | #define MD_STEEL 2 34 | #define MD_WIRE 3 35 | #define MD_MOVE 4 36 | #define MD_DELETE 5 37 | #define MD_MODES_NUM 6 38 | CColorROPU32 mode_colors[MD_MODES_NUM]= 39 | {BROWN,LTGRAY,DKGRAY,RED,PURPLE,RED}; 40 | DefineLstLoad("ST_SPAN_MODES","Mass\0Concrete\0Steel\0Wire\0Move\0Delete\0"); 41 | 42 | class SpanAnimateStruct 43 | { 44 | U8 *saved_ode; 45 | F64 elapsed_t,start_wall_t; 46 | } a; 47 | 48 | extern MyMass *PlaceMass(I64 x, I64 y); 49 | extern F64 SpanTime(); 50 | -------------------------------------------------------------------------------- /Apps/Span/SpanBridge.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Apps/Span/SpanBridge.HC -------------------------------------------------------------------------------- /Apps/Span/SpanDerive.HC: -------------------------------------------------------------------------------- 1 | U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *) 2 | { 3 | //The forces due to springs and drag are 4 | //automatically handled by the 5 | //ode code. We can add new forces 6 | //here. 7 | CTask *task=ode->win_task; 8 | F64 d,dd; 9 | CD3 p,p2; 10 | MyMass *tmpm1,*tmpm2; 11 | 12 | //Collisions 13 | tmpm1=ode->next_mass; 14 | while (tmpm1!=&ode->next_mass) { 15 | tmpm2=tmpm1->next; 16 | while (tmpm2!=&ode->next_mass) { 17 | D3Sub(&p,&tmpm2->state->x,&tmpm1->state->x); 18 | dd=D3NormSqr(&p); 19 | if (dd<=Sqr(tmpm1->radius+tmpm2->radius)) { 20 | d=Sqrt(dd)+0.0001; 21 | dd=10.0*Sqr(Sqr(Sqr(tmpm1->radius+tmpm2->radius)-dd)); 22 | D3MulEqu(&p,dd/d); 23 | D3AddEqu(&tmpm2->DstateDt->DxDt,&p); 24 | D3SubEqu(&tmpm1->DstateDt->DxDt,&p); 25 | } 26 | tmpm2=tmpm2->next; 27 | } 28 | tmpm1=tmpm1->next; 29 | } 30 | 31 | tmpm1=ode->next_mass; 32 | while (tmpm1!=&ode->next_mass) { 33 | if (!(tmpm1->flags&MSF_FIXED)) 34 | tmpm1->DstateDt->DyDt+=10.0*tmpm1->mass; //Gravity 35 | tmpm1=tmpm1->next; 36 | } 37 | 38 | if (cursor_mass) { 39 | p2.x=ms.pos.x-task->pix_left-task->scroll_x; 40 | p2.y=ms.pos.y-task->pix_top-task->scroll_y; 41 | p2.z=0; 42 | D3Sub(&p,&p2,&cursor_mass->state->x); 43 | d=10.0*D3NormSqr(&p); 44 | D3MulEqu(&p,d); 45 | D3AddEqu(&cursor_mass->DstateDt->DxDt,&p); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Apps/Strut/Load.HC: -------------------------------------------------------------------------------- 1 | #help_index "Games" 2 | 3 | Cd(__DIR__);; 4 | #include "Strut" 5 | 6 | #help_index "" 7 | -------------------------------------------------------------------------------- /Apps/Strut/Run.HC: -------------------------------------------------------------------------------- 1 | Cd(__DIR__);; 2 | #include "Load" 3 | Strut; 4 | -------------------------------------------------------------------------------- /Apps/Strut/Strut.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Apps/Strut/Strut.HC -------------------------------------------------------------------------------- /Apps/TimeClock/Install.HC: -------------------------------------------------------------------------------- 1 | if (!FileFind("~/TimeClock",,FUF_JUST_DIRS)) { 2 | DirMk("~/TimeClock"); 3 | DocClear; 4 | "After Loading, type $$GREEN$$PunchIn;$$FG$$, " 5 | "$$GREEN$$PunchOut;$$FG$$ or $$GREEN$$TimeRep;$$FG$$\n" 6 | "You might want to make PLUGINS for hot keys.\n\n\n"; 7 | } 8 | 9 | -------------------------------------------------------------------------------- /Apps/TimeClock/Load.HC: -------------------------------------------------------------------------------- 1 | #help_index "Misc" 2 | 3 | Cd(__DIR__);; 4 | #include "TimeClk" 5 | #include "Install" //Might as well always install 6 | 7 | #help_index "" 8 | -------------------------------------------------------------------------------- /Apps/Titanium/Load.HC: -------------------------------------------------------------------------------- 1 | #help_index "Games" 2 | 3 | Cd(__DIR__);; 4 | #include "Titanium" 5 | 6 | #help_index "" 7 | -------------------------------------------------------------------------------- /Apps/Titanium/Run.HC: -------------------------------------------------------------------------------- 1 | Cd(__DIR__);; 2 | #include "Load" 3 | Titanium; -------------------------------------------------------------------------------- /Apps/Titanium/Titanium.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Apps/Titanium/Titanium.HC -------------------------------------------------------------------------------- /Apps/ToTheFront/Install.HC: -------------------------------------------------------------------------------- 1 | DirMk("~/ToTheFront"); 2 | 3 | -------------------------------------------------------------------------------- /Apps/ToTheFront/Load.HC: -------------------------------------------------------------------------------- 1 | #help_index "Games" 2 | 3 | Cd(__DIR__);; 4 | #include "TTFGlbls" 5 | #include "TTFLib" 6 | #include "TTFInit" 7 | #include "TTFVis" 8 | #include "TTFFire" 9 | #include "TTFMove" 10 | #include "TTFDraw" 11 | #include "ToTheFront" 12 | 13 | #help_index "" 14 | -------------------------------------------------------------------------------- /Apps/ToTheFront/Run.HC: -------------------------------------------------------------------------------- 1 | Cd(__DIR__);; 2 | #include "Load" 3 | ToTheFront; -------------------------------------------------------------------------------- /Apps/ToTheFront/TTFDraw.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Apps/ToTheFront/TTFDraw.HC -------------------------------------------------------------------------------- /Apps/ToTheFront/TTFFire.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Apps/ToTheFront/TTFFire.HC -------------------------------------------------------------------------------- /Apps/ToTheFront/TTFGlbls.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Apps/ToTheFront/TTFGlbls.HC -------------------------------------------------------------------------------- /Apps/ToTheFront/TTFInit.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Apps/ToTheFront/TTFInit.HC -------------------------------------------------------------------------------- /Apps/ToTheFront/TTFMove.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Apps/ToTheFront/TTFMove.HC -------------------------------------------------------------------------------- /Apps/Vocabulary/Load.HC: -------------------------------------------------------------------------------- 1 | #help_index "Games" 2 | 3 | Cd(__DIR__);; 4 | #include "VocabQuiz" 5 | 6 | #help_index "" 7 | -------------------------------------------------------------------------------- /Apps/Vocabulary/Run.HC: -------------------------------------------------------------------------------- 1 | Cd(__DIR__);; 2 | #include "Load" 3 | VocabQuiz; -------------------------------------------------------------------------------- /Apps/Vocabulary/VocabQuiz.HC: -------------------------------------------------------------------------------- 1 | U8 *RandVocabWord() 2 | { 3 | I64 i; 4 | U8 *ptr; 5 | if (!acd.num_words) 6 | return NULL; 7 | i=RandU32%acd.num_words; 8 | ptr=acd.word_lst; 9 | while (i-- && *ptr==ACD_WORD_CHAR) 10 | ptr+=StrLen(ptr)+3; 11 | if (*ptr++!=ACD_WORD_CHAR) 12 | return NULL; 13 | else 14 | return ptr; 15 | } 16 | 17 | U0 VocabQuiz() 18 | { 19 | I64 ch,i,num; 20 | U8 *right_word,*words[4]; 21 | if (!FileFind(ACD_DEF_FILENAME)) { 22 | "Uncompressed dictionary not present.\n"; 23 | return; 24 | } 25 | do { 26 | right_word=RandVocabWord; 27 | for (i=0;i<4;i++) 28 | words[i]=RandVocabWord; 29 | num=RandU32&3; 30 | words[num]=right_word; 31 | 32 | "$$WW,1$$$$CM-LE,5$$$$RED$$$$BK,1$$%s$$BK,0$$:$$FG$$$$LM,4$$\n",right_word; 33 | for (i=0;i<4;i++) 34 | "\n\n$$GREEN$$$$BT-X,\"%d\",LM=\"%d\"$$$$FG$$" 35 | "$$LM,7$$%s\n$$LM,4$$",i+1,i+1,ACDDefGet(words[i]); 36 | "\n\n$$LTBLUE$$Answer:$$FG$$"; 37 | do { 38 | ch=GetKey(,TRUE); 39 | DocBottom; 40 | if ('1'<=ch<='4') { 41 | '\n'; 42 | if (ch-'1'==num) { 43 | "$$LTGREEN$$Correct\n$$FG$$"; 44 | Snd(74); 45 | } else { 46 | "$$LTRED$$Incorrect\n$$FG$$"; 47 | Snd(46); 48 | } 49 | Sleep(500); 50 | Snd; 51 | ACDPopUpDef(right_word); 52 | break; 53 | } 54 | } while (ch!=CH_SHIFT_ESC && ch!=CH_ESC); 55 | "$$LM,0$$\n"; 56 | } while (ch!=CH_SHIFT_ESC && ch!=CH_ESC); 57 | } 58 | -------------------------------------------------------------------------------- /Apps/X-Caliber/Load.HC: -------------------------------------------------------------------------------- 1 | #help_index "Games" 2 | 3 | Cd(__DIR__);; 4 | #include "XCCtrls" 5 | #include "X-Caliber" 6 | 7 | #help_index "" 8 | -------------------------------------------------------------------------------- /Apps/X-Caliber/Run.HC: -------------------------------------------------------------------------------- 1 | Cd(__DIR__);; 2 | #include "Load" 3 | XCaliber; -------------------------------------------------------------------------------- /Apps/X-Caliber/X-Caliber.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Apps/X-Caliber/X-Caliber.HC -------------------------------------------------------------------------------- /Compiler/BackLib.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Compiler/BackLib.HC -------------------------------------------------------------------------------- /Compiler/Compiler.PRJ: -------------------------------------------------------------------------------- 1 | #exe { 2 | Cd(__DIR__);; 3 | Option(OPTf_WARN_PAREN,ON); 4 | Option(OPTf_WARN_DUP_TYPES,ON); 5 | Option(OPTf_KEEP_PRIVATE,ON); 6 | } 7 | #include "/Kernel/KernelA.HH" 8 | #include "/Compiler/CompilerA.HH" 9 | #exe {Option(OPTf_EXTERNS_TO_IMPORTS,ON);}; 10 | #include "/Kernel/KernelB.HH" 11 | #include "/Kernel/KernelC.HH" 12 | #exe {Option(OPTf_EXTERNS_TO_IMPORTS,OFF);}; 13 | #exe {Option(OPTf_KEEP_PRIVATE,OFF);}; 14 | #include "Templates" 15 | #include "CExts" 16 | CCmpGlbls cmp; 17 | #include "CInit" 18 | #include "CExcept" 19 | #include "LexLib" 20 | #include "Lex" 21 | CUAsmGlbls uasm; 22 | #include "CHash" 23 | #include "UAsm" 24 | #include "PrsLib" 25 | #include "AsmInit" 26 | #include "AsmLib" 27 | #include "AsmResolve" 28 | #include "Asm" 29 | #include "OptLib" 30 | #include "PrsExp" 31 | #include "PrsVar" 32 | #include "CMisc" 33 | #include "CMain" 34 | #include "PrsStmt" 35 | #include "OptPass012" 36 | #include "OptPass3" 37 | #include "OptPass4" 38 | #include "OptPass5" 39 | #include "OptPass6" 40 | #include "BackLib" 41 | #include "BackFA" 42 | #include "BackFB" 43 | #include "BackA" 44 | #include "BackB" 45 | #include "BackC" 46 | #include "OptPass789A" 47 | -------------------------------------------------------------------------------- /Demo/AcctExample/HomeKeyPlugIns.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/AcctExample/HomeKeyPlugIns.HC -------------------------------------------------------------------------------- /Demo/AcctExample/HomeLocalize.HC: -------------------------------------------------------------------------------- 1 | //Place this file in /Home and change 2 | //anything you want. 3 | 4 | Option(OPTf_WARN_PAREN,ON); 5 | Option(OPTf_WARN_DUP_TYPES,ON); 6 | 7 | KbdTypeMatic(0); 8 | 9 | // Las Vegas is -7 during summer, -8 during winter 10 | local_time_offset=-7*60*60*CDATE_FREQ; //Pacific 11 | // Remember you can set the time in the BIOS. 12 | 13 | //$AN,"",A="mouse_move_scale"$adjust these to set mouse move scale 14 | ms_hard.scale.x=0.5; 15 | ms_hard.scale.y=0.5; 16 | ms_hard.scale.z=5.0; //wheel 17 | 18 | //don't change these 19 | ms_hard.prescale.x=ms_hard.pos.x/ms_hard.scale.x; 20 | ms_hard.prescale.y=ms_hard.pos.y/ms_hard.scale.y; 21 | ms_hard.prescale.z=ms_hard.pos.z/ms_hard.scale.z; 22 | -------------------------------------------------------------------------------- /Demo/AcctExample/HomeSys.HC: -------------------------------------------------------------------------------- 1 | //Place this file in /Home and change 2 | //anything you want. 3 | 4 | U0 UserStartUp() 5 | {//Run each time a user a spawned 6 | DocTermNew; 7 | Type("::/Doc/Start.DD"); 8 | LBts(&Fs->display_flags,DISPLAYf_SHOW); 9 | WinToTop; 10 | WinZBufUpdate; 11 | Dir; 12 | "$TX,"82,150",D="DD_TEMPLEOS_LOC"$LOC:"; 13 | CPURep; 14 | } 15 | 16 | U0 SrvStartUp() 17 | {//Run each time a srv task is spawned. 18 | DocTermNew; 19 | LBts(&Fs->display_flags,DISPLAYf_SHOW); 20 | WinToTop; 21 | WinZBufUpdate; 22 | } 23 | 24 | CTask *user1,*user2; 25 | 26 | U0 StartUpTasks() 27 | { 28 | user1=User; 29 | user2=User; 30 | WinToTop(user1); 31 | WinTileVert; 32 | "Boot Time:%7.3fs\n",tS; 33 | XTalk(user1,"Cd;#include \"Once\";\n"); 34 | Silent; 35 | ACInit("/*;!*/Bible.TXT*;!*.TXT"); //No Bible, no uncompressed DD. 36 | Silent(OFF); 37 | "AutoComplete Time:%7.3fs\n",tS; 38 | } 39 | 40 | if (DrvIsWritable(':')) { 41 | DelTree("::/Tmp/ScrnShots"); 42 | DirMk("::/Tmp/ScrnShots"); 43 | } 44 | 45 | StartUpTasks; 46 | 47 | "\nTempleOS V%5.3f\t%D %T\n\n",sys_os_version,sys_compile_time,sys_compile_time; 48 | -------------------------------------------------------------------------------- /Demo/AcctExample/HomeWrappers.HC: -------------------------------------------------------------------------------- 1 | #help_index "Cmd Line (Typically)" 2 | 3 | #define FILEMASK_OFF_LIMITS "!*/Misc/PCIDevices.DD*;!*/Misc/Bible.TXT*;"\ 4 | "!*/Books?/*;!*/Sup1/Sup1Words/*;!*/Sup1/Sup1Bin/*;"\ 5 | "!*/God/Vocab.DD*" 6 | 7 | public I64 F(U8 *needle_str,U8 *fu_flags=NULL) 8 | {//Find text in all text files. 9 | return Find(needle_str,"/*",fu_flags); 10 | } 11 | 12 | public I64 F2(U8 *needle_str,U8 *fu_flags=NULL) 13 | {//Find text in most text files. 14 | return Find(needle_str,"/*;" FILEMASK_OFF_LIMITS,fu_flags); 15 | } 16 | 17 | public I64 R(U8 *needle_str,U8 *replace_text=NULL,U8 *fu_flags="+l-i") 18 | {//Find text and replace in most text files. 19 | return Find(needle_str,"/*;" FILEMASK_OFF_LIMITS,fu_flags,replace_text); 20 | } 21 | 22 | public I64 FD(U8 *needle_str,U8 *fu_flags=NULL) 23 | {//Find text in cur dir text files. 24 | return Find(needle_str,"*",fu_flags); 25 | } 26 | 27 | public I64 FD2(U8 *needle_str,U8 *fu_flags=NULL) 28 | {//Find text in most cur dir text files. 29 | return Find(needle_str,"*;" FILEMASK_OFF_LIMITS,fu_flags); 30 | } 31 | 32 | public I64 RD(U8 *needle_str,U8 *replace_text=NULL,U8 *fu_flags="+l-i") 33 | {//Find text and replace in most cur dir text files. 34 | return Find(needle_str,"*;" FILEMASK_OFF_LIMITS,fu_flags,replace_text); 35 | } 36 | -------------------------------------------------------------------------------- /Demo/AcctExample/MakeHome.HC: -------------------------------------------------------------------------------- 1 | Cd(__DIR__);; 2 | 3 | //If these are not present in /Home, it uses the version in the root dir. You 4 | //can make your own, modified, version of these files in your /Home directory. 5 | #include "~/HomeLocalize" 6 | #include "/Adam/Opt/Boot/MakeBoot" 7 | #include "/Adam/Opt/Utils/MakeUtils" 8 | #include "~/HomeWrappers" 9 | MapFileLoad("::/Kernel/Kernel"); 10 | MapFileLoad("::/Compiler/Compiler"); 11 | 12 | #include "::/Apps/Psalmody/Load" 13 | #include "~/TOS/MakeTOS" 14 | #include "~/HomeKeyPlugIns" 15 | #include "~/HomeSys" 16 | Cd("..");; 17 | -------------------------------------------------------------------------------- /Demo/AcctExample/Once.HC: -------------------------------------------------------------------------------- 1 | //Place this file in /Home and change 2 | //anything you want. 3 | 4 | //This file is executed by the 5 | //first terminal window upon start-up. 6 | //See $LK,"Once",A="FF:/Home/HomeSys.HC,Once"$ and $LK,"Home Files",A="FF:::/Doc/GuideLines.DD,/Home Files"$. 7 | 8 | // Type("::/Doc/Customize.DD"); 9 | 10 | U0 Tmp() 11 | { 12 | OnceExe; 13 | switch (sys_boot_src.u16[0]) { 14 | case BOOT_SRC_DVD: 15 | "\nIf you answer 'No' you can play with\n" 16 | "the live CD without installing.\n\n" 17 | "Install onto hard drive "; 18 | if (YorN) { 19 | DocBottom; 20 | if (RunFile("::/Misc/OSInstall",,FALSE)) { 21 | Del("C:/Home/DoDistro.HC.Z"); 22 | Del("D:/Home/DoDistro.HC.Z"); 23 | OnceDrv('C',"\"\n\nRun TOSStaffIns;\n\n\n\";"); 24 | OnceDrv('D',""); //This command uses cached Registry file. 25 | if (PressAKey!=CH_SHIFT_ESC) 26 | Reboot; //Too dangerous for amateurs until reboot. 27 | } 28 | } 29 | break; 30 | } 31 | if (FileFind("D:/Tmp/Logs/access.log")) { 32 | In("\n\n%C",CH_ESC); 33 | RunFile("::/Demo/WebLogDemo/WebLogRep",, 34 | "D:/Tmp/Logs/*.log","D:/Home/WebLogRep.DD"); 35 | Del("D:/Tmp/Logs/*.log"); 36 | } 37 | } 38 | 39 | Tmp; 40 | -------------------------------------------------------------------------------- /Demo/AcctExample/PersonalMenu.DD: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/AcctExample/PersonalMenu.DD -------------------------------------------------------------------------------- /Demo/AcctExample/TOS/MakeTOS.HC: -------------------------------------------------------------------------------- 1 | Cd(__DIR__);; 2 | 3 | #include "TOSExt" 4 | #include "TOSCfg" 5 | #include "TOSMisc" 6 | #include "TOSDistro" 7 | 8 | Cd("..");; 9 | -------------------------------------------------------------------------------- /Demo/AcctExample/TOS/TOSTheme.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/AcctExample/TOS/TOSTheme.HC -------------------------------------------------------------------------------- /Demo/Asm/AsmAndC3.HC: -------------------------------------------------------------------------------- 1 | /*Asm labels can only be defined once 2 | in a task. will spawn a new task 3 | each time, so you don't get redefine 4 | error, like when repeatedly #including 5 | it from the cmd line. 6 | */ 7 | 8 | U0 AsmAndC3() 9 | { 10 | I64 i; 11 | for (i=0;i<3;i++) { 12 | "Meaning of life:"; 13 | MOV AL,0x41 14 | STC 15 | ADC AL,0 //Round-about way to make the not-special constant, 0x42. 16 | CALL PUT_HEX_U8 17 | MOV RCX,cnts.time_stamp_freq>>5 //JIT Const. Simple delay loop. 18 | @@1: LOOP @@1 19 | '\n'; 20 | } 21 | } 22 | 23 | AsmAndC3; 24 | -------------------------------------------------------------------------------- /Demo/Asm/AsmHelloWorld.HC: -------------------------------------------------------------------------------- 1 | /*Asm labels can only be defined once 2 | in a task. will spawn a new task 3 | each time, so you don't get redefine 4 | error, like when repeatedly #including 5 | it from the cmd line. 6 | 7 | These are many useful kernel 8 | routines $LK,"::/Kernel/StrA.HC",A="FF:::/Kernel/StrA.HC,PUT_CHARS"$ 9 | intended to be called from 10 | asm. Generally, they preserve 11 | regs. 12 | 13 | You can call any routine you 14 | like, C or asm, if you import it. 15 | Be aware that C routines do not 16 | preserve RAX,RBX,RCX,RDX,R8,R9. 17 | When calling from the shell or 18 | from C, preserve all other regs. 19 | 20 | */ 21 | 22 | asm { 23 | //Opcodes are slightly different to make writing my x86_64 assembler easier. 24 | //See $LK,"::/Compiler/OpCodes.DD"$. 25 | 26 | MY_WORLD_MSG: 27 | //Define U8 does not put terminating zeros 28 | //on strings. 29 | DU8 "World\n",0; 30 | 31 | //My convention is to put an underscore 32 | //on C callable asm routines. 33 | _HELLO_WORLD:: 34 | PUSH RSI //See $LK,"REGG_LOCAL_VARS",A="MN:REGG_LOCAL_VARS"$ & $LK,"REGG_LOCAL_NON_PTR_VARS",A="MN:REGG_LOCAL_NON_PTR_VARS"$ 35 | MOV RCX,10 36 | @@05: MOV RAX,RCX 37 | CALL PUT_HEX_U8 38 | MOV RAX,CH_SPACE 39 | CALL PUT_CHARS 40 | MOV RAX,'Hello ' //Supports multi-byte char consts 41 | CALL PUT_CHARS 42 | //We broke it in two pieces to show different ways. 43 | MOV RSI,MY_WORLD_MSG 44 | CALL PUT_STR 45 | LOOP @@05 46 | POP RSI 47 | RET 48 | }; 49 | 50 | Call(_HELLO_WORLD); 51 | -------------------------------------------------------------------------------- /Demo/Asm/DivByHand.HC: -------------------------------------------------------------------------------- 1 | asm { 2 | _DIV_U64_BY_U64:: 3 | PUSH RBP 4 | MOV RBP,RSP 5 | XOR RDX,RDX 6 | MOV RCX,64 7 | MOV RAX,SF_ARG1[RBP] 8 | MOV RBX,SF_ARG2[RBP] 9 | @@1: SHL1 RAX 10 | RCL1 RDX 11 | CMP RBX,RDX 12 | JA @@2 13 | INC RAX 14 | SUB RDX,RBX 15 | @@2: LOOP @@1 16 | POP RBP 17 | RET1 16 18 | } 19 | 20 | _extern _DIV_U64_BY_U64 I64 DivU64ByU64(I64 dividend,I64 divisor); 21 | 22 | "123456/10=%d\n",DivU64ByU64(123456,10); -------------------------------------------------------------------------------- /Demo/Asm/MulByHand.HC: -------------------------------------------------------------------------------- 1 | /*When I was a kid with a Commodore 64, 2 | the 6502 chip had no multiply inst 3 | and this is how we had to do it, except, 4 | I used more regs in this example. 5 | */ 6 | asm { 7 | //Opcodes are slightly different to make writing my x86_64 assembler easier. 8 | //See $LK,"::/Compiler/OpCodes.DD"$. 9 | 10 | //You can clobber RAX,RBX,RCX,RDX,R8,R9. The compiler expects that. 11 | 12 | MUL_BY_HAND_U8_U8_TO_U16: //This is only for fun. 13 | //8bit * 8bit-->16bit 14 | //AL*BL-->AX 15 | MOV CL,8 16 | SHL AX,8 17 | @@05: SHL1 AX 18 | JNC @@10 19 | ADD AL,BL 20 | @@10: DEC CL 21 | JNZ @@05 22 | RET 23 | 24 | _MUL_BY_HAND_U8_U8_TO_U16:: //C callable 25 | PUSH RBP 26 | MOV RBP,RSP 27 | MOV AL,U8 SF_ARG1[RBP] //$LK,"SF_ARG1",A="FF:::/Kernel/KernelA.HH,SF_ARG1"$ 28 | MOV BL,U8 SF_ARG2[RBP] 29 | CALL MUL_BY_HAND_U8_U8_TO_U16 30 | MOVZX RAX,AX 31 | POP RBP 32 | RET1 16 33 | 34 | _MUL_U64_U64_TO_U128:: 35 | //64bit * 64bit-->128bit 36 | PUSH RBP 37 | MOV RBP,RSP 38 | MOV RBX,U64 SF_ARG3[RBP] 39 | MOV RAX,U64 SF_ARG1[RBP] //$LK,"SF_ARG1",A="FF:::/Kernel/KernelA.HH,SF_ARG1"$ 40 | MUL U64 SF_ARG2[RBP] //Res RDX:RAX 128bit 41 | MOV U64 [RBX],RAX 42 | MOV U64 8[RBX],RDX 43 | POP RBP 44 | RET1 24 45 | }; 46 | 47 | //My convention is to put an underscore 48 | //on C callable asm routines. 49 | _extern _MUL_BY_HAND_U8_U8_TO_U16 U16 MulU8(U8 n1,U8 n2); 50 | 51 | class U128 52 | { 53 | U64 lo,hi; 54 | }; 55 | 56 | _extern _MUL_U64_U64_TO_U128 U0 MulU64(I64 n1,I64 n2,U128 *_prod); 57 | 58 | U0 MulByHand() 59 | { 60 | U128 p; 61 | "2*7 =0x%X\n",MulU8(2,7); 62 | "100*10=0x%X\n",MulU8(100,10); 63 | 64 | MulU64(0x0123456789ABCDEF,0x1000001,&p); 65 | "0x0123466789ABCDEF*0x1000001=0x%016X%016X\n",p.hi,p.lo; 66 | } 67 | 68 | MulByHand; 69 | 70 | -------------------------------------------------------------------------------- /Demo/Asm/PutDec.HC: -------------------------------------------------------------------------------- 1 | asm { 2 | PUT_DEC_U64:: 3 | //RAX is number to print in decimal. 4 | //Preserves all regs. 5 | PUSH RBP 6 | MOV RBP,RSP 7 | SUB RSP,24 //24 char buffer on stack 8 | 9 | //$LK,"Save regs",A="FF:::/Kernel/KernelA.HH,PUSH_C_REGS"$ which C code is free to clobber. We don't have to for C callers, 10 | //but this function will be nice for ASM callers if it saves all regs. 11 | PUSH_C_REGS 12 | 13 | PUSH RSI //See $LK,"REGG_LOCAL_VARS",A="MN:REGG_LOCAL_VARS"$&$LK,"REGG_LOCAL_NON_PTR_VARS",A="MN:REGG_LOCAL_NON_PTR_VARS"$ 14 | LEA RSI,-1[RBP] //Load addr of end of buffer. 15 | //We picked RSI because of PUT_STR 16 | //We'll move bwd 17 | MOV U8 [RSI],0 //Terminator 18 | 19 | TEST RAX,RAX //Special case -- zero 20 | JNZ @@05 21 | DEC RSI 22 | MOV U8 [RSI],'0' 23 | JMP @@15 24 | 25 | @@05: MOV RBX,10 //Divides by 10 26 | 27 | @@10: XOR RDX,RDX 28 | DIV RBX //RAX=(RDX:RAX)/RBX with remainder in RDX 29 | ADD RDX,'0' 30 | DEC RSI 31 | MOV U8 [RSI],DL 32 | TEST RAX,RAX 33 | JNZ @@10 34 | 35 | @@15: CALL PUT_STR 36 | POP RSI 37 | POP_C_REGS 38 | LEAVE 39 | RET 40 | 41 | _DO_IT:: //The convention is C-callable routines have underscores. 42 | MOV RAX,122333221 43 | CALL PUT_DEC_U64 44 | MOV RAX,'\n' 45 | CALL PUT_CHARS 46 | RET 47 | } 48 | 49 | Call(_DO_IT); 50 | -------------------------------------------------------------------------------- /Demo/Carry.HC: -------------------------------------------------------------------------------- 1 | //Shows the $LK,"Carry",A="MN:Carry"$ function. It holds the CPU carry flag. 2 | //$LK,"U",A="MN:U"$() Unassemble to make sure it is right. 3 | 4 | U0 BigCnt() 5 | { 6 | U64 lo=0,hi=0; 7 | "BigCnt\n"; 8 | while (hi<0x10) { 9 | lo+=1<<58; 10 | hi+=Carry; 11 | "%016X %016X\n",hi,lo; 12 | } 13 | } 14 | 15 | BigCnt; 16 | 17 | U0 BigShift() 18 | { 19 | U64 lo=1,hi=0; 20 | "Big Shift\n"; 21 | while (lo||hi) { 22 | hi<<=1; 23 | lo<<=1; 24 | hi+=Carry; 25 | "%016X %016X\n",hi,lo; 26 | } 27 | } 28 | 29 | BigShift; 30 | 31 | U0 Branch() 32 | { 33 | U64 i=0xFFCC3311,j; 34 | 'Branch\n'; 35 | for (j=0;j<64;j++) { 36 | i<<=1; 37 | if (Carry) 38 | '1'; 39 | else 40 | '0'; 41 | } 42 | '\n'; 43 | } 44 | 45 | Branch; 46 | -------------------------------------------------------------------------------- /Demo/CompileDemo.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/CompileDemo.HC -------------------------------------------------------------------------------- /Demo/DateTime.HC: -------------------------------------------------------------------------------- 1 | 2 | "\n\n%D %T\n\n\n",Now,Now; 3 | 4 | CDateStruct ds; 5 | Date2Struct(&ds,Now+local_time_offset); 6 | 7 | "Hour:%02d Minute:%02d Second:%02d\n\n\n",ds.hour,ds.min,ds.sec; 8 | 9 | "Day Name:%03tZ\n\n\n",ds.day_of_week,"ST_DAYS_OF_WEEK"; 10 | 11 | "Month Name:%03tZ\n\n\n",ds.mon-1,"ST_MONTHS"; 12 | -------------------------------------------------------------------------------- /Demo/DbgDemo.HC: -------------------------------------------------------------------------------- 1 | /* 2 | Press to break. 3 | 4 | Rerun Program 5 | 6 | Press to enter Dbg. 7 | > $LK,"Dr",A="MN:Dr"$; //Dump Regs 8 | > $LK,"G2",A="MN:G2"$; //Cont program 9 | 10 | Press to enter Dbg. 11 | > $LK,"Uf",A="MN:Uf"$("DbgDemo"); 12 | > $LK,"U",A="MN:U"$(_RIP); 13 | 14 | See $LK,"Debugging",A="HI:Debugging"$ 15 | */ 16 | 17 | U0 DbgDemo() 18 | { 19 | I64 i=0; 20 | while (TRUE) 21 | if (!(i++%2000000)) 22 | "."; 23 | } 24 | 25 | DbgDemo; 26 | 27 | -------------------------------------------------------------------------------- /Demo/Define.HC: -------------------------------------------------------------------------------- 1 | //See $LK,"Define",A="HI:Define"$. 2 | 3 | //These might be in the Adam task. 4 | DefineLoad("ST_YES_NO","(Yes or No)"); 5 | DefineLoad("ST_EXIT","Exit"); 6 | DefineLstLoad("ST_NO_YES_LST","No\0Yes\0"); 7 | 8 | //New strings might be loaded for each user 9 | //to override. 10 | 11 | "Spanish"; 12 | if (YorN) { 13 | DefineLoad("ST_YES_NO","(Si or No)"); 14 | DefineLoad("ST_EXIT","Salida"); 15 | DefineLstLoad("ST_NO_YES_LST","No\0Si\0"); 16 | } 17 | 18 | Bool Quit() 19 | { 20 | Bool res; 21 | U8 *st; 22 | I64 i; 23 | while (TRUE) { 24 | "%S %S?","ST_EXIT","ST_YES_NO"; 25 | st=GetStr; 26 | i=DefineMatch(st,"ST_NO_YES_LST",LMF_IGNORE_CASE); 27 | if (i>=0) { 28 | res=i; 29 | break; 30 | } 31 | Free(st); 32 | } 33 | return res; 34 | } 35 | 36 | Quit; 37 | -------------------------------------------------------------------------------- /Demo/Directives.HC: -------------------------------------------------------------------------------- 1 | U0 Directives() 2 | { 3 | "Date\t:%s\n",__DATE__; 4 | "Time\t:%s\n",__TIME__; 5 | "File\t:%s\n",__FILE__; 6 | "Dir\t:%s\n",__DIR__; 7 | "Line\t:%d\n",__LINE__; 8 | "CmdLine\t:%d\n",__CMD_LINE__; 9 | "Inst1\t:%P:%08X\n",$$,$$; 10 | "Inst2\t:%P:%08X\n",$$,$$; 11 | } 12 | 13 | Directives; 14 | -------------------------------------------------------------------------------- /Demo/DolDoc/ClickCallBack.HC: -------------------------------------------------------------------------------- 1 | I64 MyLeftCB1(CDoc *,CDocEntry *) 2 | { 3 | I64 i; 4 | for (i=500;i<1000;i+=25) { 5 | Snd(Freq2Ona(i)); 6 | Sleep(10); 7 | } 8 | Snd; 9 | return 0; 10 | } 11 | 12 | U0 ClickCallBack() 13 | { 14 | CDocEntry *doc_e; 15 | DocLock(DocPut); 16 | //The $LK,"DocPrint",A="MN:DocPrint"$() routine returns the addr of the last entry. 17 | doc_e=DocPrint(DocPut,"\n$$MA+LC,\"Click Me\"$$ "); 18 | //The LC flag is "has left callback". 19 | 20 | //Flags are explained here: 21 | //$LK,"::/Doc/DolDocOverview.DD"$ $LK,"::/Doc/Widget.DD"$ 22 | //$LK,"Dollar Flags",A="MN:DOCEf_TAG"$ $LK,"ST_DOC_FLAGS",A="FF:::/Adam/DolDoc/DocInit.HC,ST_DOC_FLAGS"$ 23 | "(Not preserved if you press .)\n\n"; 24 | doc_e->left_cb=&MyLeftCB1; 25 | DocUnlock(DocPut); 26 | } 27 | 28 | ClickCallBack; 29 | 30 | I64 MyLeftCB2(CDoc *,CDocEntry *) 31 | { 32 | return cnts.jiffies; 33 | } 34 | 35 | U0 PopUpJiffiesCallBack(I64 i) 36 | { 37 | CDoc *doc=DocNew; 38 | CDocEntry *doc_e=DocPrint(doc, 39 | "Click %d more times\n\n\n$$BT+LC,\"Jiffies\"$$\n\n\n",i); 40 | doc_e->left_cb=&MyLeftCB2; 41 | "Current Jiffies:%d\n",PopUpMenu(doc); 42 | DocDel(doc); 43 | } 44 | 45 | PopUpJiffiesCallBack(3); 46 | PopUpJiffiesCallBack(2); 47 | PopUpJiffiesCallBack(1); 48 | -------------------------------------------------------------------------------- /Demo/DolDoc/CursorMove.HC: -------------------------------------------------------------------------------- 1 | U0 CursorMovementDemo() 2 | { 3 | I64 i; 4 | for (i=0;i<100;i++) { 5 | "%03d ",i; 6 | "$$CM,-4,1$$"; 7 | if (i%10==9) 8 | "$$CM,4,-10$$"; 9 | } 10 | 11 | //+LX is relative to left side. 12 | //See with cursor-movement for all the flags. 13 | //Check "Quote" to set-up a cmd for in quotes. 14 | "$$CM+LX,0,+10$$\n"; 15 | } 16 | 17 | CursorMovementDemo; 18 | 19 | /*The word-wrap Off and On cmds are 20 | $$WW,0$$ and $$WW,1$$. 21 | 22 | You might need $LK,"DocMax",A="MN:DocMax"$() to adjust 23 | the cmd line window buf size. 24 | It counts cmds, not lines. 25 | 26 | The +H flag will hold-onto an entry 27 | so it doesn't get pushed-out of the document. 28 | This is useful for a $$WW+H,1$$ cmd. 29 | 30 | See $LK,"::/Doc/DolDocOverview.DD"$ for documentation on 31 | all flags and cmds. 32 | 33 | Note: the default page length is 66 lines 34 | and branching back more than the page length 35 | will rst the column to 1. So, set page 36 | length to a large number if you want to 37 | branch back a long distance. 38 | */ 39 | -------------------------------------------------------------------------------- /Demo/DolDoc/Data.HC: -------------------------------------------------------------------------------- 1 | /*$$DA is the data widget. 2 | -TRM flag is for var 3 | width fields with a terminator 4 | character. 5 | +RD refreshes the data. 6 | +UD updates the val when you edit it. 7 | 8 | -P Means it is a string var, basically. 9 | 10 | ,32 sets the tag string width. 11 | See $LK,"Data Tag Width",A="FA:::/Adam/DolDoc/DocPlain.HC,DataTagWidth"$. 12 | 13 | ,RT=I16 means the val is 2 bytes. 14 | See $LK,"DocDataFmt",A="MN:DocDataFmt"$() and $LK,"DocDataScan",A="MN:DocDataScan"$(). 15 | */ 16 | 17 | I16 i=0; 18 | U8 buf[8]; 19 | 20 | U0 UpdateGlblTask(I64) 21 | { 22 | while (TRUE) { 23 | i++; 24 | Sleep(1); 25 | } 26 | } 27 | 28 | U0 DataDemo() 29 | { 30 | CDocEntry *doc_e; 31 | 32 | //This is the command line document. 33 | CDoc *doc=DocPut; 34 | 35 | //We do this to prevent access to 36 | //doc_e->data before it is set. 37 | Bool unlock=DocLock(doc); 38 | 39 | //You might set the $LK,"DOCF_FORM",A="MN:DOCF_FORM"$ flag. 40 | // doc->flags|=DOCF_FORM 41 | //if you wish. 42 | 43 | Spawn(&UpdateGlblTask,NULL,"Update Glbl",,Fs); 44 | 45 | "Enter editor overstrike mode\n" 46 | "and you can modify the val.\n" 47 | "However, changes happen immediately,\n" 48 | "so it's tricky.\n\n"; 49 | //Use for the $$DA...$$ format. 50 | doc_e=DocPrint(doc,"$$DA-TRM+RD+UD,RT=I16,A=\"%%7d\"$$\n"); 51 | doc_e->data=&i; 52 | 53 | StrCpy(buf,"Terry"); 54 | doc_e=DocPrint(doc,"$$DA-P+RD+UD,LEN=7,A=\"Str:%%s\"$$\n"); 55 | doc_e->data=buf; 56 | 57 | if (unlock) 58 | DocUnlock(doc); 59 | } 60 | 61 | DataDemo; 62 | 63 | //See $LK,"PopUpExtents",A="MN:PopUpExtents"$(). 64 | -------------------------------------------------------------------------------- /Demo/DolDoc/DefineStr.HC: -------------------------------------------------------------------------------- 1 | /*The +D flag causes a define-string 2 | look-up and substitution. 3 | 4 | It is available in the text-widget 5 | menu under text entries for use in 6 | documentation. 7 | 8 | */ 9 | 10 | DefineLoad("COMPANY","Acme Inc"); 11 | "Company: $$TX,\"\",D=\"COMPANY\"$$\n"; 12 | 13 | DefinePrint("COMPANY_TIME","%T",Now); 14 | 15 | #exe { 16 | StreamPrint( 17 | "#define COMPANY_AGE %0.1f\n", 18 | (Now-Str2Date("8/1/2003"))/ToF64(1<<32)/CDATE_YEAR_DAYS); 19 | }; 20 | 21 | "Age : $$TX,\"\",D=\"COMPANY_AGE\"$$ years\n"; 22 | "Time: $$TX,\"\",D=\"COMPANY_TIME\"$$\n"; 23 | -------------------------------------------------------------------------------- /Demo/DolDoc/DemoDoc.DD: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/DolDoc/DemoDoc.DD -------------------------------------------------------------------------------- /Demo/DolDoc/MenuSprite.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/DolDoc/MenuSprite.HC -------------------------------------------------------------------------------- /Demo/DolDoc/NumBible.HC: -------------------------------------------------------------------------------- 1 | // This makes a new Bible file 2 | //with line numbers. 3 | 4 | U0 NumBible() 5 | { 6 | CDoc *doc_in=DocRead("::/Misc/Bible.TXT.Z",DOCF_PLAIN_TEXT_TABS), 7 | *doc_out=DocNew("~/DemoNumBible.DD.Z"); 8 | CDocEntry *doc_e=doc_in->head.next; 9 | while (doc_e!=doc_in) { 10 | if (doc_e->type_u8==DOCT_TEXT) { 11 | DocPrint(doc_out,"%05d %s",doc_e->y+1,doc_e->tag); 12 | doc_e=doc_e->next; 13 | if (doc_e->type_u8==DOCT_NEW_LINE) { 14 | DocPrint(doc_out,"\n"); 15 | doc_e=doc_e->next; 16 | } 17 | } else if (doc_e->type_u8==DOCT_NEW_LINE) { 18 | DocPrint(doc_out,"%05d\n",doc_e->y+1); 19 | doc_e=doc_e->next; 20 | } else 21 | doc_e=doc_e->next; 22 | } 23 | doc_out->flags|=DOCF_NO_CURSOR; 24 | DocWrite(doc_out); 25 | DocDel(doc_out); 26 | DocDel(doc_in); 27 | } 28 | 29 | NumBible; -------------------------------------------------------------------------------- /Demo/DolDoc/TextDemo.HC: -------------------------------------------------------------------------------- 1 | "\nSuper : 3$$SY,-3$$2$$SY,0$$=9\n\n" 2 | "Sub : H$$SY,3$$2$$SY,0$$O\n\n" 3 | "Color : $$RED$$Test$$FG$$\n\n" 4 | "Blink : $$BK,1$$Test$$BK,0$$\n\n" 5 | "Invert : $$IV,1$$Test$$IV,0$$\n\n" 6 | "UnderLine: $$UL,1$$Test$$UL,0$$\n\n" 7 | "Link : $$LK,\"Genesis,1:1\",\"BF:Genesis,1:1\"$$\n\n\n" 8 | 9 | "Bttn : $$BT-X,\"OKAY\",LE=1$$\n\n\n\n"; 10 | 11 | //You can do it this way if you like. 12 | "\nSuper : 3$SY,-3$2$SY,0$=9\n\n" 13 | "Sub : H$SY,3$2$SY,0$O\n\n" 14 | //Can't see color because of syntax highlighting. Press 15 | "Color : $FG,4$Test$FG$\n\n" 16 | "Blink : $BK,1$Test$BK,0$\n\n" 17 | "Invert : $IV,1$Test$IV,0$\n\n" 18 | "UnderLine: $UL,1$Test$UL,0$\n\n" 19 | // on this link to toggle individual commands. 20 | "Link : $LK,"Genesis,1:1",A="BF:Genesis,1:1"$\n\n\n" 21 | 22 | "Bttn : $BT,"OKAY",LE=1$\n\n\n\n"; 23 | -------------------------------------------------------------------------------- /Demo/DolDoc/TreeDemo.HC: -------------------------------------------------------------------------------- 1 | U0 TreeSub(CDoc *doc,CDirEntry *tmpde) 2 | { 3 | CDirEntry *tmpde1; 4 | while (tmpde) { 5 | tmpde1=tmpde->next; 6 | if (tmpde->attr & RS_ATTR_DIR) { 7 | DocPrint(doc,"$$TR,\"\"$$"); 8 | DocPrint(doc,"$$MA,T=\"%s\",LM=\"Cd(\\\"%s\\\");Dir;\n\"$$\n", 9 | tmpde->name,tmpde->full_name); 10 | if (tmpde->sub) { 11 | DocPrint(doc,"$$ID,+2$$"); 12 | TreeSub(doc,tmpde->sub); 13 | DocPrint(doc,"$$ID,-2$$"); 14 | } 15 | } else 16 | DocPrint(doc,"$$LK,\"%s\",A=\"FI:%s\"$$\n", 17 | tmpde->name,tmpde->full_name); 18 | //Note there is also a routine 19 | //to delete an entire CDirEntry tree. 20 | //See $LK,"DirTreeDel",A="MN:DirTreeDel"$(). 21 | DirEntryDel(tmpde); 22 | tmpde=tmpde1; 23 | } 24 | } 25 | 26 | U0 TreeDemo() 27 | { 28 | I64 fuf_flags=0; 29 | CDoc *doc=DocNew; 30 | ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r"); 31 | DocPrint(doc,"$$TR-C,\"\"$$\n"); 32 | DocPrint(doc,"$$ID,+2$$"); 33 | TreeSub(doc,FilesFind("/*",fuf_flags)); 34 | DocPrint(doc,"$$ID,-2$$"); 35 | DocInsDoc(DocPut,doc); 36 | DocDel(doc); 37 | } 38 | 39 | TreeDemo; 40 | -------------------------------------------------------------------------------- /Demo/Dsk/BlkDevRep.HC: -------------------------------------------------------------------------------- 1 | U0 BlkDevRep() 2 | {//Block Device Report. 3 | I64 i; 4 | for (i=0;i to help generate formats. 7 | U8 name[32] format "$$DA-P,LEN=32,A=\"Name:%s\"$$\n"; 8 | U8 addr[64] format "$$DA-P,LEN=64,A=\"Addr:%s\"$$\n"; 9 | U8 pad[DB_ACCT_BLKS*BLK_SIZE-64-32]; 10 | }; 11 | 12 | U0 InitDatabase() 13 | { //Write new contiguous file 14 | CFile *f=FOpen(DB_FILENAME,"w",DB_ACCT_MAX*DB_ACCT_BLKS); 15 | FClose(f); 16 | } 17 | 18 | U0 WriteAcct() 19 | { 20 | CFile *f; 21 | Acct a; 22 | I64 acctnum; 23 | 24 | acctnum=GetI64("Acct #",-1); 25 | if (0<=acctnum$$FG$$:"; 57 | ch=ToUpper(GetChar); 58 | '\n'; 59 | if (ch=='R') ReadAcct; 60 | if (ch=='W') WriteAcct; 61 | } while (ch!=CH_SHIFT_ESC && ch!=CH_ESC); 62 | } 63 | 64 | DatabaseDemo; 65 | -------------------------------------------------------------------------------- /Demo/Dsk/DskRaw.HC: -------------------------------------------------------------------------------- 1 | U0 RawAccess(I64 drv_let=0) 2 | { 3 | CDrv *dv=Let2Drv(drv_let); 4 | CBlkDev *bd=Let2BlkDev(drv_let); 5 | I64 blk,old_offset,old_size; 6 | U8 *buf=MAlloc(BLK_SIZE); 7 | 8 | DrvRep; 9 | PressAKey; 10 | 11 | ClassRep(dv); 12 | PressAKey; 13 | 14 | ClassRep(bd); 15 | PressAKey; 16 | 17 | //Temporarily change partition range to full device. 18 | //Normally, you are limited to just your partition. 19 | //This is obviously $BK,1$dangerous$BK,0$! 20 | old_offset=dv->drv_offset; 21 | old_size =dv->size; 22 | dv->drv_offset=0; 23 | dv->size=bd->max_blk+1; 24 | 25 | try { 26 | blk=GetI64("Blk to Read: ",old_offset,0,bd->max_blk); 27 | BlkRead(dv,buf,blk,1); 28 | D(buf,BLK_SIZE); 29 | } catch 30 | PutExcept; 31 | 32 | dv->drv_offset=old_offset; 33 | dv->size =old_size; 34 | 35 | Free(buf); 36 | } 37 | 38 | RawAccess; 39 | 40 | //See $LK,"BlkRead",A="MN:BlkRead"$(), $LK,"BlkWrite",A="MN:BlkWrite"$(), $LK,"DrvLock",A="MN:DrvLock"$(), $LK,"DrvUnlock",A="MN:DrvUnlock"$() 41 | //$LK,"DBlk",A="MN:DBlk"$(), $LK,"DClus",A="MN:DClus"$(), $LK,"BlkDevLock",A="MN:BlkDevLock"$() and $LK,"BlkDevUnlock",A="MN:BlkDevUnlock"$(). 42 | -------------------------------------------------------------------------------- /Demo/Dsk/FPrintF.HC: -------------------------------------------------------------------------------- 1 | /*There is no FPrintF type function and no 2 | way to grow files. Therefore, use mem to 3 | hold the file until you are done. The $LK,"CDoc",A="MN:CDoc"$ 4 | framework is convenient for this. 5 | */ 6 | 7 | U0 TreeSub(CDoc *doc,CDirEntry *tmpde) 8 | { 9 | CDirEntry *tmpde1; 10 | while (tmpde) { 11 | tmpde1=tmpde->next; 12 | if (tmpde->attr & RS_ATTR_DIR) { 13 | DocPrint(doc,"$$TR,\"\"$$"); 14 | DocPrint(doc,"$$MA,T=\"%s\",LM=\"Cd(\\\"%s\\\");Dir;\n\"$$\n", 15 | tmpde->name,tmpde->full_name); 16 | if (tmpde->sub) { 17 | DocPrint(doc,"$$ID,+2$$"); 18 | TreeSub(doc,tmpde->sub); 19 | DocPrint(doc,"$$ID,-2$$"); 20 | } 21 | } else 22 | DocPrint(doc,"$$LK,\"%s\",A=\"FI:%s\"$$\n", 23 | tmpde->name,tmpde->full_name); 24 | //Note there is also a routine 25 | //to delete an entire CDirEntry tree. 26 | //See $LK,"DirTreeDel",A="MN:DirTreeDel"$(). 27 | DirEntryDel(tmpde); 28 | tmpde=tmpde1; 29 | } 30 | } 31 | 32 | U0 FPrintFDemo(U8 *output_filename=NULL) 33 | { 34 | I64 fuf_flags=0; 35 | CDoc *doc=DocNew(output_filename); 36 | ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r"); 37 | DocPrint(doc,"$$TR-C,\"\"$$\n"); 38 | DocPrint(doc,"$$ID,+2$$"); 39 | TreeSub(doc,FilesFind("/*",fuf_flags)); 40 | DocPrint(doc,"$$ID,-2$$"); 41 | DocRecalc(doc); 42 | if (output_filename) 43 | DocWrite(doc,FALSE); 44 | else 45 | DocWrite(doc,TRUE); 46 | DocDel(doc); 47 | } 48 | 49 | FPrintFDemo; 50 | -------------------------------------------------------------------------------- /Demo/Dsk/SerializeTree.HC: -------------------------------------------------------------------------------- 1 | /*You probably don't need this. It makes a directory 2 | tree into a flat contiguous memory chunk, suitable for 3 | serial communication and rebuilds it into a tree on the 4 | other end. 5 | */ 6 | 7 | U0 SerializeTree() 8 | { 9 | CDirEntry *tmpde=FilesFind("/Demo/*.DD*",FUF_RECURSE); 10 | I64 size; 11 | U8 *ptr; 12 | CArcCompress *arc; 13 | 14 | LineRep1(tmpde); //We have $LK,"CDirEntry",A="MN:CDirEntry"$.fullname 15 | LineRep2(DocPut,tmpde); 16 | "$$GREEN$$***************$$FG$$\n"; 17 | ptr=DirTreeSerialize(tmpde,&size); 18 | DirTreeDel(tmpde); 19 | D(ptr,size); 20 | "$$GREEN$$***************:%7d$$FG$$\n",size; 21 | arc=CompressBuf(ptr,size); 22 | Free(ptr); 23 | D(arc,arc->compressed_size); 24 | "$$GREEN$$***************:%7d$$FG$$\n",size; 25 | ptr=ExpandBuf(arc); 26 | size=arc->expanded_size; 27 | Free(arc); 28 | D(ptr,size); 29 | "$$GREEN$$***************:%7d$$FG$$\n",size; 30 | tmpde=DirTreeUnserialize(ptr); 31 | LineRep2(DocPut,tmpde); //We don't have $LK,"CDirEntry",A="MN:CDirEntry"$.fullname 32 | DirTreeDel(tmpde); 33 | } 34 | 35 | SerializeTree; 36 | -------------------------------------------------------------------------------- /Demo/Dsk/UnusedSpaceRep.HC: -------------------------------------------------------------------------------- 1 | U0 UnusedSpaceRep() 2 | { 3 | I64 i; 4 | CDrv *dv; 5 | for (i=0;i<26;i++) 6 | if ((dv=Let2Drv(i+'A',FALSE)) && 7 | (dv->fs_type==FSt_FAT32 || dv->fs_type==FSt_REDSEA)) 8 | "%C: %7.3f%% Free\n", 9 | Drv2Let(dv),DrvUnused(Drv2Let(dv))*100.0/(dv->size*BLK_SIZE); 10 | } 11 | 12 | UnusedSpaceRep; 13 | -------------------------------------------------------------------------------- /Demo/Exceptions.HC: -------------------------------------------------------------------------------- 1 | //$BK,1$WARNING:$BK,0$ Don't return out of a catch{}. This 2 | //might get fixed. 3 | 4 | //You can use $LK,"PutExcept",A="MN:PutExcept"$() in a catch stmt 5 | //and it will report args. 6 | Bool Prompt(I64 i) 7 | { 8 | "%d ",i; 9 | return YorN; 10 | } 11 | 12 | U0 D1() 13 | { 14 | "D1\n"; 15 | if (Prompt(1)) throw('Point1'); 16 | if (Prompt(2)) throw('Point2'); 17 | } 18 | 19 | U0 D2() 20 | { 21 | "D2\n"; 22 | try { 23 | D1; 24 | if (Prompt(4)) throw('Point4'); 25 | } catch { 26 | "D2 hndlr\n" 27 | "Ch:%c:%P\n",Fs->except_ch,Fs->except_callers[0]; 28 | if (Fs->except_ch=='Point1') { 29 | "Caught in D2\n"; 30 | Fs->catch_except=TRUE; 31 | } 32 | } 33 | } 34 | 35 | U0 Demo() 36 | { 37 | try { 38 | D2; 39 | if (Prompt(3)) throw('Point3'); 40 | } catch { 41 | "Demo hndlr\n" 42 | "Ch:%c:%P\n",Fs->except_ch,Fs->except_callers[0]; 43 | Fs->catch_except=TRUE; 44 | } 45 | } 46 | 47 | Demo; 48 | -------------------------------------------------------------------------------- /Demo/ExtChars.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/ExtChars.HC -------------------------------------------------------------------------------- /Demo/Games/BattleLines.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Games/BattleLines.HC -------------------------------------------------------------------------------- /Demo/Games/BigGuns.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Games/BigGuns.HC -------------------------------------------------------------------------------- /Demo/Games/BlackDiamond.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Games/BlackDiamond.HC -------------------------------------------------------------------------------- /Demo/Games/BomberGolf.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Games/BomberGolf.HC -------------------------------------------------------------------------------- /Demo/Games/CastleFrankenstein.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Games/CastleFrankenstein.HC -------------------------------------------------------------------------------- /Demo/Games/CharDemo.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Games/CharDemo.HC -------------------------------------------------------------------------------- /Demo/Games/CircleTrace.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Games/CircleTrace.HC -------------------------------------------------------------------------------- /Demo/Games/Collision.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Games/Collision.HC -------------------------------------------------------------------------------- /Demo/Games/DunGen.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Games/DunGen.HC -------------------------------------------------------------------------------- /Demo/Games/ElephantWalk.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Games/ElephantWalk.HC -------------------------------------------------------------------------------- /Demo/Games/FlapBat.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Games/FlapBat.HC -------------------------------------------------------------------------------- /Demo/Games/FlatTops.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Games/FlatTops.HC -------------------------------------------------------------------------------- /Demo/Games/RawHide.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Games/RawHide.HC -------------------------------------------------------------------------------- /Demo/Games/Rocket.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Games/Rocket.HC -------------------------------------------------------------------------------- /Demo/Games/RocketScience.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Games/RocketScience.HC -------------------------------------------------------------------------------- /Demo/Games/Squirt.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Games/Squirt.HC -------------------------------------------------------------------------------- /Demo/Games/Stadium/Stadium.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Games/Stadium/Stadium.HC -------------------------------------------------------------------------------- /Demo/Games/Stadium/StadiumBG.DD: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Games/Stadium/StadiumBG.DD -------------------------------------------------------------------------------- /Demo/Games/Stadium/StadiumBG.GR: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Games/Stadium/StadiumBG.GR -------------------------------------------------------------------------------- /Demo/Games/Stadium/StadiumGen.HC: -------------------------------------------------------------------------------- 1 | //Generate "StadiumBG.GR.Z" from "StadiumBG.DD.Z" 2 | 3 | U0 StadiumGen() 4 | { 5 | U0 (*fp_old_update)(CDC *dc); 6 | CDC *dc,*dc2; 7 | 8 | Cd(__DIR__); 9 | AutoComplete; 10 | WinBorder; 11 | WinMax; 12 | DocCursor(OFF); 13 | DocClear; 14 | Type("StadiumBG.DD"); 15 | "$$CM,0,%d$$",TEXT_ROWS-3; 16 | fp_old_update=gr.fp_final_scrn_update; //hide mouse cursor 17 | gr.fp_final_scrn_update=NULL; 18 | 19 | Refresh(2,TRUE); 20 | dc2=DCScrnCapture; 21 | dc=DCExt(dc2,0,FONT_HEIGHT,GR_WIDTH,GR_HEIGHT); 22 | DCDel(dc2); 23 | 24 | GRWrite("StadiumBG",dc,DCSF_COMPRESSED|DCSF_PALETTE_GET); 25 | DCDel(dc); 26 | 27 | DocCursor(ON); 28 | gr.fp_final_scrn_update=fp_old_update; 29 | DocClear; 30 | } 31 | 32 | StadiumGen; 33 | 34 | -------------------------------------------------------------------------------- /Demo/Games/Talons.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Games/Talons.HC -------------------------------------------------------------------------------- /Demo/Games/TheDead.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Games/TheDead.HC -------------------------------------------------------------------------------- /Demo/Games/Varoom.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Games/Varoom.HC -------------------------------------------------------------------------------- /Demo/Games/Wenceslas.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Games/Wenceslas.HC -------------------------------------------------------------------------------- /Demo/Games/Zing.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Games/Zing.HC -------------------------------------------------------------------------------- /Demo/Games/ZoneOut.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Games/ZoneOut.HC -------------------------------------------------------------------------------- /Demo/GlblVars.HC: -------------------------------------------------------------------------------- 1 | //Demonstrates dynamic initialization of vars. 2 | //Static vars are, essentually, global vars. 3 | 4 | class Test 5 | { 6 | I32 time; 7 | U8 name[8]; 8 | }; 9 | 10 | Test g1[]={ 11 | {10,"Name1"}, 12 | {(tS%10.0)*100,"Name2"}, //Dynamic initialization 13 | {30,"Name3"} 14 | }; 15 | 16 | D(g1,sizeof(g1)); 17 | "Time 1:%d\n",g1[1].time; 18 | 19 | U0 Main1() 20 | { 21 | static Test s1[]={ 22 | {10,"Static1"}, 23 | {(tS%10.0)*100,"Static2"}, //Dynamic initialization 24 | {30,"Static3"} 25 | }; 26 | D(s1,sizeof(s1)); 27 | "Time 2:%d\n",s1[1].time; 28 | } 29 | 30 | Main1; 31 | 32 | /*Now, we'll use the data heap glbl option 33 | to force global vars onto the data heap. 34 | 35 | You can turn the data heap flag 36 | on and off within your programs, leaving 37 | ones which need initialization on the code heap. 38 | 39 | You can't dynamically initialize data heap 40 | glbls--they are consts. This might be a silly 41 | point, but might res in odd differences, perhaps 42 | from the order things are evaluated. 43 | 44 | Data heap glbls are good for AOT modules 45 | because they don't take-up room in the .BIN.Z file. 46 | */ 47 | 48 | #ifjit 49 | #exe {Option(OPTf_GLBLS_ON_DATA_HEAP,ON);}; 50 | 51 | Test g2[]={ 52 | {10,"name1"}, 53 | {(tS%10.0)*100,"name2"}, //No dynamic initialization--cvted to const 54 | {30,"name3"} 55 | }; 56 | 57 | D(g2,sizeof(g2)); 58 | "Time 3:%d\n",g2[1].time; 59 | 60 | U0 Main2() 61 | { 62 | static Test s2[]={ 63 | {10,"static1"}, 64 | {(tS%10.0)*100,"static2"}, //No dynamic initialization--cvted to const 65 | {30,"static3"} 66 | }; 67 | D(s2,sizeof(s2)); 68 | "Time 4:%d\n",s2[1].time; 69 | } 70 | 71 | Main2; 72 | 73 | #exe {Option(OPTf_GLBLS_ON_DATA_HEAP,ON);}; 74 | #endif 75 | 76 | '\n'; 77 | -------------------------------------------------------------------------------- /Demo/Graphics/3DPoly.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Graphics/3DPoly.HC -------------------------------------------------------------------------------- /Demo/Graphics/BSpline.HC: -------------------------------------------------------------------------------- 1 | #define PTS_NUM 16 2 | 3 | U0 BSplineDemo() 4 | { 5 | CDC *dc=DCAlias; 6 | I64 arg1,arg2,i=0,msg_code; 7 | CD3I32 c[PTS_NUM]; 8 | 9 | SettingsPush; 10 | Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER; 11 | 12 | DocClear; 13 | "Sel ctrl points with left mouse. Right when finished.\n"; 14 | DCFill; 15 | do { 16 | msg_code=GetMsg(&arg1,&arg2,1<color=GREEN; 20 | GrCircle(dc,arg1,arg2,10); 21 | i++; 22 | } 23 | } while (icolor=RED; 25 | Gr2BSpline(dc,c,i,TRUE); 26 | dc->color=BLUE; 27 | Gr3BSpline(dc,c,i,TRUE); 28 | DCDel(dc); 29 | SettingsPop; 30 | 31 | PressAKey; 32 | DCFill; 33 | } 34 | 35 | BSplineDemo; 36 | -------------------------------------------------------------------------------- /Demo/Graphics/Balloon.HC: -------------------------------------------------------------------------------- 1 | // Classic Commodore 64 Sprite 2 | 3 | U8 a[60]={0,127,0,1,255,192,3,255,224,3,231,224, 4 | 7,217,240,7,223,240,7,217,240,3,231,224, 5 | 3,255,224,3,255,224,2,255,160,1,127,64, 6 | 1,62,64,0,156,128,0,156,128,0,73,0,0,73,0, 7 | 0,62,0,0,62,0,0,28,0}; 8 | 9 | U0 Balloon() 10 | { 11 | I64 i,j,k; 12 | 13 | CLI 14 | 15 | OutU8(VGAP_IDX,VGAR_MAP_MASK); 16 | OutU8(VGAP_DATA,0xF); 17 | MemSetI64(text.vga_alias,0,640*480/64); 18 | 19 | OutU8(VGAP_IDX,VGAR_MAP_MASK); 20 | OutU8(VGAP_DATA,RED+GREEN+8); 21 | for (k=100;k<150;k++) { 22 | 23 | for (i=0;i<20;i++) 24 | for (j=0;j<3;j++) 25 | *(text.vga_alias(I64)+0x1000+(i+k)*640/8+j)(U8 *)=a[i*3+j]; 26 | 27 | Busy(40000); 28 | 29 | for (i=0;i<20;i++) 30 | for (j=0;j<3;j++) 31 | *(text.vga_alias(I64)+0x1000+(i+k)*640/8+j)(U8 *)=0; 32 | } 33 | 34 | STI 35 | VGAFlush; 36 | } 37 | 38 | Balloon; 39 | -------------------------------------------------------------------------------- /Demo/Graphics/Blot.HC: -------------------------------------------------------------------------------- 1 | CDC *dc=DCAlias; 2 | CDC *img1=DCNew(64,64); 3 | CDC *img2=DCNew(512,512); 4 | 5 | img1->color=COLOR_MONO; 6 | img1->thick=3; 7 | GrCircle(img1,30,30,20); 8 | GrFloodFill3(img1,30,30,0,TRUE); 9 | GrLine3(img1,60,0,0,0,60,0); 10 | 11 | DCFill(img2); 12 | img2->color=RED; 13 | img2->brush=img1; 14 | GrCircle(img2,256-30,256-30,128,67); 15 | img2->color=BLUE; 16 | img2->thick=6; 17 | img2->brush=NULL; 18 | GrLine3(img2,128,128,0,256+128,256+128,0); 19 | GrLine3(img2,256+128,128,0,128,256+128,0); 20 | 21 | img2->color=YELLOW; 22 | GrRect(img2,256-20,256-20,40,40); 23 | 24 | I64 i; 25 | for (i=0;i<256;i+=4) { 26 | Refresh; 27 | DCFill; 28 | GrBlot(dc,i-256,i-256,img2); 29 | Sleep(10); 30 | } 31 | U8 *tmpg=DC2Sprite(img1); 32 | Sprite(tmpg); 33 | Free(tmpg); 34 | "%h9c",'\n'; 35 | 36 | DCDel(img1); 37 | DCDel(img2); 38 | DCDel(dc); 39 | 40 | PressAKey; 41 | DCFill; 42 | -------------------------------------------------------------------------------- /Demo/Graphics/Bounce.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Graphics/Bounce.HC -------------------------------------------------------------------------------- /Demo/Graphics/Box.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Graphics/Box.HC -------------------------------------------------------------------------------- /Demo/Graphics/Cartesian.HC: -------------------------------------------------------------------------------- 1 | //x must be global. 2 | //Might as well make y global. 3 | 4 | F64 x,y,y_last; 5 | 6 | U0 Cartesian() 7 | { 8 | U8 *st; 9 | I64 ch=0,h,v; 10 | Bool first; 11 | CDC *dc=DCAlias; 12 | do { 13 | DocClear; 14 | "Enter algebraic equation to graph.\n" 15 | "Example: y=2*x\n" 16 | "y="; 17 | if (st=GetStr) { 18 | if (*st) { 19 | h=Fs->pix_width/2; 20 | v=Fs->pix_height/2; 21 | dc->color=RED; 22 | GrLine(dc,h,0,h,2*v+1); 23 | GrLine(dc,0,v,2*h+1,v); 24 | first=TRUE; 25 | dc->color=BLACK; 26 | for (x=-h;x<=h;x++) { 27 | y=-ExePrint("ToF64(%s);",st)(F64); 28 | if (!first) 29 | GrLine(dc,x-1+h,y_last+v,x+h,y+v); 30 | y_last=y; 31 | first=FALSE; 32 | } 33 | ch=GetChar; 34 | } else 35 | ch=CH_SHIFT_ESC; 36 | Free(st); 37 | } else 38 | ch=CH_SHIFT_ESC; 39 | DCFill; 40 | } while (ch!=CH_SHIFT_ESC && ch!=CH_ESC); 41 | DCDel(dc); 42 | } 43 | 44 | Cartesian; 45 | 46 | //For better performance, compile the expression entered by the 47 | //user one time with $LK,"LexExpression2Bin",A="MN:LexExpression2Bin"$() and use $LK,"Call",A="MN:Call"$(). 48 | //See $LK,"::/Demo/CompileDemo.HC"$. 49 | -------------------------------------------------------------------------------- /Demo/Graphics/CharAnimation.HC: -------------------------------------------------------------------------------- 1 | U8 *old_font=text.font; 2 | 3 | // See $LK,"::/Kernel/FontStd.HC"$, $LK,"::/Demo/ScrnCodes.HC"$, 4 | //$LK,"::/Demo/ExtChars.HC"$, and $LK,"::/Demo/Graphics/FontEd.HC"$. 5 | 6 | U64 waves[4]={ 7 | 0x0011AA440011AA44,0x0022558800225588, 8 | 0x0044AA110044AA11,0x0088552200885522}; 9 | 10 | U0 AnimateEndCB() 11 | { 12 | text.font=old_font; 13 | Exit; 14 | } 15 | 16 | U0 AnimateTask(I64) 17 | { 18 | I64 i; 19 | U64 *font=MAlloc(256*8); 20 | Fs->task_end_cb=&AnimateEndCB; 21 | MemCpy(font,text.font,256*8); 22 | text.font=font; 23 | while (TRUE) { 24 | font[CH_SPACE]=waves[i++&0x3]; 25 | Sleep(100); 26 | } 27 | } 28 | 29 | Spawn(&AnimateTask,NULL,"Animate",,Fs); 30 | TaskRep; 31 | -------------------------------------------------------------------------------- /Demo/Graphics/Collision.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Graphics/Collision.HC -------------------------------------------------------------------------------- /Demo/Graphics/Doodle.HC: -------------------------------------------------------------------------------- 1 | //This is a drawing program 2 | 3 | U0 Doodle() 4 | { 5 | I64 msg_code,i,x1,y1,x2,y2,arg1,arg2,color=BLACK; 6 | CDC *dc=DCAlias; 7 | 8 | SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$ 9 | Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER; 10 | 11 | AutoComplete; 12 | WinBorder; 13 | WinMax; 14 | DocClear; 15 | DCFill; 16 | do { 17 | msg_code=GetMsg(&arg1,&arg2, 18 | 1<=0) color=i; 23 | break; 24 | case MSG_MS_L_DOWN: 25 | x1=arg1; y1=arg2; 26 | x2=arg1; y2=arg2; 27 | dc->color=ROP_XOR+color^TRANSPARENT; 28 | dc->thick=7; 29 | do { 30 | GrLine3(dc,x1,y1,0,x2,y2,0); 31 | msg_code=GetMsg(&arg1,&arg2,1<thick=1; 6 | dc->flags&=~(DCF_TRANSFORMATION|DCF_SYMMETRY); 7 | GrRect(dc,x,y,GRID,GRID); 8 | } 9 | 10 | U0 GridDemo() 11 | { 12 | CGridGlbls old_grid; 13 | U0 (*old_draw_ms)(CDC *dc,I64 x,I64 y); //Can't init this type of var. 14 | MemCpy(&old_grid,&ms_grid,sizeof(CGridGlbls)); 15 | GridInit; 16 | ms_grid.snap=TRUE; //You can set other $LK,"stuff",A="MN:CGridGlbls"$. 17 | ms_grid.x=GRID; 18 | ms_grid.y=GRID; 19 | old_draw_ms=gr.fp_draw_ms; 20 | gr.fp_draw_ms=&DrawMyMs; 21 | while (!ms.lb) {//Left bttn to exit. 22 | GrPlot(,ms.pos.x,ms.pos.y); 23 | Yield; 24 | } 25 | DCFill; 26 | gr.fp_draw_ms=old_draw_ms; 27 | MemCpy(&ms_grid,&old_grid,sizeof(CGridGlbls)); 28 | } 29 | 30 | GridDemo; 31 | -------------------------------------------------------------------------------- /Demo/Graphics/Lattice.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Graphics/Lattice.HC -------------------------------------------------------------------------------- /Demo/Graphics/LightTable.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Graphics/LightTable.HC -------------------------------------------------------------------------------- /Demo/Graphics/Lines.HC: -------------------------------------------------------------------------------- 1 | U0 Main() 2 | { 3 | I64 x1=0,y1=0,x2=0,y2=0,i=1,c=0; 4 | I64 vx1=0,vy1=0,vx2=0,vy2=0; 5 | CDC *dc=DCAlias; 6 | while (!ScanChar) { 7 | if (!--i) { 8 | i=1000; 9 | dc->color=c++&15; 10 | } 11 | GrLine(dc,x1,y1,x2,y2); 12 | vx1=ClampI64(vx1+SignI64(RandI16),-5,5); 13 | vy1=ClampI64(vy1+SignI64(RandI16),-5,5); 14 | vx2=ClampI64(vx2+SignI64(RandI16),-5,5); 15 | vy2=ClampI64(vy2+SignI64(RandI16),-5,5); 16 | x1=ClampI64(x1+vx1,0,Fs->pix_width-1); 17 | y1=ClampI64(y1+vy1,0,Fs->pix_height-1); 18 | x2=ClampI64(x2+vx2,0,Fs->pix_width-1); 19 | y2=ClampI64(y2+vy2,0,Fs->pix_height-1); 20 | Sleep(1); //Replace this with Yield() ort Sleep(0) and see what happens! 21 | } 22 | DCFill(dc); 23 | DCDel(dc); 24 | } 25 | 26 | Main; 27 | -------------------------------------------------------------------------------- /Demo/Graphics/LowPassFilter.HC: -------------------------------------------------------------------------------- 1 | #define STEP_SIZE 400 2 | 3 | U0 LowPassFilterDemo() 4 | { 5 | F64 y,y1,t,dt; 6 | CDC *dc=DCAlias; 7 | 8 | WinBorder; 9 | WinMax; 10 | DocClear; 11 | 12 | dc->color=BLUE; 13 | GrLine(dc,0,0,0,STEP_SIZE); 14 | GrLine(dc,0,STEP_SIZE,GR_WIDTH/2,STEP_SIZE); 15 | GrLine(dc,GR_WIDTH/2,STEP_SIZE,GR_WIDTH/2,0); 16 | GrLine(dc,GR_WIDTH/2,0,GR_WIDTH,0); 17 | PressAKey; 18 | 19 | dc->color=CYAN; 20 | t=0; 21 | y=0.0; 22 | while (tcolor=BLACK; 35 | t=0; 36 | y=0.0; 37 | while (tcolor=RED; 50 | t=0; 51 | y=0.0; 52 | while (tcolor=GREEN; 65 | t=0; 66 | y=0.0; 67 | while (t to compile and run. 2 | 3 | U0 NetOfDots() 4 | { 5 | I64 i; 6 | CDC *dc=DCAlias; 7 | DocClear; 8 | dc->color=RED; 9 | for (i=0;i<480;i+=20) 10 | GrLine(dc,i,0,0,480-i,3); 11 | DCDel(dc); 12 | PressAKey; 13 | DCFill; 14 | } 15 | 16 | NetOfDots; //Run when #included 17 | -------------------------------------------------------------------------------- /Demo/Graphics/Palette.HC: -------------------------------------------------------------------------------- 1 | U0 PaletteDemo() 2 | { 3 | I64 i,j; 4 | CBGR48 bgr; 5 | for (i=0;i=-7;i--) { 10 | gr.pan_text_x=i; 11 | Sleep(30); 12 | } 13 | i++; 14 | for (;i<=0;i++) { 15 | gr.pan_text_x=i; 16 | Sleep(30); 17 | } 18 | 19 | for (i=0;i<=7;i++) { 20 | gr.pan_text_y=i; 21 | Sleep(30); 22 | } 23 | i--; 24 | for (;i>=-7;i--) { 25 | gr.pan_text_y=i; 26 | Sleep(30); 27 | } 28 | i++; 29 | for (;i<=0;i++) { 30 | gr.pan_text_y=i; 31 | Sleep(30); 32 | } 33 | } 34 | 35 | PanText; 36 | -------------------------------------------------------------------------------- /Demo/Graphics/Pick.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Graphics/Pick.HC -------------------------------------------------------------------------------- /Demo/Graphics/Pick3D.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Graphics/Pick3D.HC -------------------------------------------------------------------------------- /Demo/Graphics/PoleZeros.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Graphics/PoleZeros.HC -------------------------------------------------------------------------------- /Demo/Graphics/RotateTank.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Graphics/RotateTank.HC -------------------------------------------------------------------------------- /Demo/Graphics/ScrnCapture.HC: -------------------------------------------------------------------------------- 1 | //See $LK,"::/Demo/Games/Stadium/StadiumGen.HC"$. 2 | 3 | U0 Main() 4 | { 5 | "Capture scrn...\n"; 6 | PressAKey; 7 | GRScrnCaptureWrite("~/DemoScrnShot"); 8 | "View captured scrn...\n"; 9 | PressAKey; 10 | GRScrnCaptureRead("~/DemoScrnShot"); 11 | PressAKey; 12 | DCFill; 13 | } 14 | 15 | Main; 16 | -------------------------------------------------------------------------------- /Demo/Graphics/ScrollBars.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Graphics/ScrollBars.HC -------------------------------------------------------------------------------- /Demo/Graphics/Shading.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Graphics/Shading.HC -------------------------------------------------------------------------------- /Demo/Graphics/Shadow.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Graphics/Shadow.HC -------------------------------------------------------------------------------- /Demo/Graphics/Speedline.HC: -------------------------------------------------------------------------------- 1 | //This is a drawing program 2 | 3 | public U0 SpeedLineDemo() 4 | { 5 | I64 msg_code,cnt,x1,y1,x2,y2,arg1,arg2,color=BLACK; 6 | CDC *dc=DCAlias; 7 | dc->color=color; 8 | 9 | SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$ 10 | Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER; 11 | 12 | AutoComplete; 13 | WinBorder; 14 | WinMax; 15 | DocClear; 16 | DCFill; 17 | do { 18 | msg_code=GetMsg(&arg1,&arg2, 19 | 1<=0) 24 | dc->color=color; 25 | break; 26 | case MSG_MS_L_DOWN: 27 | x1=arg1; y1=arg2; 28 | x2=arg1; y2=arg2; 29 | cnt=0; 30 | while (msg_code!=MSG_MS_L_UP) { 31 | dc->thick=0.04*ms.speed; 32 | GrLine3(dc,x1,y1,0,x2,y2,0); 33 | msg_code=GetMsg(&arg1,&arg2, 34 | 1< you will see this: 2 | 3 | $$IB,"<1>",BI=1,BP="::/Demo/Graphics/SpritePut.HC,2"$$ 4 | 5 | That imports an external sprite. It's 6 | called a $LK,"DOCEF_BIN_PTR_LINK",A="MN:DOCEF_BIN_PTR_LINK"$. See $LK,"BP=\"\"",A="FF:::/Doc/DolDocOverview.DD,BP=\"\""$. 7 | 8 | Press and "Ptr to Sprite". 9 | Then, enter a file and the number of 10 | the sprite in the file. Note: the 11 | number can get messed-up if you change 12 | the order of sprites in the source file. 13 | You can link to a tag string instead of a num. 14 | */ 15 | 16 | U0 SpritePutExt() 17 | { 18 | I64 i; 19 | for (i=0;i<3;i++) { 20 | "US Map:"; 21 | Sprite($IB,"<1>",BI=1,BP="::/Demo/Graphics/SpritePut.HC,2"$); 22 | "%h12c",'\n'; //"h" is a secondary arg. $LK,"Print",A="FI:::/Doc/Print.DD"$ 12 newline chars. 23 | } 24 | } 25 | 26 | SpritePutExt; 27 | -------------------------------------------------------------------------------- /Demo/Graphics/SpriteRaw.HC: -------------------------------------------------------------------------------- 1 | //Normally, you make sprites with . 2 | //This shows how to build a sprite by hand. 3 | //See $MA-X+PU,"::/Apps/GrModels",LM="Cd(\"::/Apps/GrModels\");Dir;View;\n"$. 4 | 5 | class MySprite 6 | { // See $LK,"Sprite Elem Types",A="MN:SPT_LINE"$ 7 | CSpriteColor color; 8 | CSpritePtPt line1; 9 | CSpritePtPt line2; 10 | CSpritePtPt line3; 11 | CSpritePt fill; 12 | CSpriteBase end; 13 | }; 14 | 15 | 16 | U0 SpriteRawDemo() 17 | { 18 | MySprite s; 19 | 20 | MemSet(&s,0,sizeof(s)); 21 | s.color.type=SPT_COLOR; 22 | s.color.color=GREEN; 23 | s.line1.type=SPT_LINE; 24 | s.line1.x2=100; s.line1.y2=50; 25 | s.line2.type=SPT_LINE; 26 | s.line2.x2=50; s.line2.y2=100; 27 | s.line3.type=SPT_LINE; 28 | s.line3.x1=100; s.line3.y1=50; 29 | s.line3.x2=50; s.line3.y2=100; 30 | s.fill.type=SPT_FLOOD_FILL; 31 | s.fill.x1=20; s.fill.y1=20; 32 | s.end.type=SPT_END; 33 | 34 | Sprite(&s); 35 | "%h13c",'\n'; 36 | } 37 | 38 | SpriteRawDemo; 39 | -------------------------------------------------------------------------------- /Demo/Graphics/SpriteText.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Graphics/SpriteText.HC -------------------------------------------------------------------------------- /Demo/Graphics/SunMoon.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Graphics/SunMoon.HC -------------------------------------------------------------------------------- /Demo/Graphics/Transform.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Graphics/Transform.HC -------------------------------------------------------------------------------- /Demo/Graphics/WallPaperFish.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Graphics/WallPaperFish.HC -------------------------------------------------------------------------------- /Demo/Graphics/WinZBuf.HC: -------------------------------------------------------------------------------- 1 | U0 DrawIt(CTask *,CDC *dc) 2 | { 3 | I64 i,j; 4 | U16 *ptr=gr.win_z_buf; 5 | dc->color=BLACK; 6 | GrPrint(dc,0,0,"Move the windows around and watch."); 7 | for (i=0;icolor=*ptr++&15; 10 | GrPlot(dc,j,i+FONT_HEIGHT); 11 | } 12 | } 13 | 14 | U0 ScrollBars() 15 | { 16 | SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$ 17 | DocClear; 18 | Fs->draw_it=&DrawIt; 19 | GetChar(,FALSE); 20 | SettingsPop; 21 | } 22 | 23 | ScrollBars; 24 | -------------------------------------------------------------------------------- /Demo/InFile/InDir.IN: -------------------------------------------------------------------------------- 1 | /* To run this, do a directory, right click on 2 | this file's name and sel "InFile". 3 | Or, type $LK,"InFile",A="MN:InFile"$(filename); 4 | See $LK,"InFile",A="FF:::/Doc/Glossary.DD,InFile"$ in the glossary for more info. 5 | */ 6 | 7 | I64 i; 8 | for (i=0;i<3;i++) 9 | "Dir;\n"; 10 | 11 | "$$RED$$//Press a letter to complete the mask$$FG$$\n"; 12 | "Dir(\"*."; 13 | I64 ch=GetChar(,FALSE); //Prompt for first digit of mask 14 | "%c*\");\n",ch; -------------------------------------------------------------------------------- /Demo/InFile/InEd.IN: -------------------------------------------------------------------------------- 1 | /* To run this, do a directory, right click on 2 | this file's name and sel "InFile". 3 | Or, type $LK,"InFile",A="MN:InFile"$(filename); 4 | See $LK,"InFile",A="FF:::/Doc/Glossary.DD,InFile"$ in the glossary for more info. 5 | 6 | This InFile will renum the defines in 7 | InEd.DD.Z. Test it by numbering a few wrong 8 | and running this demo. 9 | 10 | */ 11 | 12 | U8 i; 13 | 14 | "Ed(\"InEd.DD.Z\");\n"; 15 | //Go to start of file 16 | Msg(MSG_KEY_DOWN,0,SC_CURSOR_UP|SCF_CTRL); 17 | for (i=0;i<=0xC3;i++) { 18 | if (i) 19 | Msg(MSG_KEY_DOWN_UP,0,SC_F3); 20 | else 21 | "%c0x%c",CH_CTRLF,CH_ESC; 22 | Msg(MSG_KEY_DOWN,0,SC_CURSOR_RIGHT); 23 | Msg(MSG_KEY_DOWN,0,SC_CURSOR_RIGHT); 24 | "%02X",i; 25 | Msg(MSG_KEY_DOWN,0,SC_CURSOR_RIGHT); 26 | Msg(MSG_KEY_DOWN,0,SC_CURSOR_RIGHT); 27 | "%c%c",CH_BACKSPACE,CH_BACKSPACE; 28 | } 29 | -------------------------------------------------------------------------------- /Demo/InFile/InPopUp.HC: -------------------------------------------------------------------------------- 1 | /* This is not an InFile. It uses $LK,"InStr",A="MN:InStr"$ 2 | to run text as though from an InFile. 3 | 4 | This example shows how you can drive pop-up 5 | windows. 6 | */ 7 | 8 | In(" "); 9 | "PopUp #1:%X\n",PopUpNoYes; 10 | 11 | InStr("Msg(MSG_KEY_DOWN,0,SC_CURSOR_RIGHT);'' CH_SPACE;"); 12 | "PopUp #2:%X\n",PopUpNoYes; 13 | -------------------------------------------------------------------------------- /Demo/InFile/InPopUpWait.IN: -------------------------------------------------------------------------------- 1 | U0 DoWait() 2 | { 3 | I64 i; 4 | for (i=0;i<3;i++) { 5 | "PopUpNoYes;\n "; 6 | 7 | //Necessary after a $LK,"DocEntryRun",A="MN:DocEntryRun"$() 8 | //which occurs when PopUp's close. 9 | TaskWait; 10 | 11 | "\"%d\\n\\n\";\n",i; 12 | } 13 | } 14 | 15 | U0 DoNoWait() 16 | { 17 | I64 i; 18 | for (i=0;i<3;i++) 19 | "PopUpNoYes;\n \"%d\\n\\n\";\n",i; 20 | } 21 | 22 | "//With Wait ";PressAKey; 23 | DoWait; 24 | "//With No Wait ";PressAKey; 25 | DoNoWait; 26 | 27 | -------------------------------------------------------------------------------- /Demo/InFile/InProfile.IN: -------------------------------------------------------------------------------- 1 | /* To run this, do a directory, right click on 2 | this file's name and sel "InFile". 3 | Or, type $LK,"InFile",A="MN:InFile"$(filename); 4 | See $LK,"InFile",A="FF:::/Doc/Glossary.DD,InFile"$ in the glossary for more info. 5 | 6 | Profiling does not $UL,1$require$UL,0$ InFiles. 7 | */ 8 | "$$RED$$Prof;$$FG$$\n"; 9 | "$$RED$$//Collecting Data$$FG$$"; 10 | PressAKey; 11 | "\n$$RED$$ProfRep;$$FG$$\n"; -------------------------------------------------------------------------------- /Demo/InFile/InSetIP.HC: -------------------------------------------------------------------------------- 1 | U0 InSetMsDemo() 2 | { 3 | I64 t,l; 4 | WinBorder(ON); 5 | l=Fs->pix_left+Fs->scroll_x; 6 | t=Fs->pix_top+Fs->scroll_y; 7 | MsSet(,,,FALSE,FALSE); //Mouse unclicked 8 | InSetMs(,l-4,t-4); 9 | InSetMs(20,l+20,t+20,,TRUE); 10 | MsSet(,,,FALSE,FALSE); 11 | } 12 | 13 | InSetMsDemo; 14 | -------------------------------------------------------------------------------- /Demo/KeyBitMap.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/KeyBitMap.HC -------------------------------------------------------------------------------- /Demo/LastClass.HC: -------------------------------------------------------------------------------- 1 | U0 StructName(U8 *d,U8 *class_name=lastclass) 2 | {//lastclass is the prev fun arg's class as a string. 3 | "%X is a \"%s\".\n",d,class_name; 4 | } 5 | 6 | class Student 7 | { 8 | Student *next; 9 | I64 age; 10 | U8 name[32]; 11 | } a; 12 | 13 | class School 14 | { 15 | U8 name[32]; 16 | Student *students; 17 | } s; 18 | 19 | I64 i; 20 | 21 | StructName(Fs); 22 | StructName(&a); 23 | StructName(&s); 24 | StructName(&i); 25 | PressAKey; 26 | 27 | //lastclass is used in $LK,"ClassRep",A="MN:ClassRep"$() and $LK,"ClassRepD",A="MN:ClassRepD"$(). 28 | ClassRepD(Gs); 29 | PressAKey; 30 | 31 | ClassRep(Fs); 32 | 33 | //See also $LK,"DocForm",A="MN:DocForm"$(), $LK,"::/Demo/Dsk/BlkDevRep.HC"$ and $LK,"::/Demo/ClassMeta.HC"$. 34 | -------------------------------------------------------------------------------- /Demo/Lectures/AndNotMod.HC: -------------------------------------------------------------------------------- 1 | //$WW,1$You may wonder why I use "&" instead of "%". 2 | 3 | #define SAMPLE_SIZE 100000000 4 | 5 | U0 TimeIns() 6 | { 7 | I64 start1,end1,start2,end2,overhead_time,test_time; 8 | I64 reg i,reg tmp; 9 | 10 | CPURep; 11 | 12 | //Measure Loop Overhead 13 | start1=GetTSC; 14 | for (i=0;i will flush scrn VGA cache. 31 | VGAFlush; 32 | } 33 | 34 | GrDemo; 35 | -------------------------------------------------------------------------------- /Demo/Lectures/InterruptDemo.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Lectures/InterruptDemo.HC -------------------------------------------------------------------------------- /Demo/Lectures/MiniGrLib.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Lectures/MiniGrLib.HC -------------------------------------------------------------------------------- /Demo/Lectures/NegDisp.HC: -------------------------------------------------------------------------------- 1 | class Person 2 | { 3 | U8 first [32]; 4 | U8 last [32]; 5 | U8 address1 [64]; 6 | U8 address2 [64]; 7 | U8 city [32]; 8 | U8 state_zip[32]; 9 | }; 10 | 11 | U0 OffsetDemo1() 12 | { 13 | Person *p=MAlloc(sizeof(Person)); 14 | StrCpy(p->first, "Terry"); 15 | StrCpy(p->last, "Davis"); 16 | StrCpy(p->address1, "8144 Sickle Lane"); 17 | StrCpy(p->address2, ""); 18 | StrCpy(p->city, "Las Vegas"); 19 | StrCpy(p->state_zip,"NV 89128"); 20 | } 21 | 22 | U(&OffsetDemo1,34); 23 | PressAKey; 24 | 25 | /* 26 | 27 | x86 has signed 8-bit displacements 28 | and signed 32-bit displacements. 29 | 30 | This example uses 8-bit negative displacements. 31 | 32 | */ 33 | 34 | class Person 35 | { $$=-128; 36 | U8 first [32]; 37 | U8 last [32]; 38 | U8 address1 [64]; 39 | U8 address2 [64]; 40 | U8 city [32]; 41 | U8 state_zip[32]; 42 | }; 43 | 44 | U0 OffsetDemo2() 45 | { 46 | Person *p=MAlloc(sizeof(Person))(I64)+128; 47 | StrCpy(p->first, "Terry"); 48 | StrCpy(p->last, "Davis"); 49 | StrCpy(p->address1, "8144 Sickle Lane"); 50 | StrCpy(p->address2, ""); 51 | StrCpy(p->city, "Las Vegas"); 52 | StrCpy(p->state_zip,"NV 89128"); 53 | } 54 | 55 | U(&OffsetDemo2,34); 56 | PressAKey; 57 | -------------------------------------------------------------------------------- /Demo/Lectures/PCIInterrupts.HC: -------------------------------------------------------------------------------- 1 | //See $LK,"PCI",A="HI:PCI"$. 2 | 3 | #if mp_cnt>1 4 | #define DEST_CPU 1 5 | #else 6 | #define DEST_CPU 0 7 | #endif 8 | 9 | #assert I_USER==0x40 10 | 11 | interrupt U0 IntMy40() 12 | { 13 | lock {progress1++;} 14 | *(dev.uncached_alias+LAPIC_EOI)(U32 *)=0; 15 | } 16 | 17 | interrupt U0 IntMy41() 18 | { 19 | lock {progress2++;} 20 | *(dev.uncached_alias+LAPIC_EOI)(U32 *)=0; 21 | } 22 | 23 | interrupt U0 IntMy42() 24 | { 25 | lock {progress3++;} 26 | *(dev.uncached_alias+LAPIC_EOI)(U32 *)=0; 27 | } 28 | 29 | interrupt U0 IntMy43() 30 | { 31 | lock {progress4++;} 32 | *(dev.uncached_alias+LAPIC_EOI)(U32 *)=0; 33 | } 34 | 35 | I64 vect[4]={&IntMy40,&IntMy41,&IntMy42,&IntMy43}; 36 | 37 | U0 Main() 38 | { 39 | I64 i; 40 | U8 *da=dev.uncached_alias+IOAPIC_REG; 41 | U32 *_d=dev.uncached_alias+IOAPIC_DATA; 42 | 43 | ProgressBarsRst; 44 | for (i=I_USER;i will flush scrn VGA cache. 43 | VGAFlush; 44 | } 45 | 46 | Main; 47 | 48 | //See $LK,"::/Demo/Lectures/GraphicsCPULoad.HC"$. 49 | 50 | -------------------------------------------------------------------------------- /Demo/MsgLoop.HC: -------------------------------------------------------------------------------- 1 | U0 MsgLoop() 2 | { 3 | I64 arg1,arg2,msg_code; 4 | "Use $LK,"msg_code",A="MN:MSG_CMD"$ defines in your programs instead of hardcoded nums.\n" 5 | " to Exit\n"; 6 | 7 | //We don't want the mouse bttns to reposition the cursor, 8 | //so we inhibit the window mgr from processing them. 9 | 10 | Fs->win_inhibit=WIF_SELF_MS_L|WIF_SELF_MS_R; 11 | 12 | do { 13 | msg_code=GetMsg(&arg1,&arg2,~(1<win_inhibit=WIG_USER_TASK_DFT; 19 | } 20 | 21 | MsgLoop; 22 | 23 | // Press and "Insert $LK,"ASCII",A="MN:CH_CTRLA"$/$LK,"ScanCode",A="FI:::/Doc/CharOverview.DD"$". 24 | -------------------------------------------------------------------------------- /Demo/MultiCore/Interrupts.HC: -------------------------------------------------------------------------------- 1 | interrupt U0 IntBeepOn() 2 | { 3 | *(dev.uncached_alias+LAPIC_EOI)(U32 *)=0; //signal end of interrupt 4 | Snd(34); 5 | } 6 | 7 | interrupt U0 IntBeepOff() 8 | { 9 | *(dev.uncached_alias+LAPIC_EOI)(U32 *)=0; 10 | Snd; 11 | } 12 | 13 | U0 IntTest() 14 | {//Modify interrupt descriptor table use by all cores. 15 | IntEntrySet(I_USER,&IntBeepOn,IDTET_TRAP); 16 | IntEntrySet(I_USER+1,&IntBeepOff,IDTET_TRAP); 17 | //Issue interupt to core1 18 | MPInt(I_USER,1); 19 | Sleep(1000); 20 | MPInt(I_USER+1,1); 21 | } 22 | 23 | IntTest; 24 | -------------------------------------------------------------------------------- /Demo/MultiCore/LoadTest.HC: -------------------------------------------------------------------------------- 1 | Bool app_done; 2 | I64 app_done_ack; 3 | 4 | U0 Job1(I64) 5 | {//Compile Compiler 6 | Silent; 7 | while (!app_done) { 8 | Cd("::/Compiler"); 9 | Cmp("Compiler"); 10 | } 11 | lock {app_done_ack--;} 12 | } 13 | 14 | U0 Job2(I64) 15 | {//Log a file 16 | while (!app_done) { 17 | AdamLog("%F","::/Demo/MultiCore/LoadTest.HC"); 18 | Yield; 19 | } 20 | lock {app_done_ack--;} 21 | } 22 | 23 | U0 Job3(I64) 24 | {//Log a file 25 | while (!app_done) { 26 | Cd("::/Compiler"); 27 | AdamLog("%F","Compiler.PRJ.Z"); 28 | Yield; 29 | } 30 | lock {app_done_ack--;} 31 | } 32 | 33 | U0 Main() 34 | { 35 | app_done=FALSE; 36 | "Running MultiCore Test...\n"; 37 | Spawn(&Job1,,,1); //core #1 38 | Spawn(&Job2,,,1); 39 | Spawn(&Job3,,,1); 40 | PressAKey; 41 | //We don't want to yank code from under MP cores. 42 | app_done_ack=3; 43 | app_done=TRUE; 44 | while (app_done_ack) 45 | Yield; 46 | } 47 | 48 | Main; 49 | -------------------------------------------------------------------------------- /Demo/MultiCore/Lock.HC: -------------------------------------------------------------------------------- 1 | /*lock{} is a compiler stmt 2 | which places asm LOCK inst 3 | prefixes on code. Only use it on 4 | read-modify-write stmts. 5 | It will generate invalid insts 6 | if you misuse it and it will crash. 7 | $LK,"U",A="MN:U"$() to see what code was generated. 8 | */ 9 | 10 | #define CNT 0x1000000 11 | 12 | I64 glbl; 13 | 14 | U0 MPUnlockedInc(I64) 15 | { 16 | I64 i; 17 | for (i=0;inum&15,Gs->num); 6 | } 7 | 8 | U0 MPPrintDemo() 9 | { 10 | I64 i; 11 | for (i=0;i<500;i++) 12 | JobQue(&Job,DocPut,i%mp_cnt); 13 | Sleep(500); 14 | "$$FG$$\n"; 15 | } 16 | 17 | MPPrintDemo; 18 | -------------------------------------------------------------------------------- /Demo/MultiCore/Primes.HC: -------------------------------------------------------------------------------- 1 | U8 *master_bitmap; 2 | I64 prime_range,my_mp_cnt,pending; 3 | 4 | U0 PrimesJob(I64 i) 5 | { 6 | I64 j,k,l=Sqrt(prime_range), 7 | lo=i*prime_range/my_mp_cnt, 8 | hi=(i+1)*prime_range/my_mp_cnt, 9 | lo2=lo+sys_cache_line_width, 10 | hi2=hi-sys_cache_line_width; 11 | if (lo2>hi2) lo2=hi2; 12 | for (j=2;j<=l;j++) { 13 | if (!Bt(master_bitmap,j)) { 14 | if (j>=lo) 15 | k=j+j; 16 | else { 17 | k=lo-lo%j; 18 | if (k2) { 23 | dst=st=StrNew(dict); 24 | while (ch=ToUpper(*dst)) { 25 | if ('A'<=ch<='Z') 26 | *dst=char_map[ch-'A']; 27 | else 28 | *dst=CH_SPACE; 29 | dst++; 30 | } 31 | *dst=0; 32 | 33 | src=_num; 34 | while (*src) { 35 | if (!StrNCmp(st,src,StrLen(st))) { 36 | ch=*src; 37 | *src=0; 38 | "%s",_num; 39 | *src=ch; 40 | "$$GREEN$$%s$$FG$$",dict; 41 | "%s\n",src+StrLen(st); 42 | } 43 | src++; 44 | } 45 | Free(st); 46 | } 47 | dict+=StrLen(dict)+3; 48 | } 49 | Free(_num); 50 | '\n'; 51 | } 52 | 53 | U0 PNWDemo() 54 | { 55 | U8 *st; 56 | while ((st=GetStr("Phone Num:")) && *st) { 57 | PhoneNumWords(st); 58 | Free(st); 59 | } 60 | Free(st); 61 | } 62 | 63 | PNWDemo; 64 | -------------------------------------------------------------------------------- /Demo/Print.HC: -------------------------------------------------------------------------------- 1 | //TempleOS supports standard $LK,"Print",A="MN:Print"$() 2 | //codes and extended ones. 3 | //See $LK,"Print(\"\") Fmt Strings",A="FI:::/Doc/Print.DD"$. 4 | 5 | //Demonstrates $LK,"aux_fmt_num",A="FF:::/Doc/Print.DD,aux_fmt_num:2"$ codes. 6 | 7 | "%10h?d\n",123456789; 8 | "%10h?d\n",12345; 9 | 10 | "%10h3d\n",123456789; 11 | "%10h3d\n",12345; 12 | 13 | "\nWith the ',' flag:\n"; 14 | "%10,h3d\n",123456789; 15 | "%10,h3d\n",12345; 16 | 17 | "\nFloating Point:\n"; 18 | "%16h?n\n",.00123456789; 19 | "%16h?n\n",12345.0; 20 | 21 | "%16.2h-6n\n",.00123456789; 22 | "%16.2h-6n\n",12345.0; 23 | 24 | '\n'; 25 | 26 | "%h25c\n",'x'; //Print 25 x's 27 | 28 | "%h*c\n",25,'y'; //Print 25 y's 29 | 30 | 'zzzz\n'; //$LK,"PutChars",A="MN:PutChars"$() up to 8 characters. 31 | 32 | '\n'; 33 | 34 | -------------------------------------------------------------------------------- /Demo/Prompt.HC: -------------------------------------------------------------------------------- 1 | U0 PromptDemo() 2 | { 3 | F64 d; 4 | I64 i; 5 | U8 *name; 6 | CDate cdt; 7 | 8 | "\n\nNow prompting from the cmd line.\n\n" 9 | "$$GREEN$$$$FG$$ keeps default.\n\n"; 10 | 11 | i=GetI64("Enter int expression(%d):",123); 12 | "Int=%d\n",i; 13 | 14 | d=GetF64("Enter float expression(%12g):",1.2e3); 15 | "Float=%e\n",d; 16 | 17 | name=GetStr("Name (%s):","John"); 18 | "Name:%s\n",name; 19 | Free(name); 20 | 21 | cdt=GetDate("Date (%D):",Now); 22 | "Date=%D\n",cdt; 23 | } 24 | 25 | PromptDemo; 26 | -------------------------------------------------------------------------------- /Demo/RadixSort.HC: -------------------------------------------------------------------------------- 1 | #define RADIX 256 2 | #define N 16 3 | 4 | U8 a[N]; 5 | 6 | class Lst 7 | { 8 | Lst *next; 9 | U8 *a; 10 | } l[N],*r[RADIX]; 11 | 12 | U0 DumpIn() 13 | { 14 | I64 i; 15 | "$$RED$$\n\nInput$$FG$$\n"; 16 | for (i=0;ia; 29 | tmpl=tmpl->next; 30 | } 31 | } 32 | } 33 | 34 | U0 Init() 35 | { 36 | I64 i; 37 | MemSet(r,0,sizeof(r)); 38 | for (i=0;icolor=RandU16&15; 8 | GrPlot(gr.dc,RandU32%GR_WIDTH,RandU32%GR_HEIGHT); 9 | } 10 | Yield; 11 | } while (tS-t0<1); 12 | DCFill; 13 | } 14 | 15 | U0 RandDemo() 16 | { 17 | I64 i; 18 | 19 | "Seed(0) will do timer XORed random numbers. " 20 | "A task starts with $LK,"Seed(0)",A="FF:::/Kernel/KTask.HC,Seed("$ by dft.\n"; 21 | PressAKey; 22 | Seed; 23 | RandPts; 24 | DCFill; 25 | 26 | "\nSeed(num) will do deterministic, non-timer random numbers starting at " 27 | "a specific seed. You can run a specific video game over and over " 28 | "by typing Seed(num) at the cmd line before the game.\n"; 29 | PressAKey; 30 | Seed(1); 31 | RandPts; 32 | DCFill; 33 | 34 | "\n\n\nWatch when we specify specific seeds:"; 35 | 36 | "\n\nSeed(1);\n"; 37 | Seed(1); 38 | for (i=0;i<5;i++) 39 | "%d: %d\n",i,RandI16; 40 | 41 | "\nSeed(2); Different, right?\n"; 42 | Seed(2); 43 | for (i=0;i<5;i++) 44 | "%d: %d\n",i,RandI16; 45 | 46 | "\nSeed(1); Repeats earlier values.\n"; 47 | Seed(1); 48 | for (i=0;i<5;i++) 49 | "%d: %d\n",i,RandI16; 50 | 51 | "\nSeed(0); Zero is special.\n"; 52 | Seed(0); 53 | for (i=0;i<5;i++) 54 | "%d: %d\n",i,RandI16; 55 | 56 | "\nSeed(0); Non-repeating.\n"; 57 | Seed(0); 58 | for (i=0;i<5;i++) 59 | "%d: %d\n",i,RandI16; 60 | 61 | Seed; //Dft should be kept to zero. 62 | } 63 | 64 | RandDemo; 65 | -------------------------------------------------------------------------------- /Demo/RegistryDemo.HC: -------------------------------------------------------------------------------- 1 | /*The ~/Registry.HC.Z file is HolyC code. 2 | You can execute a tree branch of it. The Adam 3 | branch is executed in the Adam task boot phase. 4 | Normally, you will place var declarations 5 | in the branch you make, but since an arthmetic expression 6 | is valid in HolyC you can place simple expressions 7 | without vars. 8 | */ 9 | 10 | RegDft("DemoCompany/Game1","F64 best_score=1.23;\n"); 11 | RegDft("DemoCompany/Game1/SimpleVal","1234;\n"); 12 | RegExe("DemoCompany/Game1"); 13 | 14 | U0 Game() 15 | { 16 | I64 i=RegExe("DemoCompany/Game1/SimpleVal"); 17 | "High Score:%6.5f\n",best_score; 18 | "Val:%d\n",i; 19 | i++; 20 | best_score=tS; 21 | //You could combine these into one write by making 22 | //the $$TR...$$ and $$ID,2$$, $$ID,-2$$, cmds yourself. 23 | RegWrite("DemoCompany/Game1","F64 best_score=%9.5f;\n",best_score); 24 | RegWrite("DemoCompany/Game1/SimpleVal","%d;\n",i); 25 | } 26 | 27 | Game; 28 | -------------------------------------------------------------------------------- /Demo/RevFileDemo/DemoPoemBwd.DD: -------------------------------------------------------------------------------- 1 | Will lead my steps aright. 2 | In the long way that I must tread alone, 3 | Guides through the boundless sky thy certain flight, 4 | He, who, from zone to zone, 5 | 6 | And shall not soon depart. 7 | Deeply hath sunk the lesson thou hast given, 8 | Hath swallowed up thy form; yet, on my heart 9 | Thou'rt gone, the abyss of heaven 10 | 11 | Soon o'er thy sheltered nest. 12 | And scream among thy fellows; reed shall bend 13 | Soon shalt thou find a summer home, and rest, 14 | And soon that toil shall end, 15 | 16 | Though the dark night is near. 17 | Yet stoop not, weary, to the welcome land, 18 | At that far height, the cold thin atmosphere: 19 | All day thy wings have fann'd 20 | 21 | Lone wandering, but not lost. 22 | The desert and illimitable air,-- 23 | Teaches thy way along that pathless coast,-- 24 | There is a Power whose care 25 | 26 | On the chafed ocean side? 27 | Or where the rocking billows rise and sink 28 | Of weedy lake, or marge of river wide, 29 | Seek'st thou the plashy brink 30 | 31 | Thy figure floats along. 32 | As, darkly painted on the crimson sky, 33 | Might mark thy distant flight to do thee wrong, 34 | Vainly the fowler's eye 35 | 36 | Thy solitary way? 37 | Far, through their rosy depths, dost thou pursue 38 | While glow the heavens with the last steps of day, 39 | Whither, 'midst falling dew, 40 | 41 | by William Cullen Bryant 42 | To a Waterfowl; 43 | -------------------------------------------------------------------------------- /Demo/RevFileDemo/Rev.HC: -------------------------------------------------------------------------------- 1 | /*We use the internal routines from the text editor 2 | to cut and paste lines to rev the order of 3 | lines in a text file. 4 | */ 5 | 6 | Cd(__DIR__);; 7 | 8 | U0 Rev(U8 *in_name,U8 *out_name) 9 | { 10 | CDoc *doc_in =DocRead(in_name), 11 | *doc_out=DocNew(out_name); 12 | DocTop(doc_in); 13 | while (doc_in->head.next!=doc_in) { 14 | EdLineDown(doc_in,SC_CURSOR_DOWN|SCF_SHIFT); 15 | ClipCut(doc_in); 16 | DocTop(doc_out); 17 | ClipPaste(doc_out); 18 | } 19 | DocWrite(doc_out); 20 | } 21 | 22 | Rev("DemoPoemBwd.DD.Z","~/DemoPoemFwd.DD.Z"); 23 | -------------------------------------------------------------------------------- /Demo/ScrnCodes.HC: -------------------------------------------------------------------------------- 1 | /*See $LK,"TextBase Layer",A="HI:TextBase Layer"$ for the format 2 | of the U32 you pass to TextChar() 3 | 4 | See $LK,"::/Doc/CharOverview.DD"$, $LK,"::/Demo/ExtChars.HC"$, 5 | and $LK,"::/Demo/Graphics/FontEd.HC"$. 6 | 7 | Hold and press a 3 digit decimal number 8 | or press to enter extended characters. 9 | */ 10 | 11 | U0 DrawIt(CTask *task,CDC *) 12 | { 13 | I64 i; 14 | for (i=0;i<256;i++) 15 | TextChar(task,,(i&15)*2,(i/16)*2,i+BLACK<<12+WHITE<<8); 16 | } 17 | 18 | U0 ScrnCodes() 19 | { 20 | SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$ 21 | DocClear; 22 | Fs->draw_it=&DrawIt; 23 | GetChar(,FALSE); 24 | SettingsPop; 25 | } 26 | 27 | ScrnCodes; 28 | -------------------------------------------------------------------------------- /Demo/Snd/ASCIIOrgan.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Snd/ASCIIOrgan.HC -------------------------------------------------------------------------------- /Demo/Snd/OhGreat.HC: -------------------------------------------------------------------------------- 1 | U0 Song() 2 | {//Song by Terry A. Davis 3 | Fs->task_end_cb=&SndTaskEndCB; 4 | MusicSettingsRst; 5 | try //Catch exit 6 | while (!ScanChar) { 7 | Play("6hEqDC5B6CDhE", 8 | "God \0is \0a \0g\0od \0of \0love.\n\0"); 9 | Play("5GqFEFhG6E", 10 | " \0 \0 \0 \0 \0He \0"); 11 | Play("6qDC5B6CDhE5G", 12 | "wat\0ches \0us \0from \0a\0bove.\n\0 \0"); 13 | Play("5qFEFhGB6qC", 14 | " \0 \0 \0 \0Our \0world \0"); 15 | Play("6DhCeDC5hBG", 16 | "is\0n't \0al\0ways \0nice.\n\0 \0"); 17 | Play("5qFEFhG6EqD", 18 | " \0 \0 \0 \0Be\0fore \0"); 19 | Play("6C5B6CDhE5G", 20 | "you \0gr\0ipe \0think \0twice.\n\0 \0"); 21 | Play("5qFEFhG6EqD", 22 | " \0 \0 \0 \0He \0wat\0"); 23 | Play("6C5B6CDhE5G", 24 | "ches \0us \0from \0a\0bove.\n\0 \0"); 25 | Play("5qFEFhG6EqD", 26 | " \0 \0 \0 \0He'll \0smack \0"); 27 | Play("6C5B6CDhE5G", 28 | "you \0with \0out \0a \0glove.\n\0 \0"); 29 | Play("5qFEFhGB6qC", 30 | " \0 \0 \0 \0Our \0world \0"); 31 | Play("6DhCeDC5hBG", 32 | "is\0n't \0al\0ways \0nice.\n\0 \0"); 33 | Play("5qFEFhG"); 34 | } 35 | catch 36 | PutExcept; 37 | '\n'; 38 | Snd; 39 | } 40 | 41 | Song; 42 | -------------------------------------------------------------------------------- /Demo/Snd/WaterFowl.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Demo/Snd/WaterFowl.HC -------------------------------------------------------------------------------- /Demo/SortFileDemo/F64FileGen.HC: -------------------------------------------------------------------------------- 1 | //This makes a file of N random double values. 2 | 3 | Cd(__DIR__);; 4 | 5 | U0 F64FileGenTXT(U8 *filename,I64 n) 6 | { 7 | I64 i; 8 | CDoc *doc=DocNew(filename); 9 | DocPrint(doc,"//This is unsorted.\n"); 10 | for (i=0;irbp,task); 23 | '\n'; 24 | "$$BK,1$$PRESS A KEY$$BK,0$$\n"; 25 | DocDblBufSwap; 26 | Refresh; 27 | } 28 | if (DocPut==doc) DocDblBufSwap; 29 | DocDblBufEnd; 30 | } 31 | 32 | U0 Spy() 33 | { 34 | I64 i; 35 | CTask *task; 36 | 37 | while (TRUE) { 38 | task=Fs->next_task; 39 | while (task!=Fs) { 40 | "$$MA+X,T=\"Task:%08X:%16ts\",LM=\"0x%08X\n\"$$\n", 41 | task,task->task_name,task; 42 | task=task->next_task; 43 | } 44 | '\n'; 45 | task=GetI64("Task Addr: ",0); 46 | if (TaskValidate(task)) { 47 | "\n\n\t$$BT,\"StkRep\",LM=\"1\n\"$$\n\n\n" 48 | "\n\n\t$$BT,\"CallerRep\",LM=\"2\n\"$$\n\n\n"; 49 | i=GetI64("",0); 50 | if (i==1) 51 | SpyStkRep(task); 52 | else if (i==2) 53 | SpyCallerRep(task); 54 | else 55 | break; 56 | } else 57 | break; 58 | } 59 | '\n'; 60 | } 61 | 62 | Spy; 63 | -------------------------------------------------------------------------------- /Demo/StkGrow.HC: -------------------------------------------------------------------------------- 1 | I64 Recurse(I64 n) 2 | { 3 | if (n) 4 | return 1+CallStkGrow(0x800,0x1000000,&Recurse,n-1); 5 | else 6 | return 0; 7 | } 8 | 9 | I64 Recurse2(I64 n) 10 | { 11 | if (n) 12 | return 1+Recurse2(n-1); 13 | else 14 | return 0; 15 | } 16 | 17 | I64 Recurse3(I64 n,I64 lo,I64 hi) 18 | { 19 | if (lo<=ntask_end_cb=&SndTaskEndCB; 23 | MusicSettingsRst; 24 | while (TRUE) { 25 | Play("4AB5C"); 26 | } 27 | } 28 | 29 | U0 MyGame() 30 | { 31 | I64 sc; 32 | SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$ 33 | Fs->text_attr=YELLOW<<4+BLUE; 34 | Fs->song_task=Spawn(&SongTask,NULL,"Song",,Fs); 35 | AutoComplete; 36 | WinBorder; 37 | WinMax; 38 | DocCursor; 39 | DocClear; 40 | 41 | MenuPush( 42 | "File {" 43 | " Abort(,CH_SHIFT_ESC);" 44 | " Exit(,CH_ESC);" 45 | "}" 46 | "Play {" 47 | " Restart(,'\n');" 48 | " Up(,,SC_CURSOR_UP);" 49 | " Down(,,SC_CURSOR_DOWN);" 50 | " Left(,,SC_CURSOR_LEFT);" 51 | " Right(,,SC_CURSOR_RIGHT);" 52 | "}" 53 | ); 54 | 55 | Init; 56 | Fs->animate_task=Spawn(&AnimateTask,NULL,"Animate",,Fs); 57 | Fs->draw_it=&DrawIt; 58 | 59 | try { 60 | while (TRUE) 61 | switch (GetKey(&sc)) { 62 | case 0: 63 | switch (sc.u8[0]) { 64 | case SC_CURSOR_LEFT: 65 | break; 66 | case SC_CURSOR_RIGHT: 67 | break; 68 | case SC_CURSOR_UP: 69 | break; 70 | case SC_CURSOR_DOWN: 71 | break; 72 | } 73 | break; 74 | case '\n': 75 | CleanUp; 76 | Init; 77 | break; 78 | case CH_SHIFT_ESC: 79 | case CH_ESC: 80 | goto mg_done; 81 | } 82 | mg_done: //Don't goto out of try 83 | } catch 84 | PutExcept; 85 | SettingsPop; 86 | CleanUp; 87 | MenuPop; 88 | } 89 | 90 | MyGame; 91 | -------------------------------------------------------------------------------- /Demo/Templates/InEdUtil.IN: -------------------------------------------------------------------------------- 1 | // See $LK,"InFile",A="HI:InFile"$ 2 | 3 | U0 InEdUtil(U8 *filename) 4 | { 5 | I64 i; 6 | 7 | "Ed(\"%s\");\n",filename; 8 | 9 | //Go to start of file 10 | Msg(MSG_KEY_DOWN,0,SC_CURSOR_UP|SCF_CTRL); 11 | for (i=0;i<10000;i++) { 12 | if (i) 13 | Msg(MSG_KEY_DOWN_UP,0,SC_F3); 14 | else 15 | "%c0x%c",CH_CTRLF,CH_ESC; 16 | Msg(MSG_KEY_DOWN,0,SC_CURSOR_RIGHT); 17 | Msg(MSG_KEY_DOWN,0,SC_CURSOR_RIGHT); 18 | "%02X",i; 19 | Msg(MSG_KEY_DOWN,0,SC_CURSOR_RIGHT); 20 | Msg(MSG_KEY_DOWN,0,SC_CURSOR_RIGHT); 21 | "%c%c",CH_BACKSPACE,CH_BACKSPACE; 22 | } 23 | } 24 | 25 | InEdUtil("MyFile"); 26 | -------------------------------------------------------------------------------- /Demo/Templates/Lex1.HC: -------------------------------------------------------------------------------- 1 | U0 MyRead(U8 *filename) 2 | { 3 | CCmpCtrl *cc=CmpCtrlNew(MStrPrint("#include \"%s\"",filename)); 4 | while (Lex(cc)) { 5 | "%03d:",cc->token; 6 | switch (cc->token) { 7 | case TK_IDENT: "IDENT:%s",cc->cur_str; break; 8 | case TK_STR: "STR:%s",cc->cur_str; break; 9 | case TK_CHAR_CONST: "CHAR:%d",cc->cur_i64; break; 10 | case TK_I64: "I64:%d",cc->cur_i64; break; 11 | case TK_F64: "F64:%d",cc->cur_f64; break; 12 | } 13 | '\n'; 14 | } 15 | CmpCtrlDel(cc); 16 | } 17 | -------------------------------------------------------------------------------- /Demo/Templates/MultiCore1.HC: -------------------------------------------------------------------------------- 1 | #define NUM 100 2 | 3 | I64 mp_not_done_flags,grand_total; 4 | 5 | U0 MPRoutine(CDoc *doc) 6 | { 7 | I64 i,sum=0, 8 | lo=NUM*Gs->num/mp_cnt, //This is how to divide a job 9 | hi=NUM*(Gs->num+1)/mp_cnt; 10 | for (i=lo;inum,lo,hi-1,sum); 13 | lock {grand_total+=sum;} 14 | LBtr(&mp_not_done_flags,Gs->num); 15 | } 16 | 17 | U0 Main() 18 | { 19 | I64 i; 20 | grand_total=0; 21 | mp_not_done_flags=1<next_mass; 17 | while (tmpm1!=&ode->next_mass) { 18 | tmpm2=tmpm1->next; 19 | while (tmpm2!=&ode->next_mass) { 20 | tmpm2=tmpm2->next; 21 | } 22 | tmpm1=tmpm1->next; 23 | } 24 | } 25 | 26 | U0 Init() 27 | { 28 | ode=ODENew(0,1e-4,ODEF_HAS_MASSES); 29 | ode->derive=&MyDerivative; 30 | ode->drag_v2=0.002; 31 | ode->drag_v3=0.00001; 32 | ode->acceleration_limit=5e3; 33 | 34 | QueIns(ode,Fs->last_ode); 35 | } 36 | 37 | U0 CleanUp() 38 | { 39 | QueRem(ode); 40 | QueDel(&ode->next_mass,TRUE); 41 | QueDel(&ode->next_spring,TRUE); 42 | ODEDel(ode); 43 | } 44 | -------------------------------------------------------------------------------- /Demo/Templates/Registry1.HC: -------------------------------------------------------------------------------- 1 | RegDft("MyCompany/MyApp","F64 best_score=9999;\n"); 2 | RegExe("MyCompany/MyApp"); 3 | 4 | U0 Main() 5 | { 6 | GetChar; 7 | RegWrite("MyCompany/MyApp","F64 best_score=%5.4f;\n",best_score); 8 | } 9 | 10 | Main; 11 | -------------------------------------------------------------------------------- /Demo/Templates/Util1.HC: -------------------------------------------------------------------------------- 1 | U0 MyUtil(U8 *files_find_mask,U8 *fu_flags=NULL) 2 | { 3 | I64 fuf_flags=0; 4 | CDirEntry *tmpde,*tmpde1; 5 | ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F"); 6 | ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags); 7 | tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags); 8 | while (tmpde) { 9 | PutFileLink(tmpde->full_name); 10 | '\n'; 11 | tmpde=tmpde->next; 12 | } 13 | DirTreeDel(tmpde1); 14 | } 15 | -------------------------------------------------------------------------------- /Demo/Templates/Util2.HC: -------------------------------------------------------------------------------- 1 | I64 MyUtilDoc(CDoc *doc,I64 fuf_flags) 2 | { 3 | Bool unlock=DocLock(doc); 4 | I64 res=0; 5 | CDocEntry *doc_e; 6 | DocRecalc(doc); 7 | doc_e=doc->head.next; 8 | while (doc_e!=doc) { 9 | res++; 10 | doc_e=doc_e->next; 11 | } 12 | DocRecalc(doc); 13 | if (unlock) 14 | DocUnlock(doc); 15 | return res; 16 | } 17 | 18 | I64 MyUtilFile(U8 *filename,I64 fuf_flags) 19 | { 20 | I64 res; 21 | CDoc *doc=DocRead(filename); 22 | if (res=MyUtilDoc(doc,fuf_flags)) { 23 | "%8d:%s\n",res,doc->filename.name; 24 | DocWrite(doc); 25 | } 26 | DocDel(doc); 27 | return res; 28 | } 29 | I64 MyUtilLst(CDirEntry *tmpde,I64 fuf_flags) 30 | { 31 | I64 res=0; 32 | CDirEntry *tmpde1; 33 | while (tmpde) { 34 | tmpde1=tmpde->next; 35 | if (tmpde->attr & RS_ATTR_DIR) { 36 | if (tmpde->sub) { 37 | "Processing Directory: %s\n",tmpde->full_name; 38 | res+=MyUtilLst(tmpde->sub,fuf_flags); 39 | } 40 | } else 41 | res+=MyUtilFile(tmpde->full_name,fuf_flags); 42 | DirEntryDel(tmpde); 43 | tmpde=tmpde1; 44 | } 45 | return res; 46 | } 47 | I64 MyUtil(U8 *files_find_mask="*",U8 *fu_flags=NULL) 48 | { 49 | I64 fuf_flags=0; 50 | ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+$$"); 51 | ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags); 52 | return MyUtilLst(FilesFind(files_find_mask,fuf_flags&FUG_FILES_FIND), 53 | fuf_flags&~FUG_FILES_FIND); 54 | } 55 | -------------------------------------------------------------------------------- /Demo/TimeIns.HC: -------------------------------------------------------------------------------- 1 | /*Allows you to time insts. 2 | Results vary because the CPU does 3 | parallel and out-of-order execution. 4 | */ 5 | 6 | #define SAMPLE_SIZE 10000000 7 | 8 | U0 TimeIns() 9 | { 10 | I64 i,start,end,overhead_time,test_time; 11 | F64 d=5.0; 12 | 13 | //Measure Loop Overhead 14 | start=GetTSC; 15 | for (i=0;ihead.next; 18 | I64 i; 19 | U32 num; 20 | U8 *st,*st2; 21 | "Scrambling: %s\n",name; 22 | while (doc_e!=doc) { 23 | if (doc_e->type_u8==DOCT_TEXT) { 24 | st=MAlloc(StrLen(doc_e->tag)+1); 25 | st2=MAlloc(StrLen(doc_e->tag)+1); 26 | StrFirstRem(doc_e->tag," ",st); 27 | 28 | for (i=3;i>=0;i--) { 29 | StrFirstRem(st,".",st2); 30 | num.u8[i]=key[i][Str2I64(st2)&255]; 31 | } 32 | 33 | Free(st); 34 | Free(st2); 35 | 36 | st=MStrPrint("%d.%d.%d.%d %s",num.u8[3],num.u8[2], 37 | num.u8[1],num.u8[0],doc_e->tag); 38 | Free(doc_e->tag); 39 | doc_e->tag=st; 40 | } 41 | doc_e=doc_e->next; 42 | } 43 | DocWrite(doc); 44 | DocDel(doc); 45 | } 46 | U0 WebLogScramble(U8 *files_find_mask) 47 | { 48 | CDirEntry *tmpde=FilesFind(files_find_mask,FUF_RECURSE|FUF_JUST_FILES), 49 | *tmpde1=tmpde; 50 | InitKey; 51 | while (tmpde) { 52 | LogScrambleFile(tmpde->full_name); 53 | tmpde=tmpde->next; 54 | } 55 | DirTreeDel(tmpde1); 56 | } 57 | 58 | U0 LogScrambleDemo() 59 | { 60 | U8 *dirname; 61 | Cd(__DIR__); 62 | dirname=DirCur; 63 | ST_WARN_ST "This will scramble all .log files in '%s'.\n\n",dirname; 64 | Free(dirname); 65 | if (AreYouSure) 66 | WebLogScramble("*.log*"); 67 | } 68 | 69 | LogScrambleDemo; 70 | -------------------------------------------------------------------------------- /Doc/AboutTempleOS.DD: -------------------------------------------------------------------------------- 1 | $WW,1$$FG,5$$TX+CX,"TempleOS"$$FG$ 2 | 3 | 4 | $FG,5$Websites:$FG$ 5 | $TX,"www.templeos.org",HTML="http://www.templeos.org"$ 6 | 7 | $FG,5$Owner/President:$FG$ 8 | $TX,"Terry A. Davis",HTML="mailto:tdavis@templeos.org"$ 9 | 10 | $HC,"
\"\"
"$ 11 | 12 | 8144 Sickle Lane 13 | Las Vegas, NV 89128 14 | (702)254-4223 15 | 16 | $TX,"tdavis@templeos.org",HTML="mailto:tdavis@templeos.org"$ 17 | 18 | 19 | $FG,5$About Me:$FG$ 20 | 21 | I was a National Merit Scholar with a 1440 SAT at Arizona State University. I have a bachelor's in Computer System Engineering from ASU, basically, embedded systems, and a master's in Electrical Engineering from ASU, control systems. I worked as a software, hardware and mechanical engineer at Ticketmaster from 1990-1996. 22 | 23 | I designed a 3 axis stepper-motor-driven milling machine 1996-1997 with a CAD/CAM package for a company I started called Home Automation and Robotic Equipment. 24 | 25 | $HC,"
\"\"
"$ 26 | 27 | I worked for a company named Xytec Corp. 1997-1999. We made FPGA-based image processing equipment. I wrote $FG,2$SimStructure$FG$ from 2000-2001 for H.A.R.E. I worked as head software/electrical engineer for a company called Graphic Technologies, 2001-2002, making replacement chips for toner printer cartridges so they could be refilled. 28 | 29 | $FG,5$Credits:$FG$ 30 | See $LK,"::/Doc/Credits.DD"$. 31 | 32 | -------------------------------------------------------------------------------- /Doc/AutoComplete.DD: -------------------------------------------------------------------------------- 1 | $FG,2$$WW,1$AutoComplete$FG$ is the $FG,7$LTGRAY$FG$ window on the right of the scrn. $LK,"ACInit",A="MN:ACInit"$() collects words from all text files in subdirectories. Normally, the call to $LK,"ACInit",A="MN:ACInit"$() is in $LK,"HomeSys.HC",A="FF:~/HomeSys.HC,ACInit"$. It provides auto-complete for typing, jump-to-code and jump-to-dictionary functionality. 2 | 3 | $FG,2$$FG$ Closes the $FG,7$LTGRAY$FG$ AutoComplete window. 4 | $FG,2$$FG$ Opens the $FG,7$LTGRAY$FG$ AutoComplete window. 5 | 6 | $FG,2$$FG$ Jumps to the source code for 1st symbol in the window. 7 | $FG,2$$FG$ Jumps to the source code for 2nd symbol in the window. 8 | $FG,2$$FG$ Jumps to the source code for n-th symbol in the window. 9 | $FG,2$$FG$ Autocompletes the 1st symbol in the window. 10 | $FG,2$$FG$ Autocompletes the 2nd symbol in the window. 11 | $FG,2$$FG$ Autocompletes the n-th symbol in the window. 12 | $FG,2$$FG$ Jumps to the dictionary for 1st symbol in the window. 13 | $FG,2$$FG$ Jumps to the dictionary for 2nd symbol in the window. 14 | $FG,2$$FG$ Jumps to the dictionary for n-th symbol in the window. 15 | $FG,2$$FG$ Autocompletes the 1st dictionary word in the window. 16 | $FG,2$$FG$ Autocompletes the 2nd dictionary word in the window. 17 | $FG,2$$FG$ Autocompletes the n-th dictionary word in the window. 18 | 19 | If you have the raw Project Gutenberg dictionary file, you can generate the TempleOS processed dictionary files with the stand-alone program $LK,"::/Adam/AutoComplete/ACDictGen.HC"$. 20 | -------------------------------------------------------------------------------- /Doc/Bit.DD: -------------------------------------------------------------------------------- 1 | 2 | $FG,5$These take a pointer to a bit field.$FG$ 3 | $WW,1$$FG,2$Bt$FG$: Bit Test 4 | $FG,2$Bts$FG$: Bit Test and Set to one 5 | $FG,2$Btr$FG$: Bit Test and Rst to zero 6 | $FG,2$Btc$FG$: Bit Test and Compliment (toggle) 7 | $FG,2$BEqu$FG$: Set bit to value. 8 | 9 | $FG$Bit operations are "atomic", no interrupt between the reading and writing the bit, important when multitasking. For multicore use "locked" forms.$FG$ 10 | 11 | $FG,5$These don't take a pointer, but the actual field.$FG$ 12 | $FG,2$Bsf$FG$: Bit Scan Fwd (Pos of first low one bit or -1) 13 | $FG,2$Bsr$FG$: Bit Scan Rev (Pos of first high one bit or -1) 14 | $FG,2$BCnt$FG$: Bit Cnt (Cnt of set bits) 15 | -------------------------------------------------------------------------------- /Doc/Boot.DD: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Doc/Boot.DD -------------------------------------------------------------------------------- /Doc/CharOverview.DD: -------------------------------------------------------------------------------- 1 | $WW,1$$FG,5$$TX+CX,"Char Overview"$$FG$ 2 | 3 | A $FG,2$Char$FG$acter is a single byte holding an ASCII code for a letter, num or sym. The $FG,2$TempleOS$FG$ term is a $FG,2$U8$FG$. 4 | 5 | Standard ASCII values range from 0 to 127. Values below 32 are ctrl key's. So, an ASCII #3 is a $FG,2$$FG$. TempleOS uses a few nonstandard values below 32. See $LK,"Char Definitions",A="MN:CH_SHIFT_SPACE"$. 6 | 7 | ASCII #5 is the cursor location in a saved file. 8 | ASCII #28 is $FG,2$$FG$. 9 | ASCII #31 is a $FG,2$$FG$. 10 | 11 | TempleOS ASCII is 8-bit instead of 7-bit, so it also uses the range from 128-255. Press $FG,2$$FG$ to see shapes for 128-255. Technically, $FG,2$$FG$ are $LK,"scrn codes",A="HI:TextBase Layer"$. 12 | 13 | A $FG,2$Key$FG$ is typically specified with a scan code. TempleOS scan codes contain the key value in the lowest $FG,2$U8$FG$, and flags in the upper 3 bytes. See $LK,"Scan Code Flags",A="MN:SCF_CTRL"$ and $LK,"Scan Codes",A="MN:SC_INS"$. 14 | 15 | TempleOS stores scan codes in 8 bytes. 16 | $FG,2$Byte 0$FG$ is the code. NumPad keys, SHIFT, ALT, CTRL and GUI keys combined. 17 | $FG,2$Byte 1-3$FG$ are $LK,"flags",A="MN:SCf_KEY_UP"$ 18 | 19 | The upper 4-bytes are copied from lower 4-bytes. 20 | $FG,2$Byte 4$FG$ is the code. Left, Right and NumPad keys distinct. 21 | $FG,2$Byte 5-7$FG$ are $LK,"flags",A="MN:SCf_KEY_UP"$ 22 | 23 | Run the program $LK,"::/Demo/MsgLoop.HC"$ to examine scan code. Press $FG,2$$FG$ and "Insert ASCII/ScanCode".$FG$ 24 | 25 | See $LK,"Key Allocations",A="FI:::/Doc/KeyAlloc.DD"$ and $LK,"CKbdStateGlbls",A="MN:CKbdStateGlbls"$. 26 | 27 | A $FG,2$String$FG$ is a bunch of ASCII characters terminated with a zero. 28 | -------------------------------------------------------------------------------- /Doc/CompilerOverview.DD: -------------------------------------------------------------------------------- 1 | $WW,1$$FG,5$$TX+CX,"Compiler Index"$$FG$ 2 | 3 | $LK,"::/Doc/Asm.DD"$ 4 | 5 | $LK,"::/Doc/Directives.DD"$ 6 | 7 | $LK,"::/Doc/Options.DD"$ 8 | 9 | $LK,"::/Doc/PreProcessor.DD"$ 10 | 11 | $LK,"::/Doc/ScopingLinkage.DD"$ 12 | 13 | See $LK,"Hello World",A="FI:::/Doc/HelloWorld.DD"$. 14 | -------------------------------------------------------------------------------- /Doc/Ctrls.DD: -------------------------------------------------------------------------------- 1 | $WW,1$To create a TempleOS graphic ctrl, you define callback functions and insert a $LK,"CCtrl",A="MN:CCtrl"$ structure in the $LK,"CTask",A="MN:CTask"$ queue. See $LK,"::/Demo/Graphics/Slider.HC"$, $LK,"::/Demo/Graphics/ScrollBars.HC"$ and $LK,"TermBttnNew",A="FF:::/Adam/WallPaper.HC,TermBttnNew"$. There is a template-code ctrl generator, if you press $FG,2$$FG$. 2 | -------------------------------------------------------------------------------- /Doc/Customize.DD: -------------------------------------------------------------------------------- 1 | 2 | $WW,1$* You can adjust the mouse movement rate by setting global vars in your start-up file. See $LK,"mouse scale",A="FF:~/HomeLocalize.HC,ms_hard.scale"$. 3 | 4 | * You can set your local time zone by setting the $FG,4$local_time_offset$FG$ global var in a start-up file. It's units are $LK,"CDATE_FREQ",A="MN:CDATE_FREQ"$. See $LK,"local time",A="FF:~/HomeLocalize.HC,local_time"$. 5 | 6 | * Get rid of this msg $LK,"here",A="FF:~/Once.HC,Customize.DD"$. 7 | -------------------------------------------------------------------------------- /Doc/D3.DD: -------------------------------------------------------------------------------- 1 | $WW,1$TempleOS has a class for 3 dimensional points consisting of F64s. HolyC is not C++ -- it does not support passing or returning values from functions which are not 64-bits, therefore, it can't be implemented with operator overloading. Making all function args and returns 64-bit is a core prinicple of TempleOS. 2 | 3 | As a courtesy, most of the CD3 functions return the addr of the destination vect, so you can nestle calls. They do not alloc new space for the destination vect. 4 | -------------------------------------------------------------------------------- /Doc/Date.DD: -------------------------------------------------------------------------------- 1 | $WW,1$Dates are 32-bit signed ints representing the number of days since the birth of Christ. Negative values represent B.C.E. dates. 2 | -------------------------------------------------------------------------------- /Doc/DbgFunSeg.DD: -------------------------------------------------------------------------------- 1 | $WW,1$Use $FG,2$%p$FG$ to print a pointer with FunSeg+Offset or use $FG,2$%P$FG$ to print a link to a FunSeg+Offset. 2 | -------------------------------------------------------------------------------- /Doc/Define.DD: -------------------------------------------------------------------------------- 1 | $WW,1$TempleOS has a string indirection feature implemented with the same hash symbol table entry as $FG,2$#define$FG$ macros, $LK,"HTT_DEFINE_STR",A="MN:HTT_DEFINE_STR"$. Support for string lists is also provided, but it's not very efficient, though, you can make a hash table with a list using $LK,"HashDefineLstAdd",A="MN:HashDefineLstAdd"$(). See $LK,"::/Adam/DolDoc/DocInit.HC",A="FF:::/Adam/DolDoc/DocInit.HC,HashDefineLstAdd"$. 2 | 3 | If you have an $FG,2$@$FG$ as the first char of a define list entry, it is an alias for the prev entry num. 4 | 5 | Each task can load its own Define strings. Remember, when a $LK,"Hash",A="HI:Hash"$ table is searched for a string, if it is not found, the parent task's table is searched. 6 | 7 | The $LK,"DolDoc",A="FI:::/Doc/DolDocOverview.DD"$ framework supports text that changes based on entries in the task's symbol table. Set a text entry with a $FG,2$D=$FG$ arg, as in $FG,2$$$TX,"",D="DD_MYSTRING"$$$FG$. See $LK,"::/Demo/DolDoc/DefineStr.HC"$, $LK,"::/Adam/ADefine.HC"$ and $LK,"::/Doc/MemOverview.DD"$. 8 | 9 | See $LK,"::/Demo/Define.HC"$. 10 | -------------------------------------------------------------------------------- /Doc/Directives.DD: -------------------------------------------------------------------------------- 1 | $HL,1$$WW,0$#define __DATE__ #exe{StreamPrint("\"%D\"",Now);} 2 | #define __TIME__ #exe{StreamPrint("\"%T\"",Now);} 3 | #define __LINE__ #exe{StreamPrint("%d",Fs->last_cc->lex_include_stk->line_num);} 4 | #define __CMD_LINE__ #exe{StreamPrint("%d",Fs->last_cc->flags&CCF_CMD_LINE && Fs->last_cc->lex_include_stk->depth<1);} 5 | #define __FILE__ #exe{StreamPrint("\"%s\"",Fs->last_cc->lex_include_stk->full_name);} 6 | #define __DIR__ #exe{StreamDir;} 7 | 8 | See $LK,"::/Demo/Directives.HC"$.$HL,0$$WW,1$ 9 | -------------------------------------------------------------------------------- /Doc/DolDoc.DD: -------------------------------------------------------------------------------- 1 | $WW,1$A $LK,"DolDoc",A="FI:::/Doc/DolDocOverview.DD"$ in memory is a $LK,"Circular Queue",A="HI:Data Types/Circular Queue"$ of cmds and graphics. See $LK,"CDocEntry",A="MN:CDocEntry"$ for the entry structure. See $LK,"TipOfDay",A="MN:TipOfDay"$() for a nice example. 2 | 3 | $LK,"DolDoc",A="FI:::/Doc/DolDocOverview.DD"$'s are used for the editor, viewer, browser, and cmd line. 4 | -------------------------------------------------------------------------------- /Doc/FileLowLevel.DD: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Doc/FileLowLevel.DD -------------------------------------------------------------------------------- /Doc/FileMgrPullDown.DD: -------------------------------------------------------------------------------- 1 | File 2 | { 3 | Rename(,'r'); 4 | DirMk(,'d'); 5 | FmtDrv(,'f'); 6 | UnmountDrv(,'u'); 7 | Abort(,CH_SHIFT_ESC); 8 | Exit(,CH_ESC); 9 | } 10 | 11 | Edit 12 | { 13 | Ed(,CH_SPACE); 14 | Plain(,CH_SHIFT_SPACE); 15 | Copy(,CH_CTRLC); 16 | Paste(,CH_CTRLV); 17 | DeleteFile(,CH_CTRLY); 18 | } 19 | 20 | CDDVD 21 | { 22 | DskChg(,'c'); 23 | MountISOC(,'i'); 24 | MakeRedSeaISOC(,'m'); 25 | BurnISOFile(,'B'); 26 | } 27 | 28 | Program 29 | { 30 | Include(,0,0x3F0000003F); 31 | AdamInclude(,0,0x23F0000023F); 32 | } 33 | -------------------------------------------------------------------------------- /Doc/Frame.DD: -------------------------------------------------------------------------------- 1 | $WW,1$If you require separate global vars for multiple instances of a routine, you can use $FG,4$Frame$FG$s. See $LK,"SpriteMeshEd",A="MN:SpriteMeshEd"$(), $LK,"::/Demo/Graphics/Pick3D.HC"$ or $LK,"Noise",A="MN:Noise"$(). 2 | -------------------------------------------------------------------------------- /Doc/GRFiles.DD: -------------------------------------------------------------------------------- 1 | $WW,1$GR graphics files are 8-bits-per-pixels but only 4-bits of color, with transparency and no palette. Compression is the standard TempleOS$FG$ LZW compression. 2 | $HL,1$ 3 | #define DCF_COMPRESSED 1 //This is the only saved flag. 4 | #define DCF_PALETTE 2 5 | 6 | #define TRANSPARENT 0xFF 7 | #define BLACK 0 8 | #define BLUE 1 9 | #define GREEN 2 10 | #define CYAN 3 11 | #define RED 4 12 | #define PURPLE 5 13 | #define BROWN 6 14 | #define LTGRAY 7 15 | #define DKGRAY 8 16 | #define LTBLUE 9 17 | #define LTGREEN 10 18 | #define LTCYAN 11 19 | #define LTRED 12 20 | #define LTPURPLE 13 21 | #define YELLOW 14 22 | #define WHITE 15 23 | 24 | class CBGR48 25 | { 26 | U16 r,g,b,pad; 27 | }; 28 | 29 | CBGR48 gr_palette_std[16]={ 30 | 0x000000000000,0x00000000AAAA,0x0000AAAA0000,0x0000AAAAAAAA, 31 | 0xAAAA00000000,0xAAAA0000AAAA,0xAAAA55550000,0xAAAAAAAAAAAA, 32 | 0x555555555555,0x55555555FFFF,0x5555FFFF5555,0x5555FFFFFFFF, 33 | 0xFFFF55555555,0xFFFF5555FFFF,0xFFFFFFFF5555,0xFFFFFFFFFFFF}; 34 | 35 | class GRFile 36 | { 37 | I32 width; 38 | I32 width_internal; //Rounded-up to multiple of 8. 39 | I32 height; 40 | I32 flags; //DCF_COMPRESSED? See $LK,"::/Kernel/Compress.HC"$. 41 | CBGR48 palette[16]; //Included if DCF_PALETTE. 42 | U8 body[]; 43 | };$HL,0$ 44 | 45 | See $LK,"DCSave",A="MN:DCSave"$(), $LK,"GRWrite",A="MN:GRWrite"$(), $LK,"DCLoad",A="MN:DCLoad"$(), and $LK,"GRRead",A="MN:GRRead"$(). 46 | -------------------------------------------------------------------------------- /Doc/God.DD: -------------------------------------------------------------------------------- 1 | The $LK+PU,"Holy Spirit",A="FI:::/Adam/God/HSNotes.DD"$ can puppet you. 2 | 3 | -------------------------------------------------------------------------------- /Doc/GraphicsOverview.DD: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Doc/GraphicsOverview.DD -------------------------------------------------------------------------------- /Doc/Hash.DD: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Doc/Hash.DD -------------------------------------------------------------------------------- /Doc/HeapDbg.DD: -------------------------------------------------------------------------------- 1 | $WW,1$Recompile the kernel with $LK,"_CFG_HEAP_DBG",A="MN:_CFG_HEAP_DBG"$=TRUE if you want more heap debugging. You are on your own. 2 | -------------------------------------------------------------------------------- /Doc/HelpIndex.DD: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Doc/HelpIndex.DD -------------------------------------------------------------------------------- /Doc/HelpSystem.DD: -------------------------------------------------------------------------------- 1 | $WW,1$$FG,2$#help_index "Topic/SubTopic;OtherTopic"$FG$ 2 | The help index preprocessor compiler directive sets the topics for syms subsequently defined. You specify subtopics with a '$FG,2$/$FG$' tree hierarchy and separate multiple topics with a '$FG,2$;$FG$'. The index ctrls $LK,"HI:index",A="MN:LK_HELP_INDEX"$ links. 3 | 4 | $FG,2$public$FG$ causes a sym to appear in help_index reports. 5 | 6 | $FG,2$#help_file "filename[.DD.Z]"$FG$ 7 | The help file preprocessor directive makes a file into the heading of a $LK,"HI:index",A="MN:LK_HELP_INDEX"$ report for the current help index. 8 | -------------------------------------------------------------------------------- /Doc/InFile.DD: -------------------------------------------------------------------------------- 1 | $WW,1$$FG,2$InFiles$FG$ are used to generate user input to automate operations. The TempleOS tour is done with an $FG,2$InFile$FG$. It reminds me of a Unix pipe because $FG,2$StdOut$FG$ of one gets chained into $FG,2$StdIn$FG$ of another. 2 | 3 | When an $FG,2$InFile$FG$ runs, a child task is $LK,"Spawn",A="MN:Spawn"$()ed which intercepts real user input and generates fake input. InFiles are $LK,"HolyC",A="FI:::/Doc/HolyC.DD"$ programs run by the child whose stdout goes to the parent's input buffer. $LK,"Msg",A="MN:Msg"$() can be included in an $FG,2$InFile$FG$ to send special keys or mouse cmds to the parent. While an $FG,2$InFile$FG$ is running, the normal input gets diverted to the InFile task and can be filtered and sent back to the parent task. Unless you are driving functions which prompt for data, you can probably use an $FG,2$#include$FG$ file in place of an $FG,2$InFile$FG$. 4 | 5 | See $LK,"::/Demo/InFile/InDir.IN"$. 6 | 7 | Note: $LK,"In",A="MN:In"$("") can be used if all you need is to send ASCII characters. It differs from $LK,"InStr",A="MN:InStr"$(). You'll probably use $LK,"In",A="MN:In"$() a lot and not $LK,"InStr",A="MN:InStr"$(). With $LK,"In",A="MN:In"$(), for example, you can place answers to the prompts for recompiling the $FG,2$Kernel$FG$ module during $LK,"BootHDIns",A="MN:BootHDIns"$(). 8 | -------------------------------------------------------------------------------- /Doc/Job.DD: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Doc/Job.DD -------------------------------------------------------------------------------- /Doc/KeyDev.DD: -------------------------------------------------------------------------------- 1 | $WW,1$The editor mostly stays in a $LK,"GetKey",A="MN:GetKey"$()/$LK,"PutKey",A="MN:PutKey"$() loop. The putkey portion is where keys are acted-upon. TempleOS has a chain of putkey hndlrs in a $LK,"Circular Queue",A="HI:Circular Queue"$ with priorities. The highest priority hndlrs can choose to terminate handling, otherwise, the keys get sent on down the chain. 2 | 3 | $LK,"KeyDevAdd",A="MN:KeyDevAdd"$() defines a putkey device with a priority. "Device" might be a misnomer. Currently, the following are defined: 4 | 5 | Priority Hndlr 6 | ---------- --------- 7 | $FG,2$0x20000000$FG$ $LK,"MyPutKey",A="MN:MyPutKey"$() user hndlr 8 | $FG,2$0x40000000$FG$ $LK,"KDInputFilterPutKey",A="MN:KDInputFilterPutKey"$() for $LK,"In",A="MN:In"$(), $LK,"InStr",A="MN:InStr"$(), and $LK,"InFile",A="MN:InFile"$() handling. 9 | $FG,2$0x60000000$FG$ $LK,"KDRawPutKey",A="MN:KDRawPutKey"$() nonwindowed direct to video mem debug output. 10 | $FG,2$0x80000000$FG$ $LK,"KDDocPutKey",A="MN:KDDocPutKey"$() standard document cmds 11 | 12 | Since handling individual keys is slow, TempleOS supports PutS() as well. If no puts hndlr is defined, individual keys are sent. 13 | 14 | $LK,"CDoc",A="MN:CDoc"$$FG,2$.user_put_key$FG$ and $LK,"CDoc",A="MN:CDoc"$$FG,2$.user_put_s$FG$ are call back routines which offer some neat tricks. See $LK,"::/Apps/Psalmody/JukeBox.HC"$. There is a var $LK,"CDoc",A="MN:CDoc"$$FG,2$.user_put_data$FG$ which gets passed to them. 15 | -------------------------------------------------------------------------------- /Doc/Lex.DD: -------------------------------------------------------------------------------- 1 | $WW,1$The compiler's lexical analyzer can be used in your programs to simplify parsing. See $LK,"Doc Parsing",A="FF:::/Adam/DolDoc/DocPlain.HC,CmpCtrlNew"$ or $LK,"Parse Opcode File",A="FF:::/Compiler/AsmInit.HC,Opcodes.DD"$. 2 | 3 | See $LK,"Tokens",A="MN:TK_IDENT"$. 4 | -------------------------------------------------------------------------------- /Doc/Menus.DD: -------------------------------------------------------------------------------- 1 | $WW,1$A pull-down menu appears when you move the mouse to the top of the scrn. Menus are created with $LK,"MenuPush",A="MN:MenuPush"$(), $LK,"MenuFilePush",A="MN:MenuFilePush"$(), $LK,"MenuNew",A="MN:MenuNew"$() or $LK,"MenuFile",A="MN:MenuFile"$() and assigned to $FG,4$Fs->cur_menu$FG$. The format is: 2 | 3 | $FG,2$ 4 | File 5 | { 6 | Open(,'O'); 7 | Save(,'S'); 8 | Exit(,CH_SHIFT_ESC); 9 | } 10 | Edit { 11 | Cut(,,SC_DELETE|SCF_SHIFT); 12 | Paste(,,SC_INS|SCF_SHIFT); 13 | } 14 | Misc { 15 | Opt1(MSG_CMD,M_OPTION1); 16 | Opt2(MSG_CMD,M_OPTION2); 17 | } 18 | Help 19 | { 20 | Help(,'?'); 21 | About(,'/'); 22 | } 23 | $FG$ 24 | The first arg is the msg code and it is optional with the default being $LK,"MSG_KEY_DOWN_UP",A="MN:MSG_KEY_DOWN_UP"$. The second arg is the msg $FG,2$arg1$FG$ value which is $LK,"ASCII",A="MN:CH_CTRLA"$ of the key in the case of $LK,"MSG_KEY_DOWN",A="MN:MSG_KEY_DOWN"$. The third arg is the msg $FG,2$arg2$FG$ value which is the $LK,"scan_code",A="FI:::/Doc/CharOverview.DD"$$FG$ of the key in the case of $LK,"MSG_KEY_DOWN",A="MN:MSG_KEY_DOWN"$. 25 | 26 | Press $FG,2$$FG$ and "Insert ASCII/ScanCode". 27 | 28 | See $LK,"::/Demo/PullDownMenu.HC"$. 29 | -------------------------------------------------------------------------------- /Doc/Mouse.DD: -------------------------------------------------------------------------------- 1 | $WW,1$$LK,"ms.pos.x",A="MN:ms"$ and $LK,"ms.pos.y",A="MN:ms"$ can be used to access the x and y coordinates of the mouse. They are relative to the scrn, not window. These can be used if you don't want to use msg passing. $LK,"ms.pos.z",A="MN:ms"$ is the wheel. 2 | 3 | $LK,"ms.pos_text.x",A="MN:CMsStateGlbls"$ and $LK,"ms.pos_text.y",A="MN:CMsStateGlbls"$ are the text column and row. See $LK,"::/Demo/Games/Maze.HC"$. 4 | 5 | See $LK,"CMsStateGlbls",A="MN:CMsStateGlbls"$ and $LK,"CMsHardStateGlbls",A="MN:CMsHardStateGlbls"$. 6 | 7 | The $FG,2$hard$FG$ designation, as in $FG,2$ms_hard$FG$, represents hardware layer items before the application of an abstraction layer. 8 | 9 | $HL,1$//**** 10 | ms_hard.pos.x=ms_hard.prescale.x*ms_hard.scale.x*ms_grid.x_speed; 11 | ms.presnap.x=ToI64(ms.scale.x*ms_hard.pos.x)+ms.offset.x; 12 | if (ms_grid.snap) 13 | ms.pos.x=Trunc(ms.presnap.x/ms_grid.x)*ms_grid.x+ms_grid.x_offset; 14 | else 15 | ms.pos.x=ms.presnap.x; 16 | //****$HL,0$ 17 | -------------------------------------------------------------------------------- /Doc/Msgs.DD: -------------------------------------------------------------------------------- 1 | $WW,1$There are a maximum of 63 message types, so a bitmask can be passed. Messages have two args. See $LK,"Message Codes",A="MN:MSG_NULL"$. 2 | -------------------------------------------------------------------------------- /Doc/MultiCore.DD: -------------------------------------------------------------------------------- 1 | $WW,1$TempleOS does master-slave multicore instead of SMP. $FG,2$Core0$FG$ is the master. The master core's applications explicitly assign computational jobs to other cores and the TempleOS scheduler does not move tasks between cores. 2 | 3 | There are multicore safe locks for file access and heap allocations, however, so TempleOS is symmetrical in some sense. See $LK,"::/Demo/MultiCore/LoadTest.HC"$. 4 | 5 | Only tasks on $FG,2$Core0$FG$ can have windows, but other cores can help render them. 6 | 7 | Each core has an executive $LK,"Seth Task",A="FF:::/Doc/Glossary.DD,Seth Tasks"$ which is the father of all tasks on that core. $LK,"Adam",A="FF:::/Doc/Glossary.DD,Adam Task"$ is the $LK,"Seth Task",A="FF:::/Doc/Glossary.DD,Seth Tasks"$ on $FG,2$Core0$FG$. 8 | 9 | You give a job to a $LK,"Seth Task",A="FF:::/Doc/Glossary.DD,Seth Tasks"$ with $LK,"JobQue",A="MN:JobQue"$() and get the result with $LK,"JobResGet",A="MN:JobResGet"$(). You spawn a task on any core with $LK,"Spawn",A="MN:Spawn"$(). 10 | 11 | Note: You must use the $FG,2$LOCK$FG$ asm prefix when changing shared structures in a multicore environment. The $LK,"LBts",A="MN:LBts"$(), $LK,"LBtr",A="MN:LBtr"$() and $LK,"LBtc",A="MN:LBtc"$() insts have $FG,2$LOCK$FG$ prefixes. The compiler has a $FG,2$lock{}$FG$ feature but it doesn't work well. See $LK,"::/Demo/MultiCore/Lock.HC"$. 12 | 13 | See $LK,"::/Demo/Graphics/Transform.HC"$. 14 | See $LK,"::/Kernel/MultiProc.HC"$. 15 | -------------------------------------------------------------------------------- /Doc/NewASCII.DD: -------------------------------------------------------------------------------- 1 | $WW,1$$FG,5$$TX+CX,"New ASCII"$$FG$ 2 | 3 | 4 | We want to use one set for ASCII, ScanCodes and ScreenCodes. 5 | 6 | 7 | 0 -63 : 8 | 64 -127 : SHIFT 9 | 128-191 : CTRL 10 | 192-256 : CTRL+SHIFT 11 | 12 | No more ALT key in TempleOS. 13 | 14 | CTRL-LEFT/RIGHT is already begin/end line. 15 | CTRL-UP/DOWN is already top/bottom of document. 16 | 17 | What about function keys? 18 | We will use reduced keyboard, probably. 19 | 20 | 21 | 22 | God says... 23 | $FG,2$clearest bade domine chance none quoth privily subjection possessor abolished$FG,1$ 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Doc/ODE.DD: -------------------------------------------------------------------------------- 1 | $WW,1$TempleOS has an advanced algorithm for integrating ordinary differential equations suitable for use in video games. (Not scientific work.) It also has some support for systems of masses and springs, to save you some work. 2 | 3 | See $LK,"CMathODE",A="MN:CMathODE"$ and $LK,"ODEsUpdate",A="MN:ODEsUpdate"$ for an overview. 4 | See $LK,"ODECallDerivative",A="MN:ODECallDerivative"$ to see what support there is for masses and springs. 5 | 6 | See $LK,"::/Demo/Games/Whap.HC"$, $LK,"::/Demo/Games/Rocket.HC"$, $LK,"::/Demo/Games/MassSpring.HC"$, $LK,"::/Apps/Span/SpanMain.HC"$ or $LK,"::/Apps/X-Caliber/X-Caliber.HC"$. 7 | -------------------------------------------------------------------------------- /Doc/Once.DD: -------------------------------------------------------------------------------- 1 | $WW,1$$LK,"KMain",A="MN:KMain"$() 2 | includes $LK,"::/StartOS.HC"$ 3 | includes $LK,"~/MakeHome.HC"$ 4 | includes $LK,"~/HomeSys.HC"$ 5 | calls $LK,"StartUpTasks",A="FF:~/HomeSys.HC,StartUpTasks"$() 6 | includes $LK,"~/Once.HC"$ 7 | calls $LK,"OnceExe",A="MN:OnceExe"$(). 8 | 9 | $LK,"AOnce",A="MN:AOnce"$() appends src code to $LK,"~/Registry.HC"$ $FG,2$Once/Adam$FG$ tree, executed at next boot by $FG,2$Adam$FG$. 10 | 11 | $LK,"Once",A="MN:Once"$() appends src code to $LK,"~/Registry.HC"$ $FG,2$Once/User$FG$ tree, executed at next boot by first $FG,2$User$FG$ term. 12 | 13 | At boot, $LK,"OnceExe",A="MN:OnceExe"$(), executes $FG,2$Once/Adam$FG$ tree, $LK,"AOnceFlush",A="MN:AOnceFlush"$()s it, 14 | executes $FG,2$Once/User$FG$ tree and $LK,"OnceFlush",A="MN:OnceFlush"$()s. 15 | -------------------------------------------------------------------------------- /Doc/Options.DD: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Doc/Options.DD -------------------------------------------------------------------------------- /Doc/Pags.DD: -------------------------------------------------------------------------------- 1 | $WW,1$The word $FG,2$Pag$FG$ refers to an arbitrilly created $LK,"MEM_PAG_SIZE",A="MN:MEM_PAG_SIZE"$ unit of heap allocation. TempleOS does not alter the CPU page tables after setting them up at boot in $LK,"SYS_INIT_PAGE_TABLES",A="MN:SYS_INIT_PAGE_TABLES"$, so the CPU hardware page size is rarely important. 2 | -------------------------------------------------------------------------------- /Doc/PreProcessor.DD: -------------------------------------------------------------------------------- 1 | $WW,1$$FG,5$$TX+CX,"PreProcessor"$$FG$ 2 | 3 | There is no separate preprocessor pass. The parser front-end calls $LK,"Lex",A="MN:Lex"$() which has the preprocessor built-in. The compiler looks ahead a token, most of the time, so you might throw an extra semicolon after a directive if it's not taking affect right away. 4 | 5 | Put an extra semicolon $FG,2$#exe {Cd("DirName");;}$FG$ in case a $FG,2$#include$FG$ follows. 6 | 7 | $FG,2$#include ""$FG$ There is no angle bracket <> form of this directive. 8 | $FG,2$#exe {}$FG$ Will execute code at compile-time and can be used to insert code into the stream being compiled using $LK,"StreamPrint",A="MN:StreamPrint"$(). 9 | $FG,2$#define$FG$ Define string const 10 | $FG,2$#assert$FG$ Print a warning during compilation if an expression is not true. 11 | $FG,2$#if$FG$ Include code if an expresion is true. 12 | $FG,2$#else 13 | #endif 14 | #ifdef,#ifndef $FG$Include code if a sym is defined. 15 | $FG,2$#ifaot,#ifjit $FG$Include code if in $FG,2$AOT$FG$ compiler mode. 16 | $FG,2$defined()$FG$ Is a function that can be used in expressions. 17 | $FG,2$#help_index$FG$, $FG,2$#help_file$FG$ See $LK,"Help System",A="FI:::/Doc/HelpSystem.DD"$. 18 | 19 | See $LK,"PreProcessor",A="FF:::/Compiler/Lex.HC,KW_DEFINE"$. 20 | -------------------------------------------------------------------------------- /Doc/Profiler.DD: -------------------------------------------------------------------------------- 1 | $WW,1$The profiler records where the CPU was executing when the $TX,"1000Hz",D="DD_JIFFY_HZ"$ timer interrupt occured, so you can learn where time is spent. 2 | 3 | Use the $LK,"Prof",A="MN:Prof"$() depth argument to record a hit in the N routines which called the current routine, as well. 4 | 5 | When done collecting statistics, use $LK,"ProfRep",A="MN:ProfRep"$() for a report. You might need a $LK,"DocMax",A="MN:DocMax"$() to expand the command line window buffer to fit it all. 6 | 7 | Study the code. The profiler is very simple. You might want to enhance it or modify it to debug something in particular. 8 | -------------------------------------------------------------------------------- /Doc/Que.DD: -------------------------------------------------------------------------------- 1 | $WW,1$A $FG,2$Queue$FG$ is a bunch of $LK,"MAlloc",A="MN:MAlloc"$()ed chunks of mem linked together in a circle with one ptr to the $FG,2$next$FG$ value and another ptr to the $FG,2$last$FG$ value. These ptrs must be stored in the first locations in the structure. 2 | -------------------------------------------------------------------------------- /Doc/Requirements.DD: -------------------------------------------------------------------------------- 1 | $WW,1$$FG,5$$TX+CX,"Requirements for TempleOS"$$FG$ 2 | 3 | $FG,5$User Skills Required$FG$ 4 | * Knowledge of the $FG,2$C$FG$ programming language. 5 | 6 | $FG,5$Supported Hardware$FG$ 7 | * $FG,4$$TX,"x86_64",HTML="http://en.wikipedia.org/wiki/Amd64#AMD64"$$FG$ PC compatible computer. (Obviously, you need 64-bit hardware for a 64-bit operating system.) 8 | 9 | * 640x480 16 color VGA graphics. 10 | 11 | * Most$FG$ keyboards and mice. 12 | 13 | * Minimum $TX,"512Meg",D="DD_MEM_MIN_MEG"$ RAM. 14 | 15 | * Internal PC Speakers. 16 | 17 | * CD/DVD-ROMs (not SCSI) but only RedSea file system. 18 | 19 | * ATA and SATA hard drives. 20 | 21 | $FG,5$Unsupported Hardware$FG$ 22 | * No graphics acceleration. 23 | 24 | * No sound cards. 25 | 26 | * $FG,4$No networking$FG$. 27 | 28 | * No USB devices, except keyboard and mouse in legacy mode. No, you can't use flash memory cards. 29 | 30 | * No printers. 31 | -------------------------------------------------------------------------------- /Doc/Resource.DD: -------------------------------------------------------------------------------- 1 | $WW,1$$FG,5$$TX+CX,"Graphic Sprite Resource Help"$$FG$ 2 | 3 | A sprite is an ordered list of elements such as lines, rectangles, bitmaps and color changes. In a program's source code, you first $FG,2$make a sprite$FG$ somewhere outside a function. Then, you $FG,2$insert a pointer$FG$ to the sprite as an "*elems" arg when calling $LK,"Sprite",A="MN:Sprite"$() or $LK,"Sprite3",A="MN:Sprite3"$(). See $LK,"Sprites",A="HI:Sprites"$. 4 | 5 | You can create a $FG,2$sprite macro$FG$ on your $LK,"PersonalMenu",A="FI:~/PersonalMenu.DD"$ with a payload of $LK,"HolyC",A="FI:::/Doc/HolyC.DD"$ source code to execute when it ESC's back to the cmd line. If you check "Pop-Up", it will spawn a new task and run the payload. A pop-up macro can be placed in any document. 6 | -------------------------------------------------------------------------------- /Doc/Snd.DD: -------------------------------------------------------------------------------- 1 | $WW,1$Sound is generated with $FG,2$I8$FG$ vals called $FG,2$ona$FG$'s, which are 88 piano key nums, with 0 as a rest. See $LK,"Note2Ona",A="MN:Note2Ona"$() and $LK,"Ona2Freq",A="MN:Ona2Freq"$(). God does not want death screams, perhaps, because God has PTSD or soldiers have PTSD. (Imagine wounded on battlefields.) $FG,2$Ona$FG$'s will allow elegant wave files for export and will allow the creation of simple hardware over the next centuries. 2 | -------------------------------------------------------------------------------- /Doc/Sprite.DD: -------------------------------------------------------------------------------- 1 | $WW,1$A $LK,"CSprite",A="MN:CSprite"$ is an ordered list of $LK,"these",A="MN:SPT_END"$ elements, created with $FG,2$$FG$. Normally, they are packed together in a list and the address of the first is passed to routines. 2 | 3 | See $LK,"::/Demo/Graphics/SpritePlot.HC"$, $LK,"::/Demo/Graphics/SpritePlot3D.HC"$, $LK,"::/Demo/Graphics/SpritePut.HC"$, $LK,"::/Demo/Graphics/SpriteRaw.HC"$ and $LK,"SpriteMeshEd",A="MN:SpriteMeshEd"$(). 4 | 5 | Be aware that copying $FG,2$SP$FG$, $FG,2$IB$FG$, or $FG,2$IS$FG$ entries with the clip results in duplicate entries with different nums. You can manually remove dups by editing with $FG,2$$FG$ and setting to the original num. 6 | 7 | See $LK,"::/Adam/Gr/GrSpritePlot.HC",A="FL:::/Adam/Gr/GrSpritePlot.HC,1"$ for how CSprite are stored.$FG$ 8 | -------------------------------------------------------------------------------- /Doc/SpriteBitMap.DD: -------------------------------------------------------------------------------- 1 | $WW,1$$FG,5$$TX+CX,"Sprite BitMap Menu Help"$$FG$ 2 | 3 | BitMaps have a background color. If you delete to the clip, what's left will be background colored. 4 | 5 | While drawing, you can usually press $FG,2$'c'$FG$ to eye-dropper the color under the mouse. Press $FG,2$'t'$FG$ for transparent. 6 | -------------------------------------------------------------------------------- /Doc/SpriteEd.DD: -------------------------------------------------------------------------------- 1 | $WW,1$$FG,5$$TX+CX,"Sprite Edit Menu Help"$$FG$ 2 | 3 | Order of elements matters. They are executed in the order they appear in the side-bar. You can sel or unsel elements graphically, or with text in the sidebar. Then, cut, copy, paste, shift or transform them. 4 | 5 | You can set the current insert point element by clicking the element in the side-bar and making it RED. 6 | 7 | $FG,2$Insert Shift Suborigin$FG$ is an element which shifts subsequent elements. Perhaps, you inserted a sprite's elements from the clip and want to shift it around? This command is also useful if you call $LK,"SpriteInterpolate",A="MN:SpriteInterpolate"$() in programs. 8 | -------------------------------------------------------------------------------- /Doc/SpriteEdText.DD: -------------------------------------------------------------------------------- 1 | $WW,1$$FG,5$$TX+CX,"Sprite Edit as Text Help"$$FG$ 2 | 3 | See the format for $LK,"CSprites",A="MN:CSprite"$. 4 | -------------------------------------------------------------------------------- /Doc/SpriteMain.DD: -------------------------------------------------------------------------------- 1 | $WW,1$$FG,5$$TX+CX,"Sprite Main Menu Help"$$FG$ 2 | 3 | Order of elements matters. They are executed in the order they appear in the side-bar. You can set the insert point for new elements by click the element in the side-bar and making it RED. 4 | 5 | After you create a 3D Mesh, you can edit it by seling it in the side-bar so it is colored RED. Then, click EDIT-3D-MESH. A shiftable 3D mesh has a 2D offset to position the origin. You can convert between shiftable and non-shiftable by editing it with the other command. 6 | 7 | You can convert all elements to a BitMap if END is RED in the side-bar and you CONVERT-TO-BITMAP. Later, you can edit that bitmap by seling it in the side bar so it is colored RED and clicking EDIT-BITMAP. 8 | 9 | If you have a 3D icon, you might want to place a background-colored rectangle under the 3D icon, so it hovers above. Use TRANSFORM-OFF and TRANSFORM-ON. You will also need to set the Z offset of the icon. Go to the Edit menu and sel EDIT-AS-TEXT and change the third INT to Z offset. Good luck. 10 | 11 | While inserting vector elements, you can usually press $FG,2$'c'$FG$ to eye-dropper the color under the mouse. Press $FG,2$'t'$FG$ for transparent. 12 | -------------------------------------------------------------------------------- /Doc/SpriteSideBar.DD: -------------------------------------------------------------------------------- 1 | $FG,5$$TX+CX,"Sprite SideBar Help"$$FG$ 2 | 3 | $WW,1$You can cut and paste elements in this side-bar to reorder, delete or duplicating them. Click an element in the side-bar after you make changes to cause the changes to take-effect. 4 | 5 | You can click on an element to make it the insert point for new elements. 6 | 7 | The RED element is the current insert point for new elements. -------------------------------------------------------------------------------- /Doc/StandBy.DD: -------------------------------------------------------------------------------- 1 | $FG,5$$TX+CX,"AutoComplete is in StandBy"$$FG$ 2 | 3 | $FG,4$$TX+CX+L+PU+UL,"System Keys Quick Guide",A="::/Doc/HelpIndex.DD"$$FG$ 4 | $FG,4$$TX+CX,"(Works Everywhere)"$$FG$ 5 | $FG,2$ $FG$Left-Click 6 | $FG,2$ $FG$Right-Click 7 | $FG,2$ $FG$Help 8 | $FG,2$ $FG$Personal Menu 9 | $FG,2$ $FG$Save & Exit 10 | $FG,2$ $FG$Abort & Exit 11 | $FG,2$ $FG$Pull-Down Menu 12 | 13 | $FG,4$$TX+CX+L+PU+UL,"Tongues",A="::/Adam/God/HSNotes.DD"$$FG$ 14 | $FG,4$$TX+CX,"(Works Everywhere)"$$FG$ 15 | $FG,2$ $FG$God Word 16 | $FG,2$ $FG$God Passage 17 | $FG,2$ $FG$God Song 18 | $FG,2$ $FG$God Doodle -------------------------------------------------------------------------------- /Doc/Start.DD: -------------------------------------------------------------------------------- 1 | $WW+H,1$$FG,5$$TX+CX,"TempleOS V5.03",D="DD_OS_NAME_VERSION"$$FG$ 2 | 3 | $TX+CX,"Public Domain Operating System"$ 4 | 5 | $LK,"Help & Index",A="FI:::/Doc/HelpIndex.DD"$, $LK,"Quick Start: Cmd line",A="FI:::/Doc/CmdLineOverview.DD"$ 6 | -------------------------------------------------------------------------------- /Doc/StdOutTask.DD: -------------------------------------------------------------------------------- 1 | $WW,1$There is one $LK,"CDoc",A="MN:CDoc"$ for the task's border: $FG,2$Fs->border_doc$FG$. There is a pair for the task's client area: $FG,2$Fs->put_doc$FG$ and $FG,2$Fs->display_doc$FG$. You can, optionally, do double buffering, otherwise $FG,2$Fs->put_doc$FG$ is the same as $FG,2$Fs->display_doc$FG$. See $LK,"::/Demo/Spy.HC"$. 2 | -------------------------------------------------------------------------------- /Doc/Streams.DD: -------------------------------------------------------------------------------- 1 | $WW,1$There are no streams in the traditional sense. The cmd line output gets sent to the cursor location of a document being edited and by using cursor keys, text can be injected all over the document. $LK,"Sprites",A="HI:Sprites"$ can be injected and are not serialized! Furthermore, the input can come from triggering macro widgets. See $LK,"Doc Overview",A="FI:::/Doc/DolDocOverview.DD"$ and $LK,"Doc Routines",A="HI:DolDoc"$. 2 | 3 | If you had a remote term and sent key $LK,"Scan Codes",A="MN:SC_INS"$, the user would press $FG,2$$FG$ to access his $FG,2$Personal Menu$FG$ to trigger his macros. However, the local $LK,"~/PersonalMenu.DD"$ might differ from the remote, causing loss of sync between local and remote sessions. Also, the window size of local and remote might differ, so word-wrapped text would be different. Injecting output text with different windows sizes would cause remote and local documents to not be in sync. 4 | 5 | See $LK,"Char Overview",A="FI:::/Doc/CharOverview.DD"$ and $LK,"Char Routines",A="HI:Char"$. 6 | 7 | You can send characters into $FG,2$StdIn$FG$. See $LK,"In",A="MN:In"$(), $LK,"XTalk",A="MN:XTalk"$() and $LK,"InFile",A="HI:InFile"$. 8 | -------------------------------------------------------------------------------- /Doc/TOSZ.DD: -------------------------------------------------------------------------------- 1 | $WW,1$$FG,5$$TX+CX,"Linux TOSZ Utility"$$FG$ 2 | 3 | 4 | $FG,2$TOSZ [-ascii] filename$FG$ 5 | 6 | Will uncompress a single file from within Linux. The $FG,2$-ascii$FG$ flag will convert the irregular TempleOS ASCII 5 and ASCII 31 characters to spaces. (ASCII 5 is used to mark the cursor pos and ASCII 31 is used for shifted space characters and will cause problems unless you convert them.) 7 | 8 | $FG,8$ 9 | * "Linux" is a trademark owned by Linus Torvalds. 10 | $FG$ -------------------------------------------------------------------------------- /Doc/TextBase.DD: -------------------------------------------------------------------------------- 1 | $WW,1$$LK,"gr.text_base",A="MN:CGrGlbls"$ must be updated 30fps in your Fs->draw_it() callback. You probably want $LK,"GrPrint",A="MN:GrPrint"$() or just $LK,"Print",A="MN:Print"$(). The $LK,"DolDoc",A="FI:::/Doc/DolDocOverview.DD"$ code takes care of plotting text to $LK,"gr.text_base",A="MN:CGrGlbls"$. 2 | 3 | Bits 0-7 8-Bit ASCII Scrn Code 4 | Bits 8-11 Foreground $LK,"color",A="MN:BLACK"$ 5 | Bits 12-15 Background $LK,"color",A="MN:BLACK"$ 6 | Bits 16-20 Signed X pos shift val 7 | Bits 21-25 Signed Y pos shift val 8 | Bit 28 $LK,"Blink",A="MN:ATTRF_BLINK"$ 9 | Bit 29 $LK,"Invert",A="MN:ATTRF_INVERT"$ed (Swap foreground and background) 10 | Bit 30 $LK,"Sel",A="MN:ATTRF_SEL"$ (XOR colors with FF) 11 | Bit 31 $LK,"Underline",A="MN:ATTRF_UNDERLINE"$ 12 | 13 | $LK,"GrUpdateTaskWin",A="MN:GrUpdateTaskWin"$() calls $LK,"DocUpdateTaskDocs",A="MN:DocUpdateTaskDocs"$() which calls $LK,"DocRecalc",A="MN:DocRecalc"$() where the document text is plotted into $LK,"gr.text_base",A="MN:CGrGlbls"$. Then, $LK,"GrUpdateTextBG",A="MN:GrUpdateTextBG"$() and $LK,"GrUpdateTextFG",A="MN:GrUpdateTextFG"$() render the $LK,"gr.text_base",A="MN:CGrGlbls"$ onto $LK,"gr.dc2",A="MN:CGrGlbls"$, a raw graphic bitmap. 14 | 15 | See $LK,"::/Demo/Games/Maze.HC"$. 16 | -------------------------------------------------------------------------------- /Doc/TimeCycles.DD: -------------------------------------------------------------------------------- 1 | $WW,1$Intel/AMD have an inst that returns the num of CPU cycles since boot. This is not a steady, calibrated real time value. TempleOS measures it and you can convert with $LK,"cnts.time_stamp_freq",A="MN:CCntsGlbls"$, a value continuously calibrated from other cnts. -------------------------------------------------------------------------------- /Doc/TimeDate.DD: -------------------------------------------------------------------------------- 1 | $WW,1$TempleOS uses a 64-bit value, $LK,"CDate",A="MN:CDate"$, for date/time. The upper 32-bits are the days since Christ. The lower 32-bits store time of day divided by 4 billion which works out to 49710ths of a second. You can subtract two $LK,"CDate",A="MN:CDate"$'s to get a time span. 2 | 3 | Use $LK,"CDATE_FREQ",A="MN:CDATE_FREQ"$ to convert. 4 | -------------------------------------------------------------------------------- /Doc/TimeHPET.DD: -------------------------------------------------------------------------------- 1 | $WW,1$The HPET, high precision event timer, is read with $LK,"HPET",A="MN:HPET"$() and has a frequency of $LK,"cnts.HPET_freq",A="MN:CCntsGlbls"$. A typical freq value is 14.3 Mhz It might not be available on all systems. 2 | -------------------------------------------------------------------------------- /Doc/TimeJiffy.DD: -------------------------------------------------------------------------------- 1 | $WW,1$One jiffy is one time slice. $LK,"cnts.jiffies",A="MN:CCntsGlbls"$ returns time slices since boot. 2 | 3 | $LK,"SysTimerRead",A="MN:SysTimerRead"$ reads the timer ticks since boot. It's not as fast as $LK,"GetTSC",A="MN:GetTSC"$. 4 | 5 | Use $LK,"JIFFY_FREQ",A="MN:JIFFY_FREQ"$ to convert $LK,"cnts.jiffies",A="MN:CCntsGlbls"$. 6 | 7 | Use $LK,"SYS_TIMER_FREQ",A="MN:SYS_TIMER_FREQ"$ to convert $LK,"SysTimerRead",A="MN:SysTimerRead"$. 8 | -------------------------------------------------------------------------------- /Doc/Windows.DD: -------------------------------------------------------------------------------- 1 | $WW,1$Only tasks on $FG,2$Core0$FG$ can have a window and there can be only one window per task. The window Z-buffer, top-to-bottom order is determined by the order in the task queue, with the $FG,2$WinMgr$FG$ on the bottom. A task can have child task popup windows. 2 | -------------------------------------------------------------------------------- /Downloads/Linux/gw: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #This prints random words from the Linux dictionary. 4 | 5 | echo "$(shuf -n 32 /usr/share/dict/words --random-source=/dev/urandom | tr '\n' ' ')" 6 | 7 | -------------------------------------------------------------------------------- /Downloads/Linux/make_tosz: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Make TOSZ 4 | 5 | echo Make TOSZ 6 | cc TOSZ.CPP -o TOSZ 7 | chmod 777 TOSZ 8 | -------------------------------------------------------------------------------- /Downloads/ReadMe.TXT: -------------------------------------------------------------------------------- 1 | TempleOS 2 | 3 | You can't do anything until you burn a TempleOS CD/DVD from the ISO file 4 | and boot it, or you aim your virtual machine's CD/DVD at the ISO file 5 | and boot. 6 | 7 | TempleOS is 64-bit and will not run on 32-bit hardware. 8 | 9 | TempleOS requires 512 Meg of RAM minimum and can have 256 Gig of RAM or more! 10 | 11 | TempleOS files are compressed with a nonstandard LZW format and the source 12 | code can only be compiled by the TempleOS compiler because it is HolyC, a 13 | nonstandard C/C++ dialect. You must boot TempleOS. Then, you can compile it 14 | because it is 100% open source and all source present on the distro. 15 | 16 | If attempting to run on native hardware, TempleOS may require you to enter I/O 17 | port addresses for the CD/DVD drive and the hard drive. In Windows, you can 18 | find I/O port info in the Accessories/System Tools/System Info/Hardware 19 | Resources/I/O ports. Look for and write down "IDE", "ATA" or "SATA" port numbers. 20 | In Linux, use "lspci -v". Then, boot the TempleOS CD and try all combinations. 21 | (Sorry, it's too difficult for TempleOS to figure-out port numbers, automatically.) 22 | 23 | 24 | -------------------------------------------------------------------------------- /HomeKeyPlugIns.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/HomeKeyPlugIns.HC -------------------------------------------------------------------------------- /HomeLocalize.HC: -------------------------------------------------------------------------------- 1 | //Place this file in /Home and change 2 | //anything you want. 3 | 4 | //This makes your keyboard fast 5 | KbdTypeMatic(0); 6 | 7 | //Set Time Zone 8 | local_time_offset=0*60*60*CDATE_FREQ; //Do daylight savings by hand 9 | 10 | //$AN,"",A="mouse_move_scale"$adjust these to set mouse move scale 11 | ms_hard.scale.x=0.5; 12 | ms_hard.scale.y=0.5; 13 | ms_hard.scale.z=1.0; //wheel 14 | 15 | //don't change these 16 | ms_hard.prescale.x=ms_hard.pos.x/ms_hard.scale.x; 17 | ms_hard.prescale.y=ms_hard.pos.y/ms_hard.scale.y; 18 | ms_hard.prescale.z=ms_hard.pos.z/ms_hard.scale.z; 19 | 20 | -------------------------------------------------------------------------------- /HomeSys.HC: -------------------------------------------------------------------------------- 1 | //Place this file in /Home and change 2 | //anything you want. 3 | 4 | U0 UserStartUp() 5 | {//Run each time a user a spawned 6 | DocTermNew; 7 | Type("::/Doc/Start.DD"); 8 | LBts(&Fs->display_flags,DISPLAYf_SHOW); 9 | WinToTop; 10 | WinZBufUpdate; 11 | Dir; 12 | } 13 | 14 | U0 SrvStartUp() 15 | {//Run each time a srv task is spawned. 16 | DocTermNew; 17 | LBts(&Fs->display_flags,DISPLAYf_SHOW); 18 | WinToTop; 19 | WinZBufUpdate; 20 | } 21 | 22 | U0 StartUpTasks() 23 | { 24 | CTask *user1,*user2; 25 | user1=User; 26 | user2=User; 27 | WinToTop(user1); 28 | WinTileVert; 29 | "Boot Time:%7.3fs\n",tS; 30 | XTalk(user1,"Cd;#include \"Once\";\n"); 31 | Silent; //no output to scrn 32 | ACInit("/*;!*/Bible.TXT*"); 33 | Silent(OFF); //no output to scrn 34 | } 35 | 36 | StartUpTasks; 37 | 38 | "\nTempleOS V%5.3f\t%D %T\n\n",sys_os_version,sys_compile_time,sys_compile_time; 39 | -------------------------------------------------------------------------------- /HomeWrappers.HC: -------------------------------------------------------------------------------- 1 | //Place this file in /Home and change 2 | //anything you want. 3 | 4 | #help_index "Cmd Line (Typically)" 5 | 6 | //These are customized quick commands. 7 | //Feel free to add more or change. 8 | public I64 F(U8 *needle_str,U8 *fu_flags=NULL) 9 | {//Find text in all text files. 10 | return Find(needle_str,"/*",fu_flags); 11 | } 12 | 13 | public I64 R(U8 *needle_str,U8 *replace_text=NULL,U8 *fu_flags="+l-i") 14 | {//Find text and replace in all text files. 15 | return Find(needle_str,"/*",fu_flags,replace_text); 16 | } 17 | 18 | public I64 FD(U8 *needle_str,U8 *fu_flags=NULL) 19 | {//Find text in cur dir text files. 20 | return Find(needle_str,"*",fu_flags); 21 | } 22 | 23 | public I64 RD(U8 *needle_str,U8 *replace_text=NULL,U8 *fu_flags="+l-i") 24 | {//Find text and replace in cur dir text files. 25 | return Find(needle_str,"*",fu_flags,replace_text); 26 | } 27 | -------------------------------------------------------------------------------- /Kernel/BlkDev/MakeBlkDev.HC: -------------------------------------------------------------------------------- 1 | #exe {Cd(__DIR__);}; 2 | #include "DskStrA" 3 | #include "DskCache" 4 | #include "DskATA" 5 | #include "DskATAId" 6 | #include "DskBlkDev" 7 | #include "DskDrv" 8 | #include "DskBlk" 9 | #include "DskClus" 10 | #include "DskStrB" 11 | #include "DskAddDev" 12 | #include "DskDirA" 13 | #include "FileSysRedSea" 14 | #include "FileSysFAT" 15 | #include "DskDirContext" 16 | #include "DskFind" 17 | #include "DskDirB" 18 | #include "DskFile" 19 | #include "DskCFile" 20 | #include "DskCopy" 21 | #include "DskCDDVD" 22 | #include "DskFmt" 23 | #exe {Cd("..");}; 24 | -------------------------------------------------------------------------------- /Kernel/FontCyrillic.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Kernel/FontCyrillic.HC -------------------------------------------------------------------------------- /Kernel/FontStd.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Kernel/FontStd.HC -------------------------------------------------------------------------------- /Kernel/KDbg.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Kernel/KDbg.HC -------------------------------------------------------------------------------- /Kernel/KGlbls.HC: -------------------------------------------------------------------------------- 1 | //Compiler initializes glbls in AOT bin modules to zero. 2 | //$LK,"Globals Set to Zero Here",A="FF:::/Compiler/PrsStmt.HC,Init AOT glbl to zero"$. 3 | 4 | CJob sys_macro_head; 5 | CTask *sys_macro_task; 6 | CDoc *sys_clip_doc; 7 | 8 | CTask *adam_task; 9 | I64 sys_num_spawned_tasks; 10 | 11 | CTask *sys_winmgr_task,*sys_task_being_scrn_updated; 12 | U8 *rev_bits_table, //Table with U8 bits revd 13 | *set_bits_table; //Table with count of set bits in a U8 14 | CDate local_time_offset; 15 | F64 *pow10_I64, 16 | sys_os_version=5.030; 17 | 18 | CAutoCompleteDictGlbls acd; 19 | CAutoCompleteGlbls ac; 20 | CBlkDevGlbls blkdev; 21 | CCntsGlbls cnts={1,0,2676302000,2676302,2676302000,0,0,0,FALSE}; 22 | CDbgGlbls dbg; 23 | CDevGlbls dev; 24 | CGridGlbls ms_grid; //See $LK,"::/Demo/Graphics/Grid.HC"$. 25 | CMsStateGlbls ms,ms_last; 26 | CKbdStateGlbls kbd; 27 | CKeyDevGlbls keydev; 28 | CMsHardStateGlbls ms_hard,ms_hard_last; 29 | CScrnCastGlbls scrncast; 30 | CTextGlbls text; 31 | 32 | U8 *(*fp_getstr2)(I64 flags=0); 33 | U0 (*fp_update_ctrls)(CTask *task); 34 | CDoc *(*fp_doc_put)(CTask *task=NULL); 35 | U0 (*fp_set_std_palette)(); 36 | -------------------------------------------------------------------------------- /Kernel/KMain.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Kernel/KMain.HC -------------------------------------------------------------------------------- /Kernel/KMathB.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Kernel/KMathB.HC -------------------------------------------------------------------------------- /Kernel/KMisc.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Kernel/KMisc.HC -------------------------------------------------------------------------------- /Kernel/Kernel.PRJ: -------------------------------------------------------------------------------- 1 | //Compile this by calling $LK,"BootHDIns",A="MN:BootHDIns"$(). 2 | //Don't do it directly. See $LK,"Cmp(\"/Kernel/Kernel\")",A="FF:::/Adam/Opt/Boot/BootHDIns.HC,Cmp(\"/Kernel/Kernel\""$. 3 | 4 | #exe { 5 | Cd(__DIR__);; 6 | Option(OPTf_WARN_PAREN,ON); 7 | Option(OPTf_WARN_DUP_TYPES,ON); 8 | #include "KCfg" 9 | CKCfg *kernel_cfg; 10 | kernel_cfg=KCfgNew; 11 | }; 12 | 13 | #include "KernelA.HH" 14 | #include "KStart16" 15 | #include "KStart32" 16 | #include "KStart64" 17 | #include "KMathA" 18 | #include "KUtils" 19 | #exe {Option(OPTf_KEEP_PRIVATE,ON);}; 20 | #include "/Compiler/CompilerA.HH" 21 | #exe {Option(OPTf_EXTERNS_TO_IMPORTS,ON);}; 22 | #include "/Compiler/CompilerB.HH" 23 | #exe {Option(OPTf_EXTERNS_TO_IMPORTS,OFF);}; 24 | #exe {Option(OPTf_KEEP_PRIVATE,OFF);}; 25 | #include "KernelB.HH" 26 | #include "KExts" 27 | #include "StrA" 28 | #include "KGlbls" 29 | #include "KMathB" 30 | #include "Sched" 31 | #include "Mem/MakeMem" 32 | #include "FontStd" 33 | #include "FontCyrillic" 34 | #include "StrB" 35 | #include "KHashA" 36 | #include "KInts" 37 | #include "KDataTypes" 38 | #include "Compress" 39 | #include "KHashB" 40 | #include "KLoad" 41 | #include "KDate" 42 | #include "StrPrint" 43 | #include "StrScan" 44 | #include "KDefine" 45 | #include "Display" 46 | #include "KMisc" 47 | #include "KDbg" 48 | #include "KeyDev" 49 | #include "KExcept" 50 | #include "SerialDev/MakeSerialDev" 51 | #include "QSort" 52 | #include "KTask" 53 | #include "Job" 54 | #include "PCIBIOS" 55 | #include "MultiProc" 56 | #include "EdLite" 57 | #include "BlkDev/MakeBlkDev" 58 | #include "FunSeg" 59 | #include "KMain" 60 | 61 | #exe {KCfgDel(kernel_cfg);}; 62 | -------------------------------------------------------------------------------- /Kernel/KernelA.HH: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Kernel/KernelA.HH -------------------------------------------------------------------------------- /Kernel/KernelC.HH: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Kernel/KernelC.HH -------------------------------------------------------------------------------- /Kernel/Mem/HeapCtrl.HC: -------------------------------------------------------------------------------- 1 | CHeapCtrl *HeapCtrlInit(CHeapCtrl *hc=NULL,CTask *task=NULL,CBlkPool *bp) 2 | {//See $LK,"HeapLog",A="MN:HeapLog"$() for an example. 3 | //Duplicated for $LK,"Adam Task",A="FF:::/Kernel/KStart64.HC,CHeapCtrl.bp"$. 4 | if (!hc) 5 | hc=ACAlloc(sizeof(CHeapCtrl)); 6 | hc->hc_signature=HEAP_CTRL_SIGNATURE_VAL; 7 | hc->mem_task=task; 8 | hc->bp=bp; 9 | QueInit(&hc->next_mem_blk); 10 | hc->last_mergable=NULL; 11 | hc->next_um=hc->last_um=(&hc->next_um)(U8 *)-offset(CMemUsed.next); 12 | return hc; 13 | } 14 | 15 | U0 HeapCtrlDel(CHeapCtrl *hc) 16 | {//Free all blks alloced to a HeapCtrl. 17 | CMemBlk *m,*m1; 18 | if (hc) { 19 | PUSHFD 20 | CLI 21 | while (LBts(&hc->locked_flags,HClf_LOCKED)) 22 | PAUSE 23 | m=hc->next_mem_blk; 24 | while (m!=&hc->next_mem_blk) { 25 | m1=m->next; 26 | MemPagTaskFree(m,hc); 27 | m=m1; 28 | } 29 | LBtr(&hc->locked_flags,HClf_LOCKED); 30 | POPFD 31 | Free(hc); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Kernel/Mem/MakeMem.HC: -------------------------------------------------------------------------------- 1 | #exe {Cd(__DIR__);}; 2 | #include "PageTables" 3 | #include "MemPag" 4 | #include "BlkPool" 5 | #include "MAllocFree" 6 | #include "HeapCtrl" 7 | #include "MemPhysical" 8 | #exe {Cd("..");}; 9 | -------------------------------------------------------------------------------- /Kernel/SerialDev/MakeSerialDev.HC: -------------------------------------------------------------------------------- 1 | #exe {Cd(__DIR__);}; 2 | #include "Keyboard" 3 | #include "Mouse" 4 | #include "Message" 5 | #exe {Cd("..");}; 6 | -------------------------------------------------------------------------------- /Kernel/SerialDev/Message.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Kernel/SerialDev/Message.HC -------------------------------------------------------------------------------- /Kernel/StrPrint.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Kernel/StrPrint.HC -------------------------------------------------------------------------------- /Kernel/StrScan.HC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Kernel/StrScan.HC -------------------------------------------------------------------------------- /MakeHome.HC: -------------------------------------------------------------------------------- 1 | Cd(__DIR__);; 2 | 3 | //If these are not present in /Home, it uses the version in the root dir. You 4 | //can make your own, modified, version of these files in your /Home directory. 5 | #include "~/HomeLocalize" 6 | #include "/Adam/Opt/Boot/MakeBoot" 7 | #include "/Adam/Opt/Utils/MakeUtils" 8 | #include "~/HomeWrappers" 9 | MapFileLoad("::/Kernel/Kernel"); 10 | MapFileLoad("::/Compiler/Compiler"); 11 | #include "~/HomeKeyPlugIns" 12 | #include "~/HomeSys" 13 | Cd("..");; 14 | -------------------------------------------------------------------------------- /Misc/PCIDevices.DD: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/Misc/PCIDevices.DD -------------------------------------------------------------------------------- /Misc/Tour/Tour5.IN: -------------------------------------------------------------------------------- 1 | //This is an example of how you do documentation. 2 | 3 | //Puts the cursor at the bottom. 4 | Msg(MSG_KEY_DOWN,0,SC_CURSOR_DOWN|SCF_CTRL); 5 | "\nEd(\"::/Misc/Tour/Tour5.IN.Z\");\n"; 6 | Msg(MSG_KEY_DOWN,0,SC_CURSOR_UP|SCF_CTRL); 7 | Msg(MSG_KEY_DOWN,0,SC_CURSOR_DOWN); 8 | "//"; 9 | 10 | TourPut( 11 | "Now, we'll add a link to a file using the $$GREEN$$$$FG$$ filename chooser.\n", 12 | TRUE); 13 | 14 | '' CH_CTRLL; 15 | Sleep(2000); 16 | '' CH_SPACE; 17 | Sleep(1500); 18 | '' CH_SPACE; 19 | Sleep(1500); 20 | Msg(MSG_KEY_DOWN,0,SC_CURSOR_DOWN); 21 | Sleep(1500); 22 | 23 | TourPut( 24 | "Press $$GREEN$$$$FG$$ for the file chooser. Then, " 25 | "pick a file and press $$GREEN$$$$FG$$."); 26 | InGetKey(SC_F4); 27 | Sleep(5000); 28 | TourPut("Press $$GREEN$$$$FG$$ to exit the form.\n"); 29 | InGetChar(CH_ESC); 30 | 31 | TourPut("Press $$GREEN$$$$FG$$ to abort.\n"); 32 | InGetChar(CH_SHIFT_ESC); 33 | 34 | TourPut("Use $$GREEN$$$$FG$$ to pick directories.\n",TRUE); 35 | -------------------------------------------------------------------------------- /Misc/Tour/Tour6.IN: -------------------------------------------------------------------------------- 1 | PopUp("ACInit(\"::/*;!*/Bible.TXT*\");"); 2 | AutoComplete(ON); 3 | Sleep(3500); 4 | 5 | //Puts the cursor at the bottom. 6 | Msg(MSG_KEY_DOWN,0,SC_CURSOR_DOWN|SCF_CTRL); 7 | "\nCd(\"::/Demo\");\n"; 8 | 9 | TourPut( 10 | "AutoComplete is a feature which also lets you jump to source code of " 11 | "symbols. The function keys jump to code, while the number keys jump to " 12 | "dictionary definitions.\n\n" 13 | "We will now place some text on the command line and jump to source code.\n", 14 | TRUE); 15 | 16 | "BootHD"; 17 | 18 | TourPut( 19 | "Look at the $$GREEN$$BootHDIns$$FG$$ entry in the AutoComplete " 20 | "window. Notice it is underlined. This means a source code link is " 21 | "available.\n\n" 22 | "Press $$GREEN$$$$FG$$ to jump to source code.\n"); 23 | InGetKey(SC_F1|SCF_CTRL|SCF_SHIFT); 24 | Sleep(500); 25 | WinToTop;//Kludge 26 | 27 | TourPut("Press $$GREEN$$$$FG$$ to abort the source code.\n"); 28 | InUntilChar(CH_ESC,CH_SHIFT_ESC); 29 | 30 | TourPut("Press $$GREEN$$$$FG$$ to autocomplete.\n"); 31 | InGetKey(SC_F1|SCF_CTRL); 32 | Sleep(500); 33 | 34 | Msg(MSG_KEY_DOWN,'\n',SCF_CTRL|SCF_SHIFT); 35 | "\n"; 36 | 37 | TourPut( 38 | "Tip: You can restart the AutoComplete window if you have closed it by " 39 | "pressing $$GREEN$$$$FG$$.\n",TRUE); 40 | 41 | TourPut( 42 | "You can also use the $$GREEN$$Man()$$FG$$ function to jump to source code. " 43 | "(I use AutoComplete.) The $$GREEN$$Man()$$FG$$ is good for short symbol " 44 | "names or when inside the debugger.\n",TRUE); 45 | InPrint(,"Man(\"U\");"); 46 | Sleep(1500); 47 | "\n"; 48 | 49 | TourPut("Press $$GREEN$$$$FG$$ to abort the source code.\n"); 50 | InUntilChar(CH_ESC,CH_SHIFT_ESC); 51 | -------------------------------------------------------------------------------- /Misc/Tour/Tour8.IN: -------------------------------------------------------------------------------- 1 | "FF(\"/Kernel/*\");"; 2 | TourPut( 3 | "Let's list files in the $$GREEN$$/Kernel$$FG$$ and sub directories.\n\n" 4 | "TempleOS masks have one base directory and multiple filename masks.\n\n" 5 | "Press $$GREEN$$$$FG$$.\n"); 6 | InGetStr("\n"); 7 | 8 | "FF(\"/Kernel/*\",\"-r\");"; 9 | TourPut( 10 | "The recurse $$GREEN$$+r$$FG$$ flag is usually set. Let's turn it off.\n\n" 11 | "Press $$GREEN$$$$FG$$.\n"); 12 | InGetStr("\n"); 13 | 14 | "FF(\"/Kernel/St*;*.HH*\");"; 15 | TourPut( 16 | "Let's have two mask of $$GREEN$$St*$$FG$$ plus $$GREEN$$*.HH*$$FG$$\n\n" 17 | "Press $$GREEN$$$$FG$$.\n"); 18 | InGetStr("\n"); 19 | 20 | "FF(\"/Kernel/St*;*.HH*;!*Print*\");"; 21 | TourPut( 22 | "Let's unsel $$GREEN$$*Print*$$FG$$.\n\n" 23 | "Press $$GREEN$$$$FG$$.\n"); 24 | InGetStr("\n"); 25 | TourPut("There is no way to include multiple base directories.\n",TRUE); 26 | -------------------------------------------------------------------------------- /Misc/Tour/Tour9.IN: -------------------------------------------------------------------------------- 1 | "Ed(\"::/Misc/Bible.TXT.Z\");\n"; 2 | TourPut("Press $$GREEN$$$$FG$$ to find.\n"); 3 | InGetChar(CH_CTRLF); 4 | 5 | InPrint(150,"new song"); 6 | 7 | TourPut("Cursor down 8 times.\n"); 8 | I64 i; 9 | for (i=0;i<8;i++) 10 | InGetKey(SC_CURSOR_DOWN); 11 | 12 | TourPut("Press '$$GREEN$$2$$FG$$' to show all lines within 2 of a match.\n"); 13 | InGetStr("2"); 14 | 15 | TourPut("Press $$GREEN$$$$FG$$ to exit the form.\n"); 16 | InGetChar(CH_ESC); 17 | 18 | TourPut("Look around and press $$GREEN$$$$FG$$ to turn off filter.\n"); 19 | InUntilChar(CH_ESC,CH_SHIFT_ESC); 20 | 21 | TourPut("You can combine filters to effectively do AND searches.\n",TRUE); 22 | 23 | '' CH_SHIFT_ESC; 24 | 25 | -------------------------------------------------------------------------------- /Misc/Tour/TourA.IN: -------------------------------------------------------------------------------- 1 | TourPut("Press $$GREEN$$$$FG$$."); 2 | "Ed(\"HI:Debugging\");"; 3 | InGetStr("\n"); 4 | TourPut("Press $$GREEN$$$$FG$$ to abort.\n"); 5 | InUntilChar(CH_ESC,CH_SHIFT_ESC); 6 | 7 | TourPut( 8 | "We will now use $$RED$$$$TX+L+PU+UL,\"Uf\",A=\"MN:Uf\"$$$$FG$$() to " 9 | "unassemble a function. It takes the function name as a string arg.\n\n" 10 | "Press $$GREEN$$$$FG$$.\n"); 11 | "WinBorder;WinMax;\nUf(\"CAlloc\");"; 12 | InGetStr("\n"); 13 | 14 | TourPut("Press $$GREEN$$$$FG$$ eight times.."); 15 | I64 i; 16 | for (i=0;i<8;i++) 17 | InGetKey(SC_CURSOR_UP); 18 | 19 | TourPut( 20 | "Press $$GREEN$$$$FG$$.\n"); 21 | InGetStr(" "); 22 | 23 | TourPut("Press $$GREEN$$$$FG$$ when finished.\n"); 24 | InUntilChar(CH_ESC,CH_SHIFT_ESC); 25 | 26 | //Puts the cursor at the bottom. 27 | Msg(MSG_KEY_DOWN,0,SC_CURSOR_DOWN|SCF_CTRL); 28 | 29 | TourPut( 30 | "We can unassemble a numeric address with " 31 | "$$RED$$$$TX+L+PU+UL,\"U\",A=\"MN:U\"$$$$FG$$().\n\n" 32 | "Press $$GREEN$$$$FG$$.\n"); 33 | "U(&CAlloc);"; 34 | InGetStr("\n"); 35 | 36 | TourPut("The opcodes are slightly nonstandard.\n",TRUE); 37 | "Ed(\"::/Compiler/OpCodes.DD.Z\");\n"; 38 | 39 | Msg(MSG_KEY_DOWN,CH_CTRLF,0x42100000421); 40 | "MOV"; 41 | Msg(MSG_KEY_DOWN,CH_ESC,0x100000001); 42 | 43 | TourPut("Press $$GREEN$$$$FG$$ to abort.\n"); 44 | InUntilChar(CH_ESC,CH_SHIFT_ESC); 45 | -------------------------------------------------------------------------------- /Misc/Tour/TourB.IN: -------------------------------------------------------------------------------- 1 | TourPut( 2 | "All text widgets work everywhere. The $$GREEN$$Type()$$FG$$ command is like " 3 | "the DOS command of the same name or the UNIX, $$GREEN$$cat$$FG$$ command. " 4 | "We will, now, send your menu document to the command line. It uses the " 5 | "same document format and the icons are even active!!\n\n" 6 | "Press $$GREEN$$$$FG$$.\n"); 7 | 8 | //Puts the cursor at the bottom. 9 | Msg(MSG_KEY_DOWN,0,SC_CURSOR_DOWN|SCF_CTRL); 10 | "\n"; 11 | 12 | "Type(\"~/PersonalMenu.DD\");"; 13 | InGetStr("\n"); 14 | 15 | Sleep(1500); 16 | InPrint(250,"Dir;\n"); 17 | 18 | Sleep(1500); 19 | TourPut( 20 | "$$GREEN$$Type()$$FG$$ can also be used on $$GREEN$$.GR$$FG$$ files!",TRUE); 21 | -------------------------------------------------------------------------------- /Misc/Tour/TourC.IN: -------------------------------------------------------------------------------- 1 | TourPut( 2 | "We will now run a test-suite that automatically executes most TempleOS " 3 | "demos. It takes a few minutes, so kick-back.\n\n" 4 | "Press $$GREEN$$$$FG$$.\n"); 5 | 6 | "#include \"::/Misc/OSTestSuite\";"; 7 | InGetStr("\n"); 8 | 9 | if (LBtr(&tour_put->display_flags,DISPLAYf_SHOW)) 10 | WinZBufUpdate; 11 | -------------------------------------------------------------------------------- /Once.HC: -------------------------------------------------------------------------------- 1 | //Place this file in /Home and change 2 | //anything you want. 3 | 4 | //This file is executed by the 5 | //first terminal window upon start-up. 6 | //See $LK,"Once",A="FF:~/HomeSys.HC,Once"$ and $LK,"Home Files",A="FF:::/Doc/GuideLines.DD,/Home Files"$. 7 | 8 | //Delete the rest from this file. 9 | 10 | U0 Tmp() 11 | { 12 | OnceExe; 13 | switch (sys_boot_src.u16[0]) { 14 | case BOOT_SRC_ROM: 15 | "Continue booting hard drive "; 16 | if (YorN) { 17 | DocBottom; 18 | ExeFile("C:/Home/Once"); 19 | } 20 | break; 21 | case BOOT_SRC_DVD: 22 | "\nIf you answer 'No' you can play with\n" 23 | "the live CD without installing.\n\n" 24 | "Install onto hard drive "; 25 | if (YorN) { 26 | DocBottom; 27 | RunFile("::/Misc/OSInstall",,TRUE); 28 | } 29 | if (FileFind("::/Misc/Tour")) { 30 | "\nTake Tour"; 31 | if (YorN) { 32 | DocBottom; 33 | Cd("::/Misc/Tour"); 34 | InFile("Tour"); 35 | } 36 | } 37 | break; 38 | case BOOT_SRC_RAM: 39 | case BOOT_SRC_HARDDRV: 40 | "$$PURPLE$$$$TX+CX,\"Tip of the Day\"$$$$FG$$\n"; 41 | TipOfDay; 42 | Type("::/Doc/Customize.DD"); 43 | if (FileFind("::/Misc/Tour")) { 44 | "\nTake Tour"; 45 | if (YorN) { 46 | DocBottom; 47 | Cd("::/Misc/Tour"); 48 | InFile("Tour"); 49 | } 50 | } 51 | break; 52 | } 53 | } 54 | 55 | Tmp; 56 | -------------------------------------------------------------------------------- /PersonalMenu.DD: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cia-foundation/base-os/81e37f4fe4512ea0fb502369238b9db02c68ddee/PersonalMenu.DD -------------------------------------------------------------------------------- /PersonalNotes.DD: -------------------------------------------------------------------------------- 1 | Place your notes or TODO here. 2 | $FG,2$$FG$ 3 | 4 | 5 | -------------------------------------------------------------------------------- /StartOS.HC: -------------------------------------------------------------------------------- 1 | //This is executed by the Adam task at boot. 2 | //See $LK,"Adam Start-up",A="FF:::/Kernel/KMain.HC,\"StartOS"$. 3 | 4 | #help_index "Compiler/Directive" 5 | public extern I8i Option(I64i num,I8i val); 6 | Option(0,0); //(0,0)=EchoOff (0,1)=EchoOn 7 | 8 | #include "/Kernel/KernelA.HH" 9 | #include "/Compiler/CompilerA.HH" 10 | #include "/Kernel/KernelB.HH" 11 | #include "/Kernel/KernelC.HH" 12 | #include "/Compiler/CompilerB.HH" 13 | 14 | Option(OPTf_WARN_PAREN,ON); 15 | Option(OPTf_WARN_DUP_TYPES,ON); 16 | HashTablePurge(adam_task->hash_table); 17 | 18 | #include "/Adam/MakeAdam" 19 | 20 | //Dbg("Type 'G;'"); 21 | DocTermNew; 22 | WinVert(2,10); 23 | 24 | sys_winmgr_task=Spawn(&WinMgrTask,NULL,"Window Mgr"); 25 | Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_BORDER 26 | -WIF_SELF_GRAB_SCROLL-WIF_SELF_CTRLS; 27 | LBts(&Fs->display_flags,DISPLAYf_CHILDREN_NOT_ON_TOP); 28 | LBts(&Fs->display_flags,DISPLAYf_SHOW); 29 | RegInit; 30 | LBts(&sys_run_level,RLf_REGISTRY); 31 | if (!ins_reg.registered) 32 | InsUnreg; 33 | 34 | WallPaperInit; 35 | 36 | if (DrvIsWritable) 37 | DirMk("/Tmp"); //Good to have a Tmp 38 | 39 | Option(OPTf_WARN_PAREN,OFF); 40 | Option(OPTf_WARN_DUP_TYPES,OFF); 41 | LBts(&sys_run_level,RLf_HOME); 42 | 43 | #help_index "" 44 | #include "~/MakeHome" 45 | 46 | //After this file, the Adam task enters $LK,"server mode",A="HI:Job"$. 47 | --------------------------------------------------------------------------------