Fat12 bootloader problem

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
wacco

Fat12 bootloader problem

Post by wacco »

Hi there,

I used daniel faulkner's tutorials to build my own bootloader which loads the kernel file out of the fat partition. Now is daniels' loader split into two loaders, with the second one in a few reserved sectors. Yuk :P
So i decided to fiddle it all into the first sector. That worked, i only completely forgot the segment registers. After doodling around a bit for an hour or three, i now have the situation that i have a fat table in my memory at 1000h:0000h, my code still runs from 0000:7C00, and i'm trying to get my kernel to 3000h:0000h. It even loads the first sector of the kernel, but after that something screws up, and my read sector function borks because of a faulty provided lba. So, apparantly i'm updating my KernelClusterAddress in a faulty way, or it's faulty in the first place but i'm getting away with it for the first time :P
Can anyone take a look at my code? It's a pretty sweet loader, if it works... Just rename your kernel file to perseus.bin and paste it on a floppy with this loader in the first sector, and it will get loaded to 3000h:0000h (and jumped to off course).

It's over here: http://oege.ie.hva.nl/~meeuwi10/bootfat.asm
If you want a quick hello world (actually it's something i copied from another file of mine, hence the sloppy function) to test the whole kernel loading thing, here's one: http://oege.ie.hva.nl/~meeuwi10/helloworld.asm
Curufir

Re:Fat12 bootloader problem

Post by Curufir »

Only had a quick chance to look at it (I'm on my way to bed, I'll look again tomorrow).

This sprang out at me though.

Code: Select all

.15:    cmp ax, 0xFFFF    ; end of chain
        jne .13
Isn't this wrong?

Since ax (If my eyes aren't playing tricks on me here) can only hold a maximum 12-bit value (You mask/shift the top 4 bits in Fclust) this is going to give you an infinite loop.
wacco

Re:Fat12 bootloader problem

Post by wacco »

That did the trick! After a few hours of getting it to work with the right segments, i completely missed that little typo ;D

*wacco cheers, does a little dance, reboots pc to see if it's really really working, does another little dance!

Now on to the more serious work :P
Post Reply