Bootf
Jump to navigation
Jump to search
Bootf is a small FAT12 floppy bootloader for protected mode OS images, created by John Fine. It is also a coding sample for cramming lots of operations into very little code. The boot code on a FAT diskette or FAT partition is limited to 0x1C0 bytes (0x3E bytes are reserved at the beginning and 0x2 at the end of a 0x200 byte sector). BOOTF.ASM fits with 0x1A bytes to spare.
Features
- Enables the A20 gate.
- Switches to big real mode.
- Computes the locations of the FAT, the root directory and the first cluster.
- Reads in the root directory.
- Scans the root directory for a specific file (KERNEL.BIN).
- Reads in the FAT.
- Reads the file (KERNEL.BIN) to RAM starting at physical 1Mb.
- Builds two page tables and one page directory mapping:
- The first 4Mb linear to the first 4Mb physical.
- Linear FF800000 (where all my protected mode images start) to physical RAM starting at 1Mb.
- Self map the page directory to the end of linear memory.
- Switch to protected mode with paging turned on.
- JMP to KERNEL.BIN at linear FF800000.
Limitations
- Runs only on a 386+.
- The FAT structure must be the first thing on the drive (no partitions). It just uses "reserved" sectors before the FAT, not "hidden" etc.
- The sector size must be 512 bytes.
- There are less than 256 sectors per fat (safe, since FAT12 has less than 4096*1.5 bytes per FAT).
- LBN of root directory less than 65536 (safe in unpartitioned FAT12).
See Also
External Links
- Bootf02.zip (Mirror)
- 'Official' Site (Mirror)
- Chris Giese OSDev (Mirror)