Loading kernel from a:\ (in FAT12)

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Svempa

Loading kernel from a:\ (in FAT12)

Post by Svempa »

This is my problem. I have made my bootloader to be in FAT12. I want to put the kernel in the root of a:\ (a:\kernel.bin) so if you look for exampel in windows explorer and under a:\ you would see kernel.bin. Now i want in the booloader to load the kernel (a:\kernel.bin) from there. How can this be done?

My own attemps has resulted in tripple faults when jmp to the kernel...

/Svempa
drizzt

Re:Loading kernel from a:\ (in FAT12)

Post by drizzt »

Tom

Re:Loading kernel from a:\ (in FAT12)

Post by Tom »

I'm thinking of doing something like that for FritzOS possibly...

But...

John Fine's web page has example(s) for that.
beyondsociety

Re:Loading kernel from a:\ (in FAT12)

Post by beyondsociety »

[attachment deleted by admin]
Mr_Spam

Re:Loading kernel from a:\ (in FAT12)

Post by Mr_Spam »

i dont under stand what the nop command dose in that example... any knows what it dose?
Curufir

Re:Loading kernel from a:\ (in FAT12)

Post by Curufir »

Specification of fat12 requires that there be a 3 byte operation before the BIOS Parameter Block (The BIOS here is misleading, BIOS doesn't need/want/require this table to load the disk. It's an MS invention) the short jump counts as 2 bytes, the nop counts as 1 byte. If you're wondering why then take a look at the BPB itself. Without this odd numbered size of instructions the most commonly used word sized information would lie on an odd boundary, meaning 2 memory accesses to read the word.

The NOP instruction itself means...*Drumroll*...no operation ;D. IE it is ignored by the processor, useful for spacing things properly.

Curufir
Mr_Spam

Re:Loading kernel from a:\ (in FAT12)

Post by Mr_Spam »

thanks!
Ozguxxx

Re:Loading kernel from a:\ (in FAT12)

Post by Ozguxxx »

I think you do not have to add this at top of your program but the real important thing is reading the fat. You have to do several calculations and find the name of file in root, and then find first cluster of file in fat and then read clusters from file and then load it into memory and then jump to it. :) Very easy!!! So I think you do not have to worry about BPB but rather you have to take care of reading the disk and then getting file place and etc...
Post Reply