$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/DVD 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/DVD, 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 Grub, 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/KStart16.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/Opt/Boot$FG$ directory. $LK,"Boot.CPP",A="FI:::/Adam/Opt/Boot/BootHDIns.CPP"$ Installs and patches boot sectors $LK,"BootDVD.CPP",A="FI:::/Adam/Opt/Boot/BootDVD.CPP"$ CD/DVD Boot sector $LK,"BootMHD.CPP",A="FI:::/Adam/Opt/Boot/BootMHD.CPP"$ Master HD boot record $LK,"BootMHD2.CPP",A="FI:::/Adam/Opt/Boot/BootMHD2.CPP"$ Stage 2 master boot loader $LK,"BootHD.CPP",A="FI:::/Adam/Opt/Boot/BootHD.CPP"$ HD partition boot record $FG,2$BootDVD$FG$ is the CD/DVD boot sector. If you are curious on the layout of $FG,2$ISO9660$FG$ CD/DVDs, see $LK,"DskISO9660.CPP",A="FI:::/Adam/Opt/Boot/DskISO9660.CPP"$. To make a custom bootable CD/DVD, look here $LK,"Bootable CD",A="FI:::/Misc/DoDistro.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,"BootHDIns",A="MN:BootHDIns"$() does this. $LK,"BootMHDIns",A="MN:BootMHDIns"$() 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 source code from then on. $LK,"::/StartOS.CPP"$ is the starting start-up script. It processes (compiles into memory) the stuff in the $FG,2$/Adam$FG$ and $FG,2$/Home$FG$ directories. 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,"BootRAM",A="MN:BootRAM"$(). $SP,"",BI=1$ ¿èTempleOS MBRÎATempleOS MBR part 2ê”KernelMainÞÁ/StartOS.CPP.ZÌò/Home/MakeHome.CPP.Z H/Home/DoOnce.CPP.Z `˜`TempleOS CD-ROM BootLoader¤vTempleOS Partition BootBlock@Lt€�DþDDèþèB`˜ç˜ ˜<˜ ½Íí ˜ BÁDRAMReboot() Soft boot