My FAT12 Bootsector FINALLY works :D
Posted: Fri Jul 28, 2006 9:36 am
After two weeks of hair-tearing frusteration, Ive finally got my FAT12 Bootsector working precisely how I want it!
And the best part is, I finally understand the Assembler Im writing and learnt a great deal about Debugging under Bochs!
Its so... like, good feeling to be able to fix a problem after weeks of it making you want to scream!
Its just a standard FAT12 bootloader, but... Ive rewritten old Bootloader code so many times now, that most of this was written by me! Although, Ive referenced hundreds of other peoples bootloaders and articles in order to try and fix some bugs. But most of it I didnt have to change, YAY!.
The bootloader loads a file called K.BIN from the floppydrive, and will load it in all its entirity.
K.bin is the Second stage bootloader and Kernel all in one file.
Stage2 so far, has room for about 1kb of code.
at the 1kb point (offset 0x400) in the file, the Kernel code begins.
And, my sector loads the file to 0x0000F000.
so, F000 - F400 is Stage 2 code.
F400 - ???? is Kernel code.
What I should do, is make the Stage2 copy the Kernel code to 0x10000, then execute it there. 0x10000 just feels tidy .
So, for the rest of the night - Im going to be working on the Stage 2 Bootloader Code.
To setup Protected Mode, Video mode I want the Kernel to start in, Stack for the Kernel. GDT (Ring0 Data/Code, Ring3 Data/Code, Null...)
THEN! Finally, ATLAST! Ill be in C World! YAYYYYYYY
Ive included the sourcecode to the Stage1 FAT12 Bootloader, should anyone be interested.
Its hardly commented, so I appologize in advance.
~Zeii.
And the best part is, I finally understand the Assembler Im writing and learnt a great deal about Debugging under Bochs!
Its so... like, good feeling to be able to fix a problem after weeks of it making you want to scream!
Its just a standard FAT12 bootloader, but... Ive rewritten old Bootloader code so many times now, that most of this was written by me! Although, Ive referenced hundreds of other peoples bootloaders and articles in order to try and fix some bugs. But most of it I didnt have to change, YAY!.
The bootloader loads a file called K.BIN from the floppydrive, and will load it in all its entirity.
K.bin is the Second stage bootloader and Kernel all in one file.
Stage2 so far, has room for about 1kb of code.
at the 1kb point (offset 0x400) in the file, the Kernel code begins.
And, my sector loads the file to 0x0000F000.
so, F000 - F400 is Stage 2 code.
F400 - ???? is Kernel code.
What I should do, is make the Stage2 copy the Kernel code to 0x10000, then execute it there. 0x10000 just feels tidy .
So, for the rest of the night - Im going to be working on the Stage 2 Bootloader Code.
To setup Protected Mode, Video mode I want the Kernel to start in, Stack for the Kernel. GDT (Ring0 Data/Code, Ring3 Data/Code, Null...)
THEN! Finally, ATLAST! Ill be in C World! YAYYYYYYY
Ive included the sourcecode to the Stage1 FAT12 Bootloader, should anyone be interested.
Its hardly commented, so I appologize in advance.
~Zeii.