flat assembler
Message board for the users of flat assembler.
Index
> Projects and Ideas > Programing a Bootstrap |
Author |
|
connor 06 Jun 2019, 04:38
What im thinking about now is mastering the art of making a custom boot program.
To load a file of my choice, in my case a custom cpm86.sys file and not just that, to boot in 34/64 bir real mode. HOW DOES BOOT WORK?
_________________ cars tech weed bitches country & thug life Last edited by connor on 24 Oct 2019, 04:13; edited 2 times in total |
|||||||||||
06 Jun 2019, 04:38 |
|
revolution 12 Jun 2019, 06:58
Normally a boot sector can't do too much, so it simply loads in more sectors from a fixed location on the HDD/SSD to a fixed location in memory and runs that new code. Often the fixed location is just the next sectors after the boot sector. You might find that referred to as a second stage boot loader.
Form there, with more code to do more things it can do much more. So you can have various functions to decode the disk format and find a boot file, switch to 32-bit unreal, or 32-bit protected, or 64-bit protected mode. Or generally whatever is needed. You don't even have to have a disk format in place, or even an OS, your code can be a simple single purpose application. |
|||
12 Jun 2019, 06:58 |
|
connor 14 Jun 2019, 06:30
Any exapmles?
& can it all be done with a assembly compiler or do i need something special? |
|||
14 Jun 2019, 06:30 |
|
revolution 14 Jun 2019, 06:47
There are a few examples of boot sectors on this board. Have a look in the OS Construction forum.
You can do everything with assembler. You don't need anything special. |
|||
14 Jun 2019, 06:47 |
|
rugxulo 28 Jul 2019, 02:12
You can look at FreeDOS (though it uses NASM).
|
|||
28 Jul 2019, 02:12 |
|
bzt 21 Sep 2019, 15:38
connor wrote: Any exapmles? There are other disassembled examples as well, eg. Windows floppy boot sector and Windows disk boot sector (for FAT32). Also the xv6 boot sector simply loads the kernel starting from the second sector (although this code has a minimal part written in C for ELF loading). Obviously, if you want to load an executable that was compiled for 32 bit protected mode, then you'll have to set up protected mode before you transfer the control (same stands for 64 bit long mode). This can be done in the boot sector if you're very talented and experienced, but it's more common to have a minimal trampoline code in the executable (meaning the function _start (being the entry point) is compiled for real-mode, which sets up whatever mode you need and then jumps to the real main function). Or you could implement a two stage loader, in which case the boot sector loads the second stage, which in turn are free to load the executable from any filesystem and set up any mode for it without the 512 byte size constraint. For a two stage loader example, take a look at my boot loader. This does not support floppies (LBA mode only), but it is compatible with the no emulation El Torito CD-ROM boot standard as well, and it is written for FASM. It loads the second stage from a configurable starting sector. |
|||
21 Sep 2019, 15:38 |
|
connor 26 Oct 2019, 04:14
_________________ cars tech weed bitches country & thug life |
|||||||||||
26 Oct 2019, 04:14 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.