Team Ai
Datasetpublic

hschumann2/TempleOS-Source-Code

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes847downloads
Boot.txt113 linesDownload Raw Back to Doc
1 2                                  Booting A PC3 4TempleOS only supports traditional BIOS booting, not the newer technique, UEFI.5This document describes BIOS booting.6 7When you turn-on (power-up) a computer or you do a hardware reset, the computer8starts executing the BIOS.  Sometimes, you must change the BIOS boot order to9boot the device you want.10 11The BIOS loads a boot sector from CD/DVD, hard disk or whatever.  The boot12sector runs in 16-bit real mode and often loads-in a second file that's bigger13if it can't be done by just one sector.  It's a safe bet that boot sectors are14hand-coded assembly language.  Most boot sectors use the BIOS to load-in the15next stage.16 17Not only do boot sectors have a size limit, 512 bytes or 2048 bytes for CD/DVD,18the files they load have to fit within 640K because they run in 16-bit mode.19This means they usually can't just load the whole operating system and start it20running.  Some boot loaders, like Grub, have a capability of switching modes21before handing-off control to the operating system.  The operating system must22load the rest of itself.  With TempleOS, the ::/Kernel.BIN.C file is loaded by23the boot sector.  I try to put a minimum in the Kernel Module, so that it will24always fit in 640K.  When Kernel.BIN runs, it switches to 32-bit mode, then, to2564-bit mode allowing access to more memory.  Then, it loads in the rest of26TempleOS by executing ::/StartOS.HC.27 28All the boot related code for TempleOS is in the /Adam/Opt/Boot directory.29 30BootDVD.HC      CD/DVD boot sector.31BootDVDIns.HC   Prep for CD/DVD install by creating /0000Boot/0000Kernel.BIN.C.32If you are curious about ISO9660 CD/DVDs, see DskISO9660.HC.  To make a custom33bootable CD/DVD, look here Bootable CD.34 35BootMHD.HC      Stage 1 Master HD boot loader.36BootMHD2.HC     Stage 2 Master HD boot loader.37BootMHDIns.HC   Installs Master HD boot loader.38BootMHD goes on block zero.  /0000Boot/BootMHD2.BIN.C is stored as a file in a39partition, risky and unusual, since most master boot loaders place stage 2 in a40gap that's not in any partition.  BootMHD2 displays a menu and boots a41partition.42 43BootHD.HC       HD partition boot record.44BootHDIns.HC    Installs HD partition boot record.45BootHD is the boot record for a TempleOS partition.  Each partition has its own46partition boot record, the first block of the partition.47 48My boot records don't access directories because that would make them too big49for one block and would make them depend on a file system layout.  Instead, they50get patched with the LBA, logical block addresses, to load files.  To update51with a new TempleOS kernel, you must create a ::/Kernel.BIN.C binary file and52patch the boot loader so it knows the LBA blocks to load.  Therefore, you53usually recompile the kernel and update the boot sector at the same time with54BootHDIns().  BootMHDIns() will install a master boot loader.55 56With TempleOS, ::/Kernel.BIN.C loads ::/Compiler/Compiler.BIN so it can work57with source code from then on.  It compiles start-up scripts beginning with58::/StartOS.HC into the Adam Task's memory including the code in the /Adam and /H59ome directories.60 61It is possible to do a fast reboot without doing a hardware reset.  You might do62this when working on ::/Kernel.BIN.C or your start-up scripts when you want to63compile them effect.  See BootRAM().64 65 66/* Graphics Not Rendered in HTML */67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113