Page 1 of 1

Case Study: FAT12 bootloader

Posted: Sat Jul 31, 2010 12:10 am
by bitshifter
Hello
I have designed and written a FAT12 bootloader (FASM syntax)
Please check it out and leave a comment or suggestion...
http://board.flatassembler.net/topic.php?t=11774
Code may be updated periodically (work in progress)
Feel free to use it in any of your projects...
Thanks for your time.

Re: Case Study: FAT12 bootloader

Posted: Sat Jul 31, 2010 6:19 am
by Creature
A kernel max size of 64 kB seems awfully low. My really basic kernel is already over 500 kB (without debugging symbols).

Re: Case Study: FAT12 bootloader

Posted: Sat Jul 31, 2010 8:15 pm
by Ready4Dis
It looks pretty good to me. As for the above comment: It's hard to get that much free memory when you are limited to such small space. If this was a second stage loader I would agree, but for a first stage loading a fat12 file seems pretty good. This means, you can copy your second stage to your floppy without worrying about where it ends up. Second stage could then load your kernel and load it above 1mb and have access to however much space it requires. If you try to stuff unreal mode, or jumping between real/pmode in there, it may get to large to fit in the boot sector, although i'm sure with a bit of finesse, you could probably get it to fit, but enabling A20 and everything else would probably put it over it's limits. 500kb for your kernel is pretty large, no clue what all you have done in there, but seems pretty big :P. The point of the bootloader is just a trampoline, if you need to grab memory maps, enable a20, load above 1mb for larger kernels, that's the job of a second stage.

The bootloader looks well written, and easy to follow. Modifying it for Fat16 would be well, almost nothing really. What we really need is a good fat32 loader, fat12/16 are a bit easier, and the actual tables are small enough to load into ram. If you ever get bored and work on a Fat32 loader, i'd be very interested in using it :). What kind of license are you attaching to this?

Re: Case Study: FAT12 bootloader

Posted: Sun Aug 01, 2010 6:52 am
by bitshifter
Thanks for the replies.

I am working on new memory map.
I will update the code in a couple hours/days...

The kernel is getting its own 64kb segment.
Also a system stack segment with 64kb space.

My idea of simple memory map...

0000:0000 Interrupt vector table
0040:0000 BIOS communication area
0050:0000 Buffer for ROOT/FAT/ETC
07c0:0000 Boot code
07e0:0000 Boot/Kernel stack
17e0:0000 Kernel code
27eo:0000 Free space
a000:0000 Video memory

Look ok to you guys?

I like small 16 bit OS so 64kb is plenty-o-memory for me.
But yeah, it could be a nice first stage loader...

Oh, and the code is in public domain.
Do as you wish with it...