$WW,1$$FG,5$$TX+CX,"Booting A PC"$$FG$ TempleOS only supports traditional $FG,2$BIOS$FG$ booting, not the newer technique, $FG,2$UEFI$FG$. This describes $FG,2$BIOS$FG$ booting. When you turn-on (better term is "power-up"!) a computer or do a hardware reset, it starts in the $FG,2$BIOS$FG$. Sometimes, you must change the $FG,2$BIOS$FG$ boot order to boot stuff. The $FG,2$BIOS$FG$ loads a boot sector from CD-ROM or hard disk or whatever. The boot sector runs in 16-bit mode and often loads-in a second file that's bigger if it can't be done by just one sector. It's a safe bet that boot sectors are hand-coded assembly language Most boot sectors use the $FG,2$BIOS$FG$ to load-in the rest. Not only do boot sectors have a size limit, 512 bytes or 2048 bytes for CD-ROM, the files they load have to fit within 640K because they run in 16-bit mode. This means they usually can't just load the whole operating system and start it running. I guess some boot loaders, like $LK,"Grub",A="FI:::/Doc/Grub.TXT"$, have a capability of switching modes before handing-off control to the operating system. Anyway, the operating system must load the rest of itself. My $LK,"Kernel",A="FI:::/Kernel/KStart.CPP"$ module is what the boot sector loads and I try to put a minimum in it so that it will always fit in 640K. It switches to 32-bit mode, then, to 64-bit mode allowing access to more memory. It loads in the rest of TempleOS. All the boot related stuff for TempleOS is in the $FG,2$/Adam/Boot$FG$ directory. $LK,"InsBoot.CPP",A="FI:::/Adam/Boot/InsBoot.CPP"$ Installs and patches boot sectors $LK,"BootCD.CPP",A="FI:::/Adam/Boot/BootCD.CPP"$ CD-ROM Boot sector $LK,"BootMHD.CPP",A="FI:::/Adam/Boot/BootMHD.CPP"$ Master HD boot record $LK,"BootMHD2.CPP",A="FI:::/Adam/Boot/BootMHD2.CPP"$ Stage 2 master boot loader $LK,"BootHD.CPP",A="FI:::/Adam/Boot/BootHD.CPP"$ HD partition boot record $FG,2$BootCD$FG$ is the CD-ROM boot sector. If you are curious on the layout of $FG,2$ISO9660$FG$ CD-ROMs, see $LK,"DiskCDDVD.CPP",A="FI:::/Adam/Boot/DskCDDVD.CPP"$. To make a custom bootable CD-ROM, look here $LK,"Bootable CD",A="FI:::/Misc/MakeDistro.CPP"$. $FG,2$BootMHD$FG$ is the master boot record for a hard drive. This goes on block zero. It loads-in $FG,2$BootMHD2$FG$ which is stored as a file on a partition, kinda risky and unusual -- most other master boot loaders place stage 2 in a gap that's not in any particular partition. $FG,2$BootMHD2$FG$ displays a menu and will boot a partition. Each partition has it's own partition boot record, the first block of the partition. $FG,2$BootHD$FG$ is the boot record for a TempleOS partition. My boot records don't access directories because that would make them too big for one block and would make them depend on a file system layout. Instead, they get patched with the LBA, logical block addresses, to load other stuff. To update with a new TempleOS kernel, you must create a binary file and patch the boot loader so it knows the LBA blocks to load. Therefore, you usually recompile the kernel and update the boot sector at the same time. $LK,"MakeOSPrtBootInstall",A="MN:MakeOSPrtBootInstall"$() does this. $LK,"MasterBootIntall",A="MN:MasterBootIntall"$() will install a master boot loader. With TempleOS , the $FG,2$Kernel$FG$ module loads the $FG,2$Compiler$FG$ module so it can process start-up scripts and works with srource code from then on. $LK,"::/Kernel/Adam1.CPP"$ is the starting start-up script. It processes (compiles into memory) the stuff in the $FG,2$/Adam$FG$ directory and ends by $FG,2$#include$FG$ing the $LK,"HOME/Adam3.CPP"$ file. It is possible to reboot without doing a hardware rst. This is faster. You might do this when working on $FG,2$Kernel$FG$ or your start-up scripts when you want them to take effect. See $LK,"SoftBoot",A="MN:SoftBoot"$(). $SP,"",BI=1$ TempleOS MBR@TempleOS MBR part 2OSMain/LT/OSMain/Adam1.APZ/LT/Adam/Adam2.APZ@HOME/Adam3.APZHOME/DoIt.CPZ ``TempleOS CD-ROM BootLoaderxTempleOS Partition BootBlock@LtDLDL` 0 <  Boot() Soft boot