hschumann2/TempleOS-Source-Code
0847
1 2 Frequently Asked Questions3 4-] How come it is public domain, not GPL?5 I, Terry A. Davis, wrote all 120,933 lines of TempleOS over the past 13.86 years (full-time). It can run on some bare metal 64-bit PC's from about7 2005-2010 with no layering, libraries, tools, modules or anything from other8 sources. Otherwise, you run it in a virtual machine, like VMware, QEMU or Vir9 tualBox. It is independent and stands alone. It has no networking, so it10 certainly doesn't call home. 100% of the src code is including on all11 distro's, from the kernel to the compiler to the boot loaders! See12 ::/Doc/Credits.DD.13-] Shouldn't it be GNU/TempleOS?14 TempleOS executes no code not written by me at any time except for a few BIOS15 calls for configuration. I even wrote boot-loaders, so I do not need Grub.16 See ::/Doc/Credits.DD.17-] Don't you use GNU's gcc?18 TempleOS was written from scratch, starting with TASM long ago, launching from19 real-mode DOS. Now, there is no Linux or GNU or any other code in TempleOS.20 Yes, I wrote the compiler from scratch. See ::/Doc/Credits.DD.21-] Why do you dual boot?22 TempleOS is 100% independent -- it does not access the files of your primary23 operating system and TempleOS will work as the only operating system on your24 computer, but it has no networking. In your off hours, you will use your25 other operating system.26-] It has links, so is it a browser?27 TempleOS is an operating system, not a browser. TempleOS links are a special28 format and only link too local files and symbol source addresses.29-] Where are the animated 3D icon GIFs?30 3D Sprites are stored as a mesh of triangles. There are no GIF files. It31 rotates 3D sprite objects on the fly.32-] If the compiler is JIT, isn't it an interpretor?33 TempleOS compiles, doesn't interpret, and uses no byte code anywhere. I34 loosely use the word script sometimes, but it's actually compiled. The35 compiler's optimization code is actually where the compiler evaluates36 constants to simplify them, like every optimizing compiler.37-] Are you a Creationist?38 I am an evolutionist. Adam is a better term for the first father of all tasks39 than root was!40-] Is 'Bt()' in the code Bit Torrent?41 Bt() is bit test, like the x86 inst, not bit torrent.42-] Is 'Fs->' in the code file system?43 Fs is a segment reg, not file system. (Fs is kept pointing to the current44 task's record.) There is no memory segmentation. It is 64-bit and flat. FS45 and GS are used as general purpose regs, more or less.46-] Is it Pascal?47 TempleOS uses a dialect of C/C++ called HolyC. It is not Pascal. I altered48 the syntax making parenthesis optional on function calls with no paramaters.49-] Why doesn't Sleep() make my laptop hibernate?50 Sleep() makes a program pause. It is not hibernation for a laptop.51-] What is Yield() for in loops?52 Yield() saves the current task's regs (context) and loads in the next task.53 In a loop waiting for disk IO, it executes Yield() which pegs the CPU load,54 yet the system is responsive.55-] What is JIT Compiled Mode?56 The term JIT Compile Mode means it compiles and executes code placed into mem,57 not stored on disk.58-] Why do files end in .Z? Are they encrypted?59 Files with names ending in .Z are individually compressed using60 TempleOS Compression. They are not encrypted. Copy() or rename them with61 Move() to a name without .Z and they will be stored in an uncompressed form.62 See TOSZ for Linux or Windows uncompress C/C++ code.63-] Is it open source? How do I build it?64 TempleOS is 100% open src. All the src code is included in the distro. Use65 BootHDIns() to compile the kernel and compiler. The rest is JIT Compiled66 during boot. See ::/StartOS.HC.67-] Where are object files? How do I link?68 TempleOS does not use object files or a linker. AOT Compile Mode is used to69 directly create flat binary files, ::/Kernel.BIN.C and70 ::/Compiler/Compiler.BIN with no object files and linking. JIT Compile Mode71 place code in memory, ready to run, with no object files or linking. Linking72 is done when BIN modules are Load()ed.73-] What is the FPS refresh rate?74 The refresh rate is 30 frames-per-second. That is how often TempleOS updates75 scrn mem. It is not syncronized to the hardware.76-] How does a task own the speaker?77 No task or application has a lock on the speaker so apps will interfere with78 each other.79-] Why does it leak memory?80 TempleOS allocs mem as more items are displayed in the window. Also, TempleOS81 allocs mem for code as it is compiled at the cmd line. If you #include a file82 twice, it allocs more mem for it. If you have a 50,000 line program with each83 line taking twenty bytes on a machine with 1 Gig, you could #include it a84 thousand times if it had no data or graphics and no other use of mem. If it85 bothers you, hit <CTRL-ALT-x> and <CTRL-ALT-t>, periodically, to kill and86 recreate the task. Use the pop-up flag on macros in your PersonalMenu to87 spawn new tasks, run applications and free the applications when they are88 finished. Small mem chunks stick to the task when they are freed until it is89 killed. The only way to get in trouble is allocating multiple Meg chunks and90 freeing them. These can only be reused if the same size gets alloced again.91 Use HeapLog(), HeapLogAddrRep() and HeapLogSizeRep() to see who alloced mem92 and didn't free it. See MemOverview.93-] Why do I get a memory leak when editing big files?94 The editor periodically takes a snap-shot of the document for UNDO and this95 looks like a memory leak.96-] Why is it in text mode?97 TempleOS runs in VGA 640x480 16 color graphics mode, not text mode. It98 changes to this mode with a BIOS call while in real-mode before it switches to99 64-bit mode. The text is drawn by hand. See ::/Kernel/FontStd.HC. If100 graphics mode fails, it falls-back on text mode. You can force text mode with101 an Kernel config option.102-] Where is the kernel memory?103 TempleOS identity-maps all memory, all the time. It is like paging is not104 used. There is no special kernel high half memory space. TempleOS is105 ring-0-only, so everything is kernel, even user programs. There is a special106 task called Adam and he doesn't die, so his heap never gets freed. That's as107 close to kernel memory as it gets. All code goes in the lowest 2Gig of108 addresses, known as the Code Heap, so that the REL32 addressing mode can be109 used. See MemOverview.110-] Why does it run code from stack addresses?111 TempleOS puts all code in the lowest 2Gig, known as the Code Heap, so that the112 REL32 addressing mode can be used. TempleOS is 64-bit, but 2Gig is enough for113 code. It actually puts global variables there, too, but you can turn that off114 with OPTf_GLBLS_ON_DATA_HEAP. MAlloc() allocs higher memory.115-] How does it SYSCALL?116 TempleOS doesn't use software interrupts or SYSCALL insts because it never117 needs to change out of ring-0, even running user programs. Calls are always C118 ALL REL32 insts.119-] How do you fault-in stack?120 The stack does not grow, so do not do deep recursion. In theory, memory gets121 fragmented, too.122-] How do I set the PATH?123 There is no PATH. You do not enter filenames at the command-line and expect124 them to run. You enter C-like code. Get Started Here.125-] How do I boot it with Grub?126 If you use Grub, you chain-load like Windows. See Boot. You can use the127 TempleOS boot-loader. Master-Boot-Loader-Stage1, Master-Boot-Loader-Stage2,128 Partition-Boot-Loader, CD-DVD-Boot-Loader.129-] How do I get Kernel.BIN to boot?130 The boot-loaders must be patched by you running BootHDIns() or BootMHDIns().131 Those will write the block address into the boot-loader because the132 boot-loaders do not navigate file systems to find the Stage2 if you relocate133 it.134-] Why is there some 16-Bit code?135 TempleOS is 64-bit. Like all PC operating systems, the boot-loader starts in136 16-bit real-mode. TempleOS calls a few BIOS info routines, switches to137 VGA-640x480x4bit, switches to 32-bit, then, 64-bit mode. There is an odd138 thing called a PCI BIOS which is 32-bit used for PCI config space access.139 TempleOS calls that a couple times. It must temporarily drop-out-of 64-bit140 mode for that and stop multi-tasking.141-] Why are you pushing 32-bit values on the stack?142 PUSH EAX : All stack operations in 64-bit mode are 64-bits.143-] Why are you using 32-bit insts and not setting high 32-bits?144 XOR EAX,EAX : Operations on 32-bit regs clear the high 32-bits.145-] How do you use the FS and GS segment registers.146 MOV RAX,FS:[RAX] : FS can be set with a WRMSR, but displacement is RIP147 relative, so it's tricky to use. FS is used for the current CTask, GS for148 CCPU.149-] How do I set ORG for position of code?150 The compiler creates pos independent code. Don't create code which is loaded151 at a fixed, specified location. Code in a BIN file is pos independent by152 virtue of a table in the BIN file for patching absolute addresses.153-] How are symbols loaded?154 Binary executable files have export syms which are loaded into the sym tables.155 The operating system Kernel has such an export table. In addition, some map156 files are processed to provide more information on syms -- src file links.157 This is how the Man()/AutoComplete feature can find src lines.158-] Why doesn't assert work?159 #assert might print a message at COMPILE time, not run time.160-] Why doesn't C++ public work?161 The word public in HolyC does very little except allow the Help & Index and162 Who() to exclude meaningless syms. If you wish a full report of public and163 nonpublic syms Click Here.164-] How does the debugger do source debugging?165 When compilation takes place, the structures used by the compiler stick166 around. Data on classes can be accessed. See ClassRep().167-] What are the ASCII 5 and ASCII 31 chars doing in my text files?168 The cursor location is stored as an ASCII 5 in files. ASCII 31 is SHIFT-SPACE169 , a character which does not get converted to tabs by space-to-tabs, S2T().170 The ASCII 28 is SHIFT-ESC.171-] Why is there garbage at the end of my text files?172 Binary sprite data is stored beyond the terminating NULL in text files. Map173 files store debug src line addresses.174-] Why are sprites so small?175 Sprites can be stored as vector graphics so they might take shockingly little176 room. They can be converted to bitmaps.177-] Why don't I need to recompile /Adam and /Home files?178 If you change code in the /Adam or your /Home directory, you don't need to179 recompile, you just need to reboot because those directories get recompiled180 when you boot. It uses JIT Compile Mode. There is no .BIN file for JIT181 compilation. See ::/StartOS.HC.182-] Why does it finds files that aren't there?183 If not found, .Z is added or removed from filename and a search is done again.184 If a file is still not found, the parent directories are searched for a file185 of the same name.186 187 188* "Windows" is a trademark owned by MicroSoft Corp.189* "Linux" is a trademark owned by Linus Torvalds.190* "QEMU" is a trademark owned by Fabrice Bellard.191* "VMware" is a trademark owned by VMware, Inc.192* "VirtualBox" is a trademark owned by Oracle.193 