[whatever-fat12] fat12 bootloader
-
- Posts: 12
- Joined: Sun Apr 16, 2017 1:20 pm
- Libera.chat IRC: fdkj83425
- Contact:
[whatever-fat12] fat12 bootloader
I made a one-stage fat12 bootloader
https://github.com/gituser2194/whatever-fat12
Testing done:
- successfully loaded lone 512-byte image
- successfully loaded 512-byte image with another file "dummy.txt" in the root directory
- successfully loaded 4096-byte image with another file "dummy.txt" in the root directory
- experimented with other sizes for "dummy.txt" to make sure lba-chs conversion worked properly
https://github.com/gituser2194/whatever-fat12
Testing done:
- successfully loaded lone 512-byte image
- successfully loaded 512-byte image with another file "dummy.txt" in the root directory
- successfully loaded 4096-byte image with another file "dummy.txt" in the root directory
- experimented with other sizes for "dummy.txt" to make sure lba-chs conversion worked properly
-
- Posts: 12
- Joined: Sun Apr 16, 2017 1:20 pm
- Libera.chat IRC: fdkj83425
- Contact:
Re: [whatever-fat12] fat12 bootloader
note: updated readme
-
- Member
- Posts: 5512
- Joined: Mon Mar 25, 2013 7:01 pm
Re: [whatever-fat12] fat12 bootloader
Does it also work correctly when your image is fragmented? (For example, write a 512-byte image, add a dummy file, then overwrite the image with a 4096-byte image.)computersandcoffee wrote:- successfully loaded 4096-byte image with another file "dummy.txt" in the root directory
Does it also work correctly when you write a 200kB dummy file to the disk first, followed by your image?computersandcoffee wrote:- experimented with other sizes for "dummy.txt" to make sure lba-chs conversion worked properly
-
- Posts: 12
- Joined: Sun Apr 16, 2017 1:20 pm
- Libera.chat IRC: fdkj83425
- Contact:
Re: [whatever-fat12] fat12 bootloader
For number one, I didn't test it after finding out from your post because I know the answer is no. I will add it to the limitations and to the "going to fix" area in the readme.Octocontrabass wrote:Does it also work correctly when your image is fragmented? (For example, write a 512-byte image, add a dummy file, then overwrite the image with a 4096-byte image.)computersandcoffee wrote:- successfully loaded 4096-byte image with another file "dummy.txt" in the root directory
Does it also work correctly when you write a 200kB dummy file to the disk first, followed by your image?computersandcoffee wrote:- experimented with other sizes for "dummy.txt" to make sure lba-chs conversion worked properly
For number two, I cp'd a 200 KiB file in first and then my kernel.bin and it worked as normal. So yes.
Thank you
-
- Member
- Posts: 5512
- Joined: Mon Mar 25, 2013 7:01 pm
Re: [whatever-fat12] fat12 bootloader
Whoops, I just re-checked my math and it was 2MB. I don't think you'll have to worry about that on a 1.44MB floppy disk.computersandcoffee wrote:For number two, I cp'd a 200 KiB file in first and then my kernel.bin and it worked as normal. So yes.
One other thing just caught my eye: your stack is only 32 bytes. That's awfully small...
-
- Posts: 12
- Joined: Sun Apr 16, 2017 1:20 pm
- Libera.chat IRC: fdkj83425
- Contact:
Re: [whatever-fat12] fat12 bootloader
I changed it so the stack is 64 bytes and also added support for booting off of drives other than fda that are supported by the bios emulationOctocontrabass wrote:Whoops, I just re-checked my math and it was 2MB. I don't think you'll have to worry about that on a 1.44MB floppy disk.computersandcoffee wrote:For number two, I cp'd a 200 KiB file in first and then my kernel.bin and it worked as normal. So yes.
One other thing just caught my eye: your stack is only 32 bytes. That's awfully small...
Just out of curiosity, what kind of problem would i encounter with the dummy file being 2MB
-
- Member
- Posts: 5512
- Joined: Mon Mar 25, 2013 7:01 pm
Re: [whatever-fat12] fat12 bootloader
Only 64 bytes? That's still tiny! Why not set SP to something like 0x7C00 and have plenty of room for your stack?
-
- Posts: 12
- Joined: Sun Apr 16, 2017 1:20 pm
- Libera.chat IRC: fdkj83425
- Contact:
Re: [whatever-fat12] fat12 bootloader
I just set the SP to 0x7c00 and put in a thank you comment
I didn't do that because I was told one time that the stack needed to be labeled in the code for it to be "correct"
That also frees up more space for actual code
I didn't do that because I was told one time that the stack needed to be labeled in the code for it to be "correct"
That also frees up more space for actual code
-
- Member
- Posts: 5512
- Joined: Mon Mar 25, 2013 7:01 pm
Re: [whatever-fat12] fat12 bootloader
Aside from not being able to fit it on the disk? That's about the point where chs_convert breaks down with floppy disk geometry. If you decide to adapt it to work on other types of disks, the limit will be different (up to about 8MB).computersandcoffee wrote:Just out of curiosity, what kind of problem would i encounter with the dummy file being 2MB
Speaking of chs_convert, is there any particular reason you decided to use so many conditional jumps? That seems like a great way to hide subtle off-by-one bugs.
If you really want to have a label for it, consider that 0x7C00 is also the address where the first byte of your bootloader is located.computersandcoffee wrote:I didn't do that because I was told one time that the stack needed to be labeled in the code for it to be "correct"
-
- Posts: 12
- Joined: Sun Apr 16, 2017 1:20 pm
- Libera.chat IRC: fdkj83425
- Contact:
Re: [whatever-fat12] fat12 bootloader
The conditional jumps are a by-product of my thought process. When I wrote that code, I didn't have a mathematical formula in my head - I just remembered that after 18 sectors, the head increases, and after another 18 sectors, the cylinder increases and the head goes back down to 0, and then repeat. It translated into assembly code containing a lot of conditional jumps.
-
- Posts: 12
- Joined: Sun Apr 16, 2017 1:20 pm
- Libera.chat IRC: fdkj83425
- Contact:
Re: [whatever-fat12] fat12 bootloader
Hi.
I don't have time to maintain this project, sadly.
I will leave the GitHub repository up just in case someone wants it though. Honestly, though, you're probably better off with another solution.
I'm highly unlikely to start another OSDEV-related project, but if I do, I will make sure that I have the resources, etc. to maintain it.
I don't have time to maintain this project, sadly.
I will leave the GitHub repository up just in case someone wants it though. Honestly, though, you're probably better off with another solution.
I'm highly unlikely to start another OSDEV-related project, but if I do, I will make sure that I have the resources, etc. to maintain it.